[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:20 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=a54dd85
The following commit has been merged in the master branch:
commit a54dd853ffddd4998ce2d932809f57505675f288
Author: Samoilenko Yuri <kinnalru at gmail.com>
Date: Thu Jan 30 20:25:22 2014 +0400
play continues...
---
plasmoid/declarativeplugin/responsewaiter.cpp | 38 ++--------
plasmoid/declarativeplugin/responsewaiter.h | 26 ++-----
plasmoid/package/contents/ui/DeviceDelegate.qml | 92 ++++++++++++-------------
3 files changed, 54 insertions(+), 102 deletions(-)
diff --git a/plasmoid/declarativeplugin/responsewaiter.cpp b/plasmoid/declarativeplugin/responsewaiter.cpp
index d03ca6b..9c2af1a 100644
--- a/plasmoid/declarativeplugin/responsewaiter.cpp
+++ b/plasmoid/declarativeplugin/responsewaiter.cpp
@@ -15,9 +15,6 @@ Q_DECLARE_METATYPE(QDBusPendingReply<bool>)
Q_DECLARE_METATYPE(QDBusPendingReply<int>)
Q_DECLARE_METATYPE(QDBusPendingReply<QString>)
-//Q_DECLARE_METATYPE(DBusResponseWaiter::onComplete)
-//Q_DECLARE_METATYPE(DBusResponseWaiter::onError)
-
DBusResponseWaiter::DBusResponseWaiter()
: QObject()
{
@@ -28,9 +25,6 @@ DBusResponseWaiter::DBusResponseWaiter()
<< qRegisterMetaType<QDBusPendingReply<int> >("QDBusPendingReply<int>")
<< qRegisterMetaType<QDBusPendingReply<QString> >("QDBusPendingReply<QString>")
;
-
- //qRegisterMetaType<DBusResponseWaiter::onComplete>("DBusResponseWaiter::onComplete");
- //qRegisterMetaType<DBusResponseWaiter::onError>("DBusResponseWaiter::onError");
}
QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
@@ -50,17 +44,13 @@ QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
void DBusResponse::setPendingCall(QVariant variant)
{
- qDebug() << "spc1";
- m_pendingCall = variant;
- qDebug() << "spc2";
- if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter().extractPendingCall(m_pendingCall)))
+ if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter().extractPendingCall(variant)))
{
- qDebug() << "spc3";
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(*call);
+ watcher->setProperty("pengingCall", variant);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onCallFinished(QDBusPendingCallWatcher*)));
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), watcher, SLOT(deleteLater()));
};
- qDebug() << "spc4";
}
@@ -68,39 +58,23 @@ void DBusResponse::onCallFinished(QDBusPendingCallWatcher* watcher)
{
QVariant variant = watcher->property("pengingCall");
- qDebug() << "ocf 1";
- if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter().extractPendingCall(m_pendingCall)))
+ if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter().extractPendingCall(variant)))
{
- qDebug() << "ocf 2";
if (call->isError())
{
+ Q_EMIT error(call->error().message());
}
else
{
- qDebug() << "ocf 4444:" << this;
- // onComplete success = watcher->property("onComplete").value<onComplete>();
-
-// e_->rootContext()->setContextProperty("test_func", m_onSuccess);
-
-
- QDeclarativeExpression *expr = new QDeclarativeExpression(e_->rootContext(), this, "wow");
- qDebug() << "ocf 555";
- expr->evaluate(); // result = 400
-
-// qDebug() << "ocf 666" << expr->error();
-//
QDBusMessage reply = call->reply();
if (reply.arguments().count() > 0)
{
-// success(reply.arguments().first());
-
-
-
+ Q_EMIT success(reply.arguments().first());
}
else
{
-// success(QVariant());
+ Q_EMIT success(QVariant());
}
}
}
diff --git a/plasmoid/declarativeplugin/responsewaiter.h b/plasmoid/declarativeplugin/responsewaiter.h
index 0a0af80..55869f0 100644
--- a/plasmoid/declarativeplugin/responsewaiter.h
+++ b/plasmoid/declarativeplugin/responsewaiter.h
@@ -15,38 +15,20 @@ class DBusResponse : public QObject
{
Q_OBJECT
- Q_PROPERTY(QVariant pendingCall READ pendingCall WRITE setPendingCall NOTIFY pendingCallChanged)
- Q_PROPERTY(QVariant onError READ onError WRITE setOnError NOTIFY onErrorChanged)
- Q_PROPERTY(QVariant onSuccess READ onSuccess WRITE setOnSuccess NOTIFY onSuccessChanged)
+ Q_PROPERTY(QVariant pendingCall WRITE setPendingCall)
public:
- DBusResponse(QDeclarativeEngine* e = 0) : QObject(e) , e_(e) {qDebug() << "C";};
+ DBusResponse(QObject* parent = 0) : QObject(parent) {}
virtual ~DBusResponse() {};
void setPendingCall(QVariant e);
- QVariant pendingCall() {return m_pendingCall;}
-
- void setOnError(QVariant e) {m_onError = e;}
- QVariant onError() {return m_onError;}
-
- void setOnSuccess(QVariant e) {m_onSuccess = e;}
- QVariant onSuccess() {return m_onSuccess;}
-
Q_SIGNALS:
- void onSuccessChanged();
- void onErrorChanged();
- void pendingCallChanged();
+ void success(QVariant result);
+ void error(QString message);
private Q_SLOTS:
void onCallFinished(QDBusPendingCallWatcher* watcher);
-
-private:
- QVariant m_pendingCall;
- QVariant m_onError;
- QVariant m_onSuccess;
-
- QDeclarativeEngine* e_;
};
class DBusResponseWaiter : public QObject
diff --git a/plasmoid/package/contents/ui/DeviceDelegate.qml b/plasmoid/package/contents/ui/DeviceDelegate.qml
index 3437320..6099f1e 100644
--- a/plasmoid/package/contents/ui/DeviceDelegate.qml
+++ b/plasmoid/package/contents/ui/DeviceDelegate.qml
@@ -27,57 +27,25 @@ PlasmaComponents.ListItem
{
id: root
property string deviceId: model.deviceId
- property variant sftp: null
+ property variant sftp: SftpDbusInterfaceFactory.create(deviceId)
DBusResponse
{
- id: resp
-
- function wow() {
- console.log("wow")
- }
- }
-
- Component.onCompleted: {
- sftp = SftpDbusInterfaceFactory.create(deviceId)
-
-// resp.wow()
-// resp.wow()
-// resp.wow()
-
-// resp.func = bb
-
-
- resp.pendingCall = sftp.isMounted()
-
- var response = DBusResponseFactory.create()
- response.pendingCall = sftp.isMounted()
-
- /*
- response.onSuccess = bb;
-// function (v) {
-// console.debug("SUCCESSS");
-// console.debug(v);
-// }
- console.log("o3")
- response.onError = function(v) {console.log("eeeeee")}
- console.log("o4")
- response.pendingCall = sftp.isMounted()
- console.log("o5")*/
-
-
-
-// rr.pendingCall = 1;
-// onCompleted: {
-// console.debug("GGGGGGGGGGGGGGGGG")
-// }
-// }
-//
-// console.debug(ResponseWaiter.waitForReply(sftp.mountPoint()))
-
+ id: resp
+ onSuccess: {
+ console.log(1)
+ if (result)
+ {
+ browse.state = "MOUNTED"
+ }
+ }
+ onError: function(message) {
+ console.debug("error:" + message)
+ }
+ pendingCall: sftp.isMounted()
}
-
+
Column {
width: parent.width
@@ -93,10 +61,34 @@ PlasmaComponents.ListItem
id: browse
text: "Browse"
state: "UNMOUNTED"
+
+ function mounted() {
+ console.debug("SUCCESS")
+ }
onClicked: {
if (state == "UNMOUNTED") {
- sftp.startBrowsing()
- state = "MOUNTED"
+ state = "MOUNTING"
+ resp.success.connect(function(result){
+ if (result) {
+ state = "MOUNTED"
+ }
+ else {
+ state = "UNMOUNTED"
+ }
+ })
+
+ resp.error.connect(function(){
+ console.debug("ERROR")
+ })
+ resp.pendingCall = sftp.startBrowsing()
+// if (ResponseWaiter.waitForReply(sftp.startBrowsing()))
+// {
+// state = "MOUNTED"
+// }
+// else
+// {
+// state = "UNMOUNTED"
+// }
}
else {
sftp.umount()
@@ -110,6 +102,10 @@ PlasmaComponents.ListItem
PropertyChanges { target: browse; text: "Browse"}
},
State {
+ name: "MOUNTING"
+ PropertyChanges { target: browse; text: "Mounting..."}
+ },
+ State {
name: "MOUNTED"
PropertyChanges { target: browse; text: "Unmount"}
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list