-rw-r--r-- | core/launcher/desktop.cpp | 2 | ||||
-rw-r--r-- | core/launcher/main.cpp | 2 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 7 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 2 |
4 files changed, 5 insertions, 8 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 974de0c..aa51898 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,426 +1,426 @@ | |||
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 | 41 | ||
42 | #ifdef QT_QWS_CUSTOM | 42 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
43 | #include <qpe/custom.h> | 43 | #include <qpe/custom.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #include <qgfx_qws.h> | 46 | #include <qgfx_qws.h> |
47 | #include <qmainwindow.h> | 47 | #include <qmainwindow.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qtimer.h> | 49 | #include <qtimer.h> |
50 | #include <qwindowsystem_qws.h> | 50 | #include <qwindowsystem_qws.h> |
51 | 51 | ||
52 | #include <qvaluelist.h> | 52 | #include <qvaluelist.h> |
53 | 53 | ||
54 | #include <stdlib.h> | 54 | #include <stdlib.h> |
55 | #include <unistd.h> | 55 | #include <unistd.h> |
56 | 56 | ||
57 | class QCopKeyRegister | 57 | class QCopKeyRegister |
58 | { | 58 | { |
59 | public: | 59 | public: |
60 | QCopKeyRegister() : keyCode(0) { } | 60 | QCopKeyRegister() : keyCode(0) { } |
61 | QCopKeyRegister(int k, const QString &c, const QString &m) | 61 | QCopKeyRegister(int k, const QString &c, const QString &m) |
62 | : keyCode(k), channel(c), message(m) { } | 62 | : keyCode(k), channel(c), message(m) { } |
63 | 63 | ||
64 | int getKeyCode() const { return keyCode; } | 64 | int getKeyCode() const { return keyCode; } |
65 | QString getChannel() const { return channel; } | 65 | QString getChannel() const { return channel; } |
66 | QString getMessage() const { return message; } | 66 | QString getMessage() const { return message; } |
67 | 67 | ||
68 | private: | 68 | private: |
69 | int keyCode; | 69 | int keyCode; |
70 | QString channel, message; | 70 | QString channel, message; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 73 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
74 | KeyRegisterList keyRegisterList; | 74 | KeyRegisterList keyRegisterList; |
75 | 75 | ||
76 | static Desktop* qpedesktop = 0; | 76 | static Desktop* qpedesktop = 0; |
77 | static int loggedin=0; | 77 | static int loggedin=0; |
78 | static void login(bool at_poweron) | 78 | static void login(bool at_poweron) |
79 | { | 79 | { |
80 | if ( !loggedin ) { | 80 | if ( !loggedin ) { |
81 | Global::terminateBuiltin("calibrate"); | 81 | Global::terminateBuiltin("calibrate"); |
82 | Password::authenticate(at_poweron); | 82 | Password::authenticate(at_poweron); |
83 | loggedin=1; | 83 | loggedin=1; |
84 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 84 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | bool Desktop::screenLocked() | 88 | bool Desktop::screenLocked() |
89 | { | 89 | { |
90 | return loggedin == 0; | 90 | return loggedin == 0; |
91 | } | 91 | } |
92 | 92 | ||
93 | /* | 93 | /* |
94 | Priority is number of alerts that are needed to pop up | 94 | Priority is number of alerts that are needed to pop up |
95 | alert. | 95 | alert. |
96 | */ | 96 | */ |
97 | class DesktopPowerAlerter : public QMessageBox | 97 | class DesktopPowerAlerter : public QMessageBox |
98 | { | 98 | { |
99 | public: | 99 | public: |
100 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 100 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
101 | : QMessageBox( tr("Battery Status"), "Low Battery", | 101 | : QMessageBox( tr("Battery Status"), "Low Battery", |
102 | QMessageBox::Critical, | 102 | QMessageBox::Critical, |
103 | QMessageBox::Ok | QMessageBox::Default, | 103 | QMessageBox::Ok | QMessageBox::Default, |
104 | QMessageBox::NoButton, QMessageBox::NoButton, | 104 | QMessageBox::NoButton, QMessageBox::NoButton, |
105 | parent, name, FALSE ) | 105 | parent, name, FALSE ) |
106 | { | 106 | { |
107 | currentPriority = INT_MAX; | 107 | currentPriority = INT_MAX; |
108 | alertCount = 0; | 108 | alertCount = 0; |
109 | } | 109 | } |
110 | 110 | ||
111 | void alert( const QString &text, int priority ); | 111 | void alert( const QString &text, int priority ); |
112 | void hideEvent( QHideEvent * ); | 112 | void hideEvent( QHideEvent * ); |
113 | private: | 113 | private: |
114 | int currentPriority; | 114 | int currentPriority; |
115 | int alertCount; | 115 | int alertCount; |
116 | }; | 116 | }; |
117 | 117 | ||
118 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 118 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
119 | { | 119 | { |
120 | alertCount++; | 120 | alertCount++; |
121 | if ( alertCount < priority ) | 121 | if ( alertCount < priority ) |
122 | return; | 122 | return; |
123 | if ( priority > currentPriority ) | 123 | if ( priority > currentPriority ) |
124 | return; | 124 | return; |
125 | currentPriority = priority; | 125 | currentPriority = priority; |
126 | setText( text ); | 126 | setText( text ); |
127 | show(); | 127 | show(); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 131 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
132 | { | 132 | { |
133 | QMessageBox::hideEvent( e ); | 133 | QMessageBox::hideEvent( e ); |
134 | alertCount = 0; | 134 | alertCount = 0; |
135 | currentPriority = INT_MAX; | 135 | currentPriority = INT_MAX; |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 140 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
141 | : QPEApplication( argc, argv, appType ) | 141 | : QPEApplication( argc, argv, appType ) |
142 | { | 142 | { |
143 | 143 | ||
144 | QTimer *t = new QTimer( this ); | 144 | QTimer *t = new QTimer( this ); |
145 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); | 145 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); |
146 | t->start( 10000 ); | 146 | t->start( 10000 ); |
147 | ps = new PowerStatus; | 147 | ps = new PowerStatus; |
148 | pa = new DesktopPowerAlerter( 0 ); | 148 | pa = new DesktopPowerAlerter( 0 ); |
149 | 149 | ||
150 | channel = new QCopChannel( "QPE/Desktop", this ); | 150 | channel = new QCopChannel( "QPE/Desktop", this ); |
151 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 151 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
152 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 152 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | DesktopApplication::~DesktopApplication() | 156 | DesktopApplication::~DesktopApplication() |
157 | { | 157 | { |
158 | delete ps; | 158 | delete ps; |
159 | delete pa; | 159 | delete pa; |
160 | } | 160 | } |
161 | 161 | ||
162 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | 162 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) |
163 | { | 163 | { |
164 | QDataStream stream( data, IO_ReadOnly ); | 164 | QDataStream stream( data, IO_ReadOnly ); |
165 | if (msg == "keyRegister(int key, QString channel, QString message)") | 165 | if (msg == "keyRegister(int key, QString channel, QString message)") |
166 | { | 166 | { |
167 | int k; | 167 | int k; |
168 | QString c, m; | 168 | QString c, m; |
169 | stream >> k; | 169 | stream >> k; |
170 | stream >> c; | 170 | stream >> c; |
171 | stream >> m; | 171 | stream >> m; |
172 | 172 | ||
173 | 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 ); |
174 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 174 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
175 | } | 175 | } |
176 | else if (msg == "suspend()"){ | 176 | else if (msg == "suspend()"){ |
177 | emit power(); | 177 | emit power(); |
178 | } | 178 | } |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 182 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
183 | 183 | ||
184 | #ifdef Q_WS_QWS | 184 | #ifdef Q_WS_QWS |
185 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 185 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
186 | { | 186 | { |
187 | qpedesktop->checkMemory(); | 187 | qpedesktop->checkMemory(); |
188 | 188 | ||
189 | if ( e->type == QWSEvent::Key ) { | 189 | if ( e->type == QWSEvent::Key ) { |
190 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 190 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
191 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 191 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
192 | return TRUE; | 192 | return TRUE; |
193 | bool press = ke->simpleData.is_press; | 193 | bool press = ke->simpleData.is_press; |
194 | bool autoRepeat= ke->simpleData.is_auto_repeat; | 194 | bool autoRepeat= ke->simpleData.is_auto_repeat; |
195 | if (!keyRegisterList.isEmpty()) | 195 | if (!keyRegisterList.isEmpty()) |
196 | { | 196 | { |
197 | KeyRegisterList::Iterator it; | 197 | KeyRegisterList::Iterator it; |
198 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 198 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) |
199 | { | 199 | { |
200 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { | 200 | if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { |
201 | if(press) qDebug("press"); else qDebug("release"); | 201 | if(press) qDebug("press"); else qDebug("release"); |
202 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 202 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | if ( !keyboardGrabbed() ) { | 207 | if ( !keyboardGrabbed() ) { |
208 | if ( ke->simpleData.keycode == Key_F9 ) { | 208 | if ( ke->simpleData.keycode == Key_F9 ) { |
209 | if ( press ) emit datebook(); | 209 | if ( press ) emit datebook(); |
210 | return TRUE; | 210 | return TRUE; |
211 | } | 211 | } |
212 | if ( ke->simpleData.keycode == Key_F10 ) { | 212 | if ( ke->simpleData.keycode == Key_F10 ) { |
213 | if ( !press && cardSendTimer ) { | 213 | if ( !press && cardSendTimer ) { |
214 | emit contacts(); | 214 | emit contacts(); |
215 | delete cardSendTimer; | 215 | delete cardSendTimer; |
216 | } else if ( press ) { | 216 | } else if ( press ) { |
217 | cardSendTimer = new QTimer(); | 217 | cardSendTimer = new QTimer(); |
218 | cardSendTimer->start( 2000, TRUE ); | 218 | cardSendTimer->start( 2000, TRUE ); |
219 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 219 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
220 | } | 220 | } |
221 | return TRUE; | 221 | return TRUE; |
222 | } | 222 | } |
223 | /* menu key now opens application menu/toolbar | 223 | /* menu key now opens application menu/toolbar |
224 | if ( ke->simpleData.keycode == Key_F11 ) { | 224 | if ( ke->simpleData.keycode == Key_F11 ) { |
225 | if ( press ) emit menu(); | 225 | if ( press ) emit menu(); |
226 | return TRUE; | 226 | return TRUE; |
227 | } | 227 | } |
228 | */ | 228 | */ |
229 | if ( ke->simpleData.keycode == Key_F12 ) { | 229 | if ( ke->simpleData.keycode == Key_F12 ) { |
230 | while( activePopupWidget() ) | 230 | while( activePopupWidget() ) |
231 | activePopupWidget()->close(); | 231 | activePopupWidget()->close(); |
232 | if ( press ) emit launch(); | 232 | if ( press ) emit launch(); |
233 | return TRUE; | 233 | return TRUE; |
234 | } | 234 | } |
235 | if ( ke->simpleData.keycode == Key_F13 ) { | 235 | if ( ke->simpleData.keycode == Key_F13 ) { |
236 | if ( press ) emit email(); | 236 | if ( press ) emit email(); |
237 | return TRUE; | 237 | return TRUE; |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
241 | if ( ke->simpleData.keycode == Key_F34 ) { | 241 | if ( ke->simpleData.keycode == Key_F34 ) { |
242 | if ( press ) emit power(); | 242 | if ( press ) emit power(); |
243 | return TRUE; | 243 | return TRUE; |
244 | } | 244 | } |
245 | if ( ke->simpleData.keycode == Key_SysReq ) { | 245 | if ( ke->simpleData.keycode == Key_SysReq ) { |
246 | if ( press ) emit power(); | 246 | if ( press ) emit power(); |
247 | return TRUE; | 247 | return TRUE; |
248 | } | 248 | } |
249 | if ( ke->simpleData.keycode == Key_F35 ) { | 249 | if ( ke->simpleData.keycode == Key_F35 ) { |
250 | if ( press ) emit backlight(); | 250 | if ( press ) emit backlight(); |
251 | return TRUE; | 251 | return TRUE; |
252 | } | 252 | } |
253 | if ( ke->simpleData.keycode == Key_F32 ) { | 253 | if ( ke->simpleData.keycode == Key_F32 ) { |
254 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 254 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
255 | return TRUE; | 255 | return TRUE; |
256 | } | 256 | } |
257 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 257 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
258 | if ( press ) emit symbol(); | 258 | if ( press ) emit symbol(); |
259 | return TRUE; | 259 | return TRUE; |
260 | } | 260 | } |
261 | if ( ke->simpleData.keycode == Key_NumLock ) { | 261 | if ( ke->simpleData.keycode == Key_NumLock ) { |
262 | if ( press ) emit numLockStateToggle(); | 262 | if ( press ) emit numLockStateToggle(); |
263 | } | 263 | } |
264 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 264 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
265 | if ( press ) emit capsLockStateToggle(); | 265 | if ( press ) emit capsLockStateToggle(); |
266 | } | 266 | } |
267 | if ( press ) | 267 | if ( press ) |
268 | qpedesktop->keyClick(); | 268 | qpedesktop->keyClick(); |
269 | } else { | 269 | } else { |
270 | if ( e->type == QWSEvent::Mouse ) { | 270 | if ( e->type == QWSEvent::Mouse ) { |
271 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 271 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
272 | static bool up = TRUE; | 272 | static bool up = TRUE; |
273 | if ( me->simpleData.state&LeftButton ) { | 273 | if ( me->simpleData.state&LeftButton ) { |
274 | if ( up ) { | 274 | if ( up ) { |
275 | up = FALSE; | 275 | up = FALSE; |
276 | qpedesktop->screenClick(); | 276 | qpedesktop->screenClick(); |
277 | } | 277 | } |
278 | } else { | 278 | } else { |
279 | up = TRUE; | 279 | up = TRUE; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | return QPEApplication::qwsEventFilter( e ); | 284 | return QPEApplication::qwsEventFilter( e ); |
285 | } | 285 | } |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | void DesktopApplication::psTimeout() | 288 | void DesktopApplication::psTimeout() |
289 | { | 289 | { |
290 | qpedesktop->checkMemory(); // in case no events are being generated | 290 | qpedesktop->checkMemory(); // in case no events are being generated |
291 | 291 | ||
292 | *ps = PowerStatusManager::readStatus(); | 292 | *ps = PowerStatusManager::readStatus(); |
293 | 293 | ||
294 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { | 294 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { |
295 | pa->alert( tr( "Battery is running very low." ), 6 ); | 295 | pa->alert( tr( "Battery is running very low." ), 6 ); |
296 | } | 296 | } |
297 | 297 | ||
298 | if ( ps->batteryStatus() == PowerStatus::Critical ) { | 298 | if ( ps->batteryStatus() == PowerStatus::Critical ) { |
299 | pa->alert( tr( "Battery level is critical!\n" | 299 | pa->alert( tr( "Battery level is critical!\n" |
300 | "Keep power off until power restored!" ), 1 ); | 300 | "Keep power off until power restored!" ), 1 ); |
301 | } | 301 | } |
302 | 302 | ||
303 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { | 303 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { |
304 | 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 ); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | void DesktopApplication::sendCard() | 309 | void DesktopApplication::sendCard() |
310 | { | 310 | { |
311 | delete cardSendTimer; | 311 | delete cardSendTimer; |
312 | cardSendTimer = 0; | 312 | cardSendTimer = 0; |
313 | QString card = getenv("HOME"); | 313 | QString card = getenv("HOME"); |
314 | card += "/Applications/addressbook/businesscard.vcf"; | 314 | card += "/Applications/addressbook/businesscard.vcf"; |
315 | 315 | ||
316 | if ( QFile::exists( card ) ) { | 316 | if ( QFile::exists( card ) ) { |
317 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); | 317 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); |
318 | QString mimetype = "text/x-vCard"; | 318 | QString mimetype = "text/x-vCard"; |
319 | e << tr("business card") << card << mimetype; | 319 | e << tr("business card") << card << mimetype; |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | #if defined(QPE_HAVE_MEMALERTER) | 323 | #if defined(QPE_HAVE_MEMALERTER) |
324 | QPE_MEMALERTER_IMPL | 324 | QPE_MEMALERTER_IMPL |
325 | #endif | 325 | #endif |
326 | 326 | ||
327 | #if defined(CUSTOM_SOUND_IMPL) | 327 | #if defined(CUSTOM_SOUND_IMPL) |
328 | CUSTOM_SOUND_IMPL | 328 | CUSTOM_SOUND_IMPL |
329 | #endif | 329 | #endif |
330 | 330 | ||
331 | //=========================================================================== | 331 | //=========================================================================== |
332 | 332 | ||
333 | Desktop::Desktop() : | 333 | Desktop::Desktop() : |
334 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 334 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
335 | qcopBridge( 0 ), | 335 | qcopBridge( 0 ), |
336 | transferServer( 0 ), | 336 | transferServer( 0 ), |
337 | packageSlave( 0 ) | 337 | packageSlave( 0 ) |
338 | { | 338 | { |
339 | #ifdef CUSTOM_SOUND_INIT | 339 | #ifdef CUSTOM_SOUND_INIT |
340 | CUSTOM_SOUND_INIT; | 340 | CUSTOM_SOUND_INIT; |
341 | #endif | 341 | #endif |
342 | 342 | ||
343 | qpedesktop = this; | 343 | qpedesktop = this; |
344 | 344 | ||
345 | // bg = new Info( this ); | 345 | // bg = new Info( this ); |
346 | tb = new TaskBar; | 346 | tb = new TaskBar; |
347 | 347 | ||
348 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 348 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
349 | 349 | ||
350 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); | 350 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); |
351 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); | 351 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); |
352 | 352 | ||
353 | int displayw = qApp->desktop()->width(); | 353 | int displayw = qApp->desktop()->width(); |
354 | int displayh = qApp->desktop()->height(); | 354 | int displayh = qApp->desktop()->height(); |
355 | 355 | ||
356 | 356 | ||
357 | QSize sz = tb->sizeHint(); | 357 | QSize sz = tb->sizeHint(); |
358 | 358 | ||
359 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 359 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
360 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 360 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
361 | 361 | ||
362 | tb->show(); | 362 | tb->show(); |
363 | launcher->showMaximized(); | 363 | launcher->showMaximized(); |
364 | launcher->show(); | 364 | launcher->show(); |
365 | launcher->raise(); | 365 | launcher->raise(); |
366 | #if defined(QPE_HAVE_MEMALERTER) | 366 | #if defined(QPE_HAVE_MEMALERTER) |
367 | initMemalerter(); | 367 | initMemalerter(); |
368 | #endif | 368 | #endif |
369 | // start services | 369 | // start services |
370 | startTransferServer(); | 370 | startTransferServer(); |
371 | (void) new IrServer( this ); | 371 | (void) new IrServer( this ); |
372 | rereadVolumes(); | 372 | rereadVolumes(); |
373 | 373 | ||
374 | packageSlave = new PackageSlave( this ); | 374 | packageSlave = new PackageSlave( this ); |
375 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); | 375 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); |
376 | 376 | ||
377 | qApp->installEventFilter( this ); | 377 | qApp->installEventFilter( this ); |
378 | } | 378 | } |
379 | 379 | ||
380 | void Desktop::show() | 380 | void Desktop::show() |
381 | { | 381 | { |
382 | login(TRUE); | 382 | login(TRUE); |
383 | QWidget::show(); | 383 | QWidget::show(); |
384 | } | 384 | } |
385 | 385 | ||
386 | Desktop::~Desktop() | 386 | Desktop::~Desktop() |
387 | { | 387 | { |
388 | delete launcher; | 388 | delete launcher; |
389 | delete tb; | 389 | delete tb; |
390 | delete qcopBridge; | 390 | delete qcopBridge; |
391 | delete transferServer; | 391 | delete transferServer; |
392 | } | 392 | } |
393 | 393 | ||
394 | bool Desktop::recoverMemory() | 394 | bool Desktop::recoverMemory() |
395 | { | 395 | { |
396 | return tb->recoverMemory(); | 396 | return tb->recoverMemory(); |
397 | } | 397 | } |
398 | 398 | ||
399 | void Desktop::checkMemory() | 399 | void Desktop::checkMemory() |
400 | { | 400 | { |
401 | #if defined(QPE_HAVE_MEMALERTER) | 401 | #if defined(QPE_HAVE_MEMALERTER) |
402 | static bool ignoreNormal=FALSE; | 402 | static bool ignoreNormal=FALSE; |
403 | static bool existingMessage=FALSE; | 403 | static bool existingMessage=FALSE; |
404 | 404 | ||
405 | if(existingMessage) | 405 | if(existingMessage) |
406 | return; // don't show a second message while still on first | 406 | return; // don't show a second message while still on first |
407 | 407 | ||
408 | existingMessage = TRUE; | 408 | existingMessage = TRUE; |
409 | switch ( memstate ) { | 409 | switch ( memstate ) { |
410 | case Unknown: | 410 | case Unknown: |
411 | break; | 411 | break; |
412 | case Low: | 412 | case Low: |
413 | memstate = Unknown; | 413 | memstate = Unknown; |
414 | if ( recoverMemory() ) | 414 | if ( recoverMemory() ) |
415 | ignoreNormal = TRUE; | 415 | ignoreNormal = TRUE; |
416 | else | 416 | else |
417 | QMessageBox::warning( 0 , "Memory Status", | 417 | QMessageBox::warning( 0 , "Memory Status", |
418 | "The memory smacks of shortage. \n" | 418 | "The memory smacks of shortage. \n" |
419 | "Please save data. " ); | 419 | "Please save data. " ); |
420 | break; | 420 | break; |
421 | case Normal: | 421 | case Normal: |
422 | memstate = Unknown; | 422 | memstate = Unknown; |
423 | if ( ignoreNormal ) | 423 | if ( ignoreNormal ) |
424 | ignoreNormal = FALSE; | 424 | ignoreNormal = FALSE; |
425 | else | 425 | else |
426 | QMessageBox::information ( 0 , "Memory Status", | 426 | QMessageBox::information ( 0 , "Memory Status", |
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 12c2a7c..fc6d829 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -1,276 +1,276 @@ | |||
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 "taskbar.h" | 22 | #include "taskbar.h" |
23 | #include "stabmon.h" | 23 | #include "stabmon.h" |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/network.h> | 26 | #include <qpe/network.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #ifdef QT_QWS_CUSTOM | 28 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
29 | #include <qpe/custom.h> | 29 | #include <qpe/custom.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qwindowsystem_qws.h> | 33 | #include <qwindowsystem_qws.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/alarmserver.h> | 35 | #include <qpe/alarmserver.h> |
36 | 36 | ||
37 | #include <stdlib.h> | 37 | #include <stdlib.h> |
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | #include <signal.h> | 39 | #include <signal.h> |
40 | #include <unistd.h> | 40 | #include <unistd.h> |
41 | 41 | ||
42 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 42 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
43 | #include "../calibrate/calibrate.h" | 43 | #include "../calibrate/calibrate.h" |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef QT_QWS_LOGIN | 46 | #ifdef QT_QWS_LOGIN |
47 | #include "../login/qdmdialogimpl.h" | 47 | #include "../login/qdmdialogimpl.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifdef QT_QWS_CASSIOPEIA | 50 | #ifdef QT_QWS_CASSIOPEIA |
51 | static void ignoreMessage( QtMsgType, const char * ) | 51 | static void ignoreMessage( QtMsgType, const char * ) |
52 | { | 52 | { |
53 | } | 53 | } |
54 | #include <sys/mount.h> | 54 | #include <sys/mount.h> |
55 | #include <sys/types.h> | 55 | #include <sys/types.h> |
56 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
57 | #include <sys/time.h> | 57 | #include <sys/time.h> |
58 | #include <fcntl.h> | 58 | #include <fcntl.h> |
59 | #include <qdatetime.h> | 59 | #include <qdatetime.h> |
60 | 60 | ||
61 | void initCassiopeia() | 61 | void initCassiopeia() |
62 | { | 62 | { |
63 | // MIPSEL-specific init - make sure /proc exists for shm | 63 | // MIPSEL-specific init - make sure /proc exists for shm |
64 | /* | 64 | /* |
65 | if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) { | 65 | if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) { |
66 | perror("Remounting - / read/write"); | 66 | perror("Remounting - / read/write"); |
67 | } | 67 | } |
68 | */ | 68 | */ |
69 | if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) { | 69 | if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) { |
70 | perror("mounting ramfs /tmp"); | 70 | perror("mounting ramfs /tmp"); |
71 | } else { | 71 | } else { |
72 | fprintf( stderr, "mounted /tmp\n" ); | 72 | fprintf( stderr, "mounted /tmp\n" ); |
73 | } | 73 | } |
74 | if ( mount("none", "/home", "ramfs", 0, 0 ) ) { | 74 | if ( mount("none", "/home", "ramfs", 0, 0 ) ) { |
75 | perror("mounting ramfs /home"); | 75 | perror("mounting ramfs /home"); |
76 | } else { | 76 | } else { |
77 | fprintf( stderr, "mounted /home\n" ); | 77 | fprintf( stderr, "mounted /home\n" ); |
78 | } | 78 | } |
79 | if ( mount("none","/proc","proc",0,0) ) { | 79 | if ( mount("none","/proc","proc",0,0) ) { |
80 | perror("Mounting - /proc"); | 80 | perror("Mounting - /proc"); |
81 | } else { | 81 | } else { |
82 | fprintf( stderr, "mounted /proc\n" ); | 82 | fprintf( stderr, "mounted /proc\n" ); |
83 | } | 83 | } |
84 | if ( mount("none","/mnt","shm",0,0) ) { | 84 | if ( mount("none","/mnt","shm",0,0) ) { |
85 | perror("Mounting - shm"); | 85 | perror("Mounting - shm"); |
86 | } | 86 | } |
87 | setenv( "QTDIR", "/", 1 ); | 87 | setenv( "QTDIR", "/", 1 ); |
88 | setenv( "OPIEDIR", "/", 1 ); | 88 | setenv( "OPIEDIR", "/", 1 ); |
89 | setenv( "HOME", "/home", 1 ); | 89 | setenv( "HOME", "/home", 1 ); |
90 | mkdir( "/home/Documents", 0755 ); | 90 | mkdir( "/home/Documents", 0755 ); |
91 | 91 | ||
92 | // set a reasonable starting date | 92 | // set a reasonable starting date |
93 | QDateTime dt( QDate( 2001, 3, 15 ) ); | 93 | QDateTime dt( QDate( 2001, 3, 15 ) ); |
94 | QDateTime now = QDateTime::currentDateTime(); | 94 | QDateTime now = QDateTime::currentDateTime(); |
95 | int change = now.secsTo( dt ); | 95 | int change = now.secsTo( dt ); |
96 | 96 | ||
97 | time_t t = ::time(0); | 97 | time_t t = ::time(0); |
98 | t += change; | 98 | t += change; |
99 | stime(&t); | 99 | stime(&t); |
100 | 100 | ||
101 | qInstallMsgHandler(ignoreMessage); | 101 | qInstallMsgHandler(ignoreMessage); |
102 | } | 102 | } |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | #ifdef QPE_OWNAPM | 105 | #ifdef QPE_OWNAPM |
106 | #include <sys/ioctl.h> | 106 | #include <sys/ioctl.h> |
107 | #include <sys/types.h> | 107 | #include <sys/types.h> |
108 | #include <fcntl.h> | 108 | #include <fcntl.h> |
109 | #include <unistd.h> | 109 | #include <unistd.h> |
110 | #include <errno.h> | 110 | #include <errno.h> |
111 | #include <linux/ioctl.h> | 111 | #include <linux/ioctl.h> |
112 | #include <qpe/global.h> | 112 | #include <qpe/global.h> |
113 | 113 | ||
114 | static void disableAPM() | 114 | static void disableAPM() |
115 | { | 115 | { |
116 | 116 | ||
117 | int fd, cur_val, ret; | 117 | int fd, cur_val, ret; |
118 | char *device = "/dev/apm_bios"; | 118 | char *device = "/dev/apm_bios"; |
119 | 119 | ||
120 | fd = open (device, O_WRONLY); | 120 | fd = open (device, O_WRONLY); |
121 | 121 | ||
122 | if (fd == -1) { | 122 | if (fd == -1) { |
123 | perror(device); | 123 | perror(device); |
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | 126 | ||
127 | cur_val = ioctl(fd, APM_IOCGEVTSRC, 0); | 127 | cur_val = ioctl(fd, APM_IOCGEVTSRC, 0); |
128 | if (cur_val == -1) { | 128 | if (cur_val == -1) { |
129 | perror("ioctl"); | 129 | perror("ioctl"); |
130 | exit(errno); | 130 | exit(errno); |
131 | } | 131 | } |
132 | 132 | ||
133 | ret = ioctl(fd, APM_IOCSEVTSRC, cur_val & ~APM_EVT_POWER_BUTTON); | 133 | ret = ioctl(fd, APM_IOCSEVTSRC, cur_val & ~APM_EVT_POWER_BUTTON); |
134 | if (ret == -1) { | 134 | if (ret == -1) { |
135 | perror("ioctl"); | 135 | perror("ioctl"); |
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | close(fd); | 138 | close(fd); |
139 | } | 139 | } |
140 | 140 | ||
141 | static void initAPM() | 141 | static void initAPM() |
142 | { | 142 | { |
143 | // So that we have to do it ourself, but better. | 143 | // So that we have to do it ourself, but better. |
144 | disableAPM(); | 144 | disableAPM(); |
145 | } | 145 | } |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #ifdef QT_DEMO_SINGLE_FLOPPY | 148 | #ifdef QT_DEMO_SINGLE_FLOPPY |
149 | #include <sys/mount.h> | 149 | #include <sys/mount.h> |
150 | 150 | ||
151 | void initFloppy() | 151 | void initFloppy() |
152 | { | 152 | { |
153 | mount("none","/proc","proc",0,0); | 153 | mount("none","/proc","proc",0,0); |
154 | setenv( "QTDIR", "/", 0 ); | 154 | setenv( "QTDIR", "/", 0 ); |
155 | setenv( "HOME", "/root", 0 ); | 155 | setenv( "HOME", "/root", 0 ); |
156 | setenv( "QWS_SIZE", "240x320", 0 ); | 156 | setenv( "QWS_SIZE", "240x320", 0 ); |
157 | } | 157 | } |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | 160 | ||
161 | void initEnvironment() | 161 | void initEnvironment() |
162 | { | 162 | { |
163 | Config config("locale"); | 163 | Config config("locale"); |
164 | config.setGroup( "Location" ); | 164 | config.setGroup( "Location" ); |
165 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 165 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
166 | 166 | ||
167 | // if not timezone set, pick New York | 167 | // if not timezone set, pick New York |
168 | if (tz.isNull()) | 168 | if (tz.isNull()) |
169 | tz = "America/New_York"; | 169 | tz = "America/New_York"; |
170 | 170 | ||
171 | setenv( "TZ", tz, 1 ); | 171 | setenv( "TZ", tz, 1 ); |
172 | config.writeEntry( "Timezone", tz); | 172 | config.writeEntry( "Timezone", tz); |
173 | 173 | ||
174 | config.setGroup( "Language" ); | 174 | config.setGroup( "Language" ); |
175 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 175 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
176 | if ( !lang.isNull() ) | 176 | if ( !lang.isNull() ) |
177 | setenv( "LANG", lang, 1 ); | 177 | setenv( "LANG", lang, 1 ); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void initBacklight() | 180 | static void initBacklight() |
181 | { | 181 | { |
182 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 182 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
183 | e << -3; // Forced on | 183 | e << -3; // Forced on |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | int initApplication( int argc, char ** argv ) | 188 | int initApplication( int argc, char ** argv ) |
189 | { | 189 | { |
190 | #ifdef QT_QWS_CASSIOPEIA | 190 | #ifdef QT_QWS_CASSIOPEIA |
191 | initCassiopeia(); | 191 | initCassiopeia(); |
192 | #endif | 192 | #endif |
193 | 193 | ||
194 | #ifdef QPE_OWNAPM | 194 | #ifdef QPE_OWNAPM |
195 | initAPM(); | 195 | initAPM(); |
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | #ifdef QT_DEMO_SINGLE_FLOPPY | 198 | #ifdef QT_DEMO_SINGLE_FLOPPY |
199 | initFloppy(); | 199 | initFloppy(); |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | initEnvironment(); | 202 | initEnvironment(); |
203 | 203 | ||
204 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 204 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
205 | setenv( "QWS_SIZE", "240x320", 0 ); | 205 | setenv( "QWS_SIZE", "240x320", 0 ); |
206 | #endif | 206 | #endif |
207 | 207 | ||
208 | //Don't flicker at startup: | 208 | //Don't flicker at startup: |
209 | QWSServer::setDesktopBackground( QImage() ); | 209 | QWSServer::setDesktopBackground( QImage() ); |
210 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 210 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
211 | 211 | ||
212 | initBacklight(); | 212 | initBacklight(); |
213 | 213 | ||
214 | AlarmServer::initialize(); | 214 | AlarmServer::initialize(); |
215 | 215 | ||
216 | #if defined(QT_QWS_LOGIN) | 216 | #if defined(QT_QWS_LOGIN) |
217 | for( int i=0; i<a.argc(); i++ ) | 217 | for( int i=0; i<a.argc(); i++ ) |
218 | if( strcmp( a.argv()[i], "-login" ) == 0 ) { | 218 | if( strcmp( a.argv()[i], "-login" ) == 0 ) { |
219 | QDMDialogImpl::login( ); | 219 | QDMDialogImpl::login( ); |
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | Desktop *d = new Desktop(); | 224 | Desktop *d = new Desktop(); |
225 | 225 | ||
226 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); | 226 | QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); |
227 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); | 227 | QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); |
228 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); | 228 | QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); |
229 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); | 229 | QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); |
230 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 230 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
231 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 231 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
232 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 232 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
233 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 233 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
234 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 234 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
235 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 235 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
236 | 236 | ||
237 | (void)new SysFileMonitor(d); | 237 | (void)new SysFileMonitor(d); |
238 | Network::createServer(d); | 238 | Network::createServer(d); |
239 | 239 | ||
240 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 240 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
241 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 241 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
242 | // Make sure calibration widget starts on top. | 242 | // Make sure calibration widget starts on top. |
243 | Calibrate *cal = new Calibrate; | 243 | Calibrate *cal = new Calibrate; |
244 | cal->exec(); | 244 | cal->exec(); |
245 | delete cal; | 245 | delete cal; |
246 | } | 246 | } |
247 | #endif | 247 | #endif |
248 | 248 | ||
249 | d->show(); | 249 | d->show(); |
250 | 250 | ||
251 | int rv = a.exec(); | 251 | int rv = a.exec(); |
252 | 252 | ||
253 | delete d; | 253 | delete d; |
254 | 254 | ||
255 | return rv; | 255 | return rv; |
256 | } | 256 | } |
257 | 257 | ||
258 | int main( int argc, char ** argv ) | 258 | int main( int argc, char ** argv ) |
259 | { | 259 | { |
260 | #ifndef SINGLE_APP | 260 | #ifndef SINGLE_APP |
261 | signal( SIGCHLD, SIG_IGN ); | 261 | signal( SIGCHLD, SIG_IGN ); |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | int retVal = initApplication( argc, argv ); | 264 | int retVal = initApplication( argc, argv ); |
265 | 265 | ||
266 | #ifndef SINGLE_APP | 266 | #ifndef SINGLE_APP |
267 | // Kill them. Kill them all. | 267 | // Kill them. Kill them all. |
268 | setpgid( getpid(), getppid() ); | 268 | setpgid( getpid(), getppid() ); |
269 | killpg( getpid(), SIGTERM ); | 269 | killpg( getpid(), SIGTERM ); |
270 | sleep( 1 ); | 270 | sleep( 1 ); |
271 | killpg( getpid(), SIGKILL ); | 271 | killpg( getpid(), SIGKILL ); |
272 | #endif | 272 | #endif |
273 | 273 | ||
274 | return retVal; | 274 | return retVal; |
275 | } | 275 | } |
276 | 276 | ||
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index bff2a1c..5e95c99 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,318 +1,315 @@ | |||
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 | |
36 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) | ||
36 | #include <qpe/custom.h> | 37 | #include <qpe/custom.h> |
37 | #endif | 38 | #endif |
38 | #if defined(QT_QWS_IPAQ) | ||
39 | #include "qpe/custom-ipaq.h" | ||
40 | #endif | ||
41 | |||
42 | 39 | ||
43 | #include <qlabel.h> | 40 | #include <qlabel.h> |
44 | #include <qlayout.h> | 41 | #include <qlayout.h> |
45 | #include <qtimer.h> | 42 | #include <qtimer.h> |
46 | #include <qwindowsystem_qws.h> | 43 | #include <qwindowsystem_qws.h> |
47 | #include <qwidgetstack.h> | 44 | #include <qwidgetstack.h> |
48 | 45 | ||
49 | #if defined( Q_WS_QWS ) | 46 | #if defined( Q_WS_QWS ) |
50 | #include <qwsdisplay_qws.h> | 47 | #include <qwsdisplay_qws.h> |
51 | #include <qgfx_qws.h> | 48 | #include <qgfx_qws.h> |
52 | #endif | 49 | #endif |
53 | 50 | ||
54 | 51 | ||
55 | #define FACTORY(T) \ | 52 | #define FACTORY(T) \ |
56 | static QWidget *new##T( bool maximized ) { \ | 53 | static QWidget *new##T( bool maximized ) { \ |
57 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 54 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
58 | if ( maximized ) { \ | 55 | if ( maximized ) { \ |
59 | if ( qApp->desktop()->width() <= 350 ) { \ | 56 | if ( qApp->desktop()->width() <= 350 ) { \ |
60 | w->showMaximized(); \ | 57 | w->showMaximized(); \ |
61 | } else { \ | 58 | } else { \ |
62 | w->resize( QSize( 300, 300 ) ); \ | 59 | w->resize( QSize( 300, 300 ) ); \ |
63 | } \ | 60 | } \ |
64 | } \ | 61 | } \ |
65 | w->show(); \ | 62 | w->show(); \ |
66 | return w; \ | 63 | return w; \ |
67 | } | 64 | } |
68 | 65 | ||
69 | 66 | ||
70 | #ifdef SINGLE_APP | 67 | #ifdef SINGLE_APP |
71 | #define APP(a,b,c,d) FACTORY(b) | 68 | #define APP(a,b,c,d) FACTORY(b) |
72 | #include "../launcher/apps.h" | 69 | #include "../launcher/apps.h" |
73 | #undef APP | 70 | #undef APP |
74 | #endif // SINGLE_APP | 71 | #endif // SINGLE_APP |
75 | 72 | ||
76 | static Global::Command builtins[] = { | 73 | static Global::Command builtins[] = { |
77 | 74 | ||
78 | #ifdef SINGLE_APP | 75 | #ifdef SINGLE_APP |
79 | #define APP(a,b,c,d) { a, new##b, c }, | 76 | #define APP(a,b,c,d) { a, new##b, c }, |
80 | #include "../launcher/apps.h" | 77 | #include "../launcher/apps.h" |
81 | #undef APP | 78 | #undef APP |
82 | #endif | 79 | #endif |
83 | 80 | ||
84 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) | 81 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) |
85 | { "calibrate", TaskBar::calibrate, 1, 0 }, | 82 | { "calibrate", TaskBar::calibrate, 1, 0 }, |
86 | #endif | 83 | #endif |
87 | #if !defined(QT_QWS_CASSIOPEIA) | 84 | #if !defined(QT_QWS_CASSIOPEIA) |
88 | { "shutdown", Global::shutdown, 1, 0 }, | 85 | { "shutdown", Global::shutdown, 1, 0 }, |
89 | // { "run", run, 1, 0 }, | 86 | // { "run", run, 1, 0 }, |
90 | #endif | 87 | #endif |
91 | 88 | ||
92 | { 0, TaskBar::calibrate, 0, 0 }, | 89 | { 0, TaskBar::calibrate, 0, 0 }, |
93 | }; | 90 | }; |
94 | 91 | ||
95 | static bool initNumLock() | 92 | static bool initNumLock() |
96 | { | 93 | { |
97 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 94 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
98 | QPE_INITIAL_NUMLOCK_STATE | 95 | QPE_INITIAL_NUMLOCK_STATE |
99 | #endif | 96 | #endif |
100 | return FALSE; | 97 | return FALSE; |
101 | } | 98 | } |
102 | 99 | ||
103 | class LockKeyState : public QWidget | 100 | class LockKeyState : public QWidget |
104 | { | 101 | { |
105 | public: | 102 | public: |
106 | LockKeyState( QWidget *parent ) : | 103 | LockKeyState( QWidget *parent ) : |
107 | QWidget(parent), | 104 | QWidget(parent), |
108 | nl(initNumLock()), cl(FALSE) | 105 | nl(initNumLock()), cl(FALSE) |
109 | { | 106 | { |
110 | nl_pm = Resource::loadPixmap("numlock"); | 107 | nl_pm = Resource::loadPixmap("numlock"); |
111 | cl_pm = Resource::loadPixmap("capslock"); | 108 | cl_pm = Resource::loadPixmap("capslock"); |
112 | } | 109 | } |
113 | QSize sizeHint() const | 110 | QSize sizeHint() const |
114 | { | 111 | { |
115 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); | 112 | return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); |
116 | } | 113 | } |
117 | void toggleNumLockState() | 114 | void toggleNumLockState() |
118 | { | 115 | { |
119 | nl = !nl; repaint(); | 116 | nl = !nl; repaint(); |
120 | } | 117 | } |
121 | void toggleCapsLockState() | 118 | void toggleCapsLockState() |
122 | { | 119 | { |
123 | cl = !cl; repaint(); | 120 | cl = !cl; repaint(); |
124 | } | 121 | } |
125 | void paintEvent( QPaintEvent * ) | 122 | void paintEvent( QPaintEvent * ) |
126 | { | 123 | { |
127 | int y = (height()-sizeHint().height())/2; | 124 | int y = (height()-sizeHint().height())/2; |
128 | QPainter p(this); | 125 | QPainter p(this); |
129 | if ( nl ) | 126 | if ( nl ) |
130 | p.drawPixmap(1,y,nl_pm); | 127 | p.drawPixmap(1,y,nl_pm); |
131 | if ( cl ) | 128 | if ( cl ) |
132 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 129 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
133 | } | 130 | } |
134 | private: | 131 | private: |
135 | QPixmap nl_pm, cl_pm; | 132 | QPixmap nl_pm, cl_pm; |
136 | bool nl, cl; | 133 | bool nl, cl; |
137 | }; | 134 | }; |
138 | 135 | ||
139 | TaskBar::~TaskBar() | 136 | TaskBar::~TaskBar() |
140 | { | 137 | { |
141 | } | 138 | } |
142 | 139 | ||
143 | 140 | ||
144 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) | 141 | TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) |
145 | { | 142 | { |
146 | Global::setBuiltinCommands(builtins); | 143 | Global::setBuiltinCommands(builtins); |
147 | 144 | ||
148 | sm = new StartMenu( this ); | 145 | sm = new StartMenu( this ); |
149 | 146 | ||
150 | inputMethods = new InputMethods( this ); | 147 | inputMethods = new InputMethods( this ); |
151 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 148 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
152 | this, SLOT(calcMaxWindowRect()) ); | 149 | this, SLOT(calcMaxWindowRect()) ); |
153 | //new QuickLauncher( this ); | 150 | //new QuickLauncher( this ); |
154 | 151 | ||
155 | stack = new QWidgetStack( this ); | 152 | stack = new QWidgetStack( this ); |
156 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 153 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
157 | label = new QLabel(stack); | 154 | label = new QLabel(stack); |
158 | 155 | ||
159 | mru = new MRUList( stack ); | 156 | mru = new MRUList( stack ); |
160 | stack->raiseWidget( mru ); | 157 | stack->raiseWidget( mru ); |
161 | 158 | ||
162 | waitIcon = new Wait( this ); | 159 | waitIcon = new Wait( this ); |
163 | (void) new AppIcons( this ); | 160 | (void) new AppIcons( this ); |
164 | 161 | ||
165 | sysTray = new SysTray( this ); | 162 | sysTray = new SysTray( this ); |
166 | 163 | ||
167 | // ## make customizable in some way? | 164 | // ## make customizable in some way? |
168 | #ifdef QT_QWS_CUSTOM | 165 | #ifdef QT_QWS_CUSTOM |
169 | lockState = new LockKeyState( this ); | 166 | lockState = new LockKeyState( this ); |
170 | #else | 167 | #else |
171 | lockState = 0; | 168 | lockState = 0; |
172 | #endif | 169 | #endif |
173 | 170 | ||
174 | #if defined(Q_WS_QWS) | 171 | #if defined(Q_WS_QWS) |
175 | #if !defined(QT_NO_COP) | 172 | #if !defined(QT_NO_COP) |
176 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 173 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
177 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 174 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
178 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 175 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
179 | #endif | 176 | #endif |
180 | #endif | 177 | #endif |
181 | waitTimer = new QTimer( this ); | 178 | waitTimer = new QTimer( this ); |
182 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 179 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
183 | clearer = new QTimer( this ); | 180 | clearer = new QTimer( this ); |
184 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 181 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
185 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); | 182 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); |
186 | } | 183 | } |
187 | 184 | ||
188 | void TaskBar::setStatusMessage( const QString &text ) | 185 | void TaskBar::setStatusMessage( const QString &text ) |
189 | { | 186 | { |
190 | label->setText( text ); | 187 | label->setText( text ); |
191 | stack->raiseWidget( label ); | 188 | stack->raiseWidget( label ); |
192 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 189 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
193 | sysTray->hide(); | 190 | sysTray->hide(); |
194 | clearer->start( 3000 ); | 191 | clearer->start( 3000 ); |
195 | } | 192 | } |
196 | 193 | ||
197 | void TaskBar::clearStatusBar() | 194 | void TaskBar::clearStatusBar() |
198 | { | 195 | { |
199 | label->clear(); | 196 | label->clear(); |
200 | stack->raiseWidget( mru ); | 197 | stack->raiseWidget( mru ); |
201 | } | 198 | } |
202 | 199 | ||
203 | void TaskBar::startWait() | 200 | void TaskBar::startWait() |
204 | { | 201 | { |
205 | waitIcon->setWaiting( true ); | 202 | waitIcon->setWaiting( true ); |
206 | // a catchall stop after 10 seconds... | 203 | // a catchall stop after 10 seconds... |
207 | waitTimer->start( 10 * 1000, true ); | 204 | waitTimer->start( 10 * 1000, true ); |
208 | } | 205 | } |
209 | 206 | ||
210 | void TaskBar::stopWait(const QString& app) | 207 | void TaskBar::stopWait(const QString& app) |
211 | { | 208 | { |
212 | waitTimer->stop(); | 209 | waitTimer->stop(); |
213 | mru->addTask(sm->execToLink(app)); | 210 | mru->addTask(sm->execToLink(app)); |
214 | waitIcon->setWaiting( false ); | 211 | waitIcon->setWaiting( false ); |
215 | } | 212 | } |
216 | 213 | ||
217 | void TaskBar::stopWait() | 214 | void TaskBar::stopWait() |
218 | { | 215 | { |
219 | waitTimer->stop(); | 216 | waitTimer->stop(); |
220 | waitIcon->setWaiting( false ); | 217 | waitIcon->setWaiting( false ); |
221 | } | 218 | } |
222 | 219 | ||
223 | void TaskBar::resizeEvent( QResizeEvent *e ) | 220 | void TaskBar::resizeEvent( QResizeEvent *e ) |
224 | { | 221 | { |
225 | QHBox::resizeEvent( e ); | 222 | QHBox::resizeEvent( e ); |
226 | calcMaxWindowRect(); | 223 | calcMaxWindowRect(); |
227 | } | 224 | } |
228 | 225 | ||
229 | void TaskBar::styleChange( QStyle &s ) | 226 | void TaskBar::styleChange( QStyle &s ) |
230 | { | 227 | { |
231 | QHBox::styleChange( s ); | 228 | QHBox::styleChange( s ); |
232 | calcMaxWindowRect(); | 229 | calcMaxWindowRect(); |
233 | } | 230 | } |
234 | 231 | ||
235 | void TaskBar::calcMaxWindowRect() | 232 | void TaskBar::calcMaxWindowRect() |
236 | { | 233 | { |
237 | #ifdef Q_WS_QWS | 234 | #ifdef Q_WS_QWS |
238 | QRect wr; | 235 | QRect wr; |
239 | int displayWidth = qApp->desktop()->width(); | 236 | int displayWidth = qApp->desktop()->width(); |
240 | QRect ir = inputMethods->inputRect(); | 237 | QRect ir = inputMethods->inputRect(); |
241 | if ( ir.isValid() ) { | 238 | if ( ir.isValid() ) { |
242 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 239 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
243 | } else { | 240 | } else { |
244 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); | 241 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); |
245 | } | 242 | } |
246 | 243 | ||
247 | #if QT_VERSION < 300 | 244 | #if QT_VERSION < 300 |
248 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 245 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
249 | QSize(qt_screen->width(),qt_screen->height())) | 246 | QSize(qt_screen->width(),qt_screen->height())) |
250 | ); | 247 | ); |
251 | #else | 248 | #else |
252 | QWSServer::setMaxWindowRect( wr ); | 249 | QWSServer::setMaxWindowRect( wr ); |
253 | #endif | 250 | #endif |
254 | #endif | 251 | #endif |
255 | } | 252 | } |
256 | 253 | ||
257 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 254 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) |
258 | { | 255 | { |
259 | QDataStream stream( data, IO_ReadOnly ); | 256 | QDataStream stream( data, IO_ReadOnly ); |
260 | if ( msg == "message(QString)" ) { | 257 | if ( msg == "message(QString)" ) { |
261 | QString text; | 258 | QString text; |
262 | stream >> text; | 259 | stream >> text; |
263 | setStatusMessage( text ); | 260 | setStatusMessage( text ); |
264 | } else if ( msg == "hideInputMethod()" ) { | 261 | } else if ( msg == "hideInputMethod()" ) { |
265 | inputMethods->hideInputMethod(); | 262 | inputMethods->hideInputMethod(); |
266 | } else if ( msg == "showInputMethod()" ) { | 263 | } else if ( msg == "showInputMethod()" ) { |
267 | inputMethods->showInputMethod(); | 264 | inputMethods->showInputMethod(); |
268 | } else if ( msg == "reloadInputMethods()" ) { | 265 | } else if ( msg == "reloadInputMethods()" ) { |
269 | inputMethods->loadInputMethods(); | 266 | inputMethods->loadInputMethods(); |
270 | } else if ( msg == "reloadApplets()" ) { | 267 | } else if ( msg == "reloadApplets()" ) { |
271 | sysTray->loadApplets(); | 268 | sysTray->loadApplets(); |
272 | } else if ( msg == "soundAlarm()" ) { | 269 | } else if ( msg == "soundAlarm()" ) { |
273 | Desktop::soundAlarm(); | 270 | Desktop::soundAlarm(); |
274 | } | 271 | } |
275 | #ifdef CUSTOM_LEDS | 272 | #ifdef CUSTOM_LEDS |
276 | else if ( msg == "setLed(int,bool)" ) { | 273 | else if ( msg == "setLed(int,bool)" ) { |
277 | int led, status; | 274 | int led, status; |
278 | stream >> led >> status; | 275 | stream >> led >> status; |
279 | CUSTOM_LEDS( led, status ); | 276 | CUSTOM_LEDS( led, status ); |
280 | } | 277 | } |
281 | #endif | 278 | #endif |
282 | } | 279 | } |
283 | 280 | ||
284 | QWidget *TaskBar::calibrate(bool) | 281 | QWidget *TaskBar::calibrate(bool) |
285 | { | 282 | { |
286 | #ifdef Q_WS_QWS | 283 | #ifdef Q_WS_QWS |
287 | Calibrate *c = new Calibrate; | 284 | Calibrate *c = new Calibrate; |
288 | c->show(); | 285 | c->show(); |
289 | return c; | 286 | return c; |
290 | #else | 287 | #else |
291 | return 0; | 288 | return 0; |
292 | #endif | 289 | #endif |
293 | } | 290 | } |
294 | 291 | ||
295 | void TaskBar::toggleNumLockState() | 292 | void TaskBar::toggleNumLockState() |
296 | { | 293 | { |
297 | if ( lockState ) lockState->toggleNumLockState(); | 294 | if ( lockState ) lockState->toggleNumLockState(); |
298 | } | 295 | } |
299 | 296 | ||
300 | void TaskBar::toggleCapsLockState() | 297 | void TaskBar::toggleCapsLockState() |
301 | { | 298 | { |
302 | if ( lockState ) lockState->toggleCapsLockState(); | 299 | if ( lockState ) lockState->toggleCapsLockState(); |
303 | } | 300 | } |
304 | 301 | ||
305 | void TaskBar::toggleSymbolInput() | 302 | void TaskBar::toggleSymbolInput() |
306 | { | 303 | { |
307 | if ( inputMethods->currentShown() == "Unicode" ) { | 304 | if ( inputMethods->currentShown() == "Unicode" ) { |
308 | inputMethods->hideInputMethod(); | 305 | inputMethods->hideInputMethod(); |
309 | } else { | 306 | } else { |
310 | inputMethods->showInputMethod("Unicode"); | 307 | inputMethods->showInputMethod("Unicode"); |
311 | } | 308 | } |
312 | } | 309 | } |
313 | 310 | ||
314 | bool TaskBar::recoverMemory() | 311 | bool TaskBar::recoverMemory() |
315 | { | 312 | { |
316 | return mru->quitOldApps(); | 313 | return mru->quitOldApps(); |
317 | } | 314 | } |
318 | 315 | ||
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index cdeb3c7..78c4722 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h | |||
@@ -1,86 +1,86 @@ | |||
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 | #ifndef __TASKBAR_H__ | 21 | #ifndef __TASKBAR_H__ |
22 | #define __TASKBAR_H__ | 22 | #define __TASKBAR_H__ |
23 | 23 | ||
24 | #ifdef QT_QWS_CUSTOM | 24 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
25 | #include <qpe/custom.h> | 25 | #include <qpe/custom.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <qhbox.h> | 28 | #include <qhbox.h> |
29 | 29 | ||
30 | class QLabel; | 30 | class QLabel; |
31 | class QTimer; | 31 | class QTimer; |
32 | class InputMethods; | 32 | class InputMethods; |
33 | class Wait; | 33 | class Wait; |
34 | class SysTray; | 34 | class SysTray; |
35 | class MRUList; | 35 | class MRUList; |
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | class QTimer; | 37 | class QTimer; |
38 | class QLabel; | 38 | class QLabel; |
39 | class StartMenu; | 39 | class StartMenu; |
40 | class LockKeyState; | 40 | class LockKeyState; |
41 | 41 | ||
42 | class TaskBar : public QHBox { | 42 | class TaskBar : public QHBox { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | TaskBar(); | 45 | TaskBar(); |
46 | ~TaskBar(); | 46 | ~TaskBar(); |
47 | 47 | ||
48 | static QWidget *calibrate( bool ); | 48 | static QWidget *calibrate( bool ); |
49 | 49 | ||
50 | bool recoverMemory(); | 50 | bool recoverMemory(); |
51 | 51 | ||
52 | StartMenu *startMenu() const { return sm; } | 52 | StartMenu *startMenu() const { return sm; } |
53 | public slots: | 53 | public slots: |
54 | void startWait(); | 54 | void startWait(); |
55 | void stopWait(const QString&); | 55 | void stopWait(const QString&); |
56 | void stopWait(); | 56 | void stopWait(); |
57 | void clearStatusBar(); | 57 | void clearStatusBar(); |
58 | void toggleNumLockState(); | 58 | void toggleNumLockState(); |
59 | void toggleCapsLockState(); | 59 | void toggleCapsLockState(); |
60 | void toggleSymbolInput(); | 60 | void toggleSymbolInput(); |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | void resizeEvent( QResizeEvent * ); | 63 | void resizeEvent( QResizeEvent * ); |
64 | void styleChange( QStyle & ); | 64 | void styleChange( QStyle & ); |
65 | void setStatusMessage( const QString &text ); | 65 | void setStatusMessage( const QString &text ); |
66 | 66 | ||
67 | private slots: | 67 | private slots: |
68 | void calcMaxWindowRect(); | 68 | void calcMaxWindowRect(); |
69 | void receive( const QCString &msg, const QByteArray &data ); | 69 | void receive( const QCString &msg, const QByteArray &data ); |
70 | 70 | ||
71 | private: | 71 | private: |
72 | 72 | ||
73 | QTimer *waitTimer; | 73 | QTimer *waitTimer; |
74 | Wait *waitIcon; | 74 | Wait *waitIcon; |
75 | InputMethods *inputMethods; | 75 | InputMethods *inputMethods; |
76 | SysTray *sysTray; | 76 | SysTray *sysTray; |
77 | MRUList *mru; | 77 | MRUList *mru; |
78 | QWidgetStack *stack; | 78 | QWidgetStack *stack; |
79 | QTimer *clearer; | 79 | QTimer *clearer; |
80 | QLabel *label; | 80 | QLabel *label; |
81 | LockKeyState* lockState; | 81 | LockKeyState* lockState; |
82 | StartMenu *sm; | 82 | StartMenu *sm; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | #endif // __TASKBAR_H__ | 86 | #endif // __TASKBAR_H__ |