From d18be9c04f9f2b3f1117cce3a32ea2878239df89 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 24 May 2022 11:04:00 +0300 Subject: [PATCH] kuiserver: use KApplication instead of KUniqueApplication Signed-off-by: Ivailo Monev --- kuiserver/main.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/kuiserver/main.cpp b/kuiserver/main.cpp index 5346b5b4..3e336fd7 100644 --- a/kuiserver/main.cpp +++ b/kuiserver/main.cpp @@ -26,12 +26,13 @@ #include "progresslistmodel.h" -#include +#include #include #include #include #include - +#include +#include int main(int argc, char **argv) { @@ -47,19 +48,23 @@ int main(int argc, char **argv) aboutdata.addAuthor(ki18n("Matej Koss"), ki18n("Developer"), "koss@miesto.sk"); KCmdLineArgs::init(argc, argv, &aboutdata); - KUniqueApplication::addCmdLineOptions(); - - if (!KUniqueApplication::start()) { - kDebug(7024) << "kuiserver is already running!"; - return 0; - } - - KUniqueApplication app; + KApplication app; // This app is started automatically, no need for session management app.disableSessionManagement(); app.setQuitOnLastWindowClosed(false); + QDBusConnection session = QDBusConnection::sessionBus(); + if (!session.isConnected()) { + kWarning() << "No DBUS session-bus found. Check if you have started the DBUS server."; + return 1; + } + QDBusReply sessionReply = session.interface()->isServiceRegistered("org.kde.kuiserver"); + if (sessionReply.isValid() && sessionReply.value() == true) { + kWarning() << "Another instance of kuiserver is already running!"; + return 2; + } + ProgressListModel model; return app.exec(); -- 2.11.0