[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=622fdcc
The following commit has been merged in the master branch:
commit 622fdcc46e177656d86d57c6f9f28e453f380744
Author: Albert Vaca <albertvaka at gmail.com>
Date: Thu Aug 15 22:22:11 2013 +0200
Fixed KCM crash on KDED restart
+ added a new datarole that could be useful to sort
---
kcm/devicesmodel.cpp | 25 +++++++++++++++++++------
kcm/devicesmodel.h | 7 +++++++
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/kcm/devicesmodel.cpp b/kcm/devicesmodel.cpp
index d784256..5990993 100644
--- a/kcm/devicesmodel.cpp
+++ b/kcm/devicesmodel.cpp
@@ -85,7 +85,7 @@ void DevicesModel::refreshDeviceList()
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)
@@ -129,23 +129,36 @@ QVariant DevicesModel::data(const QModelIndex &index, int role) const
}
- if (!index.isValid() || index.row() < 0 || index.row() >= m_deviceList.count()) {
+ if (!index.isValid()
+ || index.row() < 0
+ || index.row() >= m_deviceList.count()
+ || !m_deviceList[index.row()]->isValid())
+ {
return QVariant();
}
+ 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: {
- bool paired = m_deviceList[index.row()]->paired();
- bool reachable = m_deviceList[index.row()]->reachable();
+ bool paired = device->paired();
+ bool reachable = device->reachable();
QString icon = reachable? (paired? "user-online" : "user-busy") : "user-offline";
return KIcon(icon).pixmap(32, 32);
}
case IdModelRole:
- return QString(m_deviceList[index.row()]->id());
+ return QString(device->id());
case NameModelRole:
- return QString(m_deviceList[index.row()]->name());
+ return QString(device->name());
+ case StatusModelRole: {
+ int status = StatusUnknown;
+ if (device->paired()) status |= StatusPaired;
+ if (device->reachable()) status |= StatusReachable;
+ return status;
+ }
+
default:
return QVariant();
}
diff --git a/kcm/devicesmodel.h b/kcm/devicesmodel.h
index adba660..1b9100f 100644
--- a/kcm/devicesmodel.h
+++ b/kcm/devicesmodel.h
@@ -39,6 +39,13 @@ public:
NameModelRole = Qt::DisplayRole,
IconModelRole = Qt::DecorationRole,
IdModelRole = Qt::UserRole,
+ StatusModelRole //= Qt::UserRole+1
+ };
+ enum StatusFlags {
+ StatusUnknown = 0x00,
+ StatusPaired = 0x01,
+ StatusReachable = 0x10,
+
};
DevicesModel(QObject *parent = 0);
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list