~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/desktop/shell/plasmaapp.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2006, 2007 Aaron Seigo <aseigo@kde.org>
 
3
 *   Copyright 2010 Chani Armitage <chani@kde.org>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU General Public License as
 
7
 *   published by the Free Software Foundation; either version 2,
 
8
 *   or (at your option) any later version.
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef PLASMA_APP_H
 
22
#define PLASMA_APP_H
 
23
 
 
24
#include <QHash>
 
25
#include <QList>
 
26
#include <QSize>
 
27
#include <QTimer>
 
28
#include <QWeakPointer>
 
29
 
 
30
#include <KUniqueApplication>
 
31
 
 
32
#include <Plasma/Plasma>
 
33
#include <plasma/packagemetadata.h>
 
34
 
 
35
class QSignalMapper;
 
36
 
 
37
namespace Plasma
 
38
{
 
39
    class AccessAppletJob;
 
40
    class Containment;
 
41
    class Corona;
 
42
    class Dialog;
 
43
} // namespace Plasma
 
44
 
 
45
namespace Kephal {
 
46
    class Screen;
 
47
} // namespace Kephal
 
48
 
 
49
class ControllerWindow;
 
50
class DesktopView;
 
51
class DesktopCorona;
 
52
class InteractiveConsole;
 
53
class PanelShadows;
 
54
class PanelView;
 
55
 
 
56
class PlasmaApp : public KUniqueApplication
 
57
{
 
58
    Q_OBJECT
 
59
public:
 
60
    ~PlasmaApp();
 
61
 
 
62
    static PlasmaApp *self();
 
63
    static bool hasComposite();
 
64
 
 
65
    static void suspendStartup(bool completed);
 
66
    DesktopCorona *corona();
 
67
 
 
68
    /**
 
69
     * Should be called when a panel hides or unhides itself
 
70
     */
 
71
    void panelHidden(bool hidden);
 
72
 
 
73
    /**
 
74
     * Returns the PanelViews
 
75
     */
 
76
    QList<PanelView*> panelViews() const;
 
77
    PanelShadows *panelShadows() const;
 
78
 
 
79
    ControllerWindow *showWidgetExplorer(int screen, Plasma::Containment *c);
 
80
    void hideController(int screen);
 
81
 
 
82
    /**
 
83
     * create a new activity based on the active one
 
84
     */
 
85
    void cloneCurrentActivity();
 
86
    /**
 
87
     * create a new blank activity with @p plugin containment type
 
88
     */
 
89
    void createActivity(const QString &plugin);
 
90
    /**
 
91
     * create a new activity from @p script
 
92
     */
 
93
    void createActivityFromScript(const QString &script, const QString &name = QString(), const QString &icon = QString(), const QStringList &startupApps = QStringList());
 
94
    static bool isPanelContainment(Plasma::Containment *containment);
 
95
 
 
96
#ifdef Q_WS_X11
 
97
    Atom m_XdndAwareAtom;
 
98
    Atom m_XdndEnterAtom;
 
99
    Atom m_XdndFinishedAtom;
 
100
    Atom m_XdndPositionAtom;
 
101
    Atom m_XdndStatusAtom;
 
102
    Atom m_XdndVersionAtom;
 
103
#endif
 
104
 
 
105
public Q_SLOTS:
 
106
    // DBUS interface. if you change these methods, you MUST run:
 
107
    // qdbuscpp2xml plasmaapp.h -o dbus/org.kde.plasma.App.xml
 
108
    void toggleDashboard();
 
109
    void showDashboard(bool show);
 
110
 
 
111
    void showInteractiveConsole();
 
112
    void loadScriptInInteractiveConsole(const QString &script);
 
113
 
 
114
    Q_SCRIPTABLE void quit();
 
115
    void setPerVirtualDesktopViews(bool perDesktopViews);
 
116
    bool perVirtualDesktopViews() const;
 
117
    void setFixedDashboard(bool fixedDashboard);
 
118
    bool fixedDashboard() const;
 
119
 
 
120
    void createWaitingPanels();
 
121
    void createWaitingDesktops();
 
122
    void createView(Plasma::Containment *containment);
 
123
 
 
124
    void toggleActivityManager();
 
125
 
 
126
    void addRemotePlasmoid(const QString &location);
 
127
 
 
128
protected:
 
129
#ifdef Q_WS_X11
 
130
    PanelView *findPanelForTrigger(WId trigger) const;
 
131
    bool x11EventFilter(XEvent *event);
 
132
#endif
 
133
    void setControllerVisible(bool show);
 
134
 
 
135
private:
 
136
    PlasmaApp();
 
137
    DesktopView* viewForScreen(int screen, int desktop) const;
 
138
    ControllerWindow *showController(int screen, Plasma::Containment *c, bool widgetExplorerMode);
 
139
    bool canRelocatePanel(PanelView * view, Kephal::Screen *screen);
 
140
    PanelView *createPanelView(Plasma::Containment *containment);
 
141
 
 
142
private Q_SLOTS:
 
143
    void setupDesktop();
 
144
    void cleanup();
 
145
    void containmentAdded(Plasma::Containment *containment);
 
146
    void containmentScreenOwnerChanged(int, int, Plasma::Containment*);
 
147
    void syncConfig();
 
148
    void panelRemoved(QObject* panel);
 
149
    void screenRemoved(int id);
 
150
    void screenAdded(Kephal::Screen *screen);
 
151
    void configureContainment(Plasma::Containment*);
 
152
    void checkVirtualDesktopViews(int numDesktops);
 
153
    void setWmClass(WId id);
 
154
    void remotePlasmoidAdded(Plasma::PackageMetadata metadata);
 
155
    void plasmoidAccessFinished(Plasma::AccessAppletJob *job);
 
156
    void wallpaperCheckedIn();
 
157
    void wallpaperCheckInTimeout();
 
158
    void dashboardClosed();
 
159
    void relocatePanels();
 
160
    void executeCommands(const QList < QVariant > & commands);
 
161
 
 
162
private:
 
163
    DesktopCorona *m_corona;
 
164
    PanelShadows *m_panelShadows;
 
165
 
 
166
    QList<PanelView*> m_panels;
 
167
    QList<QWeakPointer<Plasma::Containment> > m_panelsWaiting;
 
168
    QList<QWeakPointer<Plasma::Containment> > m_panelRelocationCandidates;
 
169
 
 
170
    QList<DesktopView*> m_desktops;
 
171
    QList<QWeakPointer<Plasma::Containment> > m_desktopsWaiting;
 
172
 
 
173
    QTimer m_panelViewCreationTimer;
 
174
    QTimer m_desktopViewCreationTimer;
 
175
    QWeakPointer<InteractiveConsole> m_console;
 
176
    int m_panelHidden;
 
177
    QSignalMapper *m_mapper;
 
178
    QHash<int, QWeakPointer<ControllerWindow> > m_widgetExplorers;
 
179
    int m_startupSuspendWaitCount;
 
180
    bool m_ignoreDashboardClosures;
 
181
    bool m_pendingFixedDashboard;
 
182
    bool m_unlockCorona;
 
183
    QString m_loadingActivity;
 
184
};
 
185
 
 
186
#endif // multiple inclusion guard