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 <QGraphicsSceneDragDropEvent>
#include <QMimeData>
#include <QGraphicsView>
#include <KLocale>
#include <KMenu>
#include <KRun>
#include <KWindowSystem>
#include <KDebug>
#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"

View File

@ -46,6 +46,11 @@ public:
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
*/
@ -94,6 +99,11 @@ public Q_SLOTS:
*/
void addKaramba(const KUrl& path);
/**
* Sets if the applets are Immutable
*/
void setImmutable(bool immutable_);
protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent* event);
@ -108,6 +118,7 @@ protected Q_SLOTS:
private:
void init();
class Private;
Private * const d;
};