[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:29:40 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=0b5fbe0

The following commit has been merged in the master branch:
commit 0b5fbe00bb663669854199a24cc1f0a127d12143
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Wed May 25 12:49:13 2016 -0600

    Split plugins for sending and receiving notifications
    
    CCMAIL: holger.k at elberer.de
---
 plugins/CMakeLists.txt                             |  1 +
 plugins/notifications/CMakeLists.txt               | 23 ----------
 .../notifications/kdeconnect_notifications.json    | 50 +---------------------
 plugins/notifications/notificationsplugin.cpp      |  2 -
 plugins/sendnotifications/CMakeLists.txt           | 38 ++++++++++++++++
 .../kdeconnect_sendnotifications.json              | 29 +++++++++++++
 .../kdeconnect_sendnotifications_config.desktop}   |  4 +-
 .../notificationslistener.cpp                      | 29 ++++++-------
 .../notificationslistener.h                        |  5 +--
 .../notifyingapplication.cpp                       |  0
 .../notifyingapplication.h                         |  0
 .../notifyingapplicationmodel.cpp                  |  0
 .../notifyingapplicationmodel.h                    |  0
 .../sendnotification_debug.h}                      |  6 +--
 .../sendnotifications_config.cpp}                  | 24 +++++------
 .../sendnotifications_config.h}                    | 14 +++---
 .../sendnotifications_config.ui}                   |  4 +-
 .../sendnotificationsplugin.cpp}                   | 44 ++++++++-----------
 .../sendnotificationsplugin.h}                     | 11 +++--
 tests/CMakeLists.txt                               |  8 ++--
 tests/testnotificationlistener.cpp                 | 24 ++++-------
 21 files changed, 144 insertions(+), 172 deletions(-)

diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index bc90749..2a49306 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -7,6 +7,7 @@ add_subdirectory(clipboard)
 add_subdirectory(telephony)
 add_subdirectory(share)
 add_subdirectory(notifications)
+add_subdirectory(sendnotifications)
 add_subdirectory(battery)
 add_subdirectory(runcommand)
 if(NOT WIN32)
diff --git a/plugins/notifications/CMakeLists.txt b/plugins/notifications/CMakeLists.txt
index d74cca6..6f7eb72 100644
--- a/plugins/notifications/CMakeLists.txt
+++ b/plugins/notifications/CMakeLists.txt
@@ -4,8 +4,6 @@ set(kdeconnect_notifications_SRCS
     notification.cpp
     notificationsplugin.cpp
     notificationsdbusinterface.cpp
-    notificationslistener.cpp
-    notifyingapplication.cpp
 )
 
 kdeconnect_add_plugin(kdeconnect_notifications JSON kdeconnect_notifications.json SOURCES ${kdeconnect_notifications_SRCS})
@@ -17,24 +15,3 @@ target_link_libraries(kdeconnect_notifications
     KF5::I18n
     KF5::IconThemes
 )
-
-#######################################
-# Config
-
-set( kdeconnect_notifications_config_SRCS
-     notifications_config.cpp
-     notifyingapplication.cpp
-     notifyingapplicationmodel.cpp
-)
-ki18n_wrap_ui( kdeconnect_notifications_config_SRCS notifications_config.ui )
-
-add_library(kdeconnect_notifications_config MODULE ${kdeconnect_notifications_config_SRCS} )
-target_link_libraries( kdeconnect_notifications_config
-    kdeconnectcore
-    kdeconnectpluginkcm
-    KF5::I18n
-    KF5::KCMUtils
-)
-
-install( TARGETS kdeconnect_notifications_config DESTINATION ${PLUGIN_INSTALL_DIR} )
-install( FILES kdeconnect_notifications_config.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
diff --git a/plugins/notifications/kdeconnect_notifications.json b/plugins/notifications/kdeconnect_notifications.json
index d696436..ee7a3ec 100644
--- a/plugins/notifications/kdeconnect_notifications.json
+++ b/plugins/notifications/kdeconnect_notifications.json
@@ -8,58 +8,12 @@
                 "Name[x-test]": "xxAlbert Vacaxx"
             }
         ], 
-        "Description": "Show phone notifications on your computer and keep them in sync", 
-        "Description[ast]": "Amuesa los avisos del preséu nel to ordenador in caltiénlos sincronizaos", 
-        "Description[ca at valencia]": "Mostra les notificacions del telèfon a l'ordinador i les manté sincronitzades", 
-        "Description[ca]": "Mostra les notificacions del telèfon a l'ordinador i les manté sincronitzades", 
-        "Description[cs]": "Zobrazit upozornění telefonu v počítači a udržovat je synchronizovaná", 
-        "Description[de]": "Benachrichtigungen auf Ihren Rechner anzeigen und abgleichen", 
-        "Description[es]": "Mostrar notificaciones del teléfono en su equipo y mantenerlas en sincronía", 
-        "Description[fi]": "Näytä puhelimen ilmoitukset tietokoneellasi ja pidä ne ajan tasalla", 
-        "Description[gl]": "Mostre notificacións dun teléfono móbil no computador e deixe que as notificacións se sincronicen co teléfono.", 
-        "Description[hu]": "A telefon értesítéseinek megjelenítése a számítógépén és azok szinkronizációja", 
-        "Description[it]": "Mostra le notifiche del telefono sul tuo computer e tienile sincronizzate", 
-        "Description[ko]": "휴대폰 알림을 컴퓨터에 표시하기", 
-        "Description[nl]": "Telefoonmeldingen op uw computer tonen en ze gesynchroniseerd houden", 
-        "Description[nn]": "Vis telefonvarslingar på datamaskina, og hald dei synkronisert", 
-        "Description[pl]": "Pokaż powiadomienia telefonu na swoim komputerze i synchronizuj je", 
-        "Description[pt]": "Mostrar as notificações do telefone no seu computador e mantê-las sincronizadas", 
-        "Description[pt_BR]": "Mostra as notificações do celular no seu computador e as mantém sincronizadas", 
-        "Description[ru]": "Показ уведомлений с телефона на компьютере и их синхронизация", 
-        "Description[sk]": "Zobraziť oznámenia telefónu na vašom počítači a udržať ich synchronizované", 
-        "Description[sv]": "Visa telefonunderrättelser på datorn och håll dem synkroniserade", 
-        "Description[tr]": "Telefon bildirimlerini bilgisayarınızla eşitler ve eşzamanlı tutar", 
-        "Description[uk]": "Показ сповіщень з телефону на вашому комп’ютері та підтримання синхронізації даних сповіщень", 
-        "Description[x-test]": "xxShow phone notifications on your computer and keep them in syncxx", 
-        "Description[zh_CN]": "在电脑显示手机通知并保持同步", 
+        "Description": "Show device's notifications on this computer and keep them in sync",
         "EnabledByDefault": true, 
         "Icon": "preferences-desktop-notification", 
         "Id": "kdeconnect_notifications", 
         "License": "GPL", 
-        "Name": "Notification sync", 
-        "Name[ast]": "Sincronización d'avisos", 
-        "Name[ca at valencia]": "Sincronització de les notificacions", 
-        "Name[ca]": "Sincronització de les notificacions", 
-        "Name[cs]": "Synchronizace upozornění", 
-        "Name[de]": "Benachrichtigungs-Abgleich", 
-        "Name[es]": "Sincronización de notificaciones", 
-        "Name[fi]": "Ilmoitusten synkronointi", 
-        "Name[gl]": "Sincronización de notificacións", 
-        "Name[hu]": "Értesítésszinkronizáció", 
-        "Name[it]": "Sincronizzazione notifiche", 
-        "Name[ko]": "알림 동기화", 
-        "Name[nl]": "Synchronisatie van meldingen", 
-        "Name[nn]": "Synkronisering av varslingar", 
-        "Name[pl]": "Powiadomienia synchronizacji", 
-        "Name[pt]": "Sincronização de notificações", 
-        "Name[pt_BR]": "Sincronização de notificações", 
-        "Name[ru]": "Синхронизация уведомлений", 
-        "Name[sk]": "Synchronizácia pripomienok", 
-        "Name[sv]": "Underrättelsesynkronisering", 
-        "Name[tr]": "Bildirim eşitleme", 
-        "Name[uk]": "Синхронізація сповіщень", 
-        "Name[x-test]": "xxNotification syncxx", 
-        "Name[zh_CN]": "通知同步", 
+        "Name": "Receive notifications",
         "ServiceTypes": [
             "KdeConnect/Plugin"
         ], 
diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp
index f47f5d8..a21daaf 100644
--- a/plugins/notifications/notificationsplugin.cpp
+++ b/plugins/notifications/notificationsplugin.cpp
@@ -21,7 +21,6 @@
 #include "notificationsplugin.h"
 
 #include "notificationsdbusinterface.h"
-#include "notificationslistener.h"
 #include "notification_debug.h"
 
 #include <KPluginFactory>
@@ -34,7 +33,6 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar
     : KdeConnectPlugin(parent, args)
 {
     notificationsDbusInterface = new NotificationsDbusInterface(this);
-    notificationsListener = new NotificationsListener(this, notificationsDbusInterface);
 }
 
 void NotificationsPlugin::connected()
diff --git a/plugins/sendnotifications/CMakeLists.txt b/plugins/sendnotifications/CMakeLists.txt
new file mode 100644
index 0000000..76ad888
--- /dev/null
+++ b/plugins/sendnotifications/CMakeLists.txt
@@ -0,0 +1,38 @@
+find_package(KF5 REQUIRED COMPONENTS Notifications KCMUtils I18n IconThemes)
+
+set(kdeconnect_sendnotifications_SRCS
+    sendnotificationsplugin.cpp
+    notificationslistener.cpp
+    notifyingapplication.cpp
+)
+
+kdeconnect_add_plugin(kdeconnect_sendnotifications JSON kdeconnect_sendnotifications.json SOURCES ${kdeconnect_sendnotifications_SRCS})
+
+target_link_libraries(kdeconnect_sendnotifications
+    kdeconnectcore
+    Qt5::DBus
+    KF5::Notifications
+    KF5::I18n
+    KF5::IconThemes
+)
+
+#######################################
+# Config
+
+set( kdeconnect_sendnotifications_config_SRCS
+     sendnotifications_config.cpp
+     notifyingapplication.cpp
+     notifyingapplicationmodel.cpp
+)
+ki18n_wrap_ui( kdeconnect_sendnotifications_config_SRCS sendnotifications_config.ui )
+
+add_library(kdeconnect_sendnotifications_config MODULE ${kdeconnect_sendnotifications_config_SRCS} )
+target_link_libraries( kdeconnect_sendnotifications_config
+    kdeconnectcore
+    kdeconnectpluginkcm
+    KF5::I18n
+    KF5::KCMUtils
+)
+
+install( TARGETS kdeconnect_sendnotifications_config DESTINATION ${PLUGIN_INSTALL_DIR} )
+install( FILES kdeconnect_sendnotifications_config.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
diff --git a/plugins/sendnotifications/kdeconnect_sendnotifications.json b/plugins/sendnotifications/kdeconnect_sendnotifications.json
new file mode 100644
index 0000000..8eb68a6
--- /dev/null
+++ b/plugins/sendnotifications/kdeconnect_sendnotifications.json
@@ -0,0 +1,29 @@
+{
+    "Encoding": "UTF-8", 
+    "KPlugin": {
+        "Authors": [
+            {
+                "Email": "holger.k at elberer.de",
+                "Name": "Holger Kaelberer",
+                "Name[x-test]": "xxAlbert Vacaxx"
+            }
+        ], 
+        "Description": "Broadcast this computer's notifications, so the can be shown in other devices.",
+        "EnabledByDefault": false,
+        "Icon": "preferences-desktop-notification", 
+        "Id": "kdeconnect_sendnotifications",
+        "License": "GPL", 
+        "Name": "Send notifications",
+        "ServiceTypes": [
+            "KdeConnect/Plugin"
+        ], 
+        "Version": "0.1", 
+        "Website": "http://albertvaka.wordpress.com"
+    }, 
+    "X-KdeConnect-OutgoingPackageType": [
+        "kdeconnect.notification"
+    ],
+    "X-KdeConnect-SupportedPackageType": [
+        "kdeconnect.notification"
+    ]
+}
\ No newline at end of file
diff --git a/plugins/notifications/kdeconnect_notifications_config.desktop b/plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop
similarity index 93%
rename from plugins/notifications/kdeconnect_notifications_config.desktop
rename to plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop
index b582e1f..51d937a 100644
--- a/plugins/notifications/kdeconnect_notifications_config.desktop
+++ b/plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop
@@ -2,8 +2,8 @@
 Type=Service
 X-KDE-ServiceTypes=KCModule
 
-X-KDE-Library=kdeconnect_notifications_config
-X-KDE-ParentComponents=kdeconnect_notifications
+X-KDE-Library=kdeconnect_sendnotifications_config
+X-KDE-ParentComponents=kdeconnect_sendnotifications
 
 Name=Notification synchronization plugin settings
 Name[ar]=إعدادات ملحقة مزامنة الإخطارات
diff --git a/plugins/notifications/notificationslistener.cpp b/plugins/sendnotifications/notificationslistener.cpp
similarity index 83%
rename from plugins/notifications/notificationslistener.cpp
rename to plugins/sendnotifications/notificationslistener.cpp
index d21f3d7..9a51167 100644
--- a/plugins/notifications/notificationslistener.cpp
+++ b/plugins/sendnotifications/notificationslistener.cpp
@@ -30,16 +30,13 @@
 #include <core/kdeconnectplugin.h>
 
 #include "notificationslistener.h"
-#include "notificationsplugin.h"
-#include "notification_debug.h"
-#include "notificationsdbusinterface.h"
+#include "sendnotificationsplugin.h"
+#include "sendnotification_debug.h"
 #include "notifyingapplication.h"
 
-NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin,
-                                             NotificationsDbusInterface* aDbusInterface)
+NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
     : QDBusAbstractAdaptor(aPlugin),
-      mPlugin(aPlugin),
-      dbusInterface(aDbusInterface)
+      mPlugin(aPlugin)
 {
     qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
 
@@ -48,12 +45,12 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin,
                                 this,
                                 QDBusConnection::ExportScriptableContents);
     if (!ret)
-        qCWarning(KDECONNECT_PLUGIN_NOTIFICATION)
+        qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION)
                 << "Error registering notifications listener for device"
                 << mPlugin->device()->name() << ":"
                 << QDBusConnection::sessionBus().lastError();
     else
-        qCDebug(KDECONNECT_PLUGIN_NOTIFICATION)
+        qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION)
                 << "Registered notifications listener for device"
                 << mPlugin->device()->name();
 
@@ -69,7 +66,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin,
 
 NotificationsListener::~NotificationsListener()
 {
-    qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Destroying NotificationsListener";
+    qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Destroying NotificationsListener";
     QDBusInterface iface("org.freedesktop.DBus", "/org/freedesktop/DBus",
                          "org.freedesktop.DBus");
     QDBusMessage res = iface.call("RemoveMatch",
@@ -86,7 +83,7 @@ void NotificationsListener::loadApplications()
         if (!applications.contains(app.name))
             applications.insert(app.name, app);
     }
-    //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Loaded" << applications.size() << " applications";
+    //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Loaded" << applications.size() << " applications";
 }
 
 uint NotificationsListener::Notify(const QString &appName, uint replacesId,
@@ -98,7 +95,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
     static int id = 0;
     Q_UNUSED(actions);
 
-    //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon << "summary=" << summary << "body=" << body << "actions=" << actions << "hints=" << hints << "timeout=" << timeout;
+    //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon << "summary=" << summary << "body=" << body << "actions=" << actions << "hints=" << hints << "timeout=" << timeout;
 
     // skip our own notifications
     if (appName == QLatin1String("KDE Connect"))
@@ -117,7 +114,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
         for (const auto& a: applications.values())
             list << QVariant::fromValue<NotifyingApplication>(a);
         mPlugin->config()->setList("applications", list);
-        //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Added new application to config:" << app;
+        //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app;
     } else
         app = applications.value(appName);
 
@@ -146,7 +143,7 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
             app.blacklistExpression.match(ticker).hasMatch())
         return 0;
 
-    //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
+    //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
     NetworkPackage np(PACKAGE_TYPE_NOTIFICATION);
     np.set("id", QString::number(replacesId > 0 ? replacesId : ++id));
     np.set("appName", appName);
@@ -166,11 +163,11 @@ uint NotificationsListener::Notify(const QString &appName, uint replacesId,
                 KIconTheme hicolor(QStringLiteral("hicolor"));
                 if (hicolor.isValid()) {
                     iconPath = hicolor.iconPath(appIcon + ".png", size, KIconLoader::MatchBest);
-                    //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
+                    //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
                 }
             }
             if (iconPath.endsWith(QLatin1String(".png"))) {
-                //qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Appending icon " << iconPath;
+                //qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Appending icon " << iconPath;
                 QSharedPointer<QIODevice> iconFile(new QFile(iconPath));
                 np.setPayload(iconFile, iconFile->size());
             }
diff --git a/plugins/notifications/notificationslistener.h b/plugins/sendnotifications/notificationslistener.h
similarity index 87%
rename from plugins/notifications/notificationslistener.h
rename to plugins/sendnotifications/notificationslistener.h
index dfa37b8..ac021ef 100644
--- a/plugins/notifications/notificationslistener.h
+++ b/plugins/sendnotifications/notificationslistener.h
@@ -22,7 +22,6 @@
 #include <core/device.h>
 
 class KdeConnectPlugin;
-class NotificationsDbusInterface;
 class Notification;
 struct NotifyingApplication;
 
@@ -32,13 +31,11 @@ class NotificationsListener : public QDBusAbstractAdaptor
     Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications")
 
 public:
-    explicit NotificationsListener(KdeConnectPlugin* aPlugin,
-                                   NotificationsDbusInterface* aDbusInterface);
+    explicit NotificationsListener(KdeConnectPlugin* aPlugin);
     virtual ~NotificationsListener();
 
 protected:
     KdeConnectPlugin* mPlugin;
-    NotificationsDbusInterface* dbusInterface;
     QHash<QString, NotifyingApplication> applications;
 
 public Q_SLOTS:
diff --git a/plugins/notifications/notifyingapplication.cpp b/plugins/sendnotifications/notifyingapplication.cpp
similarity index 100%
rename from plugins/notifications/notifyingapplication.cpp
rename to plugins/sendnotifications/notifyingapplication.cpp
diff --git a/plugins/notifications/notifyingapplication.h b/plugins/sendnotifications/notifyingapplication.h
similarity index 100%
rename from plugins/notifications/notifyingapplication.h
rename to plugins/sendnotifications/notifyingapplication.h
diff --git a/plugins/notifications/notifyingapplicationmodel.cpp b/plugins/sendnotifications/notifyingapplicationmodel.cpp
similarity index 100%
rename from plugins/notifications/notifyingapplicationmodel.cpp
rename to plugins/sendnotifications/notifyingapplicationmodel.cpp
diff --git a/plugins/notifications/notifyingapplicationmodel.h b/plugins/sendnotifications/notifyingapplicationmodel.h
similarity index 100%
rename from plugins/notifications/notifyingapplicationmodel.h
rename to plugins/sendnotifications/notifyingapplicationmodel.h
diff --git a/plugins/notifications/notification_debug.h b/plugins/sendnotifications/sendnotification_debug.h
similarity index 88%
copy from plugins/notifications/notification_debug.h
copy to plugins/sendnotifications/sendnotification_debug.h
index febca38..9050139 100644
--- a/plugins/notifications/notification_debug.h
+++ b/plugins/sendnotifications/sendnotification_debug.h
@@ -18,11 +18,11 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NOTIFICATION_DEBUG_H
-#define NOTIFICATION_DEBUG_H
+#ifndef SENDNOTIFICATION_DEBUG_H
+#define SENDNOTIFICATION_DEBUG_H
 
 #include <QLoggingCategory>
 
-Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_NOTIFICATION)
+Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SENDNOTIFICATION)
 
 #endif //NOTIFICATION_DEBUG_H
diff --git a/plugins/notifications/notifications_config.cpp b/plugins/sendnotifications/sendnotifications_config.cpp
similarity index 85%
rename from plugins/notifications/notifications_config.cpp
rename to plugins/sendnotifications/sendnotifications_config.cpp
index d9532a7..59a42df 100644
--- a/plugins/notifications/notifications_config.cpp
+++ b/plugins/sendnotifications/sendnotifications_config.cpp
@@ -18,18 +18,18 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "notifications_config.h"
-#include "ui_notifications_config.h"
+#include "sendnotifications_config.h"
+#include "ui_sendnotifications_config.h"
 #include "notifyingapplicationmodel.h"
 
 #include <KCModule>
 #include <KPluginFactory>
 
-K_PLUGIN_FACTORY(NotificationsConfigFactory, registerPlugin<NotificationsConfig>();)
+K_PLUGIN_FACTORY(SendNotificationsConfigFactory, registerPlugin<SendNotificationsConfig>();)
 
-NotificationsConfig::NotificationsConfig(QWidget *parent, const QVariantList& args)
-    : KdeConnectPluginKcm(parent, args, "kdeconnect_notifications_config")
-    , m_ui(new Ui::NotificationsConfigUi())
+SendNotificationsConfig::SendNotificationsConfig(QWidget *parent, const QVariantList& args)
+    : KdeConnectPluginKcm(parent, args, "kdeconnect_sendnotifications_config")
+    , m_ui(new Ui::SendNotificationsConfigUi())
     , appModel(new NotifyingApplicationModel)
 {
     qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
@@ -58,12 +58,12 @@ NotificationsConfig::NotificationsConfig(QWidget *parent, const QVariantList& ar
     connect(config(), SIGNAL(configChanged()), this, SLOT(loadApplications()));
 }
 
-NotificationsConfig::~NotificationsConfig()
+SendNotificationsConfig::~SendNotificationsConfig()
 {
     delete m_ui;
 }
 
-void NotificationsConfig::defaults()
+void SendNotificationsConfig::defaults()
 {
     KCModule::defaults();
     m_ui->check_persistent->setChecked(false);
@@ -73,7 +73,7 @@ void NotificationsConfig::defaults()
     Q_EMIT changed(true);
 }
 
-void NotificationsConfig::loadApplications()
+void SendNotificationsConfig::loadApplications()
 {
     appModel->clearApplications();
     QVariantList list = config()->getList("applications");
@@ -85,7 +85,7 @@ void NotificationsConfig::loadApplications()
     }
 }
 
-void NotificationsConfig::load()
+void SendNotificationsConfig::load()
 {
     KCModule::load();
     bool persistent = config()->get("generalPersistent", false);
@@ -101,7 +101,7 @@ void NotificationsConfig::load()
     Q_EMIT changed(false);
 }
 
-void NotificationsConfig::save()
+void SendNotificationsConfig::save()
 {
     config()->set("generalPersistent", m_ui->check_persistent->isChecked());
     config()->set("generalIncludeBody", m_ui->check_body->isChecked());
@@ -116,4 +116,4 @@ void NotificationsConfig::save()
     Q_EMIT changed(false);
 }
 
-#include "notifications_config.moc"
+#include "sendnotifications_config.moc"
diff --git a/plugins/notifications/notifications_config.h b/plugins/sendnotifications/sendnotifications_config.h
similarity index 81%
rename from plugins/notifications/notifications_config.h
rename to plugins/sendnotifications/sendnotifications_config.h
index fedbfc6..3a5b176 100644
--- a/plugins/notifications/notifications_config.h
+++ b/plugins/sendnotifications/sendnotifications_config.h
@@ -18,24 +18,24 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NOTIFICATIONS_CONFIG_H
-#define NOTIFICATIONS_CONFIG_H
+#ifndef SENDNOTIFICATIONS_CONFIG_H
+#define SENDNOTIFICATIONS_CONFIG_H
 
 #include "kcmplugin/kdeconnectpluginkcm.h"
 
 namespace Ui {
-    class NotificationsConfigUi;
+    class SendNotificationsConfigUi;
 }
 
 class NotifyingApplicationModel;
 
-class NotificationsConfig
+class SendNotificationsConfig
     : public KdeConnectPluginKcm
 {
     Q_OBJECT
 public:
-    NotificationsConfig(QWidget *parent, const QVariantList&);
-    virtual ~NotificationsConfig();
+    SendNotificationsConfig(QWidget *parent, const QVariantList&);
+    virtual ~SendNotificationsConfig();
 
 public Q_SLOTS:
     virtual void save() override;
@@ -46,7 +46,7 @@ private Q_SLOTS:
     void loadApplications();
 
 private:
-    Ui::NotificationsConfigUi* m_ui;
+    Ui::SendNotificationsConfigUi* m_ui;
     NotifyingApplicationModel* appModel;
 
 };
diff --git a/plugins/notifications/notifications_config.ui b/plugins/sendnotifications/sendnotifications_config.ui
similarity index 98%
rename from plugins/notifications/notifications_config.ui
rename to plugins/sendnotifications/sendnotifications_config.ui
index 83b26cc..c1ef29a 100644
--- a/plugins/notifications/notifications_config.ui
+++ b/plugins/sendnotifications/sendnotifications_config.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>NotificationsConfigUi</class>
- <widget class="QWidget" name="NotificationsConfigUi">
+ <class>SendNotificationsConfigUi</class>
+ <widget class="QWidget" name="SendNotificationsConfigUi">
   <property name="windowModality">
    <enum>Qt::WindowModal</enum>
   </property>
diff --git a/plugins/clipboard/clipboardplugin.cpp b/plugins/sendnotifications/sendnotificationsplugin.cpp
similarity index 53%
copy from plugins/clipboard/clipboardplugin.cpp
copy to plugins/sendnotifications/sendnotificationsplugin.cpp
index 656dc72..40dcf8c 100644
--- a/plugins/clipboard/clipboardplugin.cpp
+++ b/plugins/sendnotifications/sendnotificationsplugin.cpp
@@ -18,47 +18,37 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "clipboardplugin.h"
+#include "sendnotificationsplugin.h"
 
-#include <QClipboard>
-#include <QGuiApplication>
+#include "notificationslistener.h"
+#include "sendnotification_debug.h"
 
 #include <KPluginFactory>
 
-K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_clipboard.json", registerPlugin< ClipboardPlugin >(); )
+K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_sendnotifications.json", registerPlugin< SendNotificationsPlugin >(); )
 
-Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CLIPBOARD, "kdeconnect.plugin.clipboard")
+Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SENDNOTIFICATION, "kdeconnect.plugin.sendnotification")
 
-ClipboardPlugin::ClipboardPlugin(QObject *parent, const QVariantList &args)
+SendNotificationsPlugin::SendNotificationsPlugin(QObject* parent, const QVariantList& args)
     : KdeConnectPlugin(parent, args)
-    , clipboard(QGuiApplication::clipboard())
 {
-    connect(clipboard, SIGNAL(changed(QClipboard::Mode)), this, SLOT(clipboardChanged(QClipboard::Mode)));
+    notificationsListener = new NotificationsListener(this);
 }
 
-void ClipboardPlugin::clipboardChanged(QClipboard::Mode mode)
+SendNotificationsPlugin::~SendNotificationsPlugin()
 {
-    if (mode != QClipboard::Clipboard) {
-        return;
-    }
-
-    QString content = clipboard->text();
-
-    if (content == currentContent) {
-        return;
-    }
-
-    currentContent = content;
-
-    NetworkPackage np(PACKAGE_TYPE_CLIPBOARD);
-    np.set("content", content);
-    sendPackage(np);
+    delete notificationsListener;
 }
 
-bool ClipboardPlugin::receivePackage(const NetworkPackage& np)
+bool SendNotificationsPlugin::receivePackage(const NetworkPackage& np)
 {
-    clipboard->setText(np.get<QString>("content"));
+    Q_UNUSED(np);
     return true;
 }
 
-#include "clipboardplugin.moc"
+void SendNotificationsPlugin::connected()
+{
+
+}
+
+#include "sendnotificationsplugin.moc"
diff --git a/plugins/notifications/notificationsplugin.h b/plugins/sendnotifications/sendnotificationsplugin.h
similarity index 85%
copy from plugins/notifications/notificationsplugin.h
copy to plugins/sendnotifications/sendnotificationsplugin.h
index a0e2405..fcb8935 100644
--- a/plugins/notifications/notificationsplugin.h
+++ b/plugins/sendnotifications/sendnotificationsplugin.h
@@ -18,8 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NOTIFICATIONSPLUGIN_H
-#define NOTIFICATIONSPLUGIN_H
+#ifndef SENDNOTIFICATIONSPLUGIN_H
+#define SENDNOTIFICATIONSPLUGIN_H
 
 #include <knotification.h>
 
@@ -34,21 +34,20 @@
 class NotificationsDbusInterface;
 class NotificationsListener;
 
-class NotificationsPlugin
+class SendNotificationsPlugin
     : public KdeConnectPlugin
 {
     Q_OBJECT
 
 public:
-    explicit NotificationsPlugin(QObject *parent, const QVariantList &args);
-    virtual ~NotificationsPlugin();
+    explicit SendNotificationsPlugin(QObject *parent, const QVariantList &args);
+    virtual ~SendNotificationsPlugin();
     
 public Q_SLOTS:
     virtual bool receivePackage(const NetworkPackage& np) override;
     virtual void connected() override;
 
 protected:
-    NotificationsDbusInterface* notificationsDbusInterface;
     NotificationsListener* notificationsListener;
 
 };
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 812b4a3..54d7e09 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -20,10 +20,8 @@ ecm_add_test(networkpackagetests.cpp LINK_LIBRARIES ${kdeconnect_libraries})
 ecm_add_test(testsocketlinereader.cpp ../core/backends/lan/socketlinereader.cpp TEST_NAME testsocketlinereader LINK_LIBRARIES ${kdeconnect_libraries})
 ecm_add_test(downloadjobtest.cpp ../core/backends/lan/downloadjob.cpp TEST_NAME downloadjobtest LINK_LIBRARIES ${kdeconnect_libraries})
 ecm_add_test(testnotificationlistener.cpp
-             ../plugins/notifications/notificationslistener.cpp
-             ../plugins/notifications/notificationsplugin.cpp
-             ../plugins/notifications/notification.cpp
-             ../plugins/notifications/notifyingapplication.cpp
-             ../plugins/notifications/notificationsdbusinterface.cpp
+             ../plugins/sendnotifications/sendnotificationsplugin.cpp
+             ../plugins/sendnotifications/notificationslistener.cpp
+             ../plugins/sendnotifications/notifyingapplication.cpp
              TEST_NAME testnotificationlistener
              LINK_LIBRARIES ${kdeconnect_libraries} Qt5::DBus KF5::Notifications KF5::IconThemes)
diff --git a/tests/testnotificationlistener.cpp b/tests/testnotificationlistener.cpp
index b43a7d3..45597fa 100644
--- a/tests/testnotificationlistener.cpp
+++ b/tests/testnotificationlistener.cpp
@@ -31,18 +31,17 @@
 #include "core/device.h"
 #include "core/kdeconnectplugin.h"
 #include "kdeconnect-version.h"
-#include "plugins/notifications/notificationsplugin.h"
-#include "plugins/notifications/notificationslistener.h"
-#include "plugins/notifications/notificationsdbusinterface.h"
-#include "plugins/notifications/notifyingapplication.h"
+#include "plugins/sendnotifications/sendnotificationsplugin.h"
+#include "plugins/sendnotifications/notificationslistener.h"
+#include "plugins/sendnotifications/notifyingapplication.h"
 
 // Tweaked NotificationsPlugin for testing
-class TestNotificationsPlugin : public NotificationsPlugin
+class TestNotificationsPlugin : public SendNotificationsPlugin
 {
     Q_OBJECT
 public:
     explicit TestNotificationsPlugin(QObject *parent, const QVariantList &args)
-        : NotificationsPlugin(parent, args)
+    : SendNotificationsPlugin(parent, args)
     {
     }
 
@@ -59,10 +58,6 @@ public:
         notificationsListener = value;
     }
 
-    NotificationsDbusInterface* getNotificationsDbusInterface() const
-    {
-        return notificationsDbusInterface;
-    }
 };
 
 // Tweaked Device for testing:
@@ -116,9 +111,8 @@ class TestedNotificationsListener: public NotificationsListener
 {
 
 public:
-    explicit TestedNotificationsListener(KdeConnectPlugin* aPlugin,
-                                         NotificationsDbusInterface* aDbusInterface)
-        : NotificationsListener(aPlugin, aDbusInterface)
+    explicit TestedNotificationsListener(KdeConnectPlugin* aPlugin)
+        : NotificationsListener(aPlugin)
     {}
 
     virtual ~TestedNotificationsListener()
@@ -160,7 +154,7 @@ void TestNotificationListener::testNotify()
     //
 
     QString dId("testid");
-    TestDevice *d = new TestDevice(nullptr, dId); // not setting any parent or we will double free the dbusInterface
+    TestDevice *d = new TestDevice(nullptr, dId);
 
     int proxiedNotifications = 0;
     QCOMPARE(proxiedNotifications, d->getSentPackages());
@@ -172,7 +166,7 @@ void TestNotificationListener::testNotify()
     delete plugin->getNotificationsListener();
 
     // inject our tweaked NotificationsListener:
-    TestedNotificationsListener* listener = new TestedNotificationsListener(plugin, plugin->getNotificationsDbusInterface());
+    TestedNotificationsListener* listener = new TestedNotificationsListener(plugin);
     QVERIFY(listener);
     plugin->setNotificationsListener(listener);
     QCOMPARE(listener, plugin->getNotificationsListener());

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list