[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.0/kdebase/workspace/libs/plasma
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-01-11 18:34:23
Message-ID: 1200076463.967161.20235.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 760007 by aseigo:

backport of fix to globalConfig() for containments


 M  +20 -5     applet.cpp  


--- branches/KDE/4.0/kdebase/workspace/libs/plasma/applet.cpp #760006:760007
@@ -505,11 +505,14 @@
 KConfigGroup Applet::globalConfig() const
 {
     KConfigGroup globalAppletConfig;
-    if (containment() && containment()->corona()) {
-        KSharedConfig::Ptr coronaConfig = containment()->corona()->config();
-        globalAppletConfig = KConfigGroup(coronaConfig, "AppletGlobals");
+    const Containment *c = isContainment() ? dynamic_cast<const Containment*>(this) : containment();
+    QString group = isContainment() ? "ContainmentGlobals" : "AppletGlobals";
+
+    if (c && c->corona()) {
+        KSharedConfig::Ptr coronaConfig = c->corona()->config();
+        globalAppletConfig = KConfigGroup(coronaConfig, group);
     } else {
-        globalAppletConfig = KConfigGroup(KGlobal::config(), "AppletGlobals");
+        globalAppletConfig = KConfigGroup(KGlobal::config(), group);
     }
 
     return KConfigGroup(&globalAppletConfig, globalName());
@@ -933,14 +936,26 @@
 
 Containment* Applet::containment() const
 {
+/*
+ * while this is probably "more correct", much of the code in applet assumes containment
+ * returns zero in the case that this is a containment itself.
+ * if (isContainment()) {
+        return dynamic_cast<Containment*>(const_cast<Applet*>(this));
+    }
+*/
+
     QGraphicsItem *parent = parentItem();
     Containment *c = 0;
+
     while (parent) {
-        if ((c = dynamic_cast<Containment*>(parent))) {
+        Containment *possibleC =  dynamic_cast<Containment*>(parent);
+        if (possibleC && possibleC->isContainment()) {
+            c = possibleC;
             break;
         }
         parent = parent->parentItem();
     }
+
     return c;
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic