author | llornkcor <llornkcor> | 2002-06-11 13:26:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-11 13:26:52 (UTC) |
commit | d7be88ed0355e32f15da6ecbf56f2d825c530d2a (patch) (unidiff) | |
tree | b8badca1426dd9128126b1af620541c89bb14d42 | |
parent | e9b7ffa394fa30bea063fbed68b36800e9ebee6d (diff) | |
download | opie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.zip opie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.tar.gz opie-d7be88ed0355e32f15da6ecbf56f2d825c530d2a.tar.bz2 |
follow up to the follow up for custom.h related things
-rw-r--r-- | core/launcher/desktop.cpp | 3 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 693e77f..974de0c 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,425 +1,428 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "desktop.h" | 21 | #include "desktop.h" |
22 | #include "info.h" | 22 | #include "info.h" |
23 | #include "launcher.h" | 23 | #include "launcher.h" |
24 | #include "mrulist.h" | 24 | #include "mrulist.h" |
25 | #include "qcopbridge.h" | 25 | #include "qcopbridge.h" |
26 | #include "shutdownimpl.h" | 26 | #include "shutdownimpl.h" |
27 | #include "startmenu.h" | 27 | #include "startmenu.h" |
28 | #include "taskbar.h" | 28 | #include "taskbar.h" |
29 | #include "transferserver.h" | 29 | #include "transferserver.h" |
30 | #include "irserver.h" | 30 | #include "irserver.h" |
31 | #include "packageslave.h" | 31 | #include "packageslave.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/timeconversion.h> | 38 | #include <qpe/timeconversion.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | |||
42 | #ifdef QT_QWS_CUSTOM | ||
41 | #include <qpe/custom.h> | 43 | #include <qpe/custom.h> |
44 | #endif | ||
42 | 45 | ||
43 | #include <qgfx_qws.h> | 46 | #include <qgfx_qws.h> |
44 | #include <qmainwindow.h> | 47 | #include <qmainwindow.h> |
45 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
46 | #include <qtimer.h> | 49 | #include <qtimer.h> |
47 | #include <qwindowsystem_qws.h> | 50 | #include <qwindowsystem_qws.h> |
48 | 51 | ||
49 | #include <qvaluelist.h> | 52 | #include <qvaluelist.h> |
50 | 53 | ||
51 | #include <stdlib.h> | 54 | #include <stdlib.h> |
52 | #include <unistd.h> | 55 | #include <unistd.h> |
53 | 56 | ||
54 | class QCopKeyRegister | 57 | class QCopKeyRegister |
55 | { | 58 | { |
56 | public: | 59 | public: |
57 | QCopKeyRegister() : keyCode(0) { } | 60 | QCopKeyRegister() : keyCode(0) { } |
58 | QCopKeyRegister(int k, const QString &c, const QString &m) | 61 | QCopKeyRegister(int k, const QString &c, const QString &m) |
59 | : keyCode(k), channel(c), message(m) { } | 62 | : keyCode(k), channel(c), message(m) { } |
60 | 63 | ||
61 | int getKeyCode() const { return keyCode; } | 64 | int getKeyCode() const { return keyCode; } |
62 | QString getChannel() const { return channel; } | 65 | QString getChannel() const { return channel; } |
63 | QString getMessage() const { return message; } | 66 | QString getMessage() const { return message; } |
64 | 67 | ||
65 | private: | 68 | private: |
66 | int keyCode; | 69 | int keyCode; |
67 | QString channel, message; | 70 | QString channel, message; |
68 | }; | 71 | }; |
69 | 72 | ||
70 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 73 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
71 | KeyRegisterList keyRegisterList; | 74 | KeyRegisterList keyRegisterList; |
72 | 75 | ||
73 | static Desktop* qpedesktop = 0; | 76 | static Desktop* qpedesktop = 0; |
74 | static int loggedin=0; | 77 | static int loggedin=0; |
75 | static void login(bool at_poweron) | 78 | static void login(bool at_poweron) |
76 | { | 79 | { |
77 | if ( !loggedin ) { | 80 | if ( !loggedin ) { |
78 | Global::terminateBuiltin("calibrate"); | 81 | Global::terminateBuiltin("calibrate"); |
79 | Password::authenticate(at_poweron); | 82 | Password::authenticate(at_poweron); |
80 | loggedin=1; | 83 | loggedin=1; |
81 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 84 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
82 | } | 85 | } |
83 | } | 86 | } |
84 | 87 | ||
85 | bool Desktop::screenLocked() | 88 | bool Desktop::screenLocked() |
86 | { | 89 | { |
87 | return loggedin == 0; | 90 | return loggedin == 0; |
88 | } | 91 | } |
89 | 92 | ||
90 | /* | 93 | /* |
91 | Priority is number of alerts that are needed to pop up | 94 | Priority is number of alerts that are needed to pop up |
92 | alert. | 95 | alert. |
93 | */ | 96 | */ |
94 | class DesktopPowerAlerter : public QMessageBox | 97 | class DesktopPowerAlerter : public QMessageBox |
95 | { | 98 | { |
96 | public: | 99 | public: |
97 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 100 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
98 | : QMessageBox( tr("Battery Status"), "Low Battery", | 101 | : QMessageBox( tr("Battery Status"), "Low Battery", |
99 | QMessageBox::Critical, | 102 | QMessageBox::Critical, |
100 | QMessageBox::Ok | QMessageBox::Default, | 103 | QMessageBox::Ok | QMessageBox::Default, |
101 | QMessageBox::NoButton, QMessageBox::NoButton, | 104 | QMessageBox::NoButton, QMessageBox::NoButton, |
102 | parent, name, FALSE ) | 105 | parent, name, FALSE ) |
103 | { | 106 | { |
104 | currentPriority = INT_MAX; | 107 | currentPriority = INT_MAX; |
105 | alertCount = 0; | 108 | alertCount = 0; |
106 | } | 109 | } |
107 | 110 | ||
108 | void alert( const QString &text, int priority ); | 111 | void alert( const QString &text, int priority ); |
109 | void hideEvent( QHideEvent * ); | 112 | void hideEvent( QHideEvent * ); |
110 | private: | 113 | private: |
111 | int currentPriority; | 114 | int currentPriority; |
112 | int alertCount; | 115 | int alertCount; |
113 | }; | 116 | }; |
114 | 117 | ||
115 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 118 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
116 | { | 119 | { |
117 | alertCount++; | 120 | alertCount++; |
118 | if ( alertCount < priority ) | 121 | if ( alertCount < priority ) |
119 | return; | 122 | return; |
120 | if ( priority > currentPriority ) | 123 | if ( priority > currentPriority ) |
121 | return; | 124 | return; |
122 | currentPriority = priority; | 125 | currentPriority = priority; |
123 | setText( text ); | 126 | setText( text ); |
124 | show(); | 127 | show(); |
125 | } | 128 | } |
126 | 129 | ||
127 | 130 | ||
128 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 131 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
129 | { | 132 | { |
130 | QMessageBox::hideEvent( e ); | 133 | QMessageBox::hideEvent( e ); |
131 | alertCount = 0; | 134 | alertCount = 0; |
132 | currentPriority = INT_MAX; | 135 | currentPriority = INT_MAX; |
133 | } | 136 | } |
134 | 137 | ||
135 | 138 | ||
136 | 139 | ||
137 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 140 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
138 | : QPEApplication( argc, argv, appType ) | 141 | : QPEApplication( argc, argv, appType ) |
139 | { | 142 | { |
140 | 143 | ||
141 | QTimer *t = new QTimer( this ); | 144 | QTimer *t = new QTimer( this ); |
142 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); | 145 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); |
143 | t->start( 10000 ); | 146 | t->start( 10000 ); |
144 | ps = new PowerStatus; | 147 | ps = new PowerStatus; |
145 | pa = new DesktopPowerAlerter( 0 ); | 148 | pa = new DesktopPowerAlerter( 0 ); |
146 | 149 | ||
147 | channel = new QCopChannel( "QPE/Desktop", this ); | 150 | channel = new QCopChannel( "QPE/Desktop", this ); |
148 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 151 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
149 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 152 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
150 | } | 153 | } |
151 | 154 | ||
152 | 155 | ||
153 | DesktopApplication::~DesktopApplication() | 156 | DesktopApplication::~DesktopApplication() |
154 | { | 157 | { |
155 | delete ps; | 158 | delete ps; |
156 | delete pa; | 159 | delete pa; |
157 | } | 160 | } |
158 | 161 | ||
159 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | 162 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) |
160 | { | 163 | { |
161 | QDataStream stream( data, IO_ReadOnly ); | 164 | QDataStream stream( data, IO_ReadOnly ); |
162 | if (msg == "keyRegister(int key, QString channel, QString message)") | 165 | if (msg == "keyRegister(int key, QString channel, QString message)") |
163 | { | 166 | { |
164 | int k; | 167 | int k; |
165 | QString c, m; | 168 | QString c, m; |
166 | stream >> k; | 169 | stream >> k; |
167 | stream >> c; | 170 | stream >> c; |
168 | stream >> m; | 171 | stream >> m; |
169 | 172 | ||
170 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); | 173 | qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); |
171 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 174 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
172 | } | 175 | } |
173 | else if (msg == "suspend()"){ | 176 | else if (msg == "suspend()"){ |
174 | emit power(); | 177 | emit power(); |
175 | } | 178 | } |
176 | 179 | ||
177 | } | 180 | } |
178 | 181 | ||
179 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 182 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
180 | 183 | ||
181 | #ifdef Q_WS_QWS | 184 | #ifdef Q_WS_QWS |
182 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 185 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
183 | { | 186 | { |
184 | qpedesktop->checkMemory(); | 187 | qpedesktop->checkMemory(); |
185 | 188 | ||
186 | if ( e->type == QWSEvent::Key ) { | 189 | if ( e->type == QWSEvent::Key ) { |
187 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 190 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
188 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 191 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
189 | return TRUE; | 192 | return TRUE; |
190 | bool press = ke->simpleData.is_press; | 193 | bool press = ke->simpleData.is_press; |
191 | bool autoRepeat= ke->simpleData.is_auto_repeat; | 194 | bool autoRepeat= ke->simpleData.is_auto_repeat; |
192 | if (!keyRegisterList.isEmpty()) | 195 | if (!keyRegisterList.isEmpty()) |
193 | { | 196 | { |
194 | KeyRegisterList::Iterator it; | 197 | KeyRegisterList::Iterator it; |
195 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 198 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) |
196 | { | 199 | { |
197 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { | 200 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { |
198 | if(press) qDebug("press"); else qDebug("release"); | 201 | if(press) qDebug("press"); else qDebug("release"); |
199 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 202 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
200 | } | 203 | } |
201 | } | 204 | } |
202 | } | 205 | } |
203 | 206 | ||
204 | if ( !keyboardGrabbed() ) { | 207 | if ( !keyboardGrabbed() ) { |
205 | if ( ke->simpleData.keycode == Key_F9 ) { | 208 | if ( ke->simpleData.keycode == Key_F9 ) { |
206 | if ( press ) emit datebook(); | 209 | if ( press ) emit datebook(); |
207 | return TRUE; | 210 | return TRUE; |
208 | } | 211 | } |
209 | if ( ke->simpleData.keycode == Key_F10 ) { | 212 | if ( ke->simpleData.keycode == Key_F10 ) { |
210 | if ( !press && cardSendTimer ) { | 213 | if ( !press && cardSendTimer ) { |
211 | emit contacts(); | 214 | emit contacts(); |
212 | delete cardSendTimer; | 215 | delete cardSendTimer; |
213 | } else if ( press ) { | 216 | } else if ( press ) { |
214 | cardSendTimer = new QTimer(); | 217 | cardSendTimer = new QTimer(); |
215 | cardSendTimer->start( 2000, TRUE ); | 218 | cardSendTimer->start( 2000, TRUE ); |
216 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 219 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
217 | } | 220 | } |
218 | return TRUE; | 221 | return TRUE; |
219 | } | 222 | } |
220 | /* menu key now opens application menu/toolbar | 223 | /* menu key now opens application menu/toolbar |
221 | if ( ke->simpleData.keycode == Key_F11 ) { | 224 | if ( ke->simpleData.keycode == Key_F11 ) { |
222 | if ( press ) emit menu(); | 225 | if ( press ) emit menu(); |
223 | return TRUE; | 226 | return TRUE; |
224 | } | 227 | } |
225 | */ | 228 | */ |
226 | if ( ke->simpleData.keycode == Key_F12 ) { | 229 | if ( ke->simpleData.keycode == Key_F12 ) { |
227 | while( activePopupWidget() ) | 230 | while( activePopupWidget() ) |
228 | activePopupWidget()->close(); | 231 | activePopupWidget()->close(); |
229 | if ( press ) emit launch(); | 232 | if ( press ) emit launch(); |
230 | return TRUE; | 233 | return TRUE; |
231 | } | 234 | } |
232 | if ( ke->simpleData.keycode == Key_F13 ) { | 235 | if ( ke->simpleData.keycode == Key_F13 ) { |
233 | if ( press ) emit email(); | 236 | if ( press ) emit email(); |
234 | return TRUE; | 237 | return TRUE; |
235 | } | 238 | } |
236 | } | 239 | } |
237 | 240 | ||
238 | if ( ke->simpleData.keycode == Key_F34 ) { | 241 | if ( ke->simpleData.keycode == Key_F34 ) { |
239 | if ( press ) emit power(); | 242 | if ( press ) emit power(); |
240 | return TRUE; | 243 | return TRUE; |
241 | } | 244 | } |
242 | if ( ke->simpleData.keycode == Key_SysReq ) { | 245 | if ( ke->simpleData.keycode == Key_SysReq ) { |
243 | if ( press ) emit power(); | 246 | if ( press ) emit power(); |
244 | return TRUE; | 247 | return TRUE; |
245 | } | 248 | } |
246 | if ( ke->simpleData.keycode == Key_F35 ) { | 249 | if ( ke->simpleData.keycode == Key_F35 ) { |
247 | if ( press ) emit backlight(); | 250 | if ( press ) emit backlight(); |
248 | return TRUE; | 251 | return TRUE; |
249 | } | 252 | } |
250 | if ( ke->simpleData.keycode == Key_F32 ) { | 253 | if ( ke->simpleData.keycode == Key_F32 ) { |
251 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 254 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
252 | return TRUE; | 255 | return TRUE; |
253 | } | 256 | } |
254 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 257 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
255 | if ( press ) emit symbol(); | 258 | if ( press ) emit symbol(); |
256 | return TRUE; | 259 | return TRUE; |
257 | } | 260 | } |
258 | if ( ke->simpleData.keycode == Key_NumLock ) { | 261 | if ( ke->simpleData.keycode == Key_NumLock ) { |
259 | if ( press ) emit numLockStateToggle(); | 262 | if ( press ) emit numLockStateToggle(); |
260 | } | 263 | } |
261 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 264 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
262 | if ( press ) emit capsLockStateToggle(); | 265 | if ( press ) emit capsLockStateToggle(); |
263 | } | 266 | } |
264 | if ( press ) | 267 | if ( press ) |
265 | qpedesktop->keyClick(); | 268 | qpedesktop->keyClick(); |
266 | } else { | 269 | } else { |
267 | if ( e->type == QWSEvent::Mouse ) { | 270 | if ( e->type == QWSEvent::Mouse ) { |
268 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 271 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
269 | static bool up = TRUE; | 272 | static bool up = TRUE; |
270 | if ( me->simpleData.state&LeftButton ) { | 273 | if ( me->simpleData.state&LeftButton ) { |
271 | if ( up ) { | 274 | if ( up ) { |
272 | up = FALSE; | 275 | up = FALSE; |
273 | qpedesktop->screenClick(); | 276 | qpedesktop->screenClick(); |
274 | } | 277 | } |
275 | } else { | 278 | } else { |
276 | up = TRUE; | 279 | up = TRUE; |
277 | } | 280 | } |
278 | } | 281 | } |
279 | } | 282 | } |
280 | 283 | ||
281 | return QPEApplication::qwsEventFilter( e ); | 284 | return QPEApplication::qwsEventFilter( e ); |
282 | } | 285 | } |
283 | #endif | 286 | #endif |
284 | 287 | ||
285 | void DesktopApplication::psTimeout() | 288 | void DesktopApplication::psTimeout() |
286 | { | 289 | { |
287 | qpedesktop->checkMemory(); // in case no events are being generated | 290 | qpedesktop->checkMemory(); // in case no events are being generated |
288 | 291 | ||
289 | *ps = PowerStatusManager::readStatus(); | 292 | *ps = PowerStatusManager::readStatus(); |
290 | 293 | ||
291 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { | 294 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { |
292 | pa->alert( tr( "Battery is running very low." ), 6 ); | 295 | pa->alert( tr( "Battery is running very low." ), 6 ); |
293 | } | 296 | } |
294 | 297 | ||
295 | if ( ps->batteryStatus() == PowerStatus::Critical ) { | 298 | if ( ps->batteryStatus() == PowerStatus::Critical ) { |
296 | pa->alert( tr( "Battery level is critical!\n" | 299 | pa->alert( tr( "Battery level is critical!\n" |
297 | "Keep power off until power restored!" ), 1 ); | 300 | "Keep power off until power restored!" ), 1 ); |
298 | } | 301 | } |
299 | 302 | ||
300 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { | 303 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { |
301 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); | 304 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); |
302 | } | 305 | } |
303 | } | 306 | } |
304 | 307 | ||
305 | 308 | ||
306 | void DesktopApplication::sendCard() | 309 | void DesktopApplication::sendCard() |
307 | { | 310 | { |
308 | delete cardSendTimer; | 311 | delete cardSendTimer; |
309 | cardSendTimer = 0; | 312 | cardSendTimer = 0; |
310 | QString card = getenv("HOME"); | 313 | QString card = getenv("HOME"); |
311 | card += "/Applications/addressbook/businesscard.vcf"; | 314 | card += "/Applications/addressbook/businesscard.vcf"; |
312 | 315 | ||
313 | if ( QFile::exists( card ) ) { | 316 | if ( QFile::exists( card ) ) { |
314 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); | 317 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); |
315 | QString mimetype = "text/x-vCard"; | 318 | QString mimetype = "text/x-vCard"; |
316 | e << tr("business card") << card << mimetype; | 319 | e << tr("business card") << card << mimetype; |
317 | } | 320 | } |
318 | } | 321 | } |
319 | 322 | ||
320 | #if defined(QPE_HAVE_MEMALERTER) | 323 | #if defined(QPE_HAVE_MEMALERTER) |
321 | QPE_MEMALERTER_IMPL | 324 | QPE_MEMALERTER_IMPL |
322 | #endif | 325 | #endif |
323 | 326 | ||
324 | #if defined(CUSTOM_SOUND_IMPL) | 327 | #if defined(CUSTOM_SOUND_IMPL) |
325 | CUSTOM_SOUND_IMPL | 328 | CUSTOM_SOUND_IMPL |
326 | #endif | 329 | #endif |
327 | 330 | ||
328 | //=========================================================================== | 331 | //=========================================================================== |
329 | 332 | ||
330 | Desktop::Desktop() : | 333 | Desktop::Desktop() : |
331 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 334 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
332 | qcopBridge( 0 ), | 335 | qcopBridge( 0 ), |
333 | transferServer( 0 ), | 336 | transferServer( 0 ), |
334 | packageSlave( 0 ) | 337 | packageSlave( 0 ) |
335 | { | 338 | { |
336 | #ifdef CUSTOM_SOUND_INIT | 339 | #ifdef CUSTOM_SOUND_INIT |
337 | CUSTOM_SOUND_INIT; | 340 | CUSTOM_SOUND_INIT; |
338 | #endif | 341 | #endif |
339 | 342 | ||
340 | qpedesktop = this; | 343 | qpedesktop = this; |
341 | 344 | ||
342 | // bg = new Info( this ); | 345 | // bg = new Info( this ); |
343 | tb = new TaskBar; | 346 | tb = new TaskBar; |
344 | 347 | ||
345 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 348 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
346 | 349 | ||
347 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); | 350 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); |
348 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); | 351 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); |
349 | 352 | ||
350 | int displayw = qApp->desktop()->width(); | 353 | int displayw = qApp->desktop()->width(); |
351 | int displayh = qApp->desktop()->height(); | 354 | int displayh = qApp->desktop()->height(); |
352 | 355 | ||
353 | 356 | ||
354 | QSize sz = tb->sizeHint(); | 357 | QSize sz = tb->sizeHint(); |
355 | 358 | ||
356 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 359 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
357 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 360 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
358 | 361 | ||
359 | tb->show(); | 362 | tb->show(); |
360 | launcher->showMaximized(); | 363 | launcher->showMaximized(); |
361 | launcher->show(); | 364 | launcher->show(); |
362 | launcher->raise(); | 365 | launcher->raise(); |
363 | #if defined(QPE_HAVE_MEMALERTER) | 366 | #if defined(QPE_HAVE_MEMALERTER) |
364 | initMemalerter(); | 367 | initMemalerter(); |
365 | #endif | 368 | #endif |
366 | // start services | 369 | // start services |
367 | startTransferServer(); | 370 | startTransferServer(); |
368 | (void) new IrServer( this ); | 371 | (void) new IrServer( this ); |
369 | rereadVolumes(); | 372 | rereadVolumes(); |
370 | 373 | ||
371 | packageSlave = new PackageSlave( this ); | 374 | packageSlave = new PackageSlave( this ); |
372 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); | 375 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); |
373 | 376 | ||
374 | qApp->installEventFilter( this ); | 377 | qApp->installEventFilter( this ); |
375 | } | 378 | } |
376 | 379 | ||
377 | void Desktop::show() | 380 | void Desktop::show() |
378 | { | 381 | { |
379 | login(TRUE); | 382 | login(TRUE); |
380 | QWidget::show(); | 383 | QWidget::show(); |
381 | } | 384 | } |
382 | 385 | ||
383 | Desktop::~Desktop() | 386 | Desktop::~Desktop() |
384 | { | 387 | { |
385 | delete launcher; | 388 | delete launcher; |
386 | delete tb; | 389 | delete tb; |
387 | delete qcopBridge; | 390 | delete qcopBridge; |
388 | delete transferServer; | 391 | delete transferServer; |
389 | } | 392 | } |
390 | 393 | ||
391 | bool Desktop::recoverMemory() | 394 | bool Desktop::recoverMemory() |
392 | { | 395 | { |
393 | return tb->recoverMemory(); | 396 | return tb->recoverMemory(); |
394 | } | 397 | } |
395 | 398 | ||
396 | void Desktop::checkMemory() | 399 | void Desktop::checkMemory() |
397 | { | 400 | { |
398 | #if defined(QPE_HAVE_MEMALERTER) | 401 | #if defined(QPE_HAVE_MEMALERTER) |
399 | static bool ignoreNormal=FALSE; | 402 | static bool ignoreNormal=FALSE; |
400 | static bool existingMessage=FALSE; | 403 | static bool existingMessage=FALSE; |
401 | 404 | ||
402 | if(existingMessage) | 405 | if(existingMessage) |
403 | return; // don't show a second message while still on first | 406 | return; // don't show a second message while still on first |
404 | 407 | ||
405 | existingMessage = TRUE; | 408 | existingMessage = TRUE; |
406 | switch ( memstate ) { | 409 | switch ( memstate ) { |
407 | case Unknown: | 410 | case Unknown: |
408 | break; | 411 | break; |
409 | case Low: | 412 | case Low: |
410 | memstate = Unknown; | 413 | memstate = Unknown; |
411 | if ( recoverMemory() ) | 414 | if ( recoverMemory() ) |
412 | ignoreNormal = TRUE; | 415 | ignoreNormal = TRUE; |
413 | else | 416 | else |
414 | QMessageBox::warning( 0 , "Memory Status", | 417 | QMessageBox::warning( 0 , "Memory Status", |
415 | "The memory smacks of shortage. \n" | 418 | "The memory smacks of shortage. \n" |
416 | "Please save data. " ); | 419 | "Please save data. " ); |
417 | break; | 420 | break; |
418 | case Normal: | 421 | case Normal: |
419 | memstate = Unknown; | 422 | memstate = Unknown; |
420 | if ( ignoreNormal ) | 423 | if ( ignoreNormal ) |
421 | ignoreNormal = FALSE; | 424 | ignoreNormal = FALSE; |
422 | else | 425 | else |
423 | QMessageBox::information ( 0 , "Memory Status", | 426 | QMessageBox::information ( 0 , "Memory Status", |
424 | "There is enough memory again." ); | 427 | "There is enough memory again." ); |
425 | break; | 428 | break; |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index b69d165..bff2a1c 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,318 +1,318 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | *********************************************************************/ | 19 | *********************************************************************/ |
20 | 20 | ||
21 | #include "startmenu.h" | 21 | #include "startmenu.h" |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | #include "mrulist.h" | 23 | #include "mrulist.h" |
24 | #include "systray.h" | 24 | #include "systray.h" |
25 | #include "calibrate.h" | 25 | #include "calibrate.h" |
26 | #include "wait.h" | 26 | #include "wait.h" |
27 | #include "appicons.h" | 27 | #include "appicons.h" |
28 | 28 | ||
29 | #include "taskbar.h" | 29 | #include "taskbar.h" |
30 | #include "desktop.h" | 30 | #include "desktop.h" |
31 | 31 | ||
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
35 | //#ifdef QT_QWS_CUSTOM | 35 | #ifdef QT_QWS_CUSTOM |
36 | //#include <qpe/custom.h> | 36 | #include <qpe/custom.h> |
37 | //#endif | 37 | #endif |
38 | #if defined(QT_QWS_IPAQ) | 38 | #if defined(QT_QWS_IPAQ) |
39 | #include "qpe/custom-ipaq.h" | 39 | #include "qpe/custom-ipaq.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | 42 | ||
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qtimer.h> | 45 | #include <qtimer.h> |
46 | #include <qwindowsystem_qws.h> | 46 | #include <qwindowsystem_qws.h> |
47 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
48 | 48 | ||
49 | #if defined( Q_WS_QWS ) | 49 | #if defined( Q_WS_QWS ) |
50 | #include <qwsdisplay_qws.h> | 50 | #include <qwsdisplay_qws.h> |
51 | #include <qgfx_qws.h> | 51 | #include <qgfx_qws.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | 54 | ||
55 | #define FACTORY(T) \ | 55 | #define FACTORY(T) \ |
56 | static QWidget *new##T( bool maximized ) { \ | 56 | static QWidget *new##T( bool maximized ) { \ |
57 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 57 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
58 | if ( maximized ) { \ | 58 | if ( maximized ) { \ |
59 | if ( qApp->desktop()->width() <= 350 ) { \ | 59 | if ( qApp->desktop()->width() <= 350 ) { \ |
60 | w->showMaximized(); \ | 60 | w->showMaximized(); \ |
61 | } else { \ | 61 | } else { \ |
62 | w->resize( QSize( 300, 300 ) ); \ | 62 | w->resize( QSize( 300, 300 ) ); \ |
63 | } \ | 63 | } \ |
64 | } \ | 64 | } \ |
65 | w->show(); \ | 65 | w->show(); \ |
66 | return w; \ | 66 | return w; \ |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | #ifdef SINGLE_APP | 70 | #ifdef SINGLE_APP |
71 | #define APP(a,b,c,d) FACTORY(b) | 71 | #define APP(a,b,c,d) FACTORY(b) |
72 | #include "../launcher/apps.h" | 72 | #include "../launcher/apps.h" |
73 | #undef APP | 73 | #undef APP |
74 | #endif // SINGLE_APP | 74 | #endif // SINGLE_APP |
75 | 75 | ||
76 | static Global::Command builtins[] = { | 76 | static Global::Command builtins[] = { |
77 | 77 | ||
78 | #ifdef SINGLE_APP | 78 | #ifdef SINGLE_APP |
79 | #define APP(a,b,c,d) { a, new##b, c }, | 79 | #define APP(a,b,c,d) { a, new##b, c }, |
80 | #include "../launcher/apps.h" | 80 | #include "../launcher/apps.h" |
81 | #undef APP | 81 | #undef APP |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) | 84 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) |
85 | { "calibrate", TaskBar::calibrate, 1, 0 }, | 85 | { "calibrate", TaskBar::calibrate, 1, 0 }, |
86 | #endif | 86 | #endif |
87 | #if !defined(QT_QWS_CASSIOPEIA) | 87 | #if !defined(QT_QWS_CASSIOPEIA) |
88 | { "shutdown", Global::shutdown, 1, 0 }, | 88 | { "shutdown", Global::shutdown, 1, 0 }, |
89 | // { "run", run, 1, 0 }, | 89 | // { "run", run, 1, 0 }, |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | { 0, TaskBar::calibrate, 0, 0 }, | 92 | { 0, TaskBar::calibrate, 0, 0 }, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static bool initNumLock() | 95 | static bool initNumLock() |
96 | { | 96 | { |
97 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 97 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
98 | QPE_INITIAL_NUMLOCK_STATE | 98 | QPE_INITIAL_NUMLOCK_STATE |
99 | #endif | 99 | #endif |
100 | return FALSE; | 100 | return FALSE; |
101 | } | 101 | } |
102 | 102 | ||
103 | class LockKeyState : public QWidget | 103 | class LockKeyState : public QWidget |
104 | { | 104 | { |
105 | public: | 105 | public: |
106 | LockKeyState( QWidget *parent ) : | 106 | LockKeyState( QWidget *parent ) : |
107 | QWidget(parent), | 107 | QWidget(parent), |
108 | nl(initNumLock()), cl(FALSE) | 108 | nl(initNumLock()), cl(FALSE) |
109 | { | 109 | { |
110 | nl_pm = Resource::loadPixmap("numlock"); | 110 | nl_pm = Resource::loadPixmap("numlock"); |
111 | cl_pm = Resource::loadPixmap("capslock"); | 111 | cl_pm = Resource::loadPixmap("capslock"); |
112 | } | 112 | } |
113 | QSize sizeHint() const | 113 | QSize sizeHint() const |
114 | { | 114 | { |
115 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); | 115 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); |
116 | } | 116 | } |
117 | void toggleNumLockState() | 117 | void toggleNumLockState() |
118 | { | 118 | { |
119 | nl = !nl; repaint(); | 119 | nl = !nl; repaint(); |
120 | } | 120 | } |
121 | void toggleCapsLockState() | 121 | void toggleCapsLockState() |
122 | { | 122 | { |
123 | cl = !cl; repaint(); | 123 | cl = !cl; repaint(); |
124 | } | 124 | } |
125 | void paintEvent( QPaintEvent * ) | 125 | void paintEvent( QPaintEvent * ) |
126 | { | 126 | { |
127 | int y = (height()-sizeHint().height())/2; | 127 | int y = (height()-sizeHint().height())/2; |
128 | QPainter p(this); | 128 | QPainter p(this); |
129 | if ( nl ) | 129 | if ( nl ) |
130 | p.drawPixmap(1,y,nl_pm); | 130 | p.drawPixmap(1,y,nl_pm); |
131 | if ( cl ) | 131 | if ( cl ) |
132 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 132 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
133 | } | 133 | } |
134 | private: | 134 | private: |
135 | QPixmap nl_pm, cl_pm; | 135 | QPixmap nl_pm, cl_pm; |
136 | bool nl, cl; | 136 | bool nl, cl; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | TaskBar::~TaskBar() | 139 | TaskBar::~TaskBar() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 144 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
145 | { | 145 | { |
146 | Global::setBuiltinCommands(builtins); | 146 | Global::setBuiltinCommands(builtins); |
147 | 147 | ||
148 | sm = new StartMenu( this ); | 148 | sm = new StartMenu( this ); |
149 | 149 | ||
150 | inputMethods = new InputMethods( this ); | 150 | inputMethods = new InputMethods( this ); |
151 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 151 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
152 | this, SLOT(calcMaxWindowRect()) ); | 152 | this, SLOT(calcMaxWindowRect()) ); |
153 | //new QuickLauncher( this ); | 153 | //new QuickLauncher( this ); |
154 | 154 | ||
155 | stack = new QWidgetStack( this ); | 155 | stack = new QWidgetStack( this ); |
156 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 156 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
157 | label = new QLabel(stack); | 157 | label = new QLabel(stack); |
158 | 158 | ||
159 | mru = new MRUList( stack ); | 159 | mru = new MRUList( stack ); |
160 | stack->raiseWidget( mru ); | 160 | stack->raiseWidget( mru ); |
161 | 161 | ||
162 | waitIcon = new Wait( this ); | 162 | waitIcon = new Wait( this ); |
163 | (void) new AppIcons( this ); | 163 | (void) new AppIcons( this ); |
164 | 164 | ||
165 | sysTray = new SysTray( this ); | 165 | sysTray = new SysTray( this ); |
166 | 166 | ||
167 | // ## make customizable in some way? | 167 | // ## make customizable in some way? |
168 | #ifdef QT_QWS_CUSTOM | 168 | #ifdef QT_QWS_CUSTOM |
169 | lockState = new LockKeyState( this ); | 169 | lockState = new LockKeyState( this ); |
170 | #else | 170 | #else |
171 | lockState = 0; | 171 | lockState = 0; |
172 | #endif | 172 | #endif |
173 | 173 | ||
174 | #if defined(Q_WS_QWS) | 174 | #if defined(Q_WS_QWS) |
175 | #if !defined(QT_NO_COP) | 175 | #if !defined(QT_NO_COP) |
176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
179 | #endif | 179 | #endif |
180 | #endif | 180 | #endif |
181 | waitTimer = new QTimer( this ); | 181 | waitTimer = new QTimer( this ); |
182 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 182 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
183 | clearer = new QTimer( this ); | 183 | clearer = new QTimer( this ); |
184 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 184 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
185 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); | 185 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); |
186 | } | 186 | } |
187 | 187 | ||
188 | void TaskBar::setStatusMessage( const QString &text ) | 188 | void TaskBar::setStatusMessage( const QString &text ) |
189 | { | 189 | { |
190 | label->setText( text ); | 190 | label->setText( text ); |
191 | stack->raiseWidget( label ); | 191 | stack->raiseWidget( label ); |
192 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 192 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
193 | sysTray->hide(); | 193 | sysTray->hide(); |
194 | clearer->start( 3000 ); | 194 | clearer->start( 3000 ); |
195 | } | 195 | } |
196 | 196 | ||
197 | void TaskBar::clearStatusBar() | 197 | void TaskBar::clearStatusBar() |
198 | { | 198 | { |
199 | label->clear(); | 199 | label->clear(); |
200 | stack->raiseWidget( mru ); | 200 | stack->raiseWidget( mru ); |
201 | } | 201 | } |
202 | 202 | ||
203 | void TaskBar::startWait() | 203 | void TaskBar::startWait() |
204 | { | 204 | { |
205 | waitIcon->setWaiting( true ); | 205 | waitIcon->setWaiting( true ); |
206 | // a catchall stop after 10 seconds... | 206 | // a catchall stop after 10 seconds... |
207 | waitTimer->start( 10 * 1000, true ); | 207 | waitTimer->start( 10 * 1000, true ); |
208 | } | 208 | } |
209 | 209 | ||
210 | void TaskBar::stopWait(const QString& app) | 210 | void TaskBar::stopWait(const QString& app) |
211 | { | 211 | { |
212 | waitTimer->stop(); | 212 | waitTimer->stop(); |
213 | mru->addTask(sm->execToLink(app)); | 213 | mru->addTask(sm->execToLink(app)); |
214 | waitIcon->setWaiting( false ); | 214 | waitIcon->setWaiting( false ); |
215 | } | 215 | } |
216 | 216 | ||
217 | void TaskBar::stopWait() | 217 | void TaskBar::stopWait() |
218 | { | 218 | { |
219 | waitTimer->stop(); | 219 | waitTimer->stop(); |
220 | waitIcon->setWaiting( false ); | 220 | waitIcon->setWaiting( false ); |
221 | } | 221 | } |
222 | 222 | ||
223 | void TaskBar::resizeEvent( QResizeEvent *e ) | 223 | void TaskBar::resizeEvent( QResizeEvent *e ) |
224 | { | 224 | { |
225 | QHBox::resizeEvent( e ); | 225 | QHBox::resizeEvent( e ); |
226 | calcMaxWindowRect(); | 226 | calcMaxWindowRect(); |
227 | } | 227 | } |
228 | 228 | ||
229 | void TaskBar::styleChange( QStyle &s ) | 229 | void TaskBar::styleChange( QStyle &s ) |
230 | { | 230 | { |
231 | QHBox::styleChange( s ); | 231 | QHBox::styleChange( s ); |
232 | calcMaxWindowRect(); | 232 | calcMaxWindowRect(); |
233 | } | 233 | } |
234 | 234 | ||
235 | void TaskBar::calcMaxWindowRect() | 235 | void TaskBar::calcMaxWindowRect() |
236 | { | 236 | { |
237 | #ifdef Q_WS_QWS | 237 | #ifdef Q_WS_QWS |
238 | QRect wr; | 238 | QRect wr; |
239 | int displayWidth = qApp->desktop()->width(); | 239 | int displayWidth = qApp->desktop()->width(); |
240 | QRect ir = inputMethods->inputRect(); | 240 | QRect ir = inputMethods->inputRect(); |
241 | if ( ir.isValid() ) { | 241 | if ( ir.isValid() ) { |
242 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 242 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
243 | } else { | 243 | } else { |
244 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); | 244 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); |
245 | } | 245 | } |
246 | 246 | ||
247 | #if QT_VERSION < 300 | 247 | #if QT_VERSION < 300 |
248 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 248 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
249 | QSize(qt_screen->width(),qt_screen->height())) | 249 | QSize(qt_screen->width(),qt_screen->height())) |
250 | ); | 250 | ); |
251 | #else | 251 | #else |
252 | QWSServer::setMaxWindowRect( wr ); | 252 | QWSServer::setMaxWindowRect( wr ); |
253 | #endif | 253 | #endif |
254 | #endif | 254 | #endif |
255 | } | 255 | } |
256 | 256 | ||
257 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 257 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) |
258 | { | 258 | { |
259 | QDataStream stream( data, IO_ReadOnly ); | 259 | QDataStream stream( data, IO_ReadOnly ); |
260 | if ( msg == "message(QString)" ) { | 260 | if ( msg == "message(QString)" ) { |
261 | QString text; | 261 | QString text; |
262 | stream >> text; | 262 | stream >> text; |
263 | setStatusMessage( text ); | 263 | setStatusMessage( text ); |
264 | } else if ( msg == "hideInputMethod()" ) { | 264 | } else if ( msg == "hideInputMethod()" ) { |
265 | inputMethods->hideInputMethod(); | 265 | inputMethods->hideInputMethod(); |
266 | } else if ( msg == "showInputMethod()" ) { | 266 | } else if ( msg == "showInputMethod()" ) { |
267 | inputMethods->showInputMethod(); | 267 | inputMethods->showInputMethod(); |
268 | } else if ( msg == "reloadInputMethods()" ) { | 268 | } else if ( msg == "reloadInputMethods()" ) { |
269 | inputMethods->loadInputMethods(); | 269 | inputMethods->loadInputMethods(); |
270 | } else if ( msg == "reloadApplets()" ) { | 270 | } else if ( msg == "reloadApplets()" ) { |
271 | sysTray->loadApplets(); | 271 | sysTray->loadApplets(); |
272 | } else if ( msg == "soundAlarm()" ) { | 272 | } else if ( msg == "soundAlarm()" ) { |
273 | Desktop::soundAlarm(); | 273 | Desktop::soundAlarm(); |
274 | } | 274 | } |
275 | #ifdef CUSTOM_LEDS | 275 | #ifdef CUSTOM_LEDS |
276 | else if ( msg == "setLed(int,bool)" ) { | 276 | else if ( msg == "setLed(int,bool)" ) { |
277 | int led, status; | 277 | int led, status; |
278 | stream >> led >> status; | 278 | stream >> led >> status; |
279 | CUSTOM_LEDS( led, status ); | 279 | CUSTOM_LEDS( led, status ); |
280 | } | 280 | } |
281 | #endif | 281 | #endif |
282 | } | 282 | } |
283 | 283 | ||
284 | QWidget *TaskBar::calibrate(bool) | 284 | QWidget *TaskBar::calibrate(bool) |
285 | { | 285 | { |
286 | #ifdef Q_WS_QWS | 286 | #ifdef Q_WS_QWS |
287 | Calibrate *c = new Calibrate; | 287 | Calibrate *c = new Calibrate; |
288 | c->show(); | 288 | c->show(); |
289 | return c; | 289 | return c; |
290 | #else | 290 | #else |
291 | return 0; | 291 | return 0; |
292 | #endif | 292 | #endif |
293 | } | 293 | } |
294 | 294 | ||
295 | void TaskBar::toggleNumLockState() | 295 | void TaskBar::toggleNumLockState() |
296 | { | 296 | { |
297 | if ( lockState ) lockState->toggleNumLockState(); | 297 | if ( lockState ) lockState->toggleNumLockState(); |
298 | } | 298 | } |
299 | 299 | ||
300 | void TaskBar::toggleCapsLockState() | 300 | void TaskBar::toggleCapsLockState() |
301 | { | 301 | { |
302 | if ( lockState ) lockState->toggleCapsLockState(); | 302 | if ( lockState ) lockState->toggleCapsLockState(); |
303 | } | 303 | } |
304 | 304 | ||
305 | void TaskBar::toggleSymbolInput() | 305 | void TaskBar::toggleSymbolInput() |
306 | { | 306 | { |
307 | if ( inputMethods->currentShown() == "Unicode" ) { | 307 | if ( inputMethods->currentShown() == "Unicode" ) { |
308 | inputMethods->hideInputMethod(); | 308 | inputMethods->hideInputMethod(); |
309 | } else { | 309 | } else { |
310 | inputMethods->showInputMethod("Unicode"); | 310 | inputMethods->showInputMethod("Unicode"); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | bool TaskBar::recoverMemory() | 314 | bool TaskBar::recoverMemory() |
315 | { | 315 | { |
316 | return mru->quitOldApps(); | 316 | return mru->quitOldApps(); |
317 | } | 317 | } |
318 | 318 | ||