]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Keep org.freedesktop.FileManager1 registered across processes
authorDavid Edmundson <kde@davidedmundson.co.uk>
Mon, 17 Sep 2018 10:02:51 +0000 (12:02 +0200)
committerDavid Edmundson <kde@davidedmundson.co.uk>
Mon, 17 Sep 2018 10:04:00 +0000 (12:04 +0200)
Summary:
Currently if someone starts 2 dolphins, the second cannot register
org.freedesktop.FileManager1 meaning and when the first dolphin quits,
no-one has it registered.

It doesn't cause a huge problem right now as we just dbus-activate a new one if
needed, but it means the behaviour is a bit inconsistent and
non-optimal.

DBus has a system to queue names, meaning that as long as any dolphin is
running this name is owned by one of the processes.

Also this patch registers the service after the object which is
technically safer.

Test Plan:
Ran d-feet
Opened 2 dolphins, closed the first
Service was still registered and the PID of the owning process changed.

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D15539

src/dbusinterface.cpp

index e5192f2077224a63e74a69105d75501ee197dd1c..c780bc7cdc9cb853f4df70cc9d57a4df72183872 100644 (file)
 #include <KPropertiesDialog>
 
 #include <QDBusConnection>
+#include <QDBusConnectionInterface>
 
 DBusInterface::DBusInterface() :
     QObject()
 {
-    QDBusConnection::sessionBus().registerService(QStringLiteral("org.freedesktop.FileManager1"));
     QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
             QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
+    QDBusConnection::sessionBus().interface()->registerService(QStringLiteral("org.freedesktop.FileManager1"),
+                                                               QDBusConnectionInterface::QueueService);
 }
 
 void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId)