[plasma/libplasma] src/plasma: Drop Applet::globalConfig

Nicolas Fella <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a50b960182ac2f95b9a2f336c99bd388055c943e by Nicolas Fella.
Committed on 20/07/2026 at 22:24.
Pushed by nicolasfella into branch 'master'.

Drop Applet::globalConfig

This isn't called anywhere, except for scripting, so it doesn't seem to do anything.

The documentation also doesn't match the code wrt which config file is used.

We do want a feature that allows to define default values per applet type, but
this is just dead code

M  +1    -21   src/plasma/applet.cpp
M  +1    -11   src/plasma/applet.h
M  +1    -1    src/plasma/containment.cpp
M  +1    -10   src/plasma/private/applet_p.cpp
M  +0    -1    src/plasma/private/applet_p.h

https://invent.kde.org/plasma/libplasma/-/commit/a50b960182ac2f95b9a2f336c99bd388055c943e

diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp
index 00e9d0a6c..dd2a9f667 100644
--- a/src/plasma/applet.cpp
+++ b/src/plasma/applet.cpp
@@ -52,7 +52,7 @@ Applet::Applet(QObject *parentObject, const KPluginMetaData &data, const QVarian
         setProperty("org.kde.plasma:force-create", true);
     }
 
-    // WARNING: do not access config() OR globalConfig() in this method!
+    // WARNING: do not access config() in this method!
     //          that requires a scene, which is not available at this point
     d->init(args.mid(2));
 }
@@ -203,26 +203,6 @@ KConfigGroup Applet::config() const
     return KConfigGroup(d->mainConfigGroup(), QStringLiteral("Configuration"));
 }
 
-KConfigGroup Applet::globalConfig() const
-{
-    KConfigGroup globalAppletConfig;
-    QString group = isContainment() ? QStringLiteral("ContainmentGlobals") : QStringLiteral("AppletGlobals");
-
-    Containment *cont = containment();
-    Corona *corona = nullptr;
-    if (cont) {
-        corona = cont->corona();
-    }
-    if (corona) {
-        KSharedConfig::Ptr coronaConfig = corona->config();
-        globalAppletConfig = KConfigGroup(coronaConfig, group);
-    } else {
-        globalAppletConfig = KConfigGroup(KSharedConfig::openConfig(), group);
-    }
-
-    return KConfigGroup(&globalAppletConfig, d->globalName());
-}
-
 void Applet::destroy()
 {
     Corona *cor = nullptr;
diff --git a/src/plasma/applet.h b/src/plasma/applet.h
index 3e0187350..617889a4d 100644
--- a/src/plasma/applet.h
+++ b/src/plasma/applet.h
@@ -398,15 +398,6 @@ public:
      **/
     KConfigGroup config() const;
 
-    /*!
-     * Returns a KConfigGroup object to be shared by all applets of this
-     * type.
-     *
-     * This config object will write to an applet-specific config object
-     * named plasma_\<appletname\>rc in the local config directory.
-     */
-    KConfigGroup globalConfig() const;
-
     /*!
      * Returns the config skeleton object from this applet's package,
      * if any.
@@ -917,8 +908,7 @@ protected:
     // CONFIGURATION
     /*!
      * When called, the Applet should write any information needed as part
-     * of the Applet's running state to the configuration object in config()
-     * and/or globalConfig().
+     * of the Applet's running state to the configuration object in config().
      *
      * Applets that always sync their settings/state with the config
      * objects when these settings/states change do not need to reimplement
diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp
index eb91c648b..74ad85fc9 100644
--- a/src/plasma/containment.cpp
+++ b/src/plasma/containment.cpp
@@ -46,7 +46,7 @@ Containment::Containment(QObject *parentObject, const KPluginMetaData &data, con
     : Applet(parentObject, data, args)
     , d(new ContainmentPrivate(this))
 {
-    // WARNING: do not access config() OR globalConfig() in this method!
+    // WARNING: do not access config() in this method!
     //          that requires a scene, which is not available at this point
     setHasConfigurationInterface(true);
 
diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp
index 14381794f..c773a7822 100644
--- a/src/plasma/private/applet_p.cpp
+++ b/src/plasma/private/applet_p.cpp
@@ -89,7 +89,7 @@ void AppletPrivate::init(const QVariantList &args)
 {
     startupArguments = args;
 
-    // WARNING: do not access config() OR globalConfig() in this method!
+    // WARNING: do not access config() in this method!
     //          that requires a Corona, which is not available at this point
     q->setHasConfigurationInterface(true);
 
@@ -415,15 +415,6 @@ void AppletPrivate::setUiReady()
     }
 }
 
-QString AppletPrivate::globalName() const
-{
-    if (!appletDescription.isValid()) {
-        return QString();
-    }
-
-    return appletDescription.pluginId();
-}
-
 void AppletPrivate::scheduleConstraintsUpdate(Applet::Constraints c)
 {
     // Don't start up a timer if we're just starting up
diff --git a/src/plasma/private/applet_p.h b/src/plasma/private/applet_p.h
index f86091ea4..e9f7af074 100644
--- a/src/plasma/private/applet_p.h
+++ b/src/plasma/private/applet_p.h
@@ -41,7 +41,6 @@ public:
     void askDestroy();
     virtual void cleanUpAndDelete();
 
-    QString globalName() const;
     void scheduleConstraintsUpdate(Applet::Constraints c);
     void scheduleModificationNotification();
     KConfigGroup *mainConfigGroup();
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.