[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:29:38 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=8d7dad3
The following commit has been merged in the master branch:
commit 8d7dad3604cdda2f9ffaf234bf896d1bd9e53a86
Author: David Kahles <david.kahles96 at gmail.com>
Date: Wed Apr 6 02:55:50 2016 +0200
Introduce QML component to check for plugin availability
Remove those checks from three different places and put them into a reusable
component, which can be used for different plugins.
REVIEW: 127583
---
plasmoid/package/contents/ui/Battery.qml | 27 ++++++------------
plasmoid/package/contents/ui/FindMyPhone.qml | 23 ++++++---------
.../contents/ui/{Sftp.qml => PluginChecker.qml} | 33 ++++++----------------
plasmoid/package/contents/ui/Sftp.qml | 23 ++++++---------
4 files changed, 33 insertions(+), 73 deletions(-)
diff --git a/plasmoid/package/contents/ui/Battery.qml b/plasmoid/package/contents/ui/Battery.qml
index 4538437..02bf7cf 100644
--- a/plasmoid/package/contents/ui/Battery.qml
+++ b/plasmoid/package/contents/ui/Battery.qml
@@ -27,9 +27,14 @@ QtObject {
id: root
- property string deviceId: ""
- property variant device: DeviceDbusInterfaceFactory.create(deviceId)
- property bool available: false
+ property alias deviceId: checker.deviceId
+ readonly property alias device: checker.device
+ readonly property alias available: checker.available
+
+ readonly property PluginChecker pluginChecker: PluginChecker {
+ id: checker
+ pluginName: "battery"
+ }
property bool charging: false
property int charge: -1
@@ -48,7 +53,6 @@ QtObject {
onSuccess: root.charge = result
}
- // Note: magically called by qml
onAvailableChanged: {
if (available) {
battery = DeviceBatteryDbusInterfaceFactory.create(deviceId)
@@ -62,19 +66,4 @@ QtObject {
battery = null
}
}
-
- function pluginsChanged() {
- var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_battery"))
-
- if (result && result != "error") {
- available = true
- } else {
- available = false
- }
- }
-
- Component.onCompleted: {
- device.pluginsChanged.connect(pluginsChanged)
- device.pluginsChanged()
- }
}
diff --git a/plasmoid/package/contents/ui/FindMyPhone.qml b/plasmoid/package/contents/ui/FindMyPhone.qml
index 8a666b7..3a23fde 100644
--- a/plasmoid/package/contents/ui/FindMyPhone.qml
+++ b/plasmoid/package/contents/ui/FindMyPhone.qml
@@ -27,9 +27,14 @@ QtObject {
id: root
- property string deviceId: ""
- property variant device: DeviceDbusInterfaceFactory.create(deviceId)
- property bool available: false
+ property alias deviceId: checker.deviceId
+ readonly property alias device: checker.device
+ readonly property alias available: checker.available
+
+ readonly property PluginChecker pluginChecker: PluginChecker {
+ id: checker
+ pluginName: "findmyphone"
+ }
property variant findMyPhone: null
@@ -39,12 +44,6 @@ QtObject {
}
}
- Component.onCompleted: {
- device.pluginsChanged.connect(pluginsChanged)
- pluginsChanged()
- }
-
- // Note: magically called by qml
onAvailableChanged: {
if (available) {
findMyPhone = FindMyPhoneDbusInterfaceFactory.create(deviceId)
@@ -52,10 +51,4 @@ QtObject {
findMyPhone = null
}
}
-
- function pluginsChanged() {
- var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_findmyphone"))
- available = (result && result != "error");
- }
-
}
diff --git a/plasmoid/package/contents/ui/Sftp.qml b/plasmoid/package/contents/ui/PluginChecker.qml
similarity index 64%
copy from plasmoid/package/contents/ui/Sftp.qml
copy to plasmoid/package/contents/ui/PluginChecker.qml
index 9ef4f41..adfc727 100644
--- a/plasmoid/package/contents/ui/Sftp.qml
+++ b/plasmoid/package/contents/ui/PluginChecker.qml
@@ -1,5 +1,6 @@
/**
* Copyright 2014 Samoilenko Yuri <kinnalru at gmail.com>
+ * Copyright 2016 David Kahles <david.kahles96 at gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -18,9 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 2.1
-import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
+import QtQml 2.2
import org.kde.kdeconnect 1.0
QtObject {
@@ -28,33 +27,19 @@ QtObject {
id: root
property string deviceId: ""
- property variant device: DeviceDbusInterfaceFactory.create(deviceId)
+ property string pluginName: ""
+ readonly property variant device: DeviceDbusInterfaceFactory.create(deviceId)
property bool available: false
- property variant sftp: null
-
- function browse() {
- if (sftp)
- sftp.startBrowsing();
+ property Connections connection: Connections {
+ target: device
+ onPluginsChanged: pluginsChanged()
}
- Component.onCompleted: {
- device.pluginsChanged.connect(pluginsChanged)
- pluginsChanged()
- }
-
- // Note: magically called by qml
- onAvailableChanged: {
- if (available) {
- sftp = SftpDbusInterfaceFactory.create(deviceId)
- } else {
- sftp = null
- }
- }
+ Component.onCompleted: pluginsChanged()
function pluginsChanged() {
- var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_sftp"))
+ var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_" + pluginName))
available = (result && result != "error");
}
-
}
diff --git a/plasmoid/package/contents/ui/Sftp.qml b/plasmoid/package/contents/ui/Sftp.qml
index 9ef4f41..fd817e5 100644
--- a/plasmoid/package/contents/ui/Sftp.qml
+++ b/plasmoid/package/contents/ui/Sftp.qml
@@ -27,9 +27,14 @@ QtObject {
id: root
- property string deviceId: ""
- property variant device: DeviceDbusInterfaceFactory.create(deviceId)
- property bool available: false
+ property alias deviceId: checker.deviceId
+ readonly property alias device: checker.device
+ readonly property alias available: checker.available
+
+ readonly property PluginChecker pluginChecker: PluginChecker {
+ id: checker
+ pluginName: "sftp"
+ }
property variant sftp: null
@@ -38,12 +43,6 @@ QtObject {
sftp.startBrowsing();
}
- Component.onCompleted: {
- device.pluginsChanged.connect(pluginsChanged)
- pluginsChanged()
- }
-
- // Note: magically called by qml
onAvailableChanged: {
if (available) {
sftp = SftpDbusInterfaceFactory.create(deviceId)
@@ -51,10 +50,4 @@ QtObject {
sftp = null
}
}
-
- function pluginsChanged() {
- var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_sftp"))
- available = (result && result != "error");
- }
-
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list