From 960377838da5a543f2b309f76b527faca4a5dee8 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 23 Sep 2025 17:52:21 -0400 Subject: [PATCH] Replace KDBusService usage with QDBusConnection when D-Bus activated This is lighter and more reliable when it comes to being activated by KUnifiedPush. We also don't need all of the features of KDBusService here. --- src/app/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 6a2a02530..d79cc0f02 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -219,8 +219,14 @@ int main(int argc, char *argv[]) #ifdef HAVE_KUNIFIEDPUSH if (parser.isSet(dbusActivatedOption)) { - // We want to be replaceable by the main client - KDBusService service(KDBusService::Replace); +#ifdef HAVE_KDBUSADDONS + // We *don't* want to use KDBusService here. I don't know why, but it makes activation super unreliable. We don't really need it anyway. + if (!QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.neochat"))) { + // Gracefully fail if NeoChat is already running + qWarning() << "NeoChat already running, not sending push notifications."; + return 0; + } +#endif #ifdef HAVE_RUNNER // If we are built with KRunner and KUnifiedPush support, we need to do something special.