]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'Applications/19.08'
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 11 Aug 2019 14:01:41 +0000 (16:01 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 11 Aug 2019 14:01:41 +0000 (16:01 +0200)
1  2 
src/global.cpp

diff --combined src/global.cpp
index d39d202a2300ca0e7fde5a87f28d1ffa1e4204ea,21660a8281a66311216c0a0e41cd314720027b36..64282e711de29956fad1e216b77cfe99c5d8f184
@@@ -77,6 -77,12 +77,6 @@@ bool Dolphin::attachToExistingInstance(
          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(
              QStringLiteral("/dolphin/Dolphin_1"),
              QStringLiteral("org.kde.dolphin.MainWindow"))
          );
-         if (preferred->isValid()) {
+         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
          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) {