[plasma/krdp] src/kcm: kcm: Add non-default sidebar highlight

Tobias Ozór <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9ceac141ad32a75820e94eb1a174cda9990bde65 by Tobias Ozór.
Committed on 15/08/2026 at 06:55.
Pushed by ngraham into branch 'master'.

kcm: Add non-default sidebar highlight

Implement `KRDPServerData::isDefaults()`. This will be queried by System
Settings to decide if an orange dot should be drawn on the sidebar,
indicating that the KCM has settings which are set to non-default values.

M  +1    -1    src/kcm/kcmkrdpserver.cpp
A  +33   -0    src/kcm/krdpserverdata.cpp     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]
A  +24   -0    src/kcm/krdpserverdata.h     [License: LGPL(3+eV) LGPL(v3.0) LGPL(v2.1)]

https://invent.kde.org/plasma/krdp/-/commit/9ceac141ad32a75820e94eb1a174cda9990bde65

diff --git a/src/kcm/kcmkrdpserver.cpp b/src/kcm/kcmkrdpserver.cpp
index 17f5c61..a07c22d 100644
--- a/src/kcm/kcmkrdpserver.cpp
+++ b/src/kcm/kcmkrdpserver.cpp
@@ -26,7 +26,7 @@
 
 using namespace Qt::StringLiterals;
 
-K_PLUGIN_CLASS_WITH_JSON(KRDPServerConfig, "kcm_krdpserver.json")
+K_PLUGIN_FACTORY_WITH_JSON(KRDPServerConfigFactory, "kcm_krdpserver.json", registerPlugin<KRDPServerConfig>(); registerPlugin<KRDPServerData>();)
 
 static const QString passwordServiceName = QLatin1StringView("KRDP");
 static const QString dbusSystemdDestination = u"org.freedesktop.systemd1"_s;
diff --git a/src/kcm/krdpserverdata.cpp b/src/kcm/krdpserverdata.cpp
new file mode 100644
index 0000000..7c94f05
--- /dev/null
+++ b/src/kcm/krdpserverdata.cpp
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: 2026 Tobias Ozór <[email protected]>
+//
+// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+
+#include "krdpserverdata.h"
+#include "krdpserversettings.h"
+
+using namespace Qt::StringLiterals;
+
+KRDPServerData::KRDPServerData(QObject *parent)
+    : KCModuleData(parent)
+    , m_settings(new KRDPServerSettings(this))
+{
+}
+
+KRDPServerSettings *KRDPServerData::settings() const
+{
+    return m_settings;
+}
+
+bool KRDPServerData::isDefaults() const
+{
+    for (const auto *item : m_settings->items()) {
+        if (item->key() == u"Users"_s || item->key() == u"Certificate"_s || item->key() == u"CertificateKey"_s) {
+            continue;
+        }
+        if (!item->isDefault())
+            return false;
+    }
+    return true;
+}
+
+#include "moc_krdpserverdata.cpp"
diff --git a/src/kcm/krdpserverdata.h b/src/kcm/krdpserverdata.h
new file mode 100644
index 0000000..3c66796
--- /dev/null
+++ b/src/kcm/krdpserverdata.h
@@ -0,0 +1,24 @@
+// SPDX-FileCopyrightText: 2026 Tobias Ozór <[email protected]>
+//
+// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
+
+#pragma once
+
+#include <KCModuleData>
+#include <QObject>
+
+class KRDPServerSettings;
+
+class KRDPServerData : public KCModuleData
+{
+    Q_OBJECT
+
+public:
+    explicit KRDPServerData(QObject *parent = nullptr);
+    KRDPServerSettings *settings() const;
+
+    bool isDefaults() const override;
+
+private:
+    KRDPServerSettings *m_settings;
+};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.