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

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


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

The following commit has been merged in the master branch:
commit 05491442e68499d66199069b5d0967449e0e52eb
Author: Aleix Pol <aleixpol at kde.org>
Date:   Wed Apr 15 13:00:23 2015 +0200

    Make it possible to fetch the device from the DevicesModel from QML
    
    Uses the row as the argument instead of the QModelIndex.
    Defines the Device type so it can be used from QML.
    
    REVIEW: 123361
---
 interfaces/devicesmodel.cpp                                | 7 +------
 interfaces/devicesmodel.h                                  | 2 +-
 kcm/kcm.cpp                                                | 2 +-
 plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp | 1 +
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp
index 16b4d77..35e44fc 100644
--- a/interfaces/devicesmodel.cpp
+++ b/interfaces/devicesmodel.cpp
@@ -227,13 +227,8 @@ QVariant DevicesModel::data(const QModelIndex& index, int role) const
     }
 }
 
-DeviceDbusInterface* DevicesModel::getDevice(const QModelIndex& index) const
+DeviceDbusInterface* DevicesModel::getDevice(int row) const
 {
-    if (!index.isValid()) {
-        return NULL;
-    }
-
-    int row = index.row();
     if (row < 0 || row >= m_deviceList.size()) {
         return NULL;
     }
diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h
index 1f157b2..e8c1d9e 100644
--- a/interfaces/devicesmodel.h
+++ b/interfaces/devicesmodel.h
@@ -64,7 +64,7 @@ public:
     virtual QVariant data(const QModelIndex& index, int role) const;
     virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
 
-    DeviceDbusInterface* getDevice(const QModelIndex& index) const;
+    Q_SCRIPTABLE DeviceDbusInterface* getDevice(int row) const;
     virtual QHash<int, QByteArray> roleNames() const;
 
 public Q_SLOTS:
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index 7a72f74..cf422e3 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -157,7 +157,7 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
     }
 
     currentIndex = sortProxyModel->mapToSource(current);
-    currentDevice = devicesModel->getDevice(currentIndex);
+    currentDevice = devicesModel->getDevice(currentIndex.row());
 
     bool valid = (currentDevice != NULL && currentDevice->isValid());
     kcmUi->deviceInfo->setVisible(valid);
diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
index 5b9716f..c9c5f3d 100644
--- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
+++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
@@ -61,6 +61,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
     qmlRegisterType<NotificationsModel>("org.kde.kdeconnect", 1, 0, "NotificationsModel");
     qmlRegisterType<DBusAsyncResponse>("org.kde.kdeconnect", 1, 0, "DBusAsyncResponse");
     qmlRegisterType<ProcessRunner>(uri, 1, 0, "ProcessRunner");
+    qmlRegisterUncreatableType<DeviceDbusInterface>("org.kde.kdeconnect", 1, 0, "DeviceDbusInterface", QStringLiteral("You're not supposed to instantiate interfacess"));
 }
 
 void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri)

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list