Tighter match own service when trying to find suitable window to open path in.

Summary:
Current implementation matches org.kde.dolphin-.*PID while trying to exclude itself from the list of running instances.
With this fix applied only org.kde.dolphin-PID is matched.

Test Plan: Open dolphin twice. Observe only one window.

Reviewers: feverfew, #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D21547
This commit is contained in:
Thomas Posch 2019-06-03 21:52:10 +02:00 committed by Elvis Angelaccio
parent 27e3907a3d
commit 853a95b6d5

View file

@ -81,7 +81,8 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& urls, bool openFiles,
// Don't match the service without trailing "-" (unique instance)
const QString pattern = QStringLiteral("org.kde.dolphin-");
const QString myPid = QString::number(QCoreApplication::applicationPid());
// 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(