[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:25 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=182da7b
The following commit has been merged in the master branch:
commit 182da7bfc58262726e3875a69f41e77484ee54c6
Author: Albert Vaca <albertvaka at gmail.com>
Date: Wed Feb 19 16:28:17 2014 +0100
Browse button on plasmoid only visible if sftp plugin enabled
---
plasmoid/package/contents/ui/Battery.qml | 5 +--
plasmoid/package/contents/ui/DeviceDelegate.qml | 19 +++++-----
plasmoid/package/contents/ui/Sftp.qml | 48 +++++++++++++++++++------
3 files changed, 49 insertions(+), 23 deletions(-)
diff --git a/plasmoid/package/contents/ui/Battery.qml b/plasmoid/package/contents/ui/Battery.qml
index 50adcd8..5559f97 100644
--- a/plasmoid/package/contents/ui/Battery.qml
+++ b/plasmoid/package/contents/ui/Battery.qml
@@ -28,12 +28,12 @@ QtObject {
id: root
property string deviceId: ""
+ property variant device: DeviceDbusInterfaceFactory.create(deviceId)
property bool available: false
+
property bool charging: false
property int charge: -1
property string displayString: (available && charge > -1) ? ((charging) ? (i18n("Charging, %1").arg(charge)) : (i18n("Discharging, %1").arg(charge))) : i18n("No info")
-
- property variant device: DeviceDbusInterfaceFactory.create(deviceId)
property variant battery: null
property variant nested1: DBusAsyncResponse {
@@ -48,6 +48,7 @@ QtObject {
onSuccess: root.charge = result
}
+ /* Note: magically called by qml */
onAvailableChanged: {
if (available) {
battery = DeviceBatteryDbusInterfaceFactory.create(deviceId)
diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml
index a58255c..372a1b6 100644
--- a/plasmoid/package/contents/ui/DeviceDelegate.qml
+++ b/plasmoid/package/contents/ui/DeviceDelegate.qml
@@ -36,21 +36,22 @@ PlasmaComponents.ListItem
Row
{
PlasmaComponents.Label {
- width: parent.width - browse.width
+ width: browse.visible? parent.width - browse.width : parent.width
horizontalAlignment: Text.AlignHCenter
text: display
}
PlasmaComponents.Button
{
- id: browse
- iconSource: "document-open-folder"
-
Sftp {
id: sftp
deviceId: root.deviceId
}
+ id: browse
+ iconSource: "document-open-folder"
+ visible: sftp.available
+
onClicked: {
sftp.browse()
}
@@ -63,12 +64,12 @@ PlasmaComponents.ListItem
//Battery
PlasmaComponents.ListItem {
-
+
Battery {
id: battery
deviceId: root.deviceId
}
-
+
sectionDelegate: true
visible: battery.available
PlasmaComponents.Label {
@@ -80,7 +81,7 @@ PlasmaComponents.ListItem
anchors.right: parent.right
}
}
-
+
//Notifications
PlasmaComponents.ListItem {
visible: notificationsModel.count>0
@@ -122,11 +123,9 @@ PlasmaComponents.ListItem
onClicked: dbusInterface.dismiss();
}
}
- //FIXME
- //Repeater.onItemAdded: plasmoid.status = "NeedsAttentionStatus";
}
- //TODO: Other information could be displayed here
+ //NOTE: More information could be displayed here
}
}
diff --git a/plasmoid/package/contents/ui/Sftp.qml b/plasmoid/package/contents/ui/Sftp.qml
index e42dc6b..cd97604 100644
--- a/plasmoid/package/contents/ui/Sftp.qml
+++ b/plasmoid/package/contents/ui/Sftp.qml
@@ -28,29 +28,24 @@ QtObject {
id: root
property string deviceId: ""
- property bool isMounted: false
- property variant sftp: SftpDbusInterfaceFactory.create(deviceId)
+ property variant device: DeviceDbusInterfaceFactory.create(deviceId)
+ property bool available: false
+ property bool isMounted: false
+ property variant sftp: null
property variant nested: DBusAsyncResponse {
id: startupCheck
onSuccess: (result) ? root.mounted() : root.unmounted()
onError: root.error(message)
}
-
+
signal mounted
signal unmounted
signal error(string message)
onMounted: isMounted = true
onUnmounted: isMounted = false
-
- Component.onCompleted: {
- sftp.mounted.connect(mounted)
- sftp.unmounted.connect(unmounted)
-
- startupCheck.setPendingCall(sftp.isMounted())
- }
-
+
function browse() {
startupCheck.setPendingCall(sftp.startBrowsing())
}
@@ -58,5 +53,36 @@ QtObject {
function unmount() {
sftp.unmount()
}
+
+ Component.onCompleted: {
+ device.pluginsChanged.connect(pluginsChanged)
+ device.pluginsChanged()
+ }
+
+ /* Note: magically called by qml */
+ onAvailableChanged: {
+ if (available) {
+ sftp = SftpDbusInterfaceFactory.create(deviceId)
+
+ sftp.mounted.connect(mounted)
+ sftp.unmounted.connect(unmounted)
+
+ startupCheck.setPendingCall(sftp.isMounted())
+ }
+ else {
+ sftp = null
+ }
+ }
+ function pluginsChanged() {
+ var result = DBusResponseWaiter.waitForReply(device.hasPlugin("kdeconnect_sftp"))
+
+ if (result && result != "error") {
+ available = true
+ }
+ else {
+ available = false
+ }
+ }
+
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list