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

David Edmundson <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ef11dc225b0970f2c8329dc93ae9e337e12f4757 by David Edmundson, on behalf of Vlad Zahorodnii.
Committed on 23/07/2026 at 10:38.
Pushed by davidedmundson into branch 'Plasma/6.7'.

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.

(cherry picked from commit 5d9c8a51b289be9632f62577cffdee8a56ce3961)

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/ef11dc225b0970f2c8329dc93ae9e337e12f4757

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 b773f13db9..5761de3598 100644
--- a/libklookandfeel/klookandfeelmanager.cpp
+++ b/libklookandfeel/klookandfeelmanager.cpp
@@ -80,37 +80,7 @@ KLookAndFeelManager::KLookAndFeelManager(QObject *parent)
     : QObject(parent)
     , m_plasmashellChanged(false)
     , 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 109d6a1ad0..b92fc25497 100644
--- a/libklookandfeel/klookandfeelmanager.h
+++ b/libklookandfeel/klookandfeelmanager.h
@@ -99,8 +99,6 @@ public:
     void setMenuFont(const QString &font);
     void setWindowTitleFont(const QString &font);
 
-    bool isPlasmaLocked() const;
-
 Q_SIGNALS:
     void message();
     void iconsChanged();
@@ -108,7 +106,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,
@@ -129,7 +126,6 @@ private:
     Mode m_mode = Mode::Apply;
     bool m_plasmashellChanged : 1;
     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.