[plasma/krdp] src/kcm: kcm: Fix non-default highlights

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

kcm: Fix non-default highlights

SettingStateBinding requires setting names to match the exact casing
defined in the kcfg file. Additionally, correct the non-default
highlight logic for certificate(Key) text fields.

M  +12   -2    src/kcm/kcmkrdpserver.cpp
M  +4    -0    src/kcm/kcmkrdpserver.h
M  +8    -8    src/kcm/krdpserversettings.kcfg
M  +0    -4    src/kcm/ui/EditUserModal.qml
M  +5    -0    src/kcm/ui/UserListView.qml
M  +4    -6    src/kcm/ui/main.qml

https://invent.kde.org/plasma/krdp/-/commit/76e74a42756b177d81a6b7121a9a9517c7b7e77c

diff --git a/src/kcm/kcmkrdpserver.cpp b/src/kcm/kcmkrdpserver.cpp
index 96e67c5..17f5c61 100644
--- a/src/kcm/kcmkrdpserver.cpp
+++ b/src/kcm/kcmkrdpserver.cpp
@@ -285,14 +285,24 @@ void KRDPServerConfig::restartServer()
     });
 }
 
+QString KRDPServerConfig::defaultCertificatePath() const
+{
+    return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + u"/krdpserver/krdp.crt"_s;
+}
+
+QString KRDPServerConfig::defaultCertificateKeyPath() const
+{
+    return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + u"/krdpserver/krdp.key"_s;
+}
+
 void KRDPServerConfig::generateCertificate()
 {
     if (!m_serverSettings->certificate().isEmpty() || !m_serverSettings->certificateKey().isEmpty()) {
         return;
     }
     QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)).mkpath(u"krdpserver"_s);
-    QString certificatePath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + u"/krdpserver/krdp.crt"_s);
-    QString certificateKeyPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + u"/krdpserver/krdp.key"_s);
+    QString certificatePath(defaultCertificatePath());
+    QString certificateKeyPath(defaultCertificateKeyPath());
     qDebug(KRDPKCM) << "Generating certificate files to: " << certificatePath << " and " << certificateKeyPath;
     QProcess sslProcess;
     sslProcess.start(u"openssl"_s,
diff --git a/src/kcm/kcmkrdpserver.h b/src/kcm/kcmkrdpserver.h
index 443fe44..9b0685a 100644
--- a/src/kcm/kcmkrdpserver.h
+++ b/src/kcm/kcmkrdpserver.h
@@ -38,6 +38,8 @@ public:
     Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged);
 
     Q_PROPERTY(QString hostName READ hostName CONSTANT)
+    Q_PROPERTY(QString defaultCertificatePath READ defaultCertificatePath CONSTANT)
+    Q_PROPERTY(QString defaultCertificateKeyPath READ defaultCertificateKeyPath CONSTANT)
     Q_PROPERTY(bool managementAvailable READ managementAvailable CONSTANT)
 
     Q_PROPERTY(QAbstractItemModel *users READ usersModel CONSTANT)
@@ -59,6 +61,8 @@ public:
     Q_INVOKABLE void toggleServer(const bool enabled);
     Q_INVOKABLE void restartServer();
 
+    QString defaultCertificatePath() const;
+    QString defaultCertificateKeyPath() const;
     Q_INVOKABLE void generateCertificate();
     Q_INVOKABLE void copyAddressToClipboard(const QString &address);
     Q_INVOKABLE KRDPServerSettings *settings() const
diff --git a/src/kcm/krdpserversettings.kcfg b/src/kcm/krdpserversettings.kcfg
index f9c3813..3100cbb 100644
--- a/src/kcm/krdpserversettings.kcfg
+++ b/src/kcm/krdpserversettings.kcfg
@@ -10,36 +10,36 @@ SPDX-License-Identifier: BSD-2-Clause
       http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
   <kcfgfile name="krdpserverrc"/>
   <group name="General">
-    <entry name="ListenPort" type="Int">
+    <entry name="listenPort" key="ListenPort" type="Int">
       <label>The port the server listens on</label>
       <default>3389</default>
     </entry>
-      <entry name="AutogenerateCertificates" type="Bool">
+      <entry name="autogenerateCertificates" key="AutogenerateCertificates" type="Bool">
       <label>Are certificates autogenerated during server start</label>
       <default>true</default>
     </entry>
-    <entry name="Certificate" type="String">
+    <entry name="certificate" key="Certificate" type="String">
       <label>The certificate to use for TLS connections</label>
     </entry>
-    <entry name="CertificateKey" type="String">
+    <entry name="certificateKey" key="CertificateKey" type="String">
       <label>The key that matches the TLS certificate</label>
     </entry>
-    <entry name="Quality" type="Int">
+    <entry name="quality" key="Quality" type="Int">
       <label>The quality of the video stream</label>
       <default>75</default>
     </entry>
     <entry name="Users" type="StringList">
       <label>Users allowed to login, passwords are stored in KWallet</label>
     </entry>
-    <entry name="SystemUserEnabled" type="Bool">
+    <entry name="systemUserEnabled" key="SystemUserEnabled" type="Bool">
       <label>Whether the current user can log in via PAM</label>
       <default>false</default>
     </entry>
-    <entry name="Autostart" type="Bool">
+    <entry name="autostart" key="Autostart" type="Bool">
       <label>Autostart the server on login</label>
       <default>false</default>
     </entry>
-    <entry name="LockOnDisconnect" type="Bool">
+    <entry name="lockOnDisconnect" key="LockOnDisconnect" type="Bool">
       <label>Lock the session when the last client disconnects and unlock it on connect</label>
       <default>false</default>
     </entry>
diff --git a/src/kcm/ui/EditUserModal.qml b/src/kcm/ui/EditUserModal.qml
index e180712..148d705 100644
--- a/src/kcm/ui/EditUserModal.qml
+++ b/src/kcm/ui/EditUserModal.qml
@@ -78,10 +78,6 @@ Kirigami.Dialog {
             Kirigami.FormData.label: i18nc("@label:textbox", "Username:")
             Layout.fillWidth: true
             text: editUserModal.oldUsername
-            KCM.SettingStateBinding {
-                configObject: root.settings
-                settingName: "users"
-            }
             onTextEdited: {
                 editUserModal.usernameChanged = usernameField.text !== editUserModal.oldUsername;
                 editUserModal.usernameAlreadyExistsError = kcm.userExists(usernameField.text) && usernameField.text !== editUserModal.oldUsername;
diff --git a/src/kcm/ui/UserListView.qml b/src/kcm/ui/UserListView.qml
index dbc310d..02439bb 100644
--- a/src/kcm/ui/UserListView.qml
+++ b/src/kcm/ui/UserListView.qml
@@ -71,6 +71,11 @@ ListView {
 
                 checked: model.systemUserEnabled
                 onToggled: model.systemUserEnabled = checked
+
+                KCM.SettingStateBinding {
+                    configObject: settings
+                    settingName: "systemUserEnabled"
+                }
             }
         }
 
diff --git a/src/kcm/ui/main.qml b/src/kcm/ui/main.qml
index 7896365..8c992f8 100644
--- a/src/kcm/ui/main.qml
+++ b/src/kcm/ui/main.qml
@@ -352,9 +352,8 @@ KCM.ScrollViewKCM {
                             onTextChanged: {
                                 settings.certificate = text;
                             }
-                            KCM.SettingStateBinding {
-                                configObject: settings
-                                settingName: "certificate"
+                            KCM.SettingHighlighter {
+                                highlight: settings.certificate !== kcm.defaultCertificatePath
                             }
                         }
                         QQC2.Button {
@@ -380,9 +379,8 @@ KCM.ScrollViewKCM {
                             onTextChanged: {
                                 settings.certificateKey = text;
                             }
-                            KCM.SettingStateBinding {
-                                configObject: settings
-                                settingName: "certificateKey"
+                            KCM.SettingHighlighter {
+                                highlight: settings.certificateKey !== kcm.defaultCertificateKeyPath
                             }
                         }
                         QQC2.Button {
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.