]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
Adress the first round of Angelaccio's review comments
[dolphin.git] / src / main.cpp
index 0a252bc775a2f7b5227d8bc8bf7ea504e8a88d50..ef2905d776ade988e669f67dd134e78cce10f146 100644 (file)
 #include "dolphindebug.h"
 #include "dolphinmainwindow.h"
 #include "global.h"
+#include "config-kuserfeedback.h"
+#ifdef HAVE_KUSERFEEDBACK
+#include "userfeedback/dolphinfeedbackprovider.h"
+#endif
 
 #include <KAboutData>
 #include <KCrash>
@@ -26,6 +30,7 @@
 #include <QDBusInterface>
 #include <QDBusAbstractInterface>
 #include <QDBusConnectionInterface>
+#include <QSessionManager>
 
 #ifndef Q_OS_WIN
 #include <unistd.h>
@@ -132,6 +137,14 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
 
 
     if (parser.isSet(QStringLiteral("daemon"))) {
+        // Disable session management for the daemonized version
+        // See https://bugs.kde.org/show_bug.cgi?id=417219
+        auto disableSessionManagement = [](QSessionManager &sm) {
+            sm.setRestartHint(QSessionManager::RestartNever);
+        };
+        QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
+        QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
+
         KDBusService dolphinDBusService;
         DBusInterface interface;
         interface.setAsDaemon();
@@ -191,11 +204,20 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
                 if (startedWithURLs) {
                     mainWindow->openDirectories(urls, splitView);
                 }
+
+                // Now handle invalid locations in the set of active views to
+                // avoid issues like https://bugs.kde.org/show_bug.cgi?id=427619
+                mainWindow->setViewsWithInvalidPathsToHome();
             } else {
                 qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!";
             }
         }
     }
 
+#ifdef HAVE_KUSERFEEDBACK
+    auto feedbackProvider = DolphinFeedbackProvider::instance();
+    Q_UNUSED(feedbackProvider)
+#endif
+
     return app.exec(); // krazy:exclude=crash;
 }