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

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


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

The following commit has been merged in the master branch:
commit 9b3382d2b8620d05b2e2b9a5963c48607a9d914d
Author: Samoilenko Yuri <kinnalru at gmail.com>
Date:   Wed Feb 5 23:26:54 2014 +0400

    Sftp qml module polished
---
 kded/plugins/sftp/sftpplugin.cpp                   |  4 +-
 kded/plugins/sftp/sftpplugin.h                     |  2 +-
 plasmoid/package/contents/ui/BrowseButton.qml      | 94 ----------------------
 plasmoid/package/contents/ui/DeviceDelegate.qml    | 44 +++++++++-
 .../ui/{CompactRepresentation.qml => Sftp.qml}     | 60 ++++++++------
 5 files changed, 79 insertions(+), 125 deletions(-)

diff --git a/kded/plugins/sftp/sftpplugin.cpp b/kded/plugins/sftp/sftpplugin.cpp
index 7c9debd..9468e96 100644
--- a/kded/plugins/sftp/sftpplugin.cpp
+++ b/kded/plugins/sftp/sftpplugin.cpp
@@ -65,7 +65,7 @@ SftpPlugin::~SftpPlugin()
 {
     QDBusConnection::sessionBus().unregisterObject(dbusPath(), QDBusConnection::UnregisterTree);
     removeFromDolphin();    
-    umount();
+    unmount();
     kDebug(kdeconnect_kded()) << "Destroyed device:" << device()->name();
 }
 
@@ -113,7 +113,7 @@ void SftpPlugin::mount()
     connect(m_d->mounter, SIGNAL(failed(QString)), this, SLOT(onFailed(QString)));
 }
 
-void SftpPlugin::umount()
+void SftpPlugin::unmount()
 {
     kDebug(kdeconnect_kded()) << "Device:" << device()->name();
     delete m_d->mounter.data();
diff --git a/kded/plugins/sftp/sftpplugin.h b/kded/plugins/sftp/sftpplugin.h
index 0342094..c590301 100644
--- a/kded/plugins/sftp/sftpplugin.h
+++ b/kded/plugins/sftp/sftpplugin.h
@@ -54,7 +54,7 @@ public Q_SLOTS:
     virtual void connected();
 
     Q_SCRIPTABLE void mount();
-    Q_SCRIPTABLE void umount();
+    Q_SCRIPTABLE void unmount();
     Q_SCRIPTABLE bool mountAndWait();
     Q_SCRIPTABLE bool isMounted();
     
diff --git a/plasmoid/package/contents/ui/BrowseButton.qml b/plasmoid/package/contents/ui/BrowseButton.qml
deleted file mode 100644
index bba9644..0000000
--- a/plasmoid/package/contents/ui/BrowseButton.qml
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Copyright 2014 Samoilenko Yuri <kinnalru 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
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
-import org.kde.kdeconnect 1.0
-
-PlasmaComponents.Button
-{
-    id: button
-    checkable: true
-    property string deviceId: ""
-    property variant sftp: SftpDbusInterfaceFactory.create(deviceId)
-
-    state: "UNMOUNTED"
-                
-    states: [
-        State {
-            name: "UNMOUNTED"
-            PropertyChanges { target: button; checked: false; text: "Browse" }
-        },
-        State {
-            name: "MOUNTING"
-            PropertyChanges { target: button; checked: true; text: "Mounting..." }
-        },
-        State {
-            name: "MOUNTED"
-            PropertyChanges { target: button; checked: false; text: "Unmount" }
-        }
-    ]
-    
-    onClicked: {
-        if (state == "UNMOUNTED") {
-            state = "MOUNTING"
-            sftp.startBrowsing()
-        }
-        else if (state == "MOUNTED") {
-            sftp.umount()
-            state = "UNMOUNTED"
-        }
-    }
-    
-
-    DBusAsyncResponse {
-        id: startupCheck
-        onSuccess: {
-            console.log("222SUCC:" + result)
-            if (result) {
-                button.state = "MOUNTED"
-            }
-            else {
-                button.state = "UNMOUNTED"
-            }
-        }
-        onError: {
-            console.log("Error:" + message)
-            state = "UNMOUNTED"
-        }
-    }
-    
-    Component.onCompleted: {
-      
-        console.log("onCompleted device:" + deviceId)
-        
-        sftp.mounted.connect(function() {
-            browse.state = "MOUNTED"
-        })
-        
-        sftp.unmounted.connect(function() {
-            browse.state = "UNMOUNTED"
-        })
-        
-        startupCheck.pendingCall = sftp.isMounted()
-    }
-    
-}
diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml
index d37cfc1..adbe075 100644
--- a/plasmoid/package/contents/ui/DeviceDelegate.qml
+++ b/plasmoid/package/contents/ui/DeviceDelegate.qml
@@ -41,11 +41,49 @@ PlasmaComponents.ListItem
                 text: display
             }
             
-            BrowseButton {
+            PlasmaComponents.Button
+            {
                 id: browse
-                deviceId: root.deviceId
+                checkable: true
+                state: "UNMOUNTED"
+
+                states: [
+                    State {
+                        name: "UNMOUNTED"
+                        PropertyChanges { target: browse; checked: false; text: "Browse" }
+                    },
+                    State {
+                        name: "MOUNTING"
+                        PropertyChanges { target: browse; checked: true; text: "Mounting..." }
+                    },
+                    State {
+                        name: "MOUNTED"
+                        PropertyChanges { target: browse; checked: false; text: "Unmount" }
+                    }
+                ]
+
+                Sftp {
+                    id: sftp
+                    deviceId: root.deviceId
+                    
+                    onMounted: browse.state = "MOUNTED"
+                    onUnmounted: browse.state = "UNMOUNTED"
+                    onError: browse.state = "UNMOUNTED"
+                }
+                
+                onClicked: {
+                    if (state == "UNMOUNTED") {
+                        state = "MOUNTING"
+                        sftp.browse()
+                    }
+                    else if (state == "MOUNTED") {
+                        sftp.unmount()
+                        state = "UNMOUNTED"
+                    }
+                }
             }
- 
+            
+
             height: browse.height
             width: parent.width
         }
diff --git a/plasmoid/package/contents/ui/CompactRepresentation.qml b/plasmoid/package/contents/ui/Sftp.qml
similarity index 50%
copy from plasmoid/package/contents/ui/CompactRepresentation.qml
copy to plasmoid/package/contents/ui/Sftp.qml
index b2267ab..aac8c79 100644
--- a/plasmoid/package/contents/ui/CompactRepresentation.qml
+++ b/plasmoid/package/contents/ui/Sftp.qml
@@ -1,5 +1,5 @@
 /**
- * Copyright 2013 Albert Vaca <albertvaka at gmail.com>
+ * Copyright 2014 Samoilenko Yuri <kinnalru 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
@@ -20,33 +20,43 @@
 
 import QtQuick 1.1
 import org.kde.plasma.core 0.1 as PlasmaCore
+import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.kdeconnect 1.0
 
-Item {
-    id: view
-    anchors.fill: parent
+QtObject {
+  
+    id: root
+    
+    property string deviceId: ""
+    property bool isMounted: false    
+    property variant sftp: SftpDbusInterfaceFactory.create(deviceId)
 
-    //TODO: Use this to detect if we should be iconized or full size
-    function isConstrained() {
-        return (plasmoid.formFactor == Vertical || plasmoid.formFactor == Horizontal);
+    property variant nested: DBusAsyncResponse {
+        id: startupCheck
+        onSuccess: (result) ? root.mounted() : root.unmounted()
+        onError: root.error(message)
     }
-
-    PlasmaCore.IconItem {
-        id: icon
-        source: "smartphone"
-        anchors.fill: parent
+    
+    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.pendingCall = sftp.isMounted()
     }
-
-    MouseArea {
-        id: mouseArea
-        anchors.fill: parent
-        onClicked: plasmoid.togglePopup()
-
-        PlasmaCore.ToolTip {
-            id: tooltip
-            target: mouseArea
-            image: QIcon("smartphone")
-            subText: "KDE Connect device notifications"
-        }
+    
+    function browse() {
+        sftp.startBrowsing()
     }
-
+    
+    function unmount() {
+        sftp.unmount()
+    }
+    
 }

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list