]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
Add name-only tooltip and make logicalHeightHints a pair of qreal and bool
[dolphin.git] / src / main.cpp
index ef2905d776ade988e669f67dd134e78cce10f146..779690c1c5de280c9742f2d432e0a3c395156986 100644 (file)
@@ -23,6 +23,7 @@
 #include <KLocalizedString>
 #include <Kdelibs4ConfigMigrator>
 #include <KConfigGui>
+#include <KIO/PreviewJob>
 
 #include <QApplication>
 #include <QCommandLineParser>
@@ -37,7 +38,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)
@@ -61,6 +62,8 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
     QApplication app(argc, argv);
     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));
 
+    KIO::PreviewJob::setDefaultDevicePixelRatio(app.devicePixelRatio());
+
     KCrash::initialize();
 
     Kdelibs4ConfigMigrator migrate(QStringLiteral("dolphin"));
@@ -178,7 +181,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()) {
@@ -202,12 +210,12 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
                 // If the user passed any URLs to Dolphin, open those in the
                 // window after session-restoring it
                 if (startedWithURLs) {
-                    mainWindow->openDirectories(urls, splitView);
+                    if (openFiles) {
+                        mainWindow->openFiles(urls, splitView);
+                    } else {
+                        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!";
             }