From fa806d48dafec0c47141381740a5d7604293d32d Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Tue, 24 Dec 2019 18:28:26 +0100 Subject: Exclude daemonized processes from Dolphin::attachToExistingInstance() Summary: `dolphin --daemon` does not have the `/dolphin/Dolphin_1` dbus path, because it doesn't have any DolphinMainWindow. Instead of working around this issue (as we did in D21666 and D25510), just exclude these processes from the list of dbus instances checked by `Dolphin::attachToExistingInstance()`. CCBUG: 408244 Test Plan: Same test plan as in D21666 and D25510 Reviewers: #dolphin Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D26213 --- src/dbusinterface.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/dbusinterface.cpp') diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp index fd2d229a2..abdb3a0fe 100644 --- a/src/dbusinterface.cpp +++ b/src/dbusinterface.cpp @@ -44,7 +44,7 @@ void DBusInterface::ShowFolders(const QStringList& uriList, const QString& start if (urls.isEmpty()) { return; } - const auto serviceName = QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid()); + const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid()); if(!Dolphin::attachToExistingInstance(urls, false, GeneralSettings::splitView(), serviceName)) { Dolphin::openNewWindow(urls); } @@ -57,7 +57,7 @@ void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUp if (urls.isEmpty()) { return; } - const auto serviceName = QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid()); + const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid()); if(!Dolphin::attachToExistingInstance(urls, true, GeneralSettings::splitView(), serviceName)) { Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select); }; @@ -71,3 +71,13 @@ void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString KPropertiesDialog::showDialog(urls); } } + +void DBusInterface::setAsDaemon() +{ + m_isDaemon = true; +} + +bool DBusInterface::isDaemon() const +{ + return m_isDaemon; +} -- cgit v1.3