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

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


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

The following commit has been merged in the master branch:
commit 05983267e37d059992f071557e61067c741aa0b3
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Thu Aug 15 22:45:33 2013 +0200

    Fixed KCM device list not being refreshed
    
    When a the device visibilita changes
---
 daemon/daemon.cpp    |  9 ++++-----
 kcm/devicesmodel.cpp | 22 +++++++++++++---------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index 5b6faf5..d4052ea 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -133,8 +133,6 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
         Device* device = mDevices[id];
         device->addLink(dl);
 
-        Q_EMIT deviceVisibilityChanged(id, true);
-        
     } else {
         qDebug() << "It is a new device";
 
@@ -145,9 +143,10 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
         mDevices[id] = device;
 
         Q_EMIT deviceAdded(id);
-        Q_EMIT deviceVisibilityChanged(id, true);
     }
 
+    Q_EMIT deviceVisibilityChanged(id, true);
+    
 }
 
 void Daemon::onDeviceReachableStatusChanged()
@@ -156,9 +155,9 @@ void Daemon::onDeviceReachableStatusChanged()
     Device* device = (Device*)sender();
     QString id = device->id();
 
-    if (!device->reachable()) {
+    Q_EMIT deviceVisibilityChanged(id, device->reachable());
 
-        Q_EMIT deviceVisibilityChanged(id, false);
+    if (!device->reachable()) {
 
         if (!device->paired()) {
             Q_EMIT deviceRemoved(id);
diff --git a/kcm/devicesmodel.cpp b/kcm/devicesmodel.cpp
index 5990993..3500c7f 100644
--- a/kcm/devicesmodel.cpp
+++ b/kcm/devicesmodel.cpp
@@ -37,9 +37,12 @@ DevicesModel::DevicesModel(QObject *parent)
         deviceAdded(id);
     }
 
-    connect(m_dbusInterface,SIGNAL(deviceAdded(QString)),this,SLOT(deviceAdded(QString)));
-    connect(m_dbusInterface,SIGNAL(deviceVisibilityChanged(QString,bool)),this,SLOT(deviceStatusChanged(QString)));
-    connect(m_dbusInterface,SIGNAL(deviceRemoved(QString)),this,SLOT(deviceRemoved(QString)));
+    connect(m_dbusInterface, SIGNAL(deviceAdded(QString)),
+            this, SLOT(deviceAdded(QString)));
+    connect(m_dbusInterface, SIGNAL(deviceVisibilityChanged(QString,bool)),
+            this, SLOT(deviceStatusChanged(QString)));
+    connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)),
+            this, SLOT(deviceRemoved(QString)));
 }
 
 DevicesModel::~DevicesModel()
@@ -64,11 +67,12 @@ void DevicesModel::deviceRemoved(const QString& id)
     refreshDeviceList();
 }
 
-
 void DevicesModel::deviceStatusChanged(const QString& id)
 {
     Q_UNUSED(id);
-    emit dataChanged(index(0),index(rowCount()));
+    //FIXME: Emitting dataChanged does not invalidate the view, refreshDeviceList does
+    //Q_EMIT dataChanged(index(0),index(rowCount()));
+    refreshDeviceList();
 }
 
 void DevicesModel::refreshDeviceList()
@@ -79,13 +83,16 @@ void DevicesModel::refreshDeviceList()
         m_deviceList.clear();
         endRemoveRows();
     }
+
     QList<QString> deviceIds = m_dbusInterface->devices();
     Q_FOREACH(const QString& id, deviceIds) {
-        beginInsertRows(QModelIndex(), rowCount(), rowCount() + 1);
+        beginInsertRows(QModelIndex(), rowCount(), rowCount());
         m_deviceList.append(new DeviceDbusInterface(id,this));
         endInsertRows();
     }
+
     Q_EMIT dataChanged(index(0),index(deviceIds.count()));
+
 }
 /*
 bool DevicesModel::insertRows(int row, int count, const QModelIndex &parent)
@@ -128,7 +135,6 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
         }
     }
 
-
     if (!index.isValid()
         || index.row() < 0
         || index.row() >= m_deviceList.count()
@@ -139,7 +145,6 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
 
     DeviceDbusInterface* device = m_deviceList[index.row()];
 
-
     //FIXME: This function gets called lots of times per second, producing lots of dbus calls
     switch (role) {
         case IconModelRole: {
@@ -158,7 +163,6 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
             if (device->reachable()) status |= StatusReachable;
             return status;
         }
-
         default:
              return QVariant();
     }

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list