Added the ability to lock all Applets and the Desktop.

svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=671176
This commit is contained in:
Aaron Eisenberg 2007-06-04 00:25:44 +00:00
parent 80fae8f7a3
commit 8674306992
2 changed files with 29 additions and 1 deletions

View File

@ -23,11 +23,13 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QGraphicsSceneDragDropEvent> #include <QGraphicsSceneDragDropEvent>
#include <QMimeData> #include <QMimeData>
#include <QGraphicsView>
#include <KLocale> #include <KLocale>
#include <KMenu> #include <KMenu>
#include <KRun> #include <KRun>
#include <KWindowSystem> #include <KWindowSystem>
#include <KDebug>
#include "applet.h" #include "applet.h"
#include "dataengine.h" #include "dataengine.h"
@ -51,7 +53,7 @@ public:
engineExplorerAction(0) engineExplorerAction(0)
{ {
} }
bool immutable;
Applet::List applets; Applet::List applets;
FormFactor formFactor; FormFactor formFactor;
Location location; Location location;
@ -101,6 +103,7 @@ void Corona::init()
// connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayContextMenu(QPoint))); // connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayContextMenu(QPoint)));
d->engineExplorerAction = new QAction(i18n("Engine Explorer"), this); d->engineExplorerAction = new QAction(i18n("Engine Explorer"), this);
connect(d->engineExplorerAction, SIGNAL(triggered(bool)), this, SLOT(launchExplorer())); connect(d->engineExplorerAction, SIGNAL(triggered(bool)), this, SLOT(launchExplorer()));
d->immutable = false;
// setContextMenuPolicy(Qt::CustomContextMenu); // 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 } // namespace Plasma
#include "corona.moc" #include "corona.moc"

View File

@ -45,6 +45,11 @@ public:
explicit Corona(const QRectF & sceneRect, QObject * parent = 0); explicit Corona(const QRectF & sceneRect, QObject * parent = 0);
explicit Corona(qreal x, qreal y, qreal width, qreal height, QObject * parent = 0); explicit Corona(qreal x, qreal y, qreal width, qreal height, QObject * parent = 0);
~Corona(); ~Corona();
/**
* The applets are changable or not
**/
bool isImmutable();
/** /**
* The location of the Corona. @see Plasma::Location * The location of the Corona. @see Plasma::Location
@ -93,6 +98,11 @@ public Q_SLOTS:
* @param path the path to the theme file * @param path the path to the theme file
*/ */
void addKaramba(const KUrl& path); void addKaramba(const KUrl& path);
/**
* Sets if the applets are Immutable
*/
void setImmutable(bool immutable_);
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent* event); void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
@ -107,6 +117,7 @@ protected Q_SLOTS:
private: private:
void init(); void init();
class Private; class Private;
Private * const d; Private * const d;