[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:41 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=9fa8538
The following commit has been merged in the master branch:
commit 9fa8538bf13ab6b98a01bba723a4e7f4c22c92bb
Author: Albert Vaca <albertvaka at gmail.com>
Date: Sun Jun 21 20:20:40 2015 -0700
Removed some assertions that could not be true if using the model filter
Also fixed ugly hack where the KCM updated the model
---
interfaces/devicesmodel.cpp | 36 ++++++++++++++----------------------
interfaces/devicesmodel.h | 4 +---
kcm/kcm.cpp | 2 --
3 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp
index f3a2909..ca854f3 100644
--- a/interfaces/devicesmodel.cpp
+++ b/interfaces/devicesmodel.cpp
@@ -49,7 +49,7 @@ DevicesModel::DevicesModel(QObject *parent)
connect(m_dbusInterface, SIGNAL(deviceAdded(QString)),
this, SLOT(deviceAdded(QString)));
connect(m_dbusInterface, SIGNAL(deviceVisibilityChanged(QString,bool)),
- this, SLOT(deviceStatusChanged(QString)));
+ this, SLOT(deviceUpdated(QString)));
connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)),
this, SLOT(deviceRemoved(QString)));
@@ -93,26 +93,23 @@ void DevicesModel::deviceAdded(const QString& id)
void DevicesModel::deviceRemoved(const QString& id)
{
- if (!m_deviceIndexById.contains(id)) {
- Q_ASSERT(false); //This should only be emited for existing devices
- return;
+ QMap<QString, int>::iterator it = m_deviceIndexById.find(id);
+ if (it != m_deviceIndexById.end()) {
+ int row = *it;
+ m_deviceIndexById.erase(it);
+ beginRemoveRows(QModelIndex(), row, row);
+ delete m_deviceList.takeAt(row);
+ endRemoveRows();
}
- const int row = m_deviceIndexById.take(id);
- beginRemoveRows(QModelIndex(), row, row);
- delete m_deviceList.takeAt(row);
- endRemoveRows();
}
-void DevicesModel::deviceStatusChanged(const QString& id)
+void DevicesModel::deviceUpdated(const QString& id)
{
- if (!m_deviceIndexById.contains(id)) {
- Q_ASSERT(false); //This should only be emited for existing devices
- return;
+ QMap<QString, int>::iterator it = m_deviceIndexById.find(id);
+ if (it != m_deviceIndexById.end()) {
+ const QModelIndex idx = index(it.value());
+ Q_EMIT dataChanged(idx, idx);
}
-
- int row = m_deviceIndexById[id];
- const QModelIndex idx = index(row);
- Q_EMIT dataChanged(idx, idx);
}
int DevicesModel::displayFilter() const
@@ -178,13 +175,8 @@ void DevicesModel::appendDevice(DeviceDbusInterface* dev)
void DevicesModel::nameChanged(const QString& newName)
{
Q_UNUSED(newName);
-
DeviceDbusInterface* device = static_cast<DeviceDbusInterface*>(sender());
-
- int row = m_deviceIndexById[device->id()];
- Q_ASSERT(row >= 0);
- const QModelIndex idx = index(row);
- Q_EMIT dataChanged(idx, idx);
+ deviceUpdated(device->id());
}
void DevicesModel::clearDevices()
diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h
index a5d0bff..92410ff 100644
--- a/interfaces/devicesmodel.h
+++ b/interfaces/devicesmodel.h
@@ -69,12 +69,10 @@ public:
Q_SCRIPTABLE DeviceDbusInterface* getDevice(int row) const;
virtual QHash<int, QByteArray> roleNames() const;
-public Q_SLOTS:
- void deviceStatusChanged(const QString& id);
-
private Q_SLOTS:
void deviceAdded(const QString& id);
void deviceRemoved(const QString& id);
+ void deviceUpdated(const QString& id);
void refreshDeviceList();
void receivedDeviceList(QDBusPendingCallWatcher* watcher);
void nameChanged(const QString& newName);
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index 09d56e0..ac66dc0 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -259,8 +259,6 @@ void KdeConnectKcm::pairingFailed(const QString& error)
void KdeConnectKcm::pairingChanged(bool paired)
{
DeviceDbusInterface* senderDevice = (DeviceDbusInterface*) sender();
- devicesModel->deviceStatusChanged(senderDevice->id());
-
if (senderDevice != currentDevice) return;
kcmUi->pair_button->setVisible(!paired);
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list