]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/main.cpp
GIT_SILENT Sync po/docbooks with svn
[dolphin.git] / src / main.cpp
index a45083e400e434019321d1685db024e07c4a304a..611e3631ccadae3411e6a7a09c66fecbd5a5d33a 100644 (file)
 #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
@@ -46,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;
         }
@@ -181,6 +185,10 @@ int main(int argc, char **argv)
         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)) {