I would like to mount a filesystem using QT and DBUS. I subscribed to signal “DeviceAdded” using this small snippet:
void DBusWatcher::deviceAdded(const QDBusObjectPath &o) {
QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.UDisks", o.path(), "org.freedesktop.DBus.Properties", "GetAll");
QList<QVariant> args;
args.append("org.freedesktop.UDisks.Device");
call.setArguments(args);
QDBusPendingReply<QVariantMap> reply = DBusConnection::systemBus().asyncCall(call);
reply.waitForFinished();
QVariantMap map = reply.value();
// ...
}
That works pretty fine. My question is, how do I mount this thing? All I have is something like this – and it does not work at all – and with no errors.
QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.UDisks", "dont know what to put here!", "org.freedesktop.UDisks.Device", "FilesystemMount");
And now, what action should I use on QDBusConnection::systemBus(): call, asyncCall, callWithCallback? What has to be put as second argument into createMethodCall? Nothing works! Really fustrating!
OK, after struggling for at least 2 days I finally got it! I looked into
razer-qtsources, I looked intokdelibssources but somehow all theirdbusstuff did not work. So here is the snippet I’m pretty happy with:I’m using
Openboxand the latestUdisk(2)stuff running on x64-ArchLinux. Maybe someone can use it too.