From e2249860fdcc4d8c3dc1f99430d6f6fb2739bc01 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 4 Dec 2007 04:15:21 +0000 Subject: [PATCH] differentiate between runtime and kiosk immutability svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=744675 --- applet.cpp | 18 ++++++++++++++---- applet.h | 5 +++++ corona.cpp | 10 ++++++++-- corona.h | 5 +++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/applet.cpp b/applet.cpp index 6db1629d6..f68d46734 100644 --- a/applet.cpp +++ b/applet.cpp @@ -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(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(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(parent)) { + if ((c = dynamic_cast(parent))) { break; } parent = parent->parentItem(); } - return dynamic_cast(parent); + return c; } Location Applet::location() const diff --git a/applet.h b/applet.h index 93d8b5e70..e6f614848 100644 --- a/applet.h +++ b/applet.h @@ -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 diff --git a/corona.cpp b/corona.cpp index 54a3d38c6..f9e8c5981 100644 --- a/corona.cpp +++ b/corona.cpp @@ -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) diff --git a/corona.h b/corona.h index 845fd0056..3f8320f5a 100644 --- a/corona.h +++ b/corona.h @@ -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.