diff --git a/CMakeLists.txt b/CMakeLists.txt index 7be1fbd..52d7546 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,81 +1,81 @@ project( SnoreNotify ) cmake_minimum_required( VERSION 2.8.12 ) include(FeatureSummary) find_package(ECM 1.7.0 REQUIRED NO_MODULE) set_package_properties(ECM PROPERTIES DESCRIPTION "Extra modules and scripts for CMake." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules" TYPE REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings) include(GenerateExportHeader) include(CMakeDependentOption) include(ECMAddAppIcon) include(ECMGeneratePriFile) include(ECMInstallIcons) include(ECMMarkNonGuiExecutable) include(ECMOptionalAddSubdirectory) include(ECMPackageConfigHelpers) include(ECMPoQmTools) include(ECMSetupVersion) include(QtStatic) set(SNORE_VERSION_MAJOR 0) set(SNORE_VERSION_MINOR 7) -set(SNORE_VERSION_PATCH 0) +set(SNORE_VERSION_PATCH 1) set(SNORE_SUFFIX "-qt5") set(SNORE_CamelCase_SUFFIX "Qt5") find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) find_package(Qt5Gui REQUIRED) find_package(Qt5Widgets QUIET) find_package(Qt5Quick QUIET) set_package_properties(Qt5Quick PROPERTIES PURPOSE "Support builtin notifiaction backend." TYPE OPTIONAL) set_package_properties(Qt5Widgets PROPERTIES PURPOSE "Supprot for the daemon and the settings dialog as well as some backends." TYPE OPTIONAL) option(SNORE_STATIC "Build a static snore" OFF) option(SNORE_STATIC_QT "Build a static snore" OFF) set(LIBSNORE_INCLUDE_DIR ${KDE_INSTALL_INCLUDEDIR}/libsnore) set(LIBSNORE_PLUGIN_PATH ${KDE_INSTALL_PLUGINDIR}/libsnore${SNORE_SUFFIX}) set(SNORE_PLUGIN_INSTALL_PATH LIBRARY DESTINATION ${LIBSNORE_PLUGIN_PATH}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) add_subdirectory(data) add_subdirectory(src) if (NOT SNORE_STATIC) add_subdirectory(autotest) endif() if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() generate_snore_plugin_header() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES) diff --git a/src/plugins/secondary_backends/CMakeLists.txt b/src/plugins/secondary_backends/CMakeLists.txt index 1ab2117..2658a9f 100644 --- a/src/plugins/secondary_backends/CMakeLists.txt +++ b/src/plugins/secondary_backends/CMakeLists.txt @@ -1,5 +1,4 @@ ecm_optional_add_subdirectory(toasty) -ecm_optional_add_subdirectory(nma) ecm_optional_add_subdirectory(sound) ecm_optional_add_subdirectory(speech) ecm_optional_add_subdirectory(pushover_backend) diff --git a/src/plugins/secondary_backends/nma/CMakeLists.txt b/src/plugins/secondary_backends/nma/CMakeLists.txt deleted file mode 100644 index fdbd961..0000000 --- a/src/plugins/secondary_backends/nma/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_snore_plugin(NMA SOURCES nma.cpp SETTINGS_SOURCES nmasettings.cpp TYPE SecondaryBackend) diff --git a/src/plugins/secondary_backends/nma/nma.cpp b/src/plugins/secondary_backends/nma/nma.cpp deleted file mode 100644 index bee3c5f..0000000 --- a/src/plugins/secondary_backends/nma/nma.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - SnoreNotify is a Notification Framework based on Qt - Copyright (C) 2015 Hannah von Reth - - SnoreNotify is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - SnoreNotify is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with SnoreNotify. If not, see . -*/ -#include "nma.h" -#include "nmaconstants.h" - -#include "libsnore/utils.h" - -#include -#include - -namespace SnorePlugin { - -void NMA::slotNotify(Snore::Notification notification) -{ - QString key = settingsValue(NMAConstants::ApiKey).toString(); - if (key.isEmpty()) { - return; - } - - QNetworkRequest request(QUrl::fromEncoded("https://www.notifymyandroid.com/publicapi/notify")); - request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded"))); - - QString data = QLatin1String("apikey=") + key - + QLatin1String("&application=") + notification.application().name() - + QLatin1String("&event=") + notification.title() - + QLatin1String("&priority=") + QString::number(notification.priority()) - + QLatin1String("&description="); - - if (notification.constHints().value("supports-markup").toBool()) { - data += notification.text(Snore::Utils::Href | Snore::Utils::Bold | Snore::Utils::Break | - Snore::Utils::Underline | Snore::Utils::Font | Snore::Utils::Italic) - + QLatin1String("&content-type=text/html"); - } else { - data += notification.text(); - } - - QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData()); - connect(reply, &QNetworkReply::finished, [reply]() { - qCDebug(SNORE) << reply->error(); - qCDebug(SNORE) << reply->readAll(); - reply->close(); - reply->deleteLater(); - }); - -} - -void NMA::setDefaultSettings() -{ - setDefaultSettingsValue(NMAConstants::ApiKey, QString()); - SnoreSecondaryBackend::setDefaultSettings(); -} - -} diff --git a/src/plugins/secondary_backends/nma/nma.h b/src/plugins/secondary_backends/nma/nma.h deleted file mode 100644 index 7a82167..0000000 --- a/src/plugins/secondary_backends/nma/nma.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - SnoreNotify is a Notification Framework based on Qt - Copyright (C) 2015 Hannah von Reth - - SnoreNotify is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - SnoreNotify is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with SnoreNotify. If not, see . -*/ -#ifndef NMA_H -#define NMA_H - -#include "libsnore/plugins/snoresecondarybackend.h" - -#include - -namespace SnorePlugin { - - -class NMA : public Snore::SnoreSecondaryBackend -{ - Q_OBJECT - Q_INTERFACES(Snore::SnoreSecondaryBackend) - Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "snore_plugin.json") -public: - NMA() = default; - ~NMA() = default; - -protected: - void setDefaultSettings() override; - -public Q_SLOTS: - void slotNotify(Snore::Notification notification) override; - -private: - QNetworkAccessManager m_manager; - -}; - -} -#endif // NMA_H diff --git a/src/plugins/secondary_backends/nma/nmaconstants.h b/src/plugins/secondary_backends/nma/nmaconstants.h deleted file mode 100644 index 6321039..0000000 --- a/src/plugins/secondary_backends/nma/nmaconstants.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef NMACONSTANTS_H -#define NMACONSTANTS_H - -#include "libsnore/snoreglobals.h" - -namespace NMAConstants { -static const Snore::SettingsKey ApiKey = {QStringLiteral("ApiKey"), Snore::GlobalSetting}; -} -#endif // NMACONSTANTS_H diff --git a/src/plugins/secondary_backends/nma/nmasettings.cpp b/src/plugins/secondary_backends/nma/nmasettings.cpp deleted file mode 100644 index 08230c7..0000000 --- a/src/plugins/secondary_backends/nma/nmasettings.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - SnoreNotify is a Notification Framework based on Qt - Copyright (C) 2015 Hannah von Reth - - SnoreNotify is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - SnoreNotify is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with SnoreNotify. If not, see . -*/ -#include "nmasettings.h" -#include "nmaconstants.h" - -#include "libsnore/plugins/plugins.h" - -#include -#include - -NMASettings::NMASettings(Snore::SnorePlugin *plugin, QWidget *parent) : - Snore::PluginSettingsWidget(plugin, parent), - m_lineEdit(new QLineEdit) -{ - addRow(tr("Api Key:"), m_lineEdit, tr("The api key which can be found in your account page at Notifymyandroid.com.")); - addRow(QString(), new QLabel(tr("If you don't have an account yet please register at Notifymyandroid.com."), this)); -} - -NMASettings::~NMASettings() -{ -} - -void NMASettings::load() -{ - m_lineEdit->setText(settingsValue(NMAConstants::ApiKey).toString()); -} - -void NMASettings::save() -{ - setSettingsValue(NMAConstants::ApiKey, m_lineEdit->text()); -} diff --git a/src/plugins/secondary_backends/nma/nmasettings.h b/src/plugins/secondary_backends/nma/nmasettings.h deleted file mode 100644 index 394f3ad..0000000 --- a/src/plugins/secondary_backends/nma/nmasettings.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - SnoreNotify is a Notification Framework based on Qt - Copyright (C) 2015 Hannah von Reth - - SnoreNotify is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - SnoreNotify is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with SnoreNotify. If not, see . -*/ -#ifndef NOTIFYMYANDROID_H -#define NOTIFYMYANDROID_H - -#include "libsnore/plugins/settingsplugin.h" -#include "libsnore/settings/pluginsettingswidget.h" - -class QLineEdit; - -class NMASettings : public Snore::PluginSettingsWidget -{ - Q_OBJECT -public: - explicit NMASettings(Snore::SnorePlugin *plugin, QWidget *parent = 0); - ~NMASettings(); - - void load() override; - void save() override; - -private: - QLineEdit *m_lineEdit; - -}; - -SNORE_DECLARE_SETTINGS_PLUGIN(NMA) - -#endif // NOTIFYMYANDROID_HH