Plasma
desktop.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "desktop.h"
00021
00022 #include <QAction>
00023
00024 #include <KDebug>
00025
00026 #include <Plasma/Corona>
00027 #include <Plasma/Theme>
00028
00029 using namespace Plasma;
00030
00031 SaverDesktop::SaverDesktop(QObject *parent, const QVariantList &args)
00032 : Containment(parent, args),
00033 m_lockDesktopAction(0),
00034 m_appletBrowserAction(0)
00035 {
00036 setContainmentType(CustomContainment);
00037 connect(this, SIGNAL(appletAdded(Plasma::Applet *, const QPointF &)), SLOT(newApplet(Plasma::Applet *, const QPointF &)));
00038 }
00039
00040 SaverDesktop::~SaverDesktop()
00041 {
00042 }
00043
00044 void SaverDesktop::init()
00045 {
00046 Containment::init();
00047
00048
00049 QAction *unwanted = action("zoom in");
00050 delete unwanted;
00051 unwanted = action("zoom out");
00052 delete unwanted;
00053 unwanted = action("add sibling containment");
00054 delete unwanted;
00055
00056 QAction *leave = corona()->action("unlock desktop");
00057 if (leave) {
00058 addToolBoxAction(leave);
00059 }
00060
00061 QAction *lock = corona()->action("unlock widgets");
00062 if (lock) {
00063 addToolBoxAction(lock);
00064 }
00065
00066 QAction *a = action("configure");
00067 if (a) {
00068 a->setText(i18n("Settings"));
00069 addToolBoxAction(a);
00070 }
00071
00072 a = action("add widgets");
00073 if (a) {
00074 addToolBoxAction(a);
00075 }
00076 }
00077
00078 QList<QAction*> SaverDesktop::contextualActions()
00079 {
00080 if (!m_appletBrowserAction) {
00081 m_appletBrowserAction = action("add widgets");
00082 m_lockDesktopAction = corona()->action("unlock widgets");
00083 }
00084 QAction *config = action("configure");
00085 QAction *quit = corona()->action("unlock desktop");
00086
00087 QList<QAction*> actions;
00088 actions.append(m_appletBrowserAction);
00089 if (config) {
00090 actions.append(config);
00091 }
00092 actions.append(m_lockDesktopAction);
00093 actions.append(quit);
00094
00095 return actions;
00096 }
00097
00098 void SaverDesktop::newApplet(Plasma::Applet *applet, const QPointF &pos)
00099 {
00100 Q_UNUSED(pos);
00101 applet->installSceneEventFilter(this);
00102 }
00103
00104 K_EXPORT_PLASMA_APPLET(saverdesktop, SaverDesktop)
00105
00106 #include "desktop.moc"