Commit 5b5c32aa authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Support services on flatpak

Summary:
We have special casing for flatpak and Kate is mimicking KDBusService
only to some extent. This change helps kate support multiple flatpak instances
as well.

Test Plan: Built and made it work locally

Reviewers: #kate, cullmann

Reviewed By: #kate, cullmann

Subscribers: cullmann, aacid, kwrite-devel

Tags: #kate

Differential Revision: https://phabricator.kde.org/D27208
parent 54b3fd74
......@@ -23,6 +23,8 @@
#include <QDBusConnectionInterface>
#include <QDBusReply>
#include <QStringList>
#include <QFileInfo>
#include <QRegularExpression>
int KateRunningInstanceInfo::dummy_session = 0;
......@@ -40,15 +42,12 @@ bool fillinRunningKateAppInstances(KateRunningInstanceMap *map)
services = servicesReply.value();
}
QString serviceName;
QString my_pid = QString::number(QCoreApplication::applicationPid());
const bool inSandbox = QFileInfo::exists(QStringLiteral("/flatpak-info"));
const QString my_pid = inSandbox ? QDBusConnection::sessionBus().baseService().replace(QRegularExpression(QStringLiteral("[\\.:]")), QStringLiteral("_"))
: QString::number(QCoreApplication::applicationPid());
for (const QString &s : qAsConst(services)) {
if (s.startsWith(QLatin1String("org.kde.kate-"))) {
if (s.contains(my_pid)) {
continue;
}
if (s.startsWith(QLatin1String("org.kde.kate")) && !s.endsWith(my_pid)) {
KateRunningInstanceInfo *rii = new KateRunningInstanceInfo(s);
if (rii->valid) {
if (map->contains(rii->sessionName)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment