From 86743069925f9d268ce73c121a11796180f5ba7e Mon Sep 17 00:00:00 2001 From: Aaron Eisenberg Date: Mon, 4 Jun 2007 00:25:44 +0000 Subject: [PATCH] Added the ability to lock all Applets and the Desktop. svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=671176 --- corona.cpp | 19 ++++++++++++++++++- corona.h | 11 +++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/corona.cpp b/corona.cpp index eb53d6141..2f23b3728 100644 --- a/corona.cpp +++ b/corona.cpp @@ -23,11 +23,13 @@ #include #include #include +#include #include #include #include #include +#include #include "applet.h" #include "dataengine.h" @@ -51,7 +53,7 @@ public: engineExplorerAction(0) { } - + bool immutable; Applet::List applets; FormFactor formFactor; Location location; @@ -101,6 +103,7 @@ void Corona::init() // connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayContextMenu(QPoint))); d->engineExplorerAction = new QAction(i18n("Engine Explorer"), this); connect(d->engineExplorerAction, SIGNAL(triggered(bool)), this, SLOT(launchExplorer())); + d->immutable = false; // setContextMenuPolicy(Qt::CustomContextMenu); } @@ -302,6 +305,20 @@ void Corona::appletDestroyed(QObject* object) } } +bool Corona::isImmutable() +{ + return d->immutable; +} + +void Corona::setImmutable(bool immutable_) +{ + d->immutable = immutable_; + foreach (QGraphicsView* view, views()) { + //TODO: setInteractive(false) prevents context menues from showing up + view->setInteractive(!(d->immutable)); + } +} + } // namespace Plasma #include "corona.moc" diff --git a/corona.h b/corona.h index 4fad628c0..921824a8e 100644 --- a/corona.h +++ b/corona.h @@ -45,6 +45,11 @@ public: explicit Corona(const QRectF & sceneRect, QObject * parent = 0); explicit Corona(qreal x, qreal y, qreal width, qreal height, QObject * parent = 0); ~Corona(); + + /** + * The applets are changable or not + **/ + bool isImmutable(); /** * The location of the Corona. @see Plasma::Location @@ -93,6 +98,11 @@ public Q_SLOTS: * @param path the path to the theme file */ void addKaramba(const KUrl& path); + + /** + * Sets if the applets are Immutable + */ + void setImmutable(bool immutable_); protected: void dragEnterEvent(QGraphicsSceneDragDropEvent* event); @@ -107,6 +117,7 @@ protected Q_SLOTS: private: void init(); + class Private; Private * const d;