]> 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 a4b1b1963fc61683ccaf31bf214b25b926648443..ff726401ee74950e3967fe25af25d5f9a8bbe2cc 100644 (file)
@@ -21,7 +21,6 @@
 #include <KCrash>
 #include <KDBusService>
 #include <KLocalizedString>
-#include <KToolBar>
 #include <Kdelibs4ConfigMigrator>
 #include <KConfigGui>
 
@@ -38,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)
@@ -179,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()) {
@@ -214,12 +218,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
             }
         }
     }
-    Qt::ToolBarArea area = mainWindow->toolBarArea(mainWindow->toolBar());
-    if (area != Qt::TopToolBarArea && area != Qt::BottomToolBarArea) {
-        // Migrate users with disabled tool bar positions.
-        // Remove this a few years from now (2020).
-        mainWindow->addToolBar(Qt::TopToolBarArea, mainWindow->toolBar());
-    }
 
 #ifdef HAVE_KUSERFEEDBACK
     auto feedbackProvider = DolphinFeedbackProvider::instance();