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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:26:49 UTC 2016


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

The following commit has been merged in the master branch:
commit 18b3945da0753f2ff875a8b83a0e7dc0f7696dd2
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Tue Aug 20 13:53:36 2013 +0200

    Implemented notifications plugin
    
    It exports a dbus interface to manipulate notifications
---
 daemon/plugins/notifications/CMakeLists.txt        | 18 ++++++++++++++++
 .../plugins/notifications/notificationsplugin.cpp  | 25 +++++++++++++++++-----
 daemon/plugins/notifications/notificationsplugin.h | 13 +++++++----
 3 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/daemon/plugins/notifications/CMakeLists.txt b/daemon/plugins/notifications/CMakeLists.txt
index 90f748c..6995b6d 100644
--- a/daemon/plugins/notifications/CMakeLists.txt
+++ b/daemon/plugins/notifications/CMakeLists.txt
@@ -3,7 +3,9 @@ include (KDE4Defaults)
 include_directories(${KDE4_INCLUDES})
 
 set(kdeconnect_notifications_SRCS
+    notification.cpp
     notificationsplugin.cpp
+    notificationsdbusinterface.cpp
     ../kdeconnectplugin.cpp
     ../pluginloader.cpp
     ../../networkpackage.cpp
@@ -21,3 +23,19 @@ target_link_libraries(kdeconnect_notifications
 
 install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} )
 install(FILES kdeconnect_notifications.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+
+include(../../../cmakemacros.txt)
+
+generate_and_install_dbus_interface(
+    kdeconnect_notifications
+    notificationsdbusinterface.h
+    org.kde.kdeconnect.device.notifications.xml
+    OPTIONS -a
+)
+
+generate_and_install_dbus_interface(
+    kdeconnect_notifications
+    notification.h
+    org.kde.kdeconnect.device.notifications.notification.xml
+    OPTIONS -a
+)
diff --git a/daemon/plugins/notifications/notificationsplugin.cpp b/daemon/plugins/notifications/notificationsplugin.cpp
index 2bcbe87..8a0a12f 100644
--- a/daemon/plugins/notifications/notificationsplugin.cpp
+++ b/daemon/plugins/notifications/notificationsplugin.cpp
@@ -21,7 +21,10 @@
 #include "notificationsplugin.h"
 
 #include <QDebug>
-#include <kicon.h>
+
+#include <KIcon>
+
+#include "notificationsdbusinterface.h"
 
 K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); )
 K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_notifications", "kdeconnect_notifications") )
@@ -29,20 +32,32 @@ K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_notifications", "kdeconnect
 NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& args)
     : KdeConnectPlugin(parent, args)
 {
-    trayIcon = new KStatusNotifierItem(this);
-    trayIcon->setIconByName("smartphone");
-    trayIcon->setTitle(device()->name());
+    notificationsDbusInterface = new NotificationsDbusInterface(device(), parent);
+
+    NetworkPackage np(PACKAGE_TYPE_NOTIFICATION);
+    np.set("request",true);
+    device()->sendPackage(np);
 }
 
 NotificationsPlugin::~NotificationsPlugin()
 {
-    delete trayIcon;
+    //FIXME: Qt dbus does not allow to remove an adaptor! (it causes a crash in
+    // the next dbus access to its parent). The implication of not deleting this
+    // is that disabling the plugin does not remove the interface (that will
+    // return outdated values) and that enabling it again instantiates a second
+    // adaptor.
+
+    //notificationsDbusInterface->deleteLater();
+
 }
 
 bool NotificationsPlugin::receivePackage(const NetworkPackage& np)
 {
     if (np.type() != PACKAGE_TYPE_NOTIFICATION) return false;
 
+    notificationsDbusInterface->processPackage(np);
+
     return true;
 }
 
+   
diff --git a/daemon/plugins/notifications/notificationsplugin.h b/daemon/plugins/notifications/notificationsplugin.h
index 0512cb0..c355c02 100644
--- a/daemon/plugins/notifications/notificationsplugin.h
+++ b/daemon/plugins/notifications/notificationsplugin.h
@@ -18,14 +18,19 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NOTIFICATIONPACKAGEINTERFACE_H
-#define NOTIFICATIONPACKAGEINTERFACE_H
+#ifndef NOTIFICATIONSPLUGIN_H
+#define NOTIFICATIONSPLUGIN_H
 
 #include <knotification.h>
 
 #include "../kdeconnectplugin.h"
 
-#include <KStatusNotifierItem>
+/*
+ * This class is just a proxy for NotificationsDbusInterface
+ * because it can not inherit from QDBusAbstractAdaptor and
+ * KdeConnectPlugin at the same time (both are QObject)
+ */
+class NotificationsDbusInterface;
 
 class NotificationsPlugin
     : public KdeConnectPlugin
@@ -40,7 +45,7 @@ public Q_SLOTS:
     virtual bool receivePackage(const NetworkPackage& np);
 
 private:
-    KStatusNotifierItem* trayIcon;
+    NotificationsDbusInterface* notificationsDbusInterface;
 
 };
 

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list