Commit 88145014 authored by Samoilenko Yuri's avatar Samoilenko Yuri
Browse files

wow - almost work, but some tricks...

parent a54dd853
......@@ -40,11 +40,10 @@ QObject* createSftpInterface(QVariant deviceId)
return new SftpDbusInterface(deviceId.toString());
}
QDeclarativeEngine* engine_;
QObject* createDBusResponse()
{
return new DBusResponse(engine_);
return new DBusResponse();
}
void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
......@@ -60,7 +59,6 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
void KdeConnectDeclarativePlugin::initializeEngine(QDeclarativeEngine* engine, const char* uri)
{
engine_ = engine;
QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
engine->rootContext()->setContextProperty("SftpDbusInterfaceFactory"
......
......@@ -78,6 +78,7 @@ void DBusResponse::onCallFinished(QDBusPendingCallWatcher* watcher)
}
}
}
deleteLater();
}
const QDBusPendingCall* DBusResponseWaiter::extractPendingCall(QVariant& variant) const
......
......@@ -30,20 +30,23 @@ PlasmaComponents.ListItem
property variant sftp: SftpDbusInterfaceFactory.create(deviceId)
DBusResponse
{
id: resp
onSuccess: {
console.log(1)
if (result)
{
browse.state = "MOUNTED"
Component.onCompleted: {
var response = DBusResponseFactory.create()
response.success.connect( function(result) {
if (result) {
state = "MOUNTED"
}
}
onError: function(message) {
console.debug("error:" + message)
}
pendingCall: sftp.isMounted()
else {
state = "UNMOUNTED"
}
})
response.error.connect( function(message) {
console.error("Error:" + message)
state = "UNMOUNTED"
})
response.pendingCall = sftp.isMounted()
}
Column {
......@@ -62,13 +65,11 @@ PlasmaComponents.ListItem
text: "Browse"
state: "UNMOUNTED"
function mounted() {
console.debug("SUCCESS")
}
onClicked: {
if (state == "UNMOUNTED") {
state = "MOUNTING"
resp.success.connect(function(result){
var response = DBusResponseFactory.create()
response.success.connect( function(result){
if (result) {
state = "MOUNTED"
}
......@@ -77,18 +78,12 @@ PlasmaComponents.ListItem
}
})
resp.error.connect(function(){
console.debug("ERROR")
response.error.connect( function(message) {
console.error("Error:" + message)
state = "UNMOUNTED"
})
resp.pendingCall = sftp.startBrowsing()
// if (ResponseWaiter.waitForReply(sftp.startBrowsing()))
// {
// state = "MOUNTED"
// }
// else
// {
// state = "UNMOUNTED"
// }
response.pendingCall = sftp.startBrowsing()
}
else {
sftp.umount()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment