From 0e5e5b7c9dcdb8dba85f28ecd3495a029c40668d Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 12 Nov 2010 22:51:31 +0000 Subject: [PATCH] * be sure to set kiosk-based immutability * don't allow external creation of containments if the corona is immutable; they won't get saved to disk anyways svn path=/trunk/KDE/kdelibs/; revision=1196287 --- corona.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/corona.cpp b/corona.cpp index 9225983be..ab7dbaaff 100644 --- a/corona.cpp +++ b/corona.cpp @@ -402,11 +402,11 @@ void Corona::initializeLayout(const QString &configName) } if (config()->isImmutable()) { - d->updateContainmentImmutability(); + setImmutability(SystemImmutable); + } else { + KConfigGroup coronaConfig(config(), "General"); + setImmutability((ImmutabilityType)coronaConfig.readEntry("immutability", (int)Mutable)); } - - KConfigGroup coronaConfig(config(), "General"); - setImmutability((ImmutabilityType)coronaConfig.readEntry("immutability", (int)Mutable)); } bool containmentSortByPosition(const Containment *c1, const Containment *c2) @@ -606,12 +606,20 @@ KSharedConfigPtr Corona::config() const Containment *Corona::addContainment(const QString &name, const QVariantList &args) { - return d->addContainment(name, args, 0, false); + if (d->immutability == Mutable) { + return d->addContainment(name, args, 0, false); + } + + return 0; } Containment *Corona::addContainmentDelayed(const QString &name, const QVariantList &args) { - return d->addContainment(name, args, 0, true); + if (d->immutability == Mutable) { + return d->addContainment(name, args, 0, true); + } + + return 0; } void Corona::mapAnimation(Animator::Animation from, Animator::Animation to) @@ -880,8 +888,7 @@ ImmutabilityType Corona::immutability() const void Corona::setImmutability(const ImmutabilityType immutable) { - if (d->immutability == immutable || - d->immutability == SystemImmutable) { + if (d->immutability == immutable || d->immutability == SystemImmutable) { return; } @@ -906,12 +913,14 @@ void Corona::setImmutability(const ImmutabilityType immutable) } } - KConfigGroup cg(config(), "General"); + if (d->immutability != SystemImmutable) { + KConfigGroup cg(config(), "General"); - // we call the dptr member directly for locked since isImmutable() - // also checks kiosk and parent containers - cg.writeEntry("immutability", (int)d->immutability); - requestConfigSync(); + // we call the dptr member directly for locked since isImmutable() + // also checks kiosk and parent containers + cg.writeEntry("immutability", (int)d->immutability); + requestConfigSync(); + } } QList Corona::freeEdges(int screen) const