┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/global.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/global.cpp')
-rw-r--r--src/global.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/global.cpp b/src/global.cpp
index 21660a828..64282e711 100644
--- a/src/global.cpp
+++ b/src/global.cpp
@@ -77,12 +77,6 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
return false;
}
- const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
-
- // 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());
QVector<QPair<QSharedPointer<QDBusInterface>, QStringList>> dolphinServices;
if (!preferredService.isEmpty()) {
QSharedPointer<QDBusInterface> preferred(
@@ -91,11 +85,16 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
QStringLiteral("org.kde.dolphin.MainWindow"))
);
if (preferred->isValid() && !preferred->lastError().isValid()) {
- dolphinServices.append(qMakePair(preferred, QStringList() ));
+ dolphinServices.append(qMakePair(preferred, QStringList()));
}
}
// find all dolphin instances
+ const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+ // 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());
for (const QString& service : services) {
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
// Check if instance can handle our URLs
@@ -124,9 +123,9 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
for (auto& service: dolphinServices) {
QDBusReply<bool> isUrlOpen = service.first->call(QStringLiteral("isUrlOpen"), url);
if (isUrlOpen.isValid() && isUrlOpen.value()) {
- service.second.append(url);
- urlFound = true;
- break;
+ service.second.append(url);
+ urlFound = true;
+ break;
}
}
if (!urlFound) {