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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:27:40 UTC 2016


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

The following commit has been merged in the master branch:
commit b7420146eb3522b6b204a140e2ecc3ef575c64ad
Author: Aleix Pol <aleixpol at kde.org>
Date:   Sat Jun 14 19:09:31 2014 +0200

    Expose the icon name from the device instance
---
 core/device.cpp             | 17 +++++++++++++++++
 core/device.h               |  4 +++-
 interfaces/devicesmodel.cpp |  5 ++++-
 interfaces/devicesmodel.h   |  1 +
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/core/device.cpp b/core/device.cpp
index 3f50ac0..65c5809 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -484,3 +484,20 @@ QString Device::type2str(Device::DeviceType deviceType) {
     if (deviceType == Tablet) return "tablet";
     return "unknown";
 }
+
+QString Device::iconName() const
+{
+    switch(m_deviceType) {
+        case Device::Desktop:
+            return "computer";
+        case Device::Laptop:
+            return "computer-laptop";
+        case Device::Phone:
+            return "smartphone";
+        case Device::Tablet:
+            return "tablet";
+        case Device::Unknown:
+            return "unknown";
+    }
+    return QString();
+}
diff --git a/core/device.h b/core/device.h
index 7ebb5af..5ed1048 100644
--- a/core/device.h
+++ b/core/device.h
@@ -38,7 +38,8 @@ class KDECONNECTCORE_EXPORT Device
 {
     Q_OBJECT
     Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device")
-    Q_PROPERTY(QString id READ id)
+    Q_PROPERTY(QString id READ id CONSTANT)
+    Q_PROPERTY(QString iconName READ iconName CONSTANT)
     Q_PROPERTY(QString name READ name)
 
     enum PairStatus {
@@ -78,6 +79,7 @@ public:
     QString id() const { return m_deviceId; }
     QString name() const { return m_deviceName; }
     QString dbusPath() const { return "/modules/kdeconnect/devices/"+id(); }
+    QString iconName() const;
 
     //Add and remove links
     void addLink(const NetworkPackage& identityPackage, DeviceLink*);
diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp
index 8f2495f..8242107 100644
--- a/interfaces/devicesmodel.cpp
+++ b/interfaces/devicesmodel.cpp
@@ -55,6 +55,7 @@ DevicesModel::DevicesModel(QObject *parent)
     //Role names for QML
     QHash<int, QByteArray> names = roleNames();
     names.insert(IdModelRole, "deviceId");
+    names.insert(IconNameRole, "iconName");
     setRoleNames(names);
 }
 
@@ -167,8 +168,10 @@ QVariant DevicesModel::data(const QModelIndex& index, int role) const
             }
             return status;
         }
+        case IconNameRole:
+            return device->iconName();
         default:
-             return QVariant();
+            return QVariant();
     }
 }
 
diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h
index 33340f5..15bcb67 100644
--- a/interfaces/devicesmodel.h
+++ b/interfaces/devicesmodel.h
@@ -44,6 +44,7 @@ public:
         IconModelRole = Qt::DecorationRole,
         StatusModelRole = Qt::InitialSortOrderRole,
         IdModelRole = Qt::UserRole,
+        IconNameRole
     };
     enum StatusFlags {
         StatusUnknown   = 0x00,

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list