From c3fb0dc15ba71da45ed854769a3d80410c8fc598 Mon Sep 17 00:00:00 2001 From: Heiko Becker Date: Tue, 9 May 2023 08:59:14 +0200 Subject: Fix build without KF5Activities --- src/global.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index 8babbbddc..9246eeb33 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -16,7 +16,7 @@ #include #include #include -#ifdef HAVE_KACTIVITIES +#if HAVE_KACTIVITIES #include #endif @@ -143,7 +143,7 @@ bool Dolphin::attachToExistingInstance(const QList &inputUrls, QVector, QStringList>> Dolphin::dolphinGuiInstances(const QString &preferredService) { -#ifdef HAVE_KACTIVITIES +#if HAVE_KACTIVITIES static std::once_flag one_consumer; static KActivities::Consumer *consumer; std::call_once(one_consumer, []() { @@ -161,7 +161,7 @@ QVector, QStringList>> Do QSharedPointer interface( new OrgKdeDolphinMainWindowInterface(service, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus())); if (interface->isValid() && !interface->lastError().isValid()) { -#ifdef HAVE_KACTIVITIES +#if HAVE_KACTIVITIES const auto currentActivity = consumer->currentActivity(); if (currentActivity.isEmpty() || currentActivity == QStringLiteral("00000000-0000-0000-0000-000000000000") || interface->isOnActivity(consumer->currentActivity())) -- cgit v1.3 From dec80fb0f940ff4e71032c2d3544f0d60a05c4ce Mon Sep 17 00:00:00 2001 From: Méven Car Date: Thu, 18 May 2023 10:07:50 +0200 Subject: global.cpp: Ensure qApp does not emit signal because of local QEventLoop BUG: 469656 --- src/global.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index 9246eeb33..c68b2d2d0 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -148,6 +148,8 @@ QVector, QStringList>> Do static KActivities::Consumer *consumer; std::call_once(one_consumer, []() { consumer = new KActivities::Consumer(); + // to prevent QGuiApplication::saveStateRequest + const QSignalBlocker blocker(qApp); // ensures the consumer is ready for query QEventLoop loop; QObject::connect(consumer, &KActivities::Consumer::serviceStatusChanged, &loop, &QEventLoop::quit); -- cgit v1.3 From b01329bf360795b51809c0adfeefaa91b79f7950 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Wed, 24 May 2023 10:50:11 +0200 Subject: Revert "global.cpp: Ensure qApp does not emit signal because of local QEventLoop" This reverts commit dec80fb0f940ff4e71032c2d3544f0d60a05c4ce. --- src/global.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index c68b2d2d0..9246eeb33 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -148,8 +148,6 @@ QVector, QStringList>> Do static KActivities::Consumer *consumer; std::call_once(one_consumer, []() { consumer = new KActivities::Consumer(); - // to prevent QGuiApplication::saveStateRequest - const QSignalBlocker blocker(qApp); // ensures the consumer is ready for query QEventLoop loop; QObject::connect(consumer, &KActivities::Consumer::serviceStatusChanged, &loop, &QEventLoop::quit); -- cgit v1.3 From ee8b71e5568f5a56b886b877d63fb345c96b2cce Mon Sep 17 00:00:00 2001 From: Méven Car Date: Wed, 24 May 2023 10:52:59 +0200 Subject: Revert "Restrict attaching instances to those on the same activity or same virtual desktop" This reverts commit b99f6f50eef395a3ceb88fb3d4b7357cbbc13c85. BUG: 408919 Reintroduces: CCBUG: 408919 --- src/dolphinmainwindow.cpp | 25 ------------------------- src/dolphinmainwindow.h | 3 --- src/global.cpp | 44 +++++++++++--------------------------------- 3 files changed, 11 insertions(+), 61 deletions(-) (limited to 'src/global.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 0094bc2e7..00af38beb 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -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); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 92ddb24c3..5bb17e79a 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -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 diff --git a/src/global.cpp b/src/global.cpp index 9246eeb33..554eb41fa 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -16,9 +16,6 @@ #include #include #include -#if HAVE_KACTIVITIES -#include -#endif #include @@ -143,37 +140,13 @@ bool Dolphin::attachToExistingInstance(const QList &inputUrls, QVector, 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, QStringList>> dolphinInterfaces; - const auto tryAppendInterface = [&dolphinInterfaces](const QString &service) { - // Check if instance can handle our URLs - QSharedPointer 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 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, 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 interface( + new OrgKdeDolphinMainWindowInterface(service, QStringLiteral("/dolphin/Dolphin_1"), QDBusConnection::sessionBus())); + if (interface->isValid() && !interface->lastError().isValid()) { + dolphinInterfaces.append(qMakePair(interface, QStringList())); + } } } -- cgit v1.3