some kiosk/immutability logic fixes

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758174
This commit is contained in:
Aaron J. Seigo 2008-01-07 04:00:39 +00:00
parent 033f1f52b3
commit 32c6c94c76
2 changed files with 23 additions and 9 deletions

View File

@ -645,7 +645,8 @@ bool Applet::isKioskImmutable() const
void Applet::setImmutable(bool immutable)
{
if (d->immutable == immutable) {
if (d->immutable == immutable ||
(immutable && d->kioskImmutable)) {
return;
}
@ -767,7 +768,10 @@ void Applet::checkImmutability()
d->kioskImmutable = globalConfig().isImmutable() || config().isImmutable() ||
(containment() && containment()->isKioskImmutable()) ||
(dynamic_cast<Corona*>(scene()) && static_cast<Corona*>(scene())->isKioskImmutable());
setImmutable(d->kioskImmutable);
if (d->kioskImmutable) {
updateConstraints(ImmutableConstraint);
}
}
void Applet::flushUpdatedConstraints()

View File

@ -90,6 +90,15 @@ public:
}
}
void updateContainmentImmutability()
{
foreach (Containment *c, containments) {
// we need to tell each containment that immutability has been altered
// TODO: should we tell the applets too?
c->updateConstraints(ImmutableConstraint);
}
}
bool immutable;
bool kioskImmutable;
QString mimetype;
@ -274,6 +283,10 @@ void Corona::loadApplets(const QString& configName)
}
d->kioskImmutable = config()->isImmutable();
if (d->kioskImmutable) {
d->updateContainmentImmutability();
}
KConfigGroup coronaConfig(config(), "General");
setImmutable(coronaConfig.readEntry("locked", false));
}
@ -521,17 +534,14 @@ bool Corona::isKioskImmutable() const
void Corona::setImmutable(bool immutable)
{
if (d->immutable == immutable) {
if (d->immutable == immutable ||
(!immutable && d->kioskImmutable)) {
return;
}
kDebug() << "setting immutability to" << immutable;
d->immutable = immutable;
foreach (Containment *c, d->containments) {
// we need to tell each containment that immutability has been altered
// TODO: should we tell the applets too?
c->updateConstraints(ImmutableConstraint);
}
d->updateContainmentImmutability();
}
} // namespace Plasma