/* * Copyright 2006, 2007 Aaron Seigo * Copyright 2010 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PLASMA_APP_H #define PLASMA_APP_H #include #include #include #include #include #ifdef Q_WS_X11 // for Atom #include #include #endif #include #include "desktoptracker.h" namespace Plasma { class Containment; class Corona; class Dialog; } // namespace Plasma class ControllerWindow; class DesktopView; class DesktopCorona; class InteractiveConsole; class PanelShadows; class PanelView; class PlasmaApp : public KUniqueApplication { Q_OBJECT public: ~PlasmaApp(); static PlasmaApp *self(); void suspendStartup(bool completed); DesktopCorona *corona(bool createIfMissing = true); /** * Should be called when a panel hides or unhides itself */ void panelHidden(bool hidden); /** * Returns the PanelViews */ QList panelViews() const; PanelShadows *panelShadows() const; ControllerWindow *showWidgetExplorer(int screen, Plasma::Containment *c); void hideController(int screen); void prepareContainment(Plasma::Containment *containment); static bool isPanelContainment(Plasma::Containment *containment); #ifdef Q_WS_X11 Atom m_XdndAwareAtom; Atom m_XdndEnterAtom; Atom m_XdndFinishedAtom; Atom m_XdndPositionAtom; Atom m_XdndStatusAtom; Atom m_XdndVersionAtom; #endif public Q_SLOTS: // DBUS interface. if you change these methods, you MUST run: // qdbuscpp2xml plasmaapp.h -o dbus/org.kde.plasma.App.xml void showInteractiveConsole(); void loadScriptInInteractiveConsole(const QString &script); void createWaitingPanels(); void createWaitingDesktops(); void createView(Plasma::Containment *containment); QString supportInformation() const; protected: #ifdef Q_WS_X11 PanelView *findPanelForTrigger(WId trigger) const; bool x11EventFilter(XEvent *event); #endif void setControllerVisible(bool show); private: PlasmaApp(); DesktopView* viewForScreen(int screen, int desktop) const; ControllerWindow *showController(int screen, Plasma::Containment *c, bool widgetExplorerMode); bool canRelocatePanel(PanelView * view, const DesktopTracker::Screen &screen); PanelView *createPanelView(Plasma::Containment *containment); private Q_SLOTS: void setupDesktop(); void containmentAdded(Plasma::Containment *containment); void containmentScreenOwnerChanged(int, int, Plasma::Containment*); void syncConfig(); void panelRemoved(QObject* panel); void screenRemoved(const DesktopTracker::Screen &screen); void screenAdded(const DesktopTracker::Screen &screen); void configureContainment(Plasma::Containment*); void setWmClass(WId id); void wallpaperCheckedIn(); void wallpaperCheckInTimeout(); void relocatePanels(); void executeCommands(const QList < QVariant > & commands); private: DesktopCorona *m_corona; PanelShadows *m_panelShadows; QList m_panels; QList > m_panelsWaiting; QList > m_panelRelocationCandidates; QList m_desktops; QList > m_desktopsWaiting; QTimer m_panelViewCreationTimer; QTimer m_desktopViewCreationTimer; QWeakPointer m_console; int m_panelHidden; QSignalMapper *m_mapper; QHash > m_widgetExplorers; int m_startupSuspendWaitCount; bool m_unlockCorona; }; #endif // multiple inclusion guard