]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
Don't exit immediately if DBus isn't running
[dolphin.git] / src / main.cpp
index ef2905d776ade988e669f67dd134e78cce10f146..ff726401ee74950e3967fe25af25d5f9a8bbe2cc 100644 (file)
@@ -37,7 +37,7 @@
 #endif
 #include <iostream>
 
-extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
+int main(int argc, char **argv)
 {
 #ifndef Q_OS_WIN
     // Prohibit using sudo or kdesu (but allow using the root user directly)
@@ -178,7 +178,12 @@ extern "C" Q_DECL_EXPORT int kdemain(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()) {