]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/global.cpp
Add action for focusing Terminal Panel
[dolphin.git] / src / global.cpp
index d39d202a2300ca0e7fde5a87f28d1ffa1e4204ea..3b81c536aea0613a2363a43aecb731d2bd652610 100644 (file)
@@ -82,9 +82,9 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
         QSharedPointer<QDBusInterface> preferred(
             new QDBusInterface(preferredService,
             QStringLiteral("/dolphin/Dolphin_1"),
-            QStringLiteral("org.kde.dolphin.MainWindow"))
+            QString()) // #414402: use empty interface name to prevent QtDBus from caching the interface.
         );
-        if (preferred->isValid()) {
+        if (preferred->isValid() && !preferred->lastError().isValid()) {
             dolphinServices.append(qMakePair(preferred, QStringList()));
         }
     }
@@ -94,7 +94,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
     // Don't match the service without trailing "-" (unique instance)
     const QString pattern = QStringLiteral("org.kde.dolphin-");
     // Don't match the pid without leading "-"
-    const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid());
+    const QString myPid = QLatin1Char('-') + QString::number(QCoreApplication::applicationPid());
     for (const QString& service : services) {
         if (service.startsWith(pattern) && !service.endsWith(myPid)) {
             // Check if instance can handle our URLs
@@ -103,10 +103,9 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
                 QStringLiteral("/dolphin/Dolphin_1"),
                 QStringLiteral("org.kde.dolphin.MainWindow"))
             );
-            if (!instance->isValid() || instance->lastError().isValid()) {
-                continue;
+            if (instance->isValid() && !instance->lastError().isValid()) {
+                dolphinServices.append(qMakePair(instance, QStringList()));
             }
-            dolphinServices.append(qMakePair(instance, QStringList()));
         }
     }