]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Revert "Restrict attaching instances to those on the same activity or same virtual...
authorMéven Car <meven@kde.org>
Wed, 24 May 2023 08:52:59 +0000 (10:52 +0200)
committerMéven Car <meven.car@kdemail.net>
Wed, 24 May 2023 10:11:41 +0000 (10:11 +0000)
This reverts commit b99f6f50eef395a3ceb88fb3d4b7357cbbc13c85.

BUG: 408919

Reintroduces:
CCBUG: 408919

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/global.cpp

index 0094bc2e78b0f6d049f852fe505eb1e20832bcde..00af38beb5607286f3a8ee4f5c181394b556ad2b 100644 (file)
@@ -277,31 +277,6 @@ void DolphinMainWindow::openFiles(const QStringList &files, bool splitView)
     openFiles(QUrl::fromStringList(files), splitView);
 }
 
-bool DolphinMainWindow::isOnCurrentDesktop() const
-{
-#if HAVE_X11
-    if (KWindowSystem::isPlatformX11()) {
-        const NET::Properties properties = NET::WMDesktop;
-        KWindowInfo info(this->winId(), properties);
-        return info.isOnCurrentDesktop();
-    }
-#endif
-    return true;
-}
-
-bool DolphinMainWindow::isOnActivity(const QString &activityId) const
-{
-#if HAVE_X11 && HAVE_KACTIVITIES
-    if (KWindowSystem::isPlatformX11()) {
-        const NET::Properties properties = NET::Supported;
-        const NET::Properties2 properties2 = NET::WM2Activities;
-        KWindowInfo info(this->winId(), properties, properties2);
-        return info.activities().contains(activityId);
-    }
-#endif
-    return true;
-}
-
 void DolphinMainWindow::activateWindow(const QString &activationToken)
 {
     window()->setAttribute(Qt::WA_NativeWindow, true);
index 92ddb24c37420b1ca0a57a89eef66d931705b6eb..5bb17e79adb25aa0509399184edae3268e262f56 100644 (file)
@@ -204,9 +204,6 @@ public Q_SLOTS:
     /** @see GeneralSettings::splitViewChanged() */
     void slotSplitViewChanged();
 
-    bool isOnActivity(const QString &activityId) const;
-    bool isOnCurrentDesktop() const;
-
 Q_SIGNALS:
     /**
      * Is sent if the selection of the currently active view has
index 9246eeb338f20449c43ed82139c5846db5757bab..554eb41fad8db76f454356222aadc46c85574027 100644 (file)
@@ -16,9 +16,6 @@
 #include <KIO/ApplicationLauncherJob>
 #include <KService>
 #include <KWindowSystem>
-#if HAVE_KACTIVITIES
-#include <KActivities/Consumer>
-#endif
 
 #include <QApplication>
 
@@ -143,37 +140,13 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl> &inputUrls,
 
 QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Dolphin::dolphinGuiInstances(const QString &preferredService)
 {
-#if HAVE_KACTIVITIES
-    static std::once_flag one_consumer;
-    static KActivities::Consumer *consumer;
-    std::call_once(one_consumer, []() {
-        consumer = new KActivities::Consumer();
-        // ensures the consumer is ready for query
-        QEventLoop loop;
-        QObject::connect(consumer, &KActivities::Consumer::serviceStatusChanged, &loop, &QEventLoop::quit);
-        loop.exec();
-    });
-#endif
-
     QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinInterfaces;
-    const auto tryAppendInterface = [&dolphinInterfaces](const QString &service) {
-        // Check if instance can handle our URLs
-        QSharedPointer<OrgKdeDolphinMainWindowInterface> interface(
-            new OrgKdeDolphinMainWindowInterface(service, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus()));
-        if (interface->isValid() && !interface->lastError().isValid()) {
-#if HAVE_KACTIVITIES
-            const auto currentActivity = consumer->currentActivity();
-            if (currentActivity.isEmpty() || currentActivity == QStringLiteral("00000000-0000-0000-0000-000000000000")
-                || interface->isOnActivity(consumer->currentActivity()))
-#endif
-                if (interface->isOnCurrentDesktop()) {
-                    dolphinInterfaces.append(qMakePair(interface, QStringList()));
-                }
-        }
-    };
-
     if (!preferredService.isEmpty()) {
-        tryAppendInterface(preferredService);
+        QSharedPointer<OrgKdeDolphinMainWindowInterface> preferredInterface(
+            new OrgKdeDolphinMainWindowInterface(preferredService, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus()));
+        if (preferredInterface->isValid() && !preferredInterface->lastError().isValid()) {
+            dolphinInterfaces.append(qMakePair(preferredInterface, QStringList()));
+        }
     }
 
     // Look for dolphin instances among all available dbus services.
@@ -185,7 +158,12 @@ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Do
     const QString myPid = QLatin1Char('-') + QString::number(QCoreApplication::applicationPid());
     for (const QString &service : dbusServices) {
         if (service.startsWith(pattern) && !service.endsWith(myPid)) {
-            tryAppendInterface(service);
+            // Check if instance can handle our URLs
+            QSharedPointer<OrgKdeDolphinMainWindowInterface> interface(
+                new OrgKdeDolphinMainWindowInterface(service, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus()));
+            if (interface->isValid() && !interface->lastError().isValid()) {
+                dolphinInterfaces.append(qMakePair(interface, QStringList()));
+            }
         }
     }