How to run a command in QML?
As in the update 2.0.4 the codes of device lock has changed. Before the update I could use:
DeviceLockInterface {
id: devicelock
}
deviceLock.setState(1)
To lock the device in a QML file.
But Afterwards I should import "org.nemomobile.devicelock 1.0" to use device lock. But the command "deviceLock.setState" no longer works, not even with capital D nor with importing the library as DeviceLock.
However the dbus call still works:
sh -c "dbus-send --system --type=method_call --dest=org.nemomobile.lipstick /devicelock org.nemomobile.lipstick.devicelock.setState int32:1"
So, as a workaround, I want to run the bash script in my QML file. The QProcess didn't work for me. Is it possible to make it work by importing a library? Or any other solutions?
Perhaps you could use DBus from QML directly? https://sailfishos.org/develop/docs/nemo-qml-plugin-dbus/
tadzik ( 2017-02-14 14:35:44 +0200 )editIt is not possible from QML directly to execute shell commands. You could use some javascript foo that allows you that but needs importing libraries which most of them you don't need actually.
leszek ( 2017-02-14 15:02:15 +0200 )edit@AliNa: have you made a bugreport for it? it needs to be corrected...
zlutor ( 2017-02-14 19:05:48 +0200 )edit@zlutor, no, I didn't think that it might be a bug. Where to report BTW?
AliN ( 2017-02-14 21:21:28 +0200 )edit@zlutor why bug? bug in your application not following updated api versions.
coderus ( 2017-02-15 15:00:01 +0200 )edit