• Skip to content
  • Skip to link menu
KDE 4.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

desktop.cpp

Go to the documentation of this file.
00001 /*
00002 *   Copyright 2007 by Aaron Seigo <aseigo@kde.org>
00003 *   Copyright 2008 by Chani Armitage <chanika@gmail.com>
00004 *
00005 *   This program is free software; you can redistribute it and/or modify
00006 *   it under the terms of the GNU Library General Public License version 2,
00007 *   or (at your option) any later version.
00008 *
00009 *   This program is distributed in the hope that it will be useful,
00010 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *   GNU General Public License for more details
00013 *
00014 *   You should have received a copy of the GNU Library General Public
00015 *   License along with this program; if not, write to the
00016 *   Free Software Foundation, Inc.,
00017 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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     //remove the desktop actions
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"

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KStyles
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •     Animators
  •     Applets
  •     Engines
  • Solid Modules
  • System Settings
  •   SystemSettingsView
Generated for API Reference by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal