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

« back to all changes in this revision

Viewing changes to plasma/desktop/shell/desktopcorona.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 2008 Aaron Seigo <aseigo@kde.org>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU Library General Public License as
 
6
 *   published by the Free Software Foundation; either version 2, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program is distributed in the hope that it will be useful,
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *   GNU General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef DESKTOPCORONA_H
 
21
#define DESKTOPCORONA_H
 
22
 
 
23
#include <QtGui/QGraphicsScene>
 
24
#include <QHash>
 
25
 
 
26
#include <Plasma/Corona>
 
27
 
 
28
class QMenu;
 
29
class QAction;
 
30
 
 
31
class Activity;
 
32
class KActivityController;
 
33
 
 
34
namespace Plasma
 
35
{
 
36
    class Applet;
 
37
} // namespace Plasma
 
38
 
 
39
namespace Kephal {
 
40
    class Screen;
 
41
} // namespace Kephal
 
42
 
 
43
/**
 
44
 * @short A Corona with desktop-y considerations
 
45
 */
 
46
class DesktopCorona : public Plasma::Corona
 
47
{
 
48
    Q_OBJECT
 
49
 
 
50
public:
 
51
    explicit DesktopCorona(QObject * parent = 0);
 
52
    ~DesktopCorona();
 
53
 
 
54
    /**
 
55
     * Loads the default (system wide) layout for this user
 
56
     **/
 
57
    void loadDefaultLayout();
 
58
 
 
59
    /**
 
60
     * Ensures we have the necessary containments for every screen
 
61
     */
 
62
    void checkScreens(bool signalWhenExists = false);
 
63
 
 
64
    /**
 
65
     * Ensures we have the necessary containments for the given screen
 
66
     */
 
67
    void checkScreen(int screen, bool signalWhenExists = false);
 
68
 
 
69
    int numScreens() const;
 
70
    QRect screenGeometry(int id) const;
 
71
    QRegion availableScreenRegion(int id) const;
 
72
    int screenId(const QPoint &pos) const;
 
73
 
 
74
    bool loadDefaultLayoutScripts();
 
75
    void processUpdateScripts();
 
76
 
 
77
    /**
 
78
     * Ensures activities exist for the containments
 
79
     */
 
80
    void checkActivities();
 
81
 
 
82
    /**
 
83
     * @return the Activity object for the given activity id
 
84
     */
 
85
    Activity* activity(const QString &id);
 
86
 
 
87
public Q_SLOTS:
 
88
    QRect availableScreenRect(int id) const;
 
89
    void addPanel();
 
90
    void addPanel(QAction *action);
 
91
    void addPanel(const QString &plugin);
 
92
    void populateAddPanelsMenu();
 
93
    void activateNextActivity();
 
94
    void activatePreviousActivity();
 
95
    void evaluateScripts(const QStringList &scripts);
 
96
 
 
97
protected Q_SLOTS:
 
98
    void screenAdded(Kephal::Screen *s);
 
99
    void saveDefaultSetup();
 
100
    void printScriptError(const QString &error);
 
101
    void printScriptMessage(const QString &error);
 
102
    void updateImmutability(Plasma::ImmutabilityType immutability);
 
103
    void checkAddPanelAction(const QStringList &sycocaChanges = QStringList());
 
104
    void currentActivityChanged(const QString &activity);
 
105
    void activityAdded(const QString &id);
 
106
    void activityRemoved(const QString &id);
 
107
 
 
108
private:
 
109
    void init();
 
110
 
 
111
    Plasma::Applet *loadDefaultApplet(const QString &pluginName, Plasma::Containment *c);
 
112
    void checkDesktop(Activity *activity, bool signalWhenExists, int screen, int desktop = -1);
 
113
 
 
114
    QAction *m_addPanelAction;
 
115
    QMenu *m_addPanelsMenu;
 
116
    KActivityController *m_activityController;
 
117
    QHash<QString, Activity*> m_activities;
 
118
};
 
119
 
 
120
#endif
 
121
 
 
122