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

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


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

The following commit has been merged in the master branch:
commit 021bb1781a01e91060414ef770d965120f8444c8
Author: Aleix Pol <aleixpol at kde.org>
Date:   Mon Mar 16 02:58:22 2015 +0100

    Fix kdeconnect-cli after DevicesModel refactoring
    
    Can't use the model anymore as it is asynchronous, so just use the dbus
    interfaces directly.
---
 cli/kdeconnect-cli.cpp | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp
index 30c42ab..06fc2b0 100644
--- a/cli/kdeconnect-cli.cpp
+++ b/cli/kdeconnect-cli.cpp
@@ -63,35 +63,35 @@ int main(int argc, char** argv)
     about.processCommandLine(&parser);
 
     if(parser.isSet("l") || parser.isSet("a")) {
-        DevicesModel devices;
+        DaemonDbusInterface iface;
+        bool paired = true, reachable = false;
         if (parser.isSet("a")) {
-            devices.setDisplayFilter(DevicesModel::StatusFlag::StatusPaired | DevicesModel::StatusFlag::StatusReachable);
+            reachable = true;
         }
-        int deviceCount = devices.rowCount();
-        for(int i=0; i < deviceCount; ++i) {
-            QModelIndex idx = devices.index(i);
+        QDBusPendingReply<QStringList> reply = iface.devices(paired, reachable);
+        reply.waitForFinished();
+
+        const QStringList devices = reply.value();
+        foreach (const QString& id, devices) {
             if (parser.isSet("id-only")) {
-                QTextStream(stdout) << idx.data(DevicesModel::ModelRoles::IdModelRole).toString() << endl;
+                QTextStream(stdout) << id << endl;
             } else {
+                DeviceDbusInterface deviceIface(id);
                 QString statusInfo;
-                switch(idx.data(DevicesModel::StatusModelRole).toInt()) {
-                    case DevicesModel::StatusPaired:
-                        statusInfo = i18n("(paired)");
-                        break;
-                    case DevicesModel::StatusReachable:
-                        statusInfo = i18n("(reachable)");
-                        break;
-                    case DevicesModel::StatusReachable | DevicesModel::StatusPaired:
-                        statusInfo = i18n("(paired and reachable)");
-                        break;
-                }
-                QTextStream(stdout) << "- " << idx.data(Qt::DisplayRole).toString()
-                        << ": " << idx.data(DevicesModel::IdModelRole).toString() << ' ' << statusInfo << endl;
+                const bool isReachable = deviceIface.isReachable(), isPaired = deviceIface.isPaired();
+                if (isReachable && isPaired) {
+                    statusInfo = i18n("(paired and reachable)");
+                } else if (isReachable) {
+                    statusInfo = i18n("(reachable)");
+                } else if (isPaired)
+                    statusInfo = i18n("(paired)");
+                QTextStream(stdout) << "- " << deviceIface.name()
+                        << ": " << deviceIface.id() << ' ' << statusInfo << endl;
             }
         }
         if (!parser.isSet("id-only")) {
-            QTextStream(stdout) << i18n("%1 device(s) found", deviceCount) << endl;
-        } else if (!deviceCount) {
+            QTextStream(stdout) << i18np("1 device found", "%1 devices found", devices.size()) << endl;
+        } else if (devices.isEmpty()) {
             QTextStream(stderr) << i18n("No devices found") << endl;
         }
     } else if(parser.isSet("refresh")) {

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list