make globalConfig() work properly even for containments
BUG:155454 svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=760003
This commit is contained in:
parent
3d6c1c5527
commit
f02a65c95e
25
applet.cpp
25
applet.cpp
@ -507,11 +507,14 @@ KConfigGroup Applet::config() const
|
|||||||
KConfigGroup Applet::globalConfig() const
|
KConfigGroup Applet::globalConfig() const
|
||||||
{
|
{
|
||||||
KConfigGroup globalAppletConfig;
|
KConfigGroup globalAppletConfig;
|
||||||
if (containment() && containment()->corona()) {
|
const Containment *c = isContainment() ? dynamic_cast<const Containment*>(this) : containment();
|
||||||
KSharedConfig::Ptr coronaConfig = containment()->corona()->config();
|
QString group = isContainment() ? "ContainmentGlobals" : "AppletGlobals";
|
||||||
globalAppletConfig = KConfigGroup(coronaConfig, "AppletGlobals");
|
|
||||||
|
if (c && c->corona()) {
|
||||||
|
KSharedConfig::Ptr coronaConfig = c->corona()->config();
|
||||||
|
globalAppletConfig = KConfigGroup(coronaConfig, group);
|
||||||
} else {
|
} else {
|
||||||
globalAppletConfig = KConfigGroup(KGlobal::config(), "AppletGlobals");
|
globalAppletConfig = KConfigGroup(KGlobal::config(), group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return KConfigGroup(&globalAppletConfig, globalName());
|
return KConfigGroup(&globalAppletConfig, globalName());
|
||||||
@ -935,14 +938,26 @@ FormFactor Applet::formFactor() const
|
|||||||
|
|
||||||
Containment* Applet::containment() const
|
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();
|
QGraphicsItem *parent = parentItem();
|
||||||
Containment *c = 0;
|
Containment *c = 0;
|
||||||
|
|
||||||
while (parent) {
|
while (parent) {
|
||||||
if ((c = dynamic_cast<Containment*>(parent))) {
|
Containment *possibleC = dynamic_cast<Containment*>(parent);
|
||||||
|
if (possibleC && possibleC->isContainment()) {
|
||||||
|
c = possibleC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent = parent->parentItem();
|
parent = parent->parentItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user