differentiate between runtime and kiosk immutability

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=744675
This commit is contained in:
Aaron J. Seigo 2007-12-04 04:15:21 +00:00
parent f7a0308982
commit e2249860fd
4 changed files with 32 additions and 6 deletions

View File

@ -599,7 +599,14 @@ QString Applet::category(const QString& appletName)
bool Applet::isImmutable() const
{
return (containment() && containment()->isImmutable()) || d->immutable || d->kioskImmutable;
return d->immutable || d->kioskImmutable ||
(containment() && containment()->isImmutable()) ||
(scene() && static_cast<Corona*>(scene())->isImmutable());
}
bool Applet::isKioskImmutable() const
{
return d->kioskImmutable;
}
void Applet::setImmutable(bool immutable)
@ -716,7 +723,9 @@ void Applet::performSetupConfig()
void Applet::checkImmutability()
{
d->kioskImmutable = globalConfig().isImmutable() || config().isImmutable();
d->kioskImmutable = globalConfig().isImmutable() || config().isImmutable() ||
(containment() && containment()->isKioskImmutable()) ||
(scene() && static_cast<Corona*>(scene())->isKioskImmutable());
setImmutable(d->kioskImmutable);
}
@ -883,13 +892,14 @@ FormFactor Applet::formFactor() const
Containment* Applet::containment() const
{
QGraphicsItem *parent = parentItem();
Containment *c = 0;
while (parent) {
if (dynamic_cast<Containment*>(parent)) {
if ((c = dynamic_cast<Containment*>(parent))) {
break;
}
parent = parent->parentItem();
}
return dynamic_cast<Containment*>(parent);
return c;
}
Location Applet::location() const

View File

@ -401,6 +401,11 @@ class PLASMA_EXPORT Applet : public Widget
**/
bool isImmutable() const;
/**
* @return true if this applet is immutable due to Kiosk settings
*/
bool isKioskImmutable() const;
/**
* @return returns whether or not the applet is using the standard
* background

View File

@ -67,6 +67,7 @@ public:
}
bool immutable;
bool kioskImmutable;
QString mimetype;
QString configName;
KSharedConfigPtr config;
@ -225,7 +226,7 @@ void Corona::loadApplets(const QString& configName)
}
}
setImmutable(config.isImmutable());
d->kioskImmutable = config.isImmutable();
}
void Corona::loadApplets()
@ -457,7 +458,12 @@ void Corona::screenResized(int screen)
bool Corona::isImmutable() const
{
return d->immutable;
return d->kioskImmutable || d->immutable;
}
bool Corona::isKioskImmutable() const
{
return d->kioskImmutable;
}
void Corona::setImmutable(bool immutable)

View File

@ -52,6 +52,11 @@ public:
**/
bool isImmutable() const;
/**
* @return true if this Corona is immutable due to Kiosk settings
*/
bool isKioskImmutable() const;
/**
* A rect containing the maximum size a plasmoid on this corona should
* consider being.