diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbusinterface.cpp | 6 | ||||
| -rw-r--r-- | src/dolphinmainwindow.cpp | 3 | ||||
| -rw-r--r-- | src/global.cpp | 3 | ||||
| -rw-r--r-- | src/main.cpp | 7 |
4 files changed, 14 insertions, 5 deletions
diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp index 7e453f72a..2b674b968 100644 --- a/src/dbusinterface.cpp +++ b/src/dbusinterface.cpp @@ -20,8 +20,10 @@ DBusInterface::DBusInterface() : { QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); - QDBusConnection::sessionBus().interface()->registerService(QStringLiteral("org.freedesktop.FileManager1"), - QDBusConnectionInterface::QueueService); + QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface(); + if (sessionInterface) { + sessionInterface->registerService(QStringLiteral("org.freedesktop.FileManager1"), QDBusConnectionInterface::QueueService); + } } void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index fe39d4d2f..d4c8199a6 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1543,7 +1543,8 @@ void DolphinMainWindow::setupActions() stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash"))); stashSplit->setCheckable(false); - stashSplit->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier"))); + QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface(); + stashSplit->setVisible(sessionInterface && sessionInterface->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier"))); connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection()); diff --git a/src/global.cpp b/src/global.cpp index 197d6ec28..d217a67ec 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -120,7 +120,8 @@ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Do } // Look for dolphin instances among all available dbus services. - const QStringList dbusServices = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); + QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface(); + const QStringList dbusServices = sessionInterface ? sessionInterface->registeredServiceNames().value() : QStringList(); // Don't match the service without trailing "-" (unique instance) const QString pattern = QStringLiteral("org.kde.dolphin-"); // Don't match the pid without leading "-" diff --git a/src/main.cpp b/src/main.cpp index fba45f43c..ff726401e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -178,7 +178,12 @@ int main(int argc, char **argv) mainWindow->show(); - KDBusService dolphinDBusService; + // Allow starting Dolphin on a system that is not running DBus: + KDBusService::StartupOptions serviceOptions = KDBusService::Multiple; + if (!QDBusConnection::sessionBus().isConnected()) { + serviceOptions |= KDBusService::NoExitOnFailure; + } + KDBusService dolphinDBusService(serviceOptions); DBusInterface interface; if (!app.isSessionRestored()) { |
