wow - almost work, but some tricks...
This commit is contained in:
parent
a54dd853ff
commit
881450146f
3 changed files with 25 additions and 31 deletions
|
@ -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"
|
||||
}
|
||||
else {
|
||||
state = "UNMOUNTED"
|
||||
}
|
||||
onError: function(message) {
|
||||
console.debug("error:" + message)
|
||||
}
|
||||
pendingCall: sftp.isMounted()
|
||||
})
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue