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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:43 UTC 2016


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

The following commit has been merged in the master branch:
commit 06493a8192410095892b738902f3f68878814cd4
Author: Aleix Pol <aleixpol at kde.org>
Date:   Thu Jun 25 21:19:23 2015 +0200

    Keep track of whether the daemon is alive
    
    Listen to dbus registrations. Remove all devices if the service dies,
    create all devices back when restored.
    Same for the NotificationsModel.
    
    REVIEW: 124183
---
 interfaces/dbusinterfaces.cpp     | 16 ++++++++--------
 interfaces/dbusinterfaces.h       |  2 ++
 interfaces/devicesmodel.cpp       |  6 ++++++
 interfaces/notificationsmodel.cpp |  6 ++++++
 4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp
index a89f7a0..68b4c64 100644
--- a/interfaces/dbusinterfaces.cpp
+++ b/interfaces/dbusinterfaces.cpp
@@ -20,14 +20,14 @@
 
 #include "dbusinterfaces.h"
 
-QString activatedService() {
+QString DaemonDbusInterface::activatedService() {
     static const QString service = "org.kde.kdeconnect";
     QDBusConnection::sessionBus().interface()->startService(service);
     return service;
 }
 
 DaemonDbusInterface::DaemonDbusInterface(QObject* parent)
-    : OrgKdeKdeconnectDaemonInterface(activatedService(), "/modules/kdeconnect", QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDaemonInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect", QDBusConnection::sessionBus(), parent)
 {
 
 }
@@ -38,7 +38,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
 }
 
 DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
-    : OrgKdeKdeconnectDeviceInterface(activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
     , m_id(id)
 {
     connect(this, &OrgKdeKdeconnectDeviceInterface::pairingChanged, this, &DeviceDbusInterface::pairingChangedProxy);
@@ -61,7 +61,7 @@ void DeviceDbusInterface::pluginCall(const QString &plugin, const QString &metho
 }
 
 DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
-    : OrgKdeKdeconnectDeviceBatteryInterface(activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
 {
 
 }
@@ -72,7 +72,7 @@ DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
 }
 
 DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
-    : OrgKdeKdeconnectDeviceNotificationsInterface(activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
 {
 
 }
@@ -83,7 +83,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
 }
 
 NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
-    : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, QDBusConnection::sessionBus(), parent)
 {
 
 }
@@ -94,7 +94,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
 }
 
 SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
-    : OrgKdeKdeconnectDeviceSftpInterface(activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", QDBusConnection::sessionBus(), parent)
 {
 
 }
@@ -105,7 +105,7 @@ SftpDbusInterface::~SftpDbusInterface()
 }
 
 MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
-    : OrgKdeKdeconnectDeviceMprisremoteInterface(activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", QDBusConnection::sessionBus(), parent)
+    : OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", QDBusConnection::sessionBus(), parent)
 {
     connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
 }
diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h
index 260a0e6..d42a28f 100644
--- a/interfaces/dbusinterfaces.h
+++ b/interfaces/dbusinterfaces.h
@@ -42,6 +42,8 @@ class KDECONNECTINTERFACES_EXPORT DaemonDbusInterface
 public:
     DaemonDbusInterface(QObject* parent = 0);
     virtual ~DaemonDbusInterface();
+
+    static QString activatedService();
 };
 
 class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface
diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp
index 6e41699..3ac68ab 100644
--- a/interfaces/devicesmodel.cpp
+++ b/interfaces/devicesmodel.cpp
@@ -27,6 +27,7 @@
 #include <QDBusInterface>
 #include <QDBusPendingReply>
 #include <QIcon>
+#include <QDBusServiceWatcher>
 
 #include "dbusinterfaces.h"
 // #include "modeltest.h"
@@ -53,6 +54,11 @@ DevicesModel::DevicesModel(QObject *parent)
     connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)),
             this, SLOT(deviceRemoved(QString)));
 
+    QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
+                                                           QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
+    connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &DevicesModel::refreshDeviceList);
+    connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &DevicesModel::clearDevices);
+
     refreshDeviceList();
 }
 
diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp
index 9c6d38d..aba4573 100644
--- a/interfaces/notificationsmodel.cpp
+++ b/interfaces/notificationsmodel.cpp
@@ -44,6 +44,12 @@ NotificationsModel::NotificationsModel(QObject* parent)
 
     connect(this, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
             this, SIGNAL(anyDismissableChanged()));
+
+
+    QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
+                                                           QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
+    connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &NotificationsModel::refreshNotificationList);
+    connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &NotificationsModel::clearNotifications);
 }
 
 QHash<int, QByteArray> NotificationsModel::roleNames() const

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list