]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
dolphinview: Fix right click broken on placeholderLabel
[dolphin.git] / src / main.cpp
index 8661a3d1713cfa99107e99d9b67baf20412059ca..611e3631ccadae3411e6a7a09c66fecbd5a5d33a 100644 (file)
@@ -23,6 +23,7 @@
 #include <KLocalizedString>
 #include <KConfigGui>
 #include <KIO/PreviewJob>
+#include <KWindowSystem>
 
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 #include <Kdelibs4ConfigMigrator>
 #include <QApplication>
 #include <QCommandLineParser>
 #include <QDBusConnection>
-#include <QDBusInterface>
-#include <QDBusAbstractInterface>
 #include <QDBusConnectionInterface>
 #include <QSessionManager>
 
+#if HAVE_X11
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <private/qtx11extras_p.h>
+#else
+#include <QX11Info>
+#endif
+#endif
+
 #ifndef Q_OS_WIN
 #include <unistd.h>
 #endif
@@ -47,15 +54,11 @@ int main(int argc, char **argv)
     // Prohibit using sudo or kdesu (but allow using the root user directly)
     if (getuid() == 0) {
         if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
-            std::cout << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Dolphin normally and you will be prompted for elevated privileges when "
-                         "performing file operations that require them."
+            std::cout << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities."
                       << std::endl;
             return EXIT_FAILURE;
         } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities. "
-                         "Instead use Dolphin normally and you will be prompted for elevated privileges when "
-                         "performing file operations that require them."
+            std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities."
                       << std::endl;
             return EXIT_FAILURE;
         }
@@ -88,10 +91,16 @@ int main(int argc, char **argv)
     KAboutData aboutData(QStringLiteral("dolphin"), i18n("Dolphin"), QStringLiteral(DOLPHIN_VERSION_STRING),
                          i18nc("@title", "File Manager"),
                          KAboutLicense::GPL,
-                         i18nc("@info:credit", "(C) 2006-2018 Peter Penz, Frank Reininghaus, Emmanuel Pescosta and Elvis Angelaccio"));
+                         i18nc("@info:credit", "(C) 2006-2022 The Dolphin Developers"));
     aboutData.setHomepage(QStringLiteral("https://kde.org/applications/system/org.kde.dolphin"));
+    aboutData.addAuthor(i18nc("@info:credit", "Felix Ernst"),
+                        i18nc("@info:credit", "Maintainer (since 2021) and developer"),
+                        QStringLiteral("felixernst@kde.org"));
+    aboutData.addAuthor(i18nc("@info:credit", "Méven Car"),
+                        i18nc("@info:credit", "Maintainer (since 2021) and developer (since 2019)"),
+                        QStringLiteral("meven@kde.org"));
     aboutData.addAuthor(i18nc("@info:credit", "Elvis Angelaccio"),
-                        i18nc("@info:credit", "Maintainer (since 2018) and developer"),
+                        i18nc("@info:credit", "Maintainer (2018-2021) and developer"),
                         QStringLiteral("elvis.angelaccio@kde.org"));
     aboutData.addAuthor(i18nc("@info:credit", "Emmanuel Pescosta"),
                         i18nc("@info:credit", "Maintainer (2014-2018) and developer"),
@@ -137,7 +146,7 @@ int main(int argc, char **argv)
                                                                                         "will be selected.")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("split"), i18nc("@info:shell", "Dolphin will get started with a split view.")));
     parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("new-window"), i18nc("@info:shell", "Dolphin will explicitly open in a new window.")));
-    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)")));
+    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface).")));
     parser.addPositionalArgument(QStringLiteral("+[Url]"), i18nc("@info:shell", "Document to open"));
 
     parser.process(app);
@@ -171,7 +180,18 @@ int main(int argc, char **argv)
     }
 
     if (!parser.isSet(QStringLiteral("new-window"))) {
-        if (Dolphin::attachToExistingInstance(urls, openFiles, splitView)) {
+
+        QString token;
+        if (KWindowSystem::isPlatformWayland()) {
+            token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN");
+            qunsetenv("XDG_ACTIVATION_TOKEN");
+        } else if (KWindowSystem::isPlatformX11()) {
+#if HAVE_X11
+            token = QX11Info::nextStartupId();
+#endif
+        }
+
+        if (Dolphin::attachToExistingInstance(urls, openFiles, splitView, QString(), token)) {
             // Successfully attached to existing instance of Dolphin
             return 0;
         }