From 8d047336824037998c271a2adea426fd221b0505 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 1 Dec 2022 09:56:15 +0000 Subject: [PATCH] plugins/nightcolor: Register its own service name In order to make monitoring Night Color appearing and disappearing robust, make Night Color register its own dbus service. CCBUG: 428854 --- src/plugins/nightcolor/nightcolordbusinterface.cpp | 6 ++++++ src/plugins/nightcolor/nightcolordbusinterface.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/nightcolor/nightcolordbusinterface.cpp b/src/plugins/nightcolor/nightcolordbusinterface.cpp index aeeb4d23f7..6526ba48f9 100644 --- a/src/plugins/nightcolor/nightcolordbusinterface.cpp +++ b/src/plugins/nightcolor/nightcolordbusinterface.cpp @@ -174,6 +174,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent) new ColorCorrectAdaptor(this); QDBusConnection::sessionBus().registerObject(QStringLiteral("/ColorCorrect"), this); + QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.NightColor")); +} + +NightColorDBusInterface::~NightColorDBusInterface() +{ + QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.NightColor")); } bool NightColorDBusInterface::isInhibited() const diff --git a/src/plugins/nightcolor/nightcolordbusinterface.h b/src/plugins/nightcolor/nightcolordbusinterface.h index c0c5be6c22..8dd06ec24e 100644 --- a/src/plugins/nightcolor/nightcolordbusinterface.h +++ b/src/plugins/nightcolor/nightcolordbusinterface.h @@ -35,7 +35,7 @@ class NightColorDBusInterface : public QObject, public QDBusContext public: explicit NightColorDBusInterface(NightColorManager *parent); - ~NightColorDBusInterface() override = default; + ~NightColorDBusInterface() override; bool isInhibited() const; bool isEnabled() const;