1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
/*
* krootwm.h Part of the KDE project.
*
* Copyright (C) 1997 Matthias Ettrich
* (C) 1997 Torben Weis, weis@kde.org
* (C) 1998 S.u.S.E, weis@suse.de
*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License version 2 as published by the Free Software Foundation.
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 General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __krootwm_h__
#define __krootwm_h__
#include <qpixmap.h>
#include <qobject.h>
// we need Window but do not want to include X.h since it
// #defines way too many constants
typedef unsigned long XID;
typedef XID Window;
class KMenuBar;
class KDesktop;
class QPopupMenu;
class KCMultiDialog;
class KNewMenu;
class KWinModule;
class KBookmarkMenu;
class KHelpMenu;
class KActionCollection;
class KActionMenu;
class KWindowListMenu;
enum {
ITEM_HELP=100,
ITEM_PASTE,
ITEM_EXECUTE,
ITEM_CONFIGURE_BACKGROUND,
ITEM_CONFIGURE_ICONS,
ITEM_UNCLUTTER_WINDOWS,
ITEM_CASCADE_WINDOWS,
ITEM_ARRANGE_ICONS,
ITEM_LOCK_SCREEN,
ITEM_LOGOUT
};
/**
* This class is the handler for the menus (root popup menu and desktop menubar)
*/
class KRootWm: public QObject {
Q_OBJECT
public:
KRootWm(KDesktop*);
~KRootWm();
bool startup;
void mousePressed( const QPoint& _global, int _button );
bool hasLeftButtonMenu() { return leftButtonChoice != NOTHING; }
/**
* Return the unique KRootWm instance
*/
static KRootWm * self() { return s_rootWm; }
/**
* share this with desktop.cc
*/
KNewMenu * newMenu() const { return menuNew; }
/**
* The position of the (usually RMB) click that opened the 'desktop' menu
*/
QPoint desktopMenuPosition() const { return m_desktopMenuPosition; }
/**
* Read and apply configuration
*/
void initConfig();
/**
* List of config modules used by Configure Desktop
*/
static QStringList configModules();
public slots:
void slotArrangeByNameCS();
void slotArrangeByNameCI();
void slotArrangeBySize();
void slotArrangeByType();
void slotArrangeByDate();
void slotLineupIconsHoriz();
void slotLineupIconsVert();
void slotLineupIcons();
void slotRefreshDesktop();
void slotConfigureDesktop();
void slotToggleDirFirst( bool );
void slotToggleAutoAlign( bool );
void slotToggleLockIcons( bool );
void slotToggleDesktopMenu();
void slotUnclutterWindows();
void slotCascadeWindows();
void slotWindowList();
void slotLock();
void slotLogout();
void slotSwitchUser();
void slotPopulateSessions();
void slotSessionActivated( int );
void slotNewSession();
void slotLockNNewSession();
private:
KDesktop* m_pDesktop;
// The five root menus :
KWindowListMenu* windowListMenu;
QPopupMenu* desktopMenu;
// the appMenu is (will be) provided by kicker
QPopupMenu* customMenu1;
QPopupMenu* customMenu2;
KCMultiDialog* m_configDialog;
// Configuration for the root menus :
typedef enum { NOTHING = 0, WINDOWLISTMENU, DESKTOPMENU, APPMENU, CUSTOMMENU1, CUSTOMMENU2, BOOKMARKSMENU, SESSIONSMENU } menuChoice;
menuChoice leftButtonChoice;
menuChoice middleButtonChoice;
menuChoice rightButtonChoice;
KNewMenu* menuNew;
KActionMenu* bookmarks;
KBookmarkMenu* bookmarkMenu;
KActionCollection * m_actionCollection;
QPoint m_desktopMenuPosition;
void activateMenu( menuChoice choice, const QPoint& global );
void buildMenus();
bool m_bShowMenuBar;
bool m_bGlobalMenuBar;
bool m_bInit;
bool m_bDesktopEnabled;
KMenuBar *menuBar;
QPopupMenu *file;
QPopupMenu *desk;
KHelpMenu *help;
QPixmap defaultPixmap;
void doNewSession( bool lock );
QPopupMenu *sessionsMenu;
static KRootWm * s_rootWm;
private slots:
void slotMenuItemActivated(int);
void slotFileNewAboutToShow();
void slotWindowListAboutToShow();
void slotConfigClosed();
};
#endif
|