[plasma/plasma-workspace] /: Move plasmaLocked property from KLookAndFeelManager to KCM

Vlad Zahorodnii <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5d9c8a51b289be9632f62577cffdee8a56ce3961 by Vlad Zahorodnii.
Committed on 16/07/2026 at 20:06.
Pushed by vladz into branch 'master'.

Move plasmaLocked property from KLookAndFeelManager to KCM

It's unused in the manager and, in general, it will be preferred to
avoid sending unnecessary dbus requests if possible.

This should have no behavioral changes other than make startplasma and
the autoswicher module less chatty with plasmashell.

M  +26   -2    kcms/lookandfeel/kcm.cpp
M  +1    -0    kcms/lookandfeel/kcm.h
M  +0    -30   libklookandfeel/klookandfeelmanager.cpp
M  +0    -4    libklookandfeel/klookandfeelmanager.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/5d9c8a51b289be9632f62577cffdee8a56ce3961

diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp
index 029bfbdc11..e285bf236d 100644
--- a/kcms/lookandfeel/kcm.cpp
+++ b/kcms/lookandfeel/kcm.cpp
@@ -22,6 +22,10 @@
 #include <KPackage/PackageLoader>
 
 #include <QCollator>
+#include <QDBusConnection>
+#include <QDBusMessage>
+#include <QDBusPendingCall>
+#include <QDBusPendingReply>
 #include <QDebug>
 #include <QFileInfo>
 #include <QStandardPaths>
@@ -297,7 +301,27 @@ KCMLookandFeel::KCMLookandFeel(QObject *parent, const KPluginMetaData &data)
     connect(settings(), &LookAndFeelSettings::lookAndFeelPackageChanged, handleLookAndFeelPackageChanged);
     handleLookAndFeelPackageChanged();
 
-    connect(m_lnf, &KLookAndFeelManager::plasmaLockedChanged, this, &KCMLookandFeel::plasmaLockedChanged);
+    QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"),
+                                                          QStringLiteral("/PlasmaShell"),
+                                                          QStringLiteral("org.kde.PlasmaShell"),
+                                                          QStringLiteral("immutable"));
+    QDBusPendingCall async = QDBusConnection::sessionBus().asyncCall(message);
+
+    auto watcher = new QDBusPendingCallWatcher(async, this);
+    connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *call) {
+        QDBusPendingReply<bool> reply = *call;
+
+        if (reply.isError()) {
+            qWarning() << "Error:" << reply.error().message();
+        } else {
+            const bool locked = reply.value();
+            if (locked != m_plasmaLocked) {
+                m_plasmaLocked = locked;
+                Q_EMIT plasmaLockedChanged();
+            }
+        }
+        call->deleteLater();
+    });
 }
 
 KCMLookandFeel::~KCMLookandFeel() = default;
@@ -519,7 +543,7 @@ void KCMLookandFeel::resetSelectedContents()
 
 bool KCMLookandFeel::isPlasmaLocked() const
 {
-    return m_lnf->isPlasmaLocked();
+    return m_plasmaLocked;
 }
 
 #include "kcm.moc"
diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h
index 504b8a630a..efc9f41809 100644
--- a/kcms/lookandfeel/kcm.h
+++ b/kcms/lookandfeel/kcm.h
@@ -205,4 +205,5 @@ private:
     KLookAndFeelManager::Contents m_selectedContents;
 
     QStandardItemModel *m_model;
+    bool m_plasmaLocked = false;
 };
diff --git a/libklookandfeel/klookandfeelmanager.cpp b/libklookandfeel/klookandfeelmanager.cpp
index 76d8729b28..d1fb0110e5 100644
--- a/libklookandfeel/klookandfeelmanager.cpp
+++ b/libklookandfeel/klookandfeelmanager.cpp
@@ -61,37 +61,7 @@ bool configProvides(KSharedConfigPtr config, const QString &groupPath, const QSt
 KLookAndFeelManager::KLookAndFeelManager(QObject *parent)
     : QObject(parent)
     , m_fontsChanged(false)
-    , m_plasmaLocked(false)
-{
-    QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"),
-                                                          QStringLiteral("/PlasmaShell"),
-                                                          QStringLiteral("org.kde.PlasmaShell"),
-                                                          QStringLiteral("immutable"));
-    QDBusPendingCall async = QDBusConnection::sessionBus().asyncCall(message);
-
-    // Create watcher for the pending call
-    auto *watcher = new QDBusPendingCallWatcher(async, this);
-
-    // Connect watcher finished signal to our slot
-    connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *call) {
-        QDBusPendingReply<bool> reply = *call;
-
-        if (reply.isError()) {
-            qWarning() << "Error:" << reply.error().message();
-        } else {
-            const bool locked = reply.value();
-            if (locked != m_plasmaLocked) {
-                m_plasmaLocked = locked;
-                Q_EMIT plasmaLockedChanged(locked);
-            }
-        }
-        call->deleteLater();
-    });
-}
-
-bool KLookAndFeelManager::isPlasmaLocked() const
 {
-    return m_plasmaLocked;
 }
 
 KLookAndFeelManager::Contents KLookAndFeelManager::packageContents(const KPackage::Package &pkg) const
diff --git a/libklookandfeel/klookandfeelmanager.h b/libklookandfeel/klookandfeelmanager.h
index 4a2bd05eb3..80105e0f0e 100644
--- a/libklookandfeel/klookandfeelmanager.h
+++ b/libklookandfeel/klookandfeelmanager.h
@@ -94,8 +94,6 @@ public:
     void setMenuFont(const QString &font);
     void setWindowTitleFont(const QString &font);
 
-    bool isPlasmaLocked() const;
-
 Q_SIGNALS:
     void message();
     void iconsChanged();
@@ -103,7 +101,6 @@ Q_SIGNALS:
     void styleChanged(const QString &newStyle);
     void cursorsChanged(const QString &newStyle);
     void fontsChanged();
-    void plasmaLockedChanged(bool locked);
 
 private:
     void writeNewDefaults(const QString &filename,
@@ -123,7 +120,6 @@ private:
 
     Mode m_mode = Mode::Apply;
     bool m_fontsChanged : 1;
-    bool m_plasmaLocked : 1;
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(KLookAndFeelManager::Contents)
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.