author | harlekin <harlekin> | 2002-09-09 18:21:06 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-09 18:21:06 (UTC) |
commit | c9442bf567252553da8ce216de1e64cbf70db3bd (patch) (unidiff) | |
tree | 8eedf088cc2ad2608287a5e6c94ad05587fa9dc0 | |
parent | 3044db24e632adbcf5dbbf1874944d54cee7c8e3 (diff) | |
download | opie-c9442bf567252553da8ce216de1e64cbf70db3bd.zip opie-c9442bf567252553da8ce216de1e64cbf70db3bd.tar.gz opie-c9442bf567252553da8ce216de1e64cbf70db3bd.tar.bz2 |
mrulist is dead, long live runningappbar, hopefully
-rw-r--r-- | core/launcher/desktop.cpp | 6 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 6 | ||||
-rw-r--r-- | core/launcher/launcher.pro | 2 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 287 | ||||
-rw-r--r-- | core/launcher/runningappbar.h | 88 | ||||
-rw-r--r-- | core/launcher/startmenu.cpp | 4 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 21 | ||||
-rw-r--r-- | core/launcher/taskbar.h | 10 |
8 files changed, 405 insertions, 19 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index a19e4c6..bca95b2 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -1,120 +1,120 @@ | |||
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/network.h> | 40 | #include <qpe/network.h> |
41 | #include <qpe/global.h> | 41 | #include <qpe/global.h> |
42 | 42 | ||
43 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) | 43 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
44 | #include <qpe/custom.h> | 44 | #include <qpe/custom.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #include <opie/odevice.h> | 47 | #include <opie/odevice.h> |
48 | 48 | ||
49 | #include <qgfx_qws.h> | 49 | #include <qgfx_qws.h> |
50 | #include <qmainwindow.h> | 50 | #include <qmainwindow.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qwindowsystem_qws.h> | 53 | #include <qwindowsystem_qws.h> |
54 | 54 | ||
55 | #include <qvaluelist.h> | 55 | #include <qvaluelist.h> |
56 | 56 | ||
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <unistd.h> | 58 | #include <unistd.h> |
59 | #include <fcntl.h> | 59 | #include <fcntl.h> |
60 | 60 | ||
61 | class QCopKeyRegister | 61 | class QCopKeyRegister |
62 | { | 62 | { |
63 | public: | 63 | public: |
64 | QCopKeyRegister() : keyCode( 0 ) | 64 | QCopKeyRegister() : keyCode( 0 ) |
65 | { } | 65 | { } |
66 | QCopKeyRegister( int k, const QString &c, const QString &m ) | 66 | QCopKeyRegister( int k, const QString &c, const QString &m ) |
67 | : keyCode( k ), channel( c ), message( m ) | 67 | : keyCode( k ), channel( c ), message( m ) |
68 | { } | 68 | { } |
69 | 69 | ||
70 | int getKeyCode() const | 70 | int getKeyCode() const |
71 | { | 71 | { |
72 | return keyCode; | 72 | return keyCode; |
73 | } | 73 | } |
74 | QString getChannel() const | 74 | QString getChannel() const |
75 | { | 75 | { |
76 | return channel; | 76 | return channel; |
77 | } | 77 | } |
78 | QString getMessage() const | 78 | QString getMessage() const |
79 | { | 79 | { |
80 | return message; | 80 | return message; |
81 | } | 81 | } |
82 | 82 | ||
83 | private: | 83 | private: |
84 | int keyCode; | 84 | int keyCode; |
85 | QString channel, message; | 85 | QString channel, message; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | 88 | typedef QValueList<QCopKeyRegister> KeyRegisterList; |
89 | KeyRegisterList keyRegisterList; | 89 | KeyRegisterList keyRegisterList; |
90 | 90 | ||
91 | static Desktop* qpedesktop = 0; | 91 | static Desktop* qpedesktop = 0; |
92 | static int loggedin = 0; | 92 | static int loggedin = 0; |
93 | static void login( bool at_poweron ) | 93 | static void login( bool at_poweron ) |
94 | { | 94 | { |
95 | if ( !loggedin ) { | 95 | if ( !loggedin ) { |
96 | Global::terminateBuiltin( "calibrate" ); | 96 | Global::terminateBuiltin( "calibrate" ); |
97 | Password::authenticate( at_poweron ); | 97 | Password::authenticate( at_poweron ); |
98 | loggedin = 1; | 98 | loggedin = 1; |
99 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 99 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | bool Desktop::screenLocked() | 103 | bool Desktop::screenLocked() |
104 | { | 104 | { |
105 | return loggedin == 0; | 105 | return loggedin == 0; |
106 | } | 106 | } |
107 | 107 | ||
108 | /* | 108 | /* |
109 | Priority is number of alerts that are needed to pop up | 109 | Priority is number of alerts that are needed to pop up |
110 | alert. | 110 | alert. |
111 | */ | 111 | */ |
112 | class DesktopPowerAlerter : public QMessageBox | 112 | class DesktopPowerAlerter : public QMessageBox |
113 | { | 113 | { |
114 | public: | 114 | public: |
115 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 115 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
116 | : QMessageBox( tr( "Battery Status" ), "Low Battery", | 116 | : QMessageBox( tr( "Battery Status" ), "Low Battery", |
117 | QMessageBox::Critical, | 117 | QMessageBox::Critical, |
118 | QMessageBox::Ok | QMessageBox::Default, | 118 | QMessageBox::Ok | QMessageBox::Default, |
119 | QMessageBox::NoButton, QMessageBox::NoButton, | 119 | QMessageBox::NoButton, QMessageBox::NoButton, |
120 | parent, name, FALSE ) | 120 | parent, name, FALSE ) |
@@ -225,193 +225,193 @@ private: | |||
225 | // Restore screen blanking and power saving state | 225 | // Restore screen blanking and power saving state |
226 | interval = config.readNumEntry( value, def ); | 226 | interval = config.readNumEntry( value, def ); |
227 | } | 227 | } |
228 | return interval; | 228 | return interval; |
229 | } | 229 | } |
230 | 230 | ||
231 | public: | 231 | public: |
232 | void setIntervals( int i1, int i2, int i3 ) | 232 | void setIntervals( int i1, int i2, int i3 ) |
233 | { | 233 | { |
234 | Config config( "qpe" ); | 234 | Config config( "qpe" ); |
235 | config.setGroup( "Screensaver" ); | 235 | config.setGroup( "Screensaver" ); |
236 | 236 | ||
237 | int v[ 4 ]; | 237 | int v[ 4 ]; |
238 | i1 = ssi( i1, config, "Dim", "Interval_Dim", 30 ); | 238 | i1 = ssi( i1, config, "Dim", "Interval_Dim", 30 ); |
239 | i2 = ssi( i2, config, "LightOff", "Interval_LightOff", 20 ); | 239 | i2 = ssi( i2, config, "LightOff", "Interval_LightOff", 20 ); |
240 | i3 = ssi( i3, config, "", "Interval", 60 ); | 240 | i3 = ssi( i3, config, "", "Interval", 60 ); |
241 | 241 | ||
242 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 242 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
243 | 243 | ||
244 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 244 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
245 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 245 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
246 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 246 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
247 | v [ 3 ] = 0; | 247 | v [ 3 ] = 0; |
248 | m_enable_dim = ( ( i1 != 0 ) ? config. readNumEntry ( "Dim", 1 ) : false ); | 248 | m_enable_dim = ( ( i1 != 0 ) ? config. readNumEntry ( "Dim", 1 ) : false ); |
249 | m_enable_lightoff = ( ( i2 != 0 ) ? config. readNumEntry ( "LightOff", 1 ) : false ); | 249 | m_enable_lightoff = ( ( i2 != 0 ) ? config. readNumEntry ( "LightOff", 1 ) : false ); |
250 | m_enable_onlylcdoff = config. readNumEntry ( "LcdOffOnly", 0 ); | 250 | m_enable_onlylcdoff = config. readNumEntry ( "LcdOffOnly", 0 ); |
251 | 251 | ||
252 | if ( !i1 && !i2 && !i3 ) | 252 | if ( !i1 && !i2 && !i3 ) |
253 | QWSServer::setScreenSaverInterval( 0 ); | 253 | QWSServer::setScreenSaverInterval( 0 ); |
254 | else | 254 | else |
255 | QWSServer::setScreenSaverIntervals( v ); | 255 | QWSServer::setScreenSaverIntervals( v ); |
256 | } | 256 | } |
257 | 257 | ||
258 | void setInterval ( int interval ) | 258 | void setInterval ( int interval ) |
259 | { | 259 | { |
260 | setIntervals ( -1, -1, interval ); | 260 | setIntervals ( -1, -1, interval ); |
261 | } | 261 | } |
262 | 262 | ||
263 | void setMode ( int mode ) | 263 | void setMode ( int mode ) |
264 | { | 264 | { |
265 | if ( mode > m_disable_suspend ) | 265 | if ( mode > m_disable_suspend ) |
266 | setInterval( -1 ); | 266 | setInterval( -1 ); |
267 | m_disable_suspend = mode; | 267 | m_disable_suspend = mode; |
268 | } | 268 | } |
269 | 269 | ||
270 | int backlight ( ) | 270 | int backlight ( ) |
271 | { | 271 | { |
272 | if ( m_backlight_bright == -1 ) { | 272 | if ( m_backlight_bright == -1 ) { |
273 | // Read from config | 273 | // Read from config |
274 | Config config ( "qpe" ); | 274 | Config config ( "qpe" ); |
275 | config. setGroup ( "Screensaver" ); | 275 | config. setGroup ( "Screensaver" ); |
276 | m_backlight_bright = config. readNumEntry ( "Brightness", 255 ); | 276 | m_backlight_bright = config. readNumEntry ( "Brightness", 255 ); |
277 | } | 277 | } |
278 | return m_backlight_bright; | 278 | return m_backlight_bright; |
279 | } | 279 | } |
280 | 280 | ||
281 | void setBacklight ( int bright ) | 281 | void setBacklight ( int bright ) |
282 | { | 282 | { |
283 | if ( bright == -3 ) { | 283 | if ( bright == -3 ) { |
284 | // Forced on | 284 | // Forced on |
285 | m_backlight_forcedoff = false; | 285 | m_backlight_forcedoff = false; |
286 | bright = -1; | 286 | bright = -1; |
287 | } | 287 | } |
288 | if ( m_backlight_forcedoff && bright != -2 ) | 288 | if ( m_backlight_forcedoff && bright != -2 ) |
289 | return ; | 289 | return ; |
290 | if ( bright == -2 ) { | 290 | if ( bright == -2 ) { |
291 | // Toggle between off and on | 291 | // Toggle between off and on |
292 | bright = m_backlight_bright ? 0 : -1; | 292 | bright = m_backlight_bright ? 0 : -1; |
293 | m_backlight_forcedoff = !bright; | 293 | m_backlight_forcedoff = !bright; |
294 | } | 294 | } |
295 | 295 | ||
296 | m_backlight_bright = bright; | 296 | m_backlight_bright = bright; |
297 | 297 | ||
298 | bright = backlight ( ); | 298 | bright = backlight ( ); |
299 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 299 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
300 | 300 | ||
301 | m_backlight_bright = bright; | 301 | m_backlight_bright = bright; |
302 | } | 302 | } |
303 | 303 | ||
304 | private: | 304 | private: |
305 | int m_disable_suspend; | 305 | int m_disable_suspend; |
306 | bool m_enable_dim; | 306 | bool m_enable_dim; |
307 | bool m_enable_lightoff; | 307 | bool m_enable_lightoff; |
308 | bool m_enable_onlylcdoff; | 308 | bool m_enable_onlylcdoff; |
309 | 309 | ||
310 | bool m_lcd_status; | 310 | bool m_lcd_status; |
311 | 311 | ||
312 | int m_backlight_bright; | 312 | int m_backlight_bright; |
313 | bool m_backlight_forcedoff; | 313 | bool m_backlight_forcedoff; |
314 | }; | 314 | }; |
315 | 315 | ||
316 | 316 | ||
317 | void DesktopApplication::switchLCD ( bool on ) | 317 | void DesktopApplication::switchLCD ( bool on ) |
318 | { | 318 | { |
319 | if ( qApp ) { | 319 | if ( qApp ) { |
320 | DesktopApplication *dapp = (DesktopApplication *) qApp; | 320 | DesktopApplication *dapp = (DesktopApplication *) qApp; |
321 | 321 | ||
322 | if ( dapp-> m_screensaver ) | 322 | if ( dapp-> m_screensaver ) |
323 | dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 ); | 323 | dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 ); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 328 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
329 | : QPEApplication( argc, argv, appType ) | 329 | : QPEApplication( argc, argv, appType ) |
330 | { | 330 | { |
331 | 331 | ||
332 | QTimer * t = new QTimer( this ); | 332 | QTimer * t = new QTimer( this ); |
333 | connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); | 333 | connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); |
334 | t->start( 10000 ); | 334 | t->start( 10000 ); |
335 | ps = new PowerStatus; | 335 | ps = new PowerStatus; |
336 | pa = new DesktopPowerAlerter( 0 ); | 336 | pa = new DesktopPowerAlerter( 0 ); |
337 | 337 | ||
338 | channel = new QCopChannel( "QPE/Desktop", this ); | 338 | channel = new QCopChannel( "QPE/Desktop", this ); |
339 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 339 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
340 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); | 340 | this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); |
341 | 341 | ||
342 | channel = new QCopChannel( "QPE/System", this ); | 342 | channel = new QCopChannel( "QPE/System", this ); |
343 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), | 343 | connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), |
344 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); | 344 | this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); |
345 | 345 | ||
346 | m_screensaver = new QPEScreenSaver; | 346 | m_screensaver = new QPEScreenSaver; |
347 | 347 | ||
348 | m_screensaver-> setInterval ( -1 ); | 348 | m_screensaver-> setInterval ( -1 ); |
349 | QWSServer::setScreenSaver( m_screensaver ); | 349 | QWSServer::setScreenSaver( m_screensaver ); |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
353 | DesktopApplication::~DesktopApplication() | 353 | DesktopApplication::~DesktopApplication() |
354 | { | 354 | { |
355 | delete ps; | 355 | delete ps; |
356 | delete pa; | 356 | delete pa; |
357 | } | 357 | } |
358 | 358 | ||
359 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) | 359 | void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data ) |
360 | { | 360 | { |
361 | #ifdef Q_WS_QWS | 361 | #ifdef Q_WS_QWS |
362 | QDataStream stream( data, IO_ReadOnly ); | 362 | QDataStream stream( data, IO_ReadOnly ); |
363 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { | 363 | if ( msg == "keyRegister(int key, QString channel, QString message)" ) { |
364 | int k; | 364 | int k; |
365 | QString c, m; | 365 | QString c, m; |
366 | stream >> k; | 366 | stream >> k; |
367 | stream >> c; | 367 | stream >> c; |
368 | stream >> m; | 368 | stream >> m; |
369 | 369 | ||
370 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 370 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); |
371 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 371 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); |
372 | } | 372 | } |
373 | else if ( msg == "suspend()" ) { | 373 | else if ( msg == "suspend()" ) { |
374 | emit power(); | 374 | emit power(); |
375 | } | 375 | } |
376 | #endif | 376 | #endif |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | 380 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) |
381 | { | 381 | { |
382 | #ifdef Q_WS_QWS | 382 | #ifdef Q_WS_QWS |
383 | QDataStream stream ( data, IO_ReadOnly ); | 383 | QDataStream stream ( data, IO_ReadOnly ); |
384 | 384 | ||
385 | if ( msg == "setScreenSaverInterval(int)" ) { | 385 | if ( msg == "setScreenSaverInterval(int)" ) { |
386 | int time; | 386 | int time; |
387 | stream >> time; | 387 | stream >> time; |
388 | m_screensaver-> setInterval( time ); | 388 | m_screensaver-> setInterval( time ); |
389 | } | 389 | } |
390 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { | 390 | else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { |
391 | int t1, t2, t3; | 391 | int t1, t2, t3; |
392 | stream >> t1 >> t2 >> t3; | 392 | stream >> t1 >> t2 >> t3; |
393 | m_screensaver-> setIntervals( t1, t2, t3 ); | 393 | m_screensaver-> setIntervals( t1, t2, t3 ); |
394 | } | 394 | } |
395 | else if ( msg == "setBacklight(int)" ) { | 395 | else if ( msg == "setBacklight(int)" ) { |
396 | int bright; | 396 | int bright; |
397 | stream >> bright; | 397 | stream >> bright; |
398 | m_screensaver-> setBacklight( bright ); | 398 | m_screensaver-> setBacklight( bright ); |
399 | } | 399 | } |
400 | else if ( msg == "setScreenSaverMode(int)" ) { | 400 | else if ( msg == "setScreenSaverMode(int)" ) { |
401 | int mode; | 401 | int mode; |
402 | stream >> mode; | 402 | stream >> mode; |
403 | m_screensaver-> setMode ( mode ); | 403 | m_screensaver-> setMode ( mode ); |
404 | } | 404 | } |
405 | #endif | 405 | #endif |
406 | } | 406 | } |
407 | 407 | ||
408 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 408 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
409 | 409 | ||
410 | #ifdef Q_WS_QWS | 410 | #ifdef Q_WS_QWS |
411 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 411 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
412 | { | 412 | { |
413 | qpedesktop->checkMemory(); | 413 | qpedesktop->checkMemory(); |
414 | 414 | ||
415 | if ( e->type == QWSEvent::Key ) { | 415 | if ( e->type == QWSEvent::Key ) { |
416 | QWSKeyEvent * ke = ( QWSKeyEvent * ) e; | 416 | QWSKeyEvent * ke = ( QWSKeyEvent * ) e; |
417 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 417 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
@@ -634,193 +634,193 @@ Desktop::~Desktop() | |||
634 | } | 634 | } |
635 | 635 | ||
636 | bool Desktop::recoverMemory() | 636 | bool Desktop::recoverMemory() |
637 | { | 637 | { |
638 | return tb->recoverMemory(); | 638 | return tb->recoverMemory(); |
639 | } | 639 | } |
640 | 640 | ||
641 | void Desktop::checkMemory() | 641 | void Desktop::checkMemory() |
642 | { | 642 | { |
643 | #if defined(QPE_HAVE_MEMALERTER) | 643 | #if defined(QPE_HAVE_MEMALERTER) |
644 | static bool ignoreNormal = FALSE; | 644 | static bool ignoreNormal = FALSE; |
645 | static bool existingMessage = FALSE; | 645 | static bool existingMessage = FALSE; |
646 | 646 | ||
647 | if ( existingMessage ) | 647 | if ( existingMessage ) |
648 | return ; // don't show a second message while still on first | 648 | return ; // don't show a second message while still on first |
649 | 649 | ||
650 | existingMessage = TRUE; | 650 | existingMessage = TRUE; |
651 | switch ( memstate ) { | 651 | switch ( memstate ) { |
652 | case Unknown: | 652 | case Unknown: |
653 | break; | 653 | break; |
654 | case Low: | 654 | case Low: |
655 | memstate = Unknown; | 655 | memstate = Unknown; |
656 | if ( recoverMemory() ) | 656 | if ( recoverMemory() ) |
657 | ignoreNormal = TRUE; | 657 | ignoreNormal = TRUE; |
658 | else | 658 | else |
659 | QMessageBox::warning( 0 , "Memory Status", | 659 | QMessageBox::warning( 0 , "Memory Status", |
660 | "The memory smacks of shortage. \n" | 660 | "The memory smacks of shortage. \n" |
661 | "Please save data. " ); | 661 | "Please save data. " ); |
662 | break; | 662 | break; |
663 | case Normal: | 663 | case Normal: |
664 | memstate = Unknown; | 664 | memstate = Unknown; |
665 | if ( ignoreNormal ) | 665 | if ( ignoreNormal ) |
666 | ignoreNormal = FALSE; | 666 | ignoreNormal = FALSE; |
667 | else | 667 | else |
668 | QMessageBox::information ( 0 , "Memory Status", | 668 | QMessageBox::information ( 0 , "Memory Status", |
669 | "There is enough memory again." ); | 669 | "There is enough memory again." ); |
670 | break; | 670 | break; |
671 | case VeryLow: | 671 | case VeryLow: |
672 | memstate = Unknown; | 672 | memstate = Unknown; |
673 | QMessageBox::critical( 0 , "Memory Status", | 673 | QMessageBox::critical( 0 , "Memory Status", |
674 | "The memory is very low. \n" | 674 | "The memory is very low. \n" |
675 | "Please end this application \n" | 675 | "Please end this application \n" |
676 | "immediately." ); | 676 | "immediately." ); |
677 | recoverMemory(); | 677 | recoverMemory(); |
678 | } | 678 | } |
679 | existingMessage = FALSE; | 679 | existingMessage = FALSE; |
680 | #endif | 680 | #endif |
681 | } | 681 | } |
682 | 682 | ||
683 | static bool isVisibleWindow( int wid ) | 683 | static bool isVisibleWindow( int wid ) |
684 | { | 684 | { |
685 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 685 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
686 | QWSWindow* w; | 686 | QWSWindow* w; |
687 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 687 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
688 | if ( w->winId() == wid ) | 688 | if ( w->winId() == wid ) |
689 | return !w->isFullyObscured(); | 689 | return !w->isFullyObscured(); |
690 | } | 690 | } |
691 | return FALSE; | 691 | return FALSE; |
692 | } | 692 | } |
693 | 693 | ||
694 | static bool hasVisibleWindow( const QString& clientname ) | 694 | static bool hasVisibleWindow( const QString& clientname ) |
695 | { | 695 | { |
696 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 696 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
697 | QWSWindow* w; | 697 | QWSWindow* w; |
698 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { | 698 | for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { |
699 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) | 699 | if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) |
700 | return TRUE; | 700 | return TRUE; |
701 | } | 701 | } |
702 | return FALSE; | 702 | return FALSE; |
703 | } | 703 | } |
704 | 704 | ||
705 | void Desktop::raiseLauncher() | 705 | void Desktop::raiseLauncher() |
706 | { | 706 | { |
707 | Config cfg( "qpe" ); //F12 'Home' | 707 | Config cfg( "qpe" ); //F12 'Home' |
708 | cfg.setGroup( "AppsKey" ); | 708 | cfg.setGroup( "AppsKey" ); |
709 | QString tempItem; | 709 | QString tempItem; |
710 | tempItem = cfg.readEntry( "Middle", "Home" ); | 710 | tempItem = cfg.readEntry( "Middle", "Home" ); |
711 | if ( tempItem == "Home" || tempItem.isEmpty() ) { | 711 | if ( tempItem == "Home" || tempItem.isEmpty() ) { |
712 | if ( isVisibleWindow( launcher->winId() ) ) | 712 | if ( isVisibleWindow( launcher->winId() ) ) |
713 | launcher->nextView(); | 713 | launcher->nextView(); |
714 | else | 714 | else |
715 | launcher->raise(); | 715 | launcher->raise(); |
716 | } | 716 | } |
717 | else { | 717 | else { |
718 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 718 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
719 | e << tempItem; | 719 | e << tempItem; |
720 | } | 720 | } |
721 | } | 721 | } |
722 | 722 | ||
723 | void Desktop::executeOrModify( const QString& appLnkFile ) | 723 | void Desktop::executeOrModify( const QString& appLnkFile ) |
724 | { | 724 | { |
725 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); | 725 | AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); |
726 | if ( lnk.isValid() ) { | 726 | if ( lnk.isValid() ) { |
727 | QCString app = lnk.exec().utf8(); | 727 | QCString app = lnk.exec().utf8(); |
728 | Global::terminateBuiltin( "calibrate" ); | 728 | Global::terminateBuiltin( "calibrate" ); |
729 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { | 729 | if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { |
730 | MRUList::addTask( &lnk ); | 730 | //MRUList::addTask( &lnk ); |
731 | if ( hasVisibleWindow( app ) ) | 731 | if ( hasVisibleWindow( app ) ) |
732 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); | 732 | QCopChannel::send( "QPE/Application/" + app, "nextView()" ); |
733 | else | 733 | else |
734 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); | 734 | QCopChannel::send( "QPE/Application/" + app, "raise()" ); |
735 | } | 735 | } |
736 | else { | 736 | else { |
737 | lnk.execute(); | 737 | lnk.execute(); |
738 | } | 738 | } |
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | void Desktop::raiseDatebook() | 742 | void Desktop::raiseDatebook() |
743 | { | 743 | { |
744 | Config cfg( "qpe" ); //F9 'Activity' | 744 | Config cfg( "qpe" ); //F9 'Activity' |
745 | cfg.setGroup( "AppsKey" ); | 745 | cfg.setGroup( "AppsKey" ); |
746 | QString tempItem; | 746 | QString tempItem; |
747 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); | 747 | tempItem = cfg.readEntry( "LeftEnd" , "Calendar" ); |
748 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { | 748 | if ( tempItem == "Calendar" || tempItem.isEmpty() ) { |
749 | tempItem = "datebook"; | 749 | tempItem = "datebook"; |
750 | } | 750 | } |
751 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 751 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
752 | e << tempItem; | 752 | e << tempItem; |
753 | } | 753 | } |
754 | 754 | ||
755 | void Desktop::raiseContacts() | 755 | void Desktop::raiseContacts() |
756 | { | 756 | { |
757 | Config cfg( "qpe" ); //F10, 'Contacts' | 757 | Config cfg( "qpe" ); //F10, 'Contacts' |
758 | cfg.setGroup( "AppsKey" ); | 758 | cfg.setGroup( "AppsKey" ); |
759 | QString tempItem; | 759 | QString tempItem; |
760 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); | 760 | tempItem = cfg.readEntry( "Left2nd", "Address Book" ); |
761 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { | 761 | if ( tempItem == "Address Book" || tempItem.isEmpty() ) { |
762 | tempItem = "addressbook"; | 762 | tempItem = "addressbook"; |
763 | } | 763 | } |
764 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 764 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
765 | e << tempItem; | 765 | e << tempItem; |
766 | } | 766 | } |
767 | 767 | ||
768 | void Desktop::raiseMenu() | 768 | void Desktop::raiseMenu() |
769 | { | 769 | { |
770 | Config cfg( "qpe" ); //F11, 'Menu | 770 | Config cfg( "qpe" ); //F11, 'Menu |
771 | cfg.setGroup( "AppsKey" ); | 771 | cfg.setGroup( "AppsKey" ); |
772 | QString tempItem; | 772 | QString tempItem; |
773 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); | 773 | tempItem = cfg.readEntry( "Right2nd" , "Popup Menu" ); |
774 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { | 774 | if ( tempItem == "Popup Menu" || tempItem.isEmpty() ) { |
775 | Global::terminateBuiltin( "calibrate" ); | 775 | Global::terminateBuiltin( "calibrate" ); |
776 | tb->startMenu() ->launch(); | 776 | tb->startMenu() ->launch(); |
777 | } | 777 | } |
778 | else { | 778 | else { |
779 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 779 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
780 | e << tempItem; | 780 | e << tempItem; |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | void Desktop::raiseEmail() | 784 | void Desktop::raiseEmail() |
785 | { | 785 | { |
786 | Config cfg( "qpe" ); //F13, 'Mail' // only in zaurus, on ipaq mail key is F11 | 786 | Config cfg( "qpe" ); //F13, 'Mail' // only in zaurus, on ipaq mail key is F11 |
787 | cfg.setGroup( "AppsKey" ); | 787 | cfg.setGroup( "AppsKey" ); |
788 | QString tempItem; | 788 | QString tempItem; |
789 | tempItem = cfg.readEntry( "RightEnd", "Mail" ); | 789 | tempItem = cfg.readEntry( "RightEnd", "Mail" ); |
790 | if ( tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty() ) { | 790 | if ( tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty() ) { |
791 | tempItem = "mail"; | 791 | tempItem = "mail"; |
792 | } | 792 | } |
793 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 793 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
794 | e << tempItem; | 794 | e << tempItem; |
795 | } | 795 | } |
796 | 796 | ||
797 | // autoStarts apps on resume and start | 797 | // autoStarts apps on resume and start |
798 | void Desktop::execAutoStart() | 798 | void Desktop::execAutoStart() |
799 | { | 799 | { |
800 | QString appName; | 800 | QString appName; |
801 | int delay; | 801 | int delay; |
802 | QDateTime now = QDateTime::currentDateTime(); | 802 | QDateTime now = QDateTime::currentDateTime(); |
803 | Config cfg( "autostart" ); | 803 | Config cfg( "autostart" ); |
804 | cfg.setGroup( "AutoStart" ); | 804 | cfg.setGroup( "AutoStart" ); |
805 | appName = cfg.readEntry( "Apps", "" ); | 805 | appName = cfg.readEntry( "Apps", "" ); |
806 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); | 806 | delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); |
807 | // If the time between suspend and resume was longer then the | 807 | // If the time between suspend and resume was longer then the |
808 | // value saved as delay, start the app | 808 | // value saved as delay, start the app |
809 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { | 809 | if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { |
810 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 810 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
811 | e << QString( appName ); | 811 | e << QString( appName ); |
812 | } | 812 | } |
813 | } | 813 | } |
814 | 814 | ||
815 | #if defined(QPE_HAVE_TOGGLELIGHT) | 815 | #if defined(QPE_HAVE_TOGGLELIGHT) |
816 | #include <qpe/config.h> | 816 | #include <qpe/config.h> |
817 | 817 | ||
818 | #include <sys/ioctl.h> | 818 | #include <sys/ioctl.h> |
819 | #include <sys/types.h> | 819 | #include <sys/types.h> |
820 | #include <fcntl.h> | 820 | #include <fcntl.h> |
821 | #include <unistd.h> | 821 | #include <unistd.h> |
822 | #include <errno.h> | 822 | #include <errno.h> |
823 | #include <linux/ioctl.h> | 823 | #include <linux/ioctl.h> |
824 | #include <time.h> | 824 | #include <time.h> |
825 | #endif | 825 | #endif |
826 | 826 | ||
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index effcd24..fd89410 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,157 +1,157 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Holger zecke Freyther | 2 | ** Copyright (c) 2002 Holger zecke Freyther |
3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
23 | // have this class. | 23 | // have this class. |
24 | #define QTOPIA_INTERNAL_FSLP | 24 | #define QTOPIA_INTERNAL_FSLP |
25 | 25 | ||
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
36 | 36 | ||
37 | #include <qdatetime.h> | 37 | #include <qdatetime.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
40 | #include <qtimer.h> | 40 | #include <qtimer.h> |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qvbox.h> | 42 | #include <qvbox.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qstyle.h> | 44 | #include <qstyle.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qtabbar.h> | 46 | #include <qtabbar.h> |
47 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qregexp.h> | 49 | #include <qregexp.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qframe.h> | 51 | #include <qframe.h> |
52 | #include <qpainter.h> | 52 | #include <qpainter.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qtextstream.h> | 54 | #include <qtextstream.h> |
55 | 55 | ||
56 | #include "launcherview.h" | 56 | #include "launcherview.h" |
57 | #include "launcher.h" | 57 | #include "launcher.h" |
58 | #include "syncdialog.h" | 58 | #include "syncdialog.h" |
59 | #include "desktop.h" | 59 | #include "desktop.h" |
60 | #include <qpe/lnkproperties.h> | 60 | #include <qpe/lnkproperties.h> |
61 | #include "mrulist.h" | 61 | //#include "mrulist.h" |
62 | #include "qrsync.h" | 62 | #include "qrsync.h" |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <unistd.h> | 64 | #include <unistd.h> |
65 | 65 | ||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <stdio.h> | 67 | #include <stdio.h> |
68 | #include <sys/vfs.h> | 68 | #include <sys/vfs.h> |
69 | #include <mntent.h> | 69 | #include <mntent.h> |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #include <qpe/storage.h> | 72 | #include <qpe/storage.h> |
73 | #include "mediummountgui.h" | 73 | #include "mediummountgui.h" |
74 | //#define SHOW_ALL | 74 | //#define SHOW_ALL |
75 | 75 | ||
76 | // uidGen | 76 | // uidGen |
77 | 77 | ||
78 | // uidGen | 78 | // uidGen |
79 | namespace { | 79 | namespace { |
80 | QStringList configToMime( Config *cfg ){ | 80 | QStringList configToMime( Config *cfg ){ |
81 | QStringList mimes; | 81 | QStringList mimes; |
82 | bool tmpMime = true; | 82 | bool tmpMime = true; |
83 | cfg->setGroup("mimetypes" ); | 83 | cfg->setGroup("mimetypes" ); |
84 | tmpMime = cfg->readBoolEntry("all" ,true); | 84 | tmpMime = cfg->readBoolEntry("all" ,true); |
85 | if( tmpMime ){ | 85 | if( tmpMime ){ |
86 | mimes << QString::null; | 86 | mimes << QString::null; |
87 | return mimes; | 87 | return mimes; |
88 | }else{ | 88 | }else{ |
89 | tmpMime = cfg->readBoolEntry("audio", true ); | 89 | tmpMime = cfg->readBoolEntry("audio", true ); |
90 | if(tmpMime ) | 90 | if(tmpMime ) |
91 | mimes.append("audio/*" ); | 91 | mimes.append("audio/*" ); |
92 | 92 | ||
93 | tmpMime = cfg->readBoolEntry("image", true ); | 93 | tmpMime = cfg->readBoolEntry("image", true ); |
94 | if(tmpMime ) | 94 | if(tmpMime ) |
95 | mimes.append("image/*" ); | 95 | mimes.append("image/*" ); |
96 | 96 | ||
97 | tmpMime = cfg->readBoolEntry("text", true ); | 97 | tmpMime = cfg->readBoolEntry("text", true ); |
98 | if(tmpMime ) | 98 | if(tmpMime ) |
99 | mimes.append("text/*"); | 99 | mimes.append("text/*"); |
100 | 100 | ||
101 | tmpMime = cfg->readBoolEntry("video", true ); | 101 | tmpMime = cfg->readBoolEntry("video", true ); |
102 | if(tmpMime ) | 102 | if(tmpMime ) |
103 | mimes.append("video/*" ); | 103 | mimes.append("video/*" ); |
104 | } | 104 | } |
105 | return mimes; | 105 | return mimes; |
106 | } | 106 | } |
107 | 107 | ||
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 111 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
112 | QVBox( parent ) | 112 | QVBox( parent ) |
113 | { | 113 | { |
114 | categoryBar = 0; | 114 | categoryBar = 0; |
115 | stack = 0; | 115 | stack = 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | void CategoryTabWidget::prevTab() | 118 | void CategoryTabWidget::prevTab() |
119 | { | 119 | { |
120 | if ( categoryBar ) { | 120 | if ( categoryBar ) { |
121 | int n = categoryBar->count(); | 121 | int n = categoryBar->count(); |
122 | int tab = categoryBar->currentTab(); | 122 | int tab = categoryBar->currentTab(); |
123 | if ( tab >= 0 ) | 123 | if ( tab >= 0 ) |
124 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 124 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void CategoryTabWidget::nextTab() | 128 | void CategoryTabWidget::nextTab() |
129 | { | 129 | { |
130 | if ( categoryBar ) { | 130 | if ( categoryBar ) { |
131 | int n = categoryBar->count(); | 131 | int n = categoryBar->count(); |
132 | int tab = categoryBar->currentTab(); | 132 | int tab = categoryBar->currentTab(); |
133 | categoryBar->setCurrentTab( (tab + 1)%n ); | 133 | categoryBar->setCurrentTab( (tab + 1)%n ); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | void CategoryTabWidget::addItem( const QString& linkfile ) | 137 | void CategoryTabWidget::addItem( const QString& linkfile ) |
138 | { | 138 | { |
139 | int i=0; | 139 | int i=0; |
140 | AppLnk *app = new AppLnk(linkfile); | 140 | AppLnk *app = new AppLnk(linkfile); |
141 | if ( !app->isValid() ) { | 141 | if ( !app->isValid() ) { |
142 | delete app; | 142 | delete app; |
143 | return; | 143 | return; |
144 | } | 144 | } |
145 | if ( !app->file().isEmpty() ) { | 145 | if ( !app->file().isEmpty() ) { |
146 | // A document | 146 | // A document |
147 | delete app; | 147 | delete app; |
148 | app = new DocLnk(linkfile); | 148 | app = new DocLnk(linkfile); |
149 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 149 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 152 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
153 | if ( !(*it).isEmpty() ) { | 153 | if ( !(*it).isEmpty() ) { |
154 | QRegExp tf(*it,FALSE,TRUE); | 154 | QRegExp tf(*it,FALSE,TRUE); |
155 | if ( tf.match(app->type()) >= 0 ) { | 155 | if ( tf.match(app->type()) >= 0 ) { |
156 | ((LauncherView*)stack->widget(i))->addItem(app); | 156 | ((LauncherView*)stack->widget(i))->addItem(app); |
157 | return; | 157 | return; |
@@ -637,194 +637,194 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
637 | docsFolder->appendFrom( *tmp ); | 637 | docsFolder->appendFrom( *tmp ); |
638 | delete tmp; | 638 | delete tmp; |
639 | } | 639 | } |
640 | } | 640 | } |
641 | } | 641 | } |
642 | } | 642 | } |
643 | } | 643 | } |
644 | m_timeStamp = newStamp; | 644 | m_timeStamp = newStamp; |
645 | } | 645 | } |
646 | 646 | ||
647 | void Launcher::updateTabs() | 647 | void Launcher::updateTabs() |
648 | { | 648 | { |
649 | MimeType::updateApplications(); // ### reads all applnks twice | 649 | MimeType::updateApplications(); // ### reads all applnks twice |
650 | 650 | ||
651 | delete rootFolder; | 651 | delete rootFolder; |
652 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 652 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
653 | 653 | ||
654 | loadDocs(); | 654 | loadDocs(); |
655 | 655 | ||
656 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 656 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
657 | } | 657 | } |
658 | 658 | ||
659 | void Launcher::updateDocs() | 659 | void Launcher::updateDocs() |
660 | { | 660 | { |
661 | loadDocs(); | 661 | loadDocs(); |
662 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 662 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
663 | } | 663 | } |
664 | 664 | ||
665 | void Launcher::viewSelected(const QString& s) | 665 | void Launcher::viewSelected(const QString& s) |
666 | { | 666 | { |
667 | setCaption( s + tr(" - Launcher") ); | 667 | setCaption( s + tr(" - Launcher") ); |
668 | } | 668 | } |
669 | 669 | ||
670 | void Launcher::nextView() | 670 | void Launcher::nextView() |
671 | { | 671 | { |
672 | tabs->nextTab(); | 672 | tabs->nextTab(); |
673 | } | 673 | } |
674 | 674 | ||
675 | 675 | ||
676 | void Launcher::select( const AppLnk *appLnk ) | 676 | void Launcher::select( const AppLnk *appLnk ) |
677 | { | 677 | { |
678 | if ( appLnk->type() == "Folder" ) { | 678 | if ( appLnk->type() == "Folder" ) { |
679 | // Not supported: flat is simpler for the user | 679 | // Not supported: flat is simpler for the user |
680 | } else { | 680 | } else { |
681 | if ( appLnk->exec().isNull() ) { | 681 | if ( appLnk->exec().isNull() ) { |
682 | QMessageBox::information(this,tr("No application"), | 682 | QMessageBox::information(this,tr("No application"), |
683 | tr("<p>No application is defined for this document." | 683 | tr("<p>No application is defined for this document." |
684 | "<p>Type is %1.").arg(appLnk->type())); | 684 | "<p>Type is %1.").arg(appLnk->type())); |
685 | return; | 685 | return; |
686 | } | 686 | } |
687 | tabs->setBusy(TRUE); | 687 | tabs->setBusy(TRUE); |
688 | emit executing( appLnk ); | 688 | emit executing( appLnk ); |
689 | appLnk->execute(); | 689 | appLnk->execute(); |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | void Launcher::externalSelected(const AppLnk *appLnk) | 693 | void Launcher::externalSelected(const AppLnk *appLnk) |
694 | { | 694 | { |
695 | tabs->setBusy(TRUE); | 695 | tabs->setBusy(TRUE); |
696 | emit executing( appLnk ); | 696 | emit executing( appLnk ); |
697 | } | 697 | } |
698 | 698 | ||
699 | void Launcher::properties( AppLnk *appLnk ) | 699 | void Launcher::properties( AppLnk *appLnk ) |
700 | { | 700 | { |
701 | if ( appLnk->type() == "Folder" ) { | 701 | if ( appLnk->type() == "Folder" ) { |
702 | // Not supported: flat is simpler for the user | 702 | // Not supported: flat is simpler for the user |
703 | } else { | 703 | } else { |
704 | in_lnk_props = TRUE; | 704 | in_lnk_props = TRUE; |
705 | got_lnk_change = FALSE; | 705 | got_lnk_change = FALSE; |
706 | LnkProperties prop(appLnk); | 706 | LnkProperties prop(appLnk); |
707 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 707 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
708 | prop.showMaximized(); | 708 | prop.showMaximized(); |
709 | prop.exec(); | 709 | prop.exec(); |
710 | in_lnk_props = FALSE; | 710 | in_lnk_props = FALSE; |
711 | if ( got_lnk_change ) { | 711 | if ( got_lnk_change ) { |
712 | updateLink(lnk_change); | 712 | updateLink(lnk_change); |
713 | } | 713 | } |
714 | } | 714 | } |
715 | } | 715 | } |
716 | 716 | ||
717 | void Launcher::updateLink(const QString& link) | 717 | void Launcher::updateLink(const QString& link) |
718 | { | 718 | { |
719 | if (link.isNull()) | 719 | if (link.isNull()) |
720 | updateTabs(); | 720 | updateTabs(); |
721 | else if (link.isEmpty()) | 721 | else if (link.isEmpty()) |
722 | updateDocs(); | 722 | updateDocs(); |
723 | else | 723 | else |
724 | tabs->updateLink(link); | 724 | tabs->updateLink(link); |
725 | } | 725 | } |
726 | 726 | ||
727 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 727 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
728 | { | 728 | { |
729 | QDataStream stream( data, IO_ReadOnly ); | 729 | QDataStream stream( data, IO_ReadOnly ); |
730 | if ( msg == "closing(QString)" ){ | 730 | if ( msg == "closing(QString)" ){ |
731 | QString app; | 731 | QString app; |
732 | stream >> app; | 732 | stream >> app; |
733 | qWarning("app closed %s", app.latin1() ); | 733 | //qWarning("app closed %s", app.latin1() ); |
734 | MRUList::removeTask( app ); | 734 | // MRUList::removeTask( app ); |
735 | }else if ( msg == "linkChanged(QString)" ) { | 735 | }else if ( msg == "linkChanged(QString)" ) { |
736 | QString link; | 736 | QString link; |
737 | stream >> link; | 737 | stream >> link; |
738 | if ( in_lnk_props ) { | 738 | if ( in_lnk_props ) { |
739 | got_lnk_change = TRUE; | 739 | got_lnk_change = TRUE; |
740 | lnk_change = link; | 740 | lnk_change = link; |
741 | } else { | 741 | } else { |
742 | updateLink(link); | 742 | updateLink(link); |
743 | } | 743 | } |
744 | } else if ( msg == "busy()" ) { | 744 | } else if ( msg == "busy()" ) { |
745 | emit busy(); | 745 | emit busy(); |
746 | } else if ( msg == "notBusy(QString)" ) { | 746 | } else if ( msg == "notBusy(QString)" ) { |
747 | QString app; | 747 | QString app; |
748 | stream >> app; | 748 | stream >> app; |
749 | tabs->setBusy(FALSE); | 749 | tabs->setBusy(FALSE); |
750 | emit notBusy(app); | 750 | emit notBusy(app); |
751 | } else if ( msg == "mkdir(QString)" ) { | 751 | } else if ( msg == "mkdir(QString)" ) { |
752 | QString dir; | 752 | QString dir; |
753 | stream >> dir; | 753 | stream >> dir; |
754 | if ( !dir.isEmpty() ) | 754 | if ( !dir.isEmpty() ) |
755 | mkdir( dir ); | 755 | mkdir( dir ); |
756 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 756 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
757 | QString baseFile, sigFile; | 757 | QString baseFile, sigFile; |
758 | stream >> baseFile >> sigFile; | 758 | stream >> baseFile >> sigFile; |
759 | QRsync::generateSignature( baseFile, sigFile ); | 759 | QRsync::generateSignature( baseFile, sigFile ); |
760 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 760 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
761 | QString baseFile, sigFile, deltaFile; | 761 | QString baseFile, sigFile, deltaFile; |
762 | stream >> baseFile >> sigFile >> deltaFile; | 762 | stream >> baseFile >> sigFile >> deltaFile; |
763 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 763 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
764 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 764 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
765 | QString baseFile, deltaFile; | 765 | QString baseFile, deltaFile; |
766 | stream >> baseFile >> deltaFile; | 766 | stream >> baseFile >> deltaFile; |
767 | if ( !QFile::exists( baseFile ) ) { | 767 | if ( !QFile::exists( baseFile ) ) { |
768 | QFile f( baseFile ); | 768 | QFile f( baseFile ); |
769 | f.open( IO_WriteOnly ); | 769 | f.open( IO_WriteOnly ); |
770 | f.close(); | 770 | f.close(); |
771 | } | 771 | } |
772 | QRsync::applyDiff( baseFile, deltaFile ); | 772 | QRsync::applyDiff( baseFile, deltaFile ); |
773 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 773 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
774 | e << baseFile; | 774 | e << baseFile; |
775 | } else if ( msg == "rdiffCleanup()" ) { | 775 | } else if ( msg == "rdiffCleanup()" ) { |
776 | mkdir( "/tmp/rdiff" ); | 776 | mkdir( "/tmp/rdiff" ); |
777 | QDir dir; | 777 | QDir dir; |
778 | dir.setPath( "/tmp/rdiff" ); | 778 | dir.setPath( "/tmp/rdiff" ); |
779 | QStringList entries = dir.entryList(); | 779 | QStringList entries = dir.entryList(); |
780 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 780 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
781 | dir.remove( *it ); | 781 | dir.remove( *it ); |
782 | } else if ( msg == "sendHandshakeInfo()" ) { | 782 | } else if ( msg == "sendHandshakeInfo()" ) { |
783 | QString home = getenv( "HOME" ); | 783 | QString home = getenv( "HOME" ); |
784 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 784 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
785 | e << home; | 785 | e << home; |
786 | int locked = (int) Desktop::screenLocked(); | 786 | int locked = (int) Desktop::screenLocked(); |
787 | e << locked; | 787 | e << locked; |
788 | // register an app for autostart | 788 | // register an app for autostart |
789 | // if clear is send the list is cleared. | 789 | // if clear is send the list is cleared. |
790 | } else if ( msg == "autoStart(QString)" ) { | 790 | } else if ( msg == "autoStart(QString)" ) { |
791 | QString appName; | 791 | QString appName; |
792 | stream >> appName; | 792 | stream >> appName; |
793 | Config cfg( "autostart" ); | 793 | Config cfg( "autostart" ); |
794 | cfg.setGroup( "AutoStart" ); | 794 | cfg.setGroup( "AutoStart" ); |
795 | if ( appName.compare("clear") == 0){ | 795 | if ( appName.compare("clear") == 0){ |
796 | cfg.writeEntry("Apps", ""); | 796 | cfg.writeEntry("Apps", ""); |
797 | } | 797 | } |
798 | } else if ( msg == "autoStart(QString,QString)" ) { | 798 | } else if ( msg == "autoStart(QString,QString)" ) { |
799 | QString modifier, appName; | 799 | QString modifier, appName; |
800 | stream >> modifier >> appName; | 800 | stream >> modifier >> appName; |
801 | Config cfg( "autostart" ); | 801 | Config cfg( "autostart" ); |
802 | cfg.setGroup( "AutoStart" ); | 802 | cfg.setGroup( "AutoStart" ); |
803 | if ( modifier.compare("add") == 0 ){ | 803 | if ( modifier.compare("add") == 0 ){ |
804 | // only add if appname is entered | 804 | // only add if appname is entered |
805 | if (!appName.isEmpty()) { | 805 | if (!appName.isEmpty()) { |
806 | cfg.writeEntry("Apps", appName); | 806 | cfg.writeEntry("Apps", appName); |
807 | } | 807 | } |
808 | } else if (modifier.compare("remove") == 0 ) { | 808 | } else if (modifier.compare("remove") == 0 ) { |
809 | // need to change for multiple entries | 809 | // need to change for multiple entries |
810 | // actually remove is right now simular to clear, but in future there | 810 | // actually remove is right now simular to clear, but in future there |
811 | // should be multiple apps in autostart possible. | 811 | // should be multiple apps in autostart possible. |
812 | QString checkName; | 812 | QString checkName; |
813 | checkName = cfg.readEntry("Apps", ""); | 813 | checkName = cfg.readEntry("Apps", ""); |
814 | if (checkName == appName) { | 814 | if (checkName == appName) { |
815 | cfg.writeEntry("Apps", ""); | 815 | cfg.writeEntry("Apps", ""); |
816 | } | 816 | } |
817 | } | 817 | } |
818 | // case the autostart feature should be delayed | 818 | // case the autostart feature should be delayed |
819 | } else if ( msg == "autoStart(QString,QString,QString)") { | 819 | } else if ( msg == "autoStart(QString,QString,QString)") { |
820 | QString modifier, appName, delay; | 820 | QString modifier, appName, delay; |
821 | stream >> modifier >> appName >> delay; | 821 | stream >> modifier >> appName >> delay; |
822 | Config cfg( "autostart" ); | 822 | Config cfg( "autostart" ); |
823 | cfg.setGroup( "AutoStart" ); | 823 | cfg.setGroup( "AutoStart" ); |
824 | if ( modifier.compare("add") == 0 ){ | 824 | if ( modifier.compare("add") == 0 ){ |
825 | // only add it appname is entered | 825 | // only add it appname is entered |
826 | if (!appName.isEmpty()) { | 826 | if (!appName.isEmpty()) { |
827 | cfg.writeEntry("Apps", appName); | 827 | cfg.writeEntry("Apps", appName); |
828 | cfg.writeEntry("Delay", delay); | 828 | cfg.writeEntry("Delay", delay); |
829 | } | 829 | } |
830 | } else { | 830 | } else { |
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index 5b32bc3..0e557aa 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro | |||
@@ -1,118 +1,120 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = ../../bin | 3 | DESTDIR = ../../bin |
4 | HEADERS = background.h \ | 4 | HEADERS = background.h \ |
5 | desktop.h \ | 5 | desktop.h \ |
6 | qprocess.h \ | 6 | qprocess.h \ |
7 | mediummountgui.h \ | 7 | mediummountgui.h \ |
8 | info.h \ | 8 | info.h \ |
9 | appicons.h \ | 9 | appicons.h \ |
10 | taskbar.h \ | 10 | taskbar.h \ |
11 | sidething.h \ | 11 | sidething.h \ |
12 | mrulist.h \ | 12 | mrulist.h \ |
13 | runningappbar.h \ | ||
13 | stabmon.h \ | 14 | stabmon.h \ |
14 | inputmethods.h \ | 15 | inputmethods.h \ |
15 | systray.h \ | 16 | systray.h \ |
16 | wait.h \ | 17 | wait.h \ |
17 | shutdownimpl.h \ | 18 | shutdownimpl.h \ |
18 | launcher.h \ | 19 | launcher.h \ |
19 | launcherview.h \ | 20 | launcherview.h \ |
20 | ../../core/apps/calibrate/calibrate.h \ | 21 | ../../core/apps/calibrate/calibrate.h \ |
21 | startmenu.h \ | 22 | startmenu.h \ |
22 | transferserver.h \ | 23 | transferserver.h \ |
23 | qcopbridge.h \ | 24 | qcopbridge.h \ |
24 | packageslave.h \ | 25 | packageslave.h \ |
25 | irserver.h \ | 26 | irserver.h \ |
26 | ../../rsync/buf.h \ | 27 | ../../rsync/buf.h \ |
27 | ../../rsync/checksum.h \ | 28 | ../../rsync/checksum.h \ |
28 | ../../rsync/command.h \ | 29 | ../../rsync/command.h \ |
29 | ../../rsync/emit.h \ | 30 | ../../rsync/emit.h \ |
30 | ../../rsync/job.h \ | 31 | ../../rsync/job.h \ |
31 | ../../rsync/netint.h \ | 32 | ../../rsync/netint.h \ |
32 | ../../rsync/protocol.h \ | 33 | ../../rsync/protocol.h \ |
33 | ../../rsync/prototab.h \ | 34 | ../../rsync/prototab.h \ |
34 | ../../rsync/rsync.h \ | 35 | ../../rsync/rsync.h \ |
35 | ../../rsync/search.h \ | 36 | ../../rsync/search.h \ |
36 | ../../rsync/stream.h \ | 37 | ../../rsync/stream.h \ |
37 | ../../rsync/sumset.h \ | 38 | ../../rsync/sumset.h \ |
38 | ../../rsync/trace.h \ | 39 | ../../rsync/trace.h \ |
39 | ../../rsync/types.h \ | 40 | ../../rsync/types.h \ |
40 | ../../rsync/util.h \ | 41 | ../../rsync/util.h \ |
41 | ../../rsync/whole.h \ | 42 | ../../rsync/whole.h \ |
42 | ../../rsync/config_rsync.h \ | 43 | ../../rsync/config_rsync.h \ |
43 | ../../rsync/qrsync.h | 44 | ../../rsync/qrsync.h |
44 | # quicklauncher.h \ | 45 | # quicklauncher.h \ |
45 | SOURCES = background.cpp \ | 46 | SOURCES = background.cpp \ |
46 | desktop.cpp \ | 47 | desktop.cpp \ |
47 | mediummountgui.cpp \ | 48 | mediummountgui.cpp \ |
48 | qprocess.cpp qprocess_unix.cpp \ | 49 | qprocess.cpp qprocess_unix.cpp \ |
49 | info.cpp \ | 50 | info.cpp \ |
50 | appicons.cpp \ | 51 | appicons.cpp \ |
51 | taskbar.cpp \ | 52 | taskbar.cpp \ |
52 | sidething.cpp \ | 53 | sidething.cpp \ |
53 | mrulist.cpp \ | 54 | mrulist.cpp \ |
55 | runningappbar.cpp \ | ||
54 | stabmon.cpp \ | 56 | stabmon.cpp \ |
55 | inputmethods.cpp \ | 57 | inputmethods.cpp \ |
56 | systray.cpp \ | 58 | systray.cpp \ |
57 | wait.cpp \ | 59 | wait.cpp \ |
58 | shutdownimpl.cpp \ | 60 | shutdownimpl.cpp \ |
59 | launcher.cpp \ | 61 | launcher.cpp \ |
60 | launcherview.cpp \ | 62 | launcherview.cpp \ |
61 | ../../core/apps/calibrate/calibrate.cpp \ | 63 | ../../core/apps/calibrate/calibrate.cpp \ |
62 | transferserver.cpp \ | 64 | transferserver.cpp \ |
63 | packageslave.cpp \ | 65 | packageslave.cpp \ |
64 | irserver.cpp \ | 66 | irserver.cpp \ |
65 | qcopbridge.cpp \ | 67 | qcopbridge.cpp \ |
66 | startmenu.cpp \ | 68 | startmenu.cpp \ |
67 | main.cpp \ | 69 | main.cpp \ |
68 | ../../rsync/base64.c \ | 70 | ../../rsync/base64.c \ |
69 | ../../rsync/buf.c \ | 71 | ../../rsync/buf.c \ |
70 | ../../rsync/checksum.c \ | 72 | ../../rsync/checksum.c \ |
71 | ../../rsync/command.c \ | 73 | ../../rsync/command.c \ |
72 | ../../rsync/delta.c \ | 74 | ../../rsync/delta.c \ |
73 | ../../rsync/emit.c \ | 75 | ../../rsync/emit.c \ |
74 | ../../rsync/hex.c \ | 76 | ../../rsync/hex.c \ |
75 | ../../rsync/job.c \ | 77 | ../../rsync/job.c \ |
76 | ../../rsync/mdfour.c \ | 78 | ../../rsync/mdfour.c \ |
77 | ../../rsync/mksum.c \ | 79 | ../../rsync/mksum.c \ |
78 | ../../rsync/msg.c \ | 80 | ../../rsync/msg.c \ |
79 | ../../rsync/netint.c \ | 81 | ../../rsync/netint.c \ |
80 | ../../rsync/patch.c \ | 82 | ../../rsync/patch.c \ |
81 | ../../rsync/prototab.c \ | 83 | ../../rsync/prototab.c \ |
82 | ../../rsync/readsums.c \ | 84 | ../../rsync/readsums.c \ |
83 | ../../rsync/scoop.c \ | 85 | ../../rsync/scoop.c \ |
84 | ../../rsync/search.c \ | 86 | ../../rsync/search.c \ |
85 | ../../rsync/stats.c \ | 87 | ../../rsync/stats.c \ |
86 | ../../rsync/stream.c \ | 88 | ../../rsync/stream.c \ |
87 | ../../rsync/sumset.c \ | 89 | ../../rsync/sumset.c \ |
88 | ../../rsync/trace.c \ | 90 | ../../rsync/trace.c \ |
89 | ../../rsync/tube.c \ | 91 | ../../rsync/tube.c \ |
90 | ../../rsync/util.c \ | 92 | ../../rsync/util.c \ |
91 | ../../rsync/version.c \ | 93 | ../../rsync/version.c \ |
92 | ../../rsync/whole.c \ | 94 | ../../rsync/whole.c \ |
93 | ../../rsync/qrsync.cpp | 95 | ../../rsync/qrsync.cpp |
94 | INTERFACES= syncdialog.ui | 96 | INTERFACES= syncdialog.ui |
95 | INCLUDEPATH += ../../include | 97 | INCLUDEPATH += ../../include |
96 | DEPENDPATH+= ../../include . | 98 | DEPENDPATH+= ../../include . |
97 | INCLUDEPATH += ../../core/apps/calibrate | 99 | INCLUDEPATH += ../../core/apps/calibrate |
98 | DEPENDPATH+= ../../core/apps/calibrate | 100 | DEPENDPATH+= ../../core/apps/calibrate |
99 | INCLUDEPATH += ../../rsync | 101 | INCLUDEPATH += ../../rsync |
100 | DEPENDPATH+= ../../rsync | 102 | DEPENDPATH+= ../../rsync |
101 | TARGET = qpe | 103 | TARGET = qpe |
102 | LIBS += -lqpe -lcrypt -lopie | 104 | LIBS += -lqpe -lcrypt -lopie |
103 | 105 | ||
104 | TRANSLATIONS = ../../i18n/de/qpe.ts \ | 106 | TRANSLATIONS = ../../i18n/de/qpe.ts \ |
105 | ../../i18n/en/qpe.ts \ | 107 | ../../i18n/en/qpe.ts \ |
106 | ../../i18n/es/qpe.ts \ | 108 | ../../i18n/es/qpe.ts \ |
107 | ../../i18n/fr/qpe.ts \ | 109 | ../../i18n/fr/qpe.ts \ |
108 | ../../i18n/hu/qpe.ts \ | 110 | ../../i18n/hu/qpe.ts \ |
109 | ../../i18n/ja/qpe.ts \ | 111 | ../../i18n/ja/qpe.ts \ |
110 | ../../i18n/ko/qpe.ts \ | 112 | ../../i18n/ko/qpe.ts \ |
111 | ../../i18n/no/qpe.ts \ | 113 | ../../i18n/no/qpe.ts \ |
112 | ../../i18n/pl/qpe.ts \ | 114 | ../../i18n/pl/qpe.ts \ |
113 | ../../i18n/pt/qpe.ts \ | 115 | ../../i18n/pt/qpe.ts \ |
114 | ../../i18n/pt_BR/qpe.ts \ | 116 | ../../i18n/pt_BR/qpe.ts \ |
115 | ../../i18n/sl/qpe.ts \ | 117 | ../../i18n/sl/qpe.ts \ |
116 | ../../i18n/zh_CN/qpe.ts \ | 118 | ../../i18n/zh_CN/qpe.ts \ |
117 | ../../i18n/it/qpe.ts \ | 119 | ../../i18n/it/qpe.ts \ |
118 | ../../i18n/zh_TW/qpe.ts | 120 | ../../i18n/zh_TW/qpe.ts |
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp new file mode 100644 index 0000000..298f671 --- a/dev/null +++ b/core/launcher/runningappbar.cpp | |||
@@ -0,0 +1,287 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | ********************************************************************** | ||
20 | */ | ||
21 | |||
22 | #define QTOPIA_INTERNAL_PRELOADACCESS | ||
23 | |||
24 | // For "kill" | ||
25 | #include <sys/types.h> | ||
26 | #include <signal.h> | ||
27 | |||
28 | #include <qtimer.h> | ||
29 | #include <qpopupmenu.h> | ||
30 | #include <qmessagebox.h> | ||
31 | #include <qpainter.h> | ||
32 | #include "qprocess.h" | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | #include <qpe/applnk.h> | ||
35 | #include <qpe/qcopenvelope_qws.h> | ||
36 | #include <qpe/global.h> | ||
37 | #include <qwindowsystem_qws.h> | ||
38 | #include "runningappbar.h" | ||
39 | |||
40 | RunningAppBar::RunningAppBar(QWidget* parent) | ||
41 | : QFrame(parent), m_AppLnkSet(0L), m_SelectedAppIndex(-1) | ||
42 | { | ||
43 | m_AppLnkSet = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | ||
44 | |||
45 | connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); | ||
46 | connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); | ||
47 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | ||
48 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
49 | this, SLOT(received(const QCString&, const QByteArray&)) ); | ||
50 | |||
51 | spacing = AppLnk::smallIconSize()+3; | ||
52 | } | ||
53 | |||
54 | RunningAppBar::~RunningAppBar() { | ||
55 | } | ||
56 | |||
57 | void RunningAppBar::newQcopChannel(const QString& channelName) { | ||
58 | QString prefix("QPE/Application/"); | ||
59 | if (channelName.startsWith(prefix)) { | ||
60 | QString appName = channelName.mid(prefix.length()); | ||
61 | // qDebug("App %s just connected!", appName.latin1()); | ||
62 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); | ||
63 | if (newGuy && !newGuy->isPreloaded()) { | ||
64 | addTask(*newGuy); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | void RunningAppBar::removedQcopChannel(const QString& channelName) { | ||
70 | QString prefix("QPE/Application/"); | ||
71 | if (channelName.startsWith(prefix)) { | ||
72 | QString appName = channelName.mid(prefix.length()); | ||
73 | qDebug("App %s just disconnected!", appName.latin1()); | ||
74 | const AppLnk* newGuy = m_AppLnkSet->findExec(appName); | ||
75 | if (newGuy) { | ||
76 | removeTask(*newGuy); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { | ||
82 | // Since fast apps appear and disappear without disconnecting from their | ||
83 | // channel we need to watch for the showing/hiding events and update according. | ||
84 | QDataStream stream( data, IO_ReadOnly ); | ||
85 | if ( msg == "fastAppShowing(QString)") { | ||
86 | QString appName; | ||
87 | stream >> appName; | ||
88 | addTask(*m_AppLnkSet->findExec(appName)); | ||
89 | } else if ( msg == "fastAppHiding(QString)") { | ||
90 | QString appName; | ||
91 | stream >> appName; | ||
92 | removeTask(*m_AppLnkSet->findExec(appName)); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | void RunningAppBar::addTask(const AppLnk& appLnk) { | ||
97 | // qDebug("Added %s to app list.", appLnk.name().latin1()); | ||
98 | AppLnk* newApp = new AppLnk(appLnk); | ||
99 | newApp->setExec(appLnk.exec()); | ||
100 | m_AppList.prepend(newApp); | ||
101 | update(); | ||
102 | } | ||
103 | |||
104 | void RunningAppBar::removeTask(const AppLnk& appLnk) { | ||
105 | unsigned int i = 0; | ||
106 | for (; i < m_AppList.count() ; i++) { | ||
107 | AppLnk* target = m_AppList.at(i); | ||
108 | if (target->exec() == appLnk.exec()) { | ||
109 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | ||
110 | m_AppList.remove(); | ||
111 | delete target; | ||
112 | } | ||
113 | } | ||
114 | update(); | ||
115 | } | ||
116 | |||
117 | void RunningAppBar::mousePressEvent(QMouseEvent *e) | ||
118 | { | ||
119 | // Find out if the user is clicking on an app icon... | ||
120 | // If so, snag the index so when we repaint we show it | ||
121 | // as highlighed. | ||
122 | m_SelectedAppIndex = 0; | ||
123 | int x=0; | ||
124 | QListIterator<AppLnk> it( m_AppList ); | ||
125 | for ( ; it.current(); ++it,++m_SelectedAppIndex,x+=spacing ) { | ||
126 | if ( x + spacing <= width() ) { | ||
127 | if ( e->x() >= x && e->x() < x+spacing ) { | ||
128 | if ( m_SelectedAppIndex < (int)m_AppList.count() ) { | ||
129 | repaint(FALSE); | ||
130 | return; | ||
131 | } | ||
132 | } | ||
133 | } else { | ||
134 | break; | ||
135 | } | ||
136 | } | ||
137 | m_SelectedAppIndex = -1; | ||
138 | repaint( FALSE ); | ||
139 | } | ||
140 | |||
141 | void RunningAppBar::mouseReleaseEvent(QMouseEvent *e) | ||
142 | { | ||
143 | if (e->button() == QMouseEvent::RightButton) { | ||
144 | return; | ||
145 | } | ||
146 | if ( m_SelectedAppIndex >= 0 ) { | ||
147 | QString channel = QString("QPE/Application/") + m_AppList.at(m_SelectedAppIndex)->exec(); | ||
148 | if (QCopChannel::isRegistered(channel.latin1())) { | ||
149 | // qDebug("%s is running!", m_AppList.at(m_SelectedAppIndex)->exec().latin1()); | ||
150 | QCopEnvelope e(channel.latin1(), "raise()"); | ||
151 | // This class will delete itself after hearing from the app or the timer expiring | ||
152 | (void)new AppMonitor(*m_AppList.at(m_SelectedAppIndex), *this); | ||
153 | } | ||
154 | else { | ||
155 | removeTask(*m_AppList.at(m_SelectedAppIndex)); | ||
156 | } | ||
157 | |||
158 | m_SelectedAppIndex = -1; | ||
159 | update(); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | void RunningAppBar::paintEvent( QPaintEvent * ) | ||
164 | { | ||
165 | QPainter p( this ); | ||
166 | AppLnk *curApp; | ||
167 | int x = 0; | ||
168 | int y = (height() - AppLnk::smallIconSize()) / 2; | ||
169 | int i = 0; | ||
170 | |||
171 | p.fillRect( 0, 0, width(), height(), colorGroup().background() ); | ||
172 | |||
173 | QListIterator<AppLnk> it(m_AppList); | ||
174 | |||
175 | for (; it.current(); i++, ++it ) { | ||
176 | if ( x + spacing <= width() ) { | ||
177 | curApp = it.current(); | ||
178 | if ( (int)i == m_SelectedAppIndex ) | ||
179 | p.fillRect( x, y, spacing, curApp->pixmap().height()+1, colorGroup().highlight() ); | ||
180 | else | ||
181 | p.eraseRect( x, y, spacing, curApp->pixmap().height()+1 ); | ||
182 | p.drawPixmap( x, y, curApp->pixmap() ); | ||
183 | x += spacing; | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | QSize RunningAppBar::sizeHint() const | ||
189 | { | ||
190 | return QSize( frameWidth(), AppLnk::smallIconSize()+frameWidth()*2+3 ); | ||
191 | } | ||
192 | |||
193 | const int AppMonitor::RAISE_TIMEOUT_MS = 500; | ||
194 | |||
195 | AppMonitor::AppMonitor(const AppLnk& app, RunningAppBar& owner) | ||
196 | : QObject(0L), m_Owner(owner), m_App(app), m_PsProc(0L), m_AppKillerBox(0L) { | ||
197 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | ||
198 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
199 | this, SLOT(received(const QCString&, const QByteArray&)) ); | ||
200 | connect(&m_Timer, SIGNAL(timeout()), this, SLOT(timerExpired())); | ||
201 | m_Timer.start(RAISE_TIMEOUT_MS, TRUE); | ||
202 | } | ||
203 | |||
204 | AppMonitor::~AppMonitor() { | ||
205 | if (m_AppKillerBox) { | ||
206 | delete m_AppKillerBox; | ||
207 | m_AppKillerBox = 0L; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | void AppMonitor::received(const QCString& msg, const QByteArray& data) { | ||
212 | QDataStream stream( data, IO_ReadOnly ); | ||
213 | |||
214 | if (msg == "appRaised(QString)") { | ||
215 | QString appName; | ||
216 | stream >> appName; | ||
217 | if (appName == m_App.exec()) { | ||
218 | // qDebug("Got a heartbeat from %s", appName.latin1()); | ||
219 | m_Timer.stop(); | ||
220 | // Check to make sure we're not waiting on user input... | ||
221 | if (m_AppKillerBox) { | ||
222 | // If we are, we kill the dialog box, and the code waiting on the result | ||
223 | // will clean us up (basically the user said "no"). | ||
224 | delete m_AppKillerBox; | ||
225 | m_AppKillerBox = 0L; | ||
226 | } | ||
227 | else { | ||
228 | // Ok, we're not waiting on user input, so clean us up now. | ||
229 | // WE DELETE OURSELVES HERE! Don't do anything else!! | ||
230 | delete this; | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | |||
236 | void AppMonitor::timerExpired() { | ||
237 | // qDebug("Checking in on %s", m_App.name().latin1()); | ||
238 | // We store this incase the application responds while we're | ||
239 | // waiting for user input so we know not to delete ourselves. This | ||
240 | // will be cleaned up in the destructor. | ||
241 | m_AppKillerBox = new QMessageBox(tr("Application Problem"), | ||
242 | tr("<p>%1 is not responding.</p>").arg(m_App.name()) + | ||
243 | tr("<p>Would you like to force the application to exit?</p>"), | ||
244 | QMessageBox::Warning, QMessageBox::Yes, | ||
245 | QMessageBox::No | QMessageBox::Default, | ||
246 | QMessageBox::NoButton); | ||
247 | if (m_AppKillerBox->exec() == QMessageBox::Yes) { | ||
248 | // qDebug("Killing the app!!! Bwuhahahaha!"); | ||
249 | m_PsProc = new QProcess(QString("ps")); | ||
250 | m_PsProc->addArgument("h"); | ||
251 | m_PsProc->addArgument("-C"); | ||
252 | m_PsProc->addArgument(m_App.exec()); | ||
253 | m_PsProc->addArgument("-o"); | ||
254 | m_PsProc->addArgument("pid"); | ||
255 | connect(m_PsProc, SIGNAL(processExited()), this, SLOT(psProcFinished())); | ||
256 | m_PsProc->start(); | ||
257 | } | ||
258 | else { | ||
259 | // qDebug("Wuss.."); | ||
260 | // WE DELETE OURSELVES HERE! Don't do anything else!! | ||
261 | delete this; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | void AppMonitor::psProcFinished() { | ||
266 | QString pid = m_PsProc->readLineStdout(); | ||
267 | delete m_PsProc; | ||
268 | m_PsProc = 0L; | ||
269 | |||
270 | // qDebug("Killing app %s", pid.latin1()); | ||
271 | if (pid.isEmpty()) { | ||
272 | // Hmm.. did the application bail before we got there? | ||
273 | qDebug("AppMonitor: Tried to kill application %s but ps couldn't find it.", m_App.exec().latin1()); | ||
274 | } | ||
275 | else { | ||
276 | int success = kill(pid.toUInt(), SIGKILL); | ||
277 | if (success == 0) { | ||
278 | m_Owner.removeTask(m_App); | ||
279 | } | ||
280 | else { | ||
281 | qWarning("Could not kill task %s", m_App.exec().latin1()); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | // WE DELETE OURSELVES HERE! Don't do anything else!! | ||
286 | delete this; | ||
287 | } | ||
diff --git a/core/launcher/runningappbar.h b/core/launcher/runningappbar.h new file mode 100644 index 0000000..880bb69 --- a/dev/null +++ b/core/launcher/runningappbar.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef RUNNING_APP_BAR_H | ||
22 | #define RUNNING_APP_BAR_H | ||
23 | |||
24 | #include <qframe.h> | ||
25 | #include <qlist.h> | ||
26 | #include <qtimer.h> | ||
27 | |||
28 | class AppLnk; | ||
29 | class AppLnkSet; | ||
30 | class QCString; | ||
31 | class QProcess; | ||
32 | class QMessageBox; | ||
33 | |||
34 | class RunningAppBar : public QFrame { | ||
35 | Q_OBJECT | ||
36 | |||
37 | public: | ||
38 | RunningAppBar(QWidget* parent); | ||
39 | ~RunningAppBar(); | ||
40 | |||
41 | void addTask(const AppLnk& appLnk); | ||
42 | void removeTask(const AppLnk& appLnk); | ||
43 | void paintEvent(QPaintEvent* event); | ||
44 | void mousePressEvent(QMouseEvent*); | ||
45 | void mouseReleaseEvent(QMouseEvent*); | ||
46 | QSize sizeHint() const; | ||
47 | |||
48 | private slots: | ||
49 | void newQcopChannel(const QString& channel); | ||
50 | void removedQcopChannel(const QString& channel); | ||
51 | void received(const QCString& msg, const QByteArray& data); | ||
52 | |||
53 | private: | ||
54 | AppLnkSet* m_AppLnkSet; | ||
55 | QList<AppLnk> m_AppList; | ||
56 | int m_SelectedAppIndex; | ||
57 | int spacing; | ||
58 | }; | ||
59 | |||
60 | /** | ||
61 | * Internal class that checks back in on the process when timerExpired is called | ||
62 | * to make sure the process is on top. If it's not it displays a dialog | ||
63 | * box asking permission to kill it. | ||
64 | */ | ||
65 | class AppMonitor : public QObject { | ||
66 | Q_OBJECT | ||
67 | |||
68 | public: | ||
69 | static const int RAISE_TIMEOUT_MS; | ||
70 | |||
71 | AppMonitor(const AppLnk& app, RunningAppBar& owner); | ||
72 | ~AppMonitor(); | ||
73 | |||
74 | private slots: | ||
75 | void timerExpired(); | ||
76 | void received(const QCString& msg, const QByteArray& data); | ||
77 | void psProcFinished(); | ||
78 | |||
79 | private: | ||
80 | RunningAppBar& m_Owner; | ||
81 | const AppLnk& m_App; | ||
82 | QTimer m_Timer; | ||
83 | QProcess* m_PsProc; | ||
84 | QMessageBox* m_AppKillerBox; | ||
85 | }; | ||
86 | |||
87 | #endif | ||
88 | |||
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp index 5bac874..5506c55 100644 --- a/core/launcher/startmenu.cpp +++ b/core/launcher/startmenu.cpp | |||
@@ -1,171 +1,171 @@ | |||
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 "sidething.h" | 22 | #include "sidething.h" |
23 | #include "mrulist.h" | 23 | //#include "mrulist.h" |
24 | #include "info.h" | 24 | #include "info.h" |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
29 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
30 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
31 | 31 | ||
32 | #include <qdict.h> | 32 | #include <qdict.h> |
33 | 33 | ||
34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
35 | 35 | ||
36 | 36 | ||
37 | // #define USE_CONFIG_FILE | 37 | // #define USE_CONFIG_FILE |
38 | 38 | ||
39 | 39 | ||
40 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) | 40 | StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) |
41 | { | 41 | { |
42 | loadOptions(); | 42 | loadOptions(); |
43 | 43 | ||
44 | setPixmap( Resource::loadPixmap( startButtonPixmap ) ); | 44 | setPixmap( Resource::loadPixmap( startButtonPixmap ) ); |
45 | setFocusPolicy( NoFocus ); | 45 | setFocusPolicy( NoFocus ); |
46 | //setFlat( startButtonIsFlat ); | 46 | //setFlat( startButtonIsFlat ); |
47 | 47 | ||
48 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); | 48 | apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" ); |
49 | 49 | ||
50 | createMenu(); | 50 | createMenu(); |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void StartMenu::mousePressEvent( QMouseEvent * ) | 54 | void StartMenu::mousePressEvent( QMouseEvent * ) |
55 | { | 55 | { |
56 | launch(); | 56 | launch(); |
57 | if (desktopInfo) | 57 | if (desktopInfo) |
58 | desktopInfo->menuClicked(); | 58 | desktopInfo->menuClicked(); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | StartMenu::~StartMenu() | 62 | StartMenu::~StartMenu() |
63 | { | 63 | { |
64 | delete apps; | 64 | delete apps; |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | void StartMenu::loadOptions() | 68 | void StartMenu::loadOptions() |
69 | { | 69 | { |
70 | #ifdef USE_CONFIG_FILE | 70 | #ifdef USE_CONFIG_FILE |
71 | // Read configuration file | 71 | // Read configuration file |
72 | Config config("StartMenu"); | 72 | Config config("StartMenu"); |
73 | config.setGroup( "StartMenu" ); | 73 | config.setGroup( "StartMenu" ); |
74 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); | 74 | QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" ); |
75 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; | 75 | useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE; |
76 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); | 76 | QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" ); |
77 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; | 77 | startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE; |
78 | QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); | 78 | // QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" ); |
79 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); | 79 | popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "launcher/sidebar" ); |
80 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); | 80 | startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" ); |
81 | #else | 81 | #else |
82 | // Basically just #include the .qpe_menu.conf file settings | 82 | // Basically just #include the .qpe_menu.conf file settings |
83 | useWidePopupMenu = FALSE; | 83 | useWidePopupMenu = FALSE; |
84 | popupMenuSidePixmap = "lauchner/sidebar"; | 84 | popupMenuSidePixmap = "lauchner/sidebar"; |
85 | startButtonIsFlat = TRUE; | 85 | startButtonIsFlat = TRUE; |
86 | startButtonPixmap = "launcher/start_button"; | 86 | startButtonPixmap = "launcher/start_button"; |
87 | #endif | 87 | #endif |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | void StartMenu::createMenu() | 91 | void StartMenu::createMenu() |
92 | { | 92 | { |
93 | if ( useWidePopupMenu ) | 93 | if ( useWidePopupMenu ) |
94 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); | 94 | launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap ); |
95 | else | 95 | else |
96 | launchMenu = new StartPopupMenu( this ); | 96 | launchMenu = new StartPopupMenu( this ); |
97 | 97 | ||
98 | loadMenu( apps, launchMenu ); | 98 | loadMenu( apps, launchMenu ); |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | void StartMenu::itemSelected( int id ) | 102 | void StartMenu::itemSelected( int id ) |
103 | { | 103 | { |
104 | const AppLnk *app = apps->find( id ); | 104 | const AppLnk *app = apps->find( id ); |
105 | if ( app ) | 105 | if ( app ) |
106 | app->execute(); | 106 | app->execute(); |
107 | } | 107 | } |
108 | 108 | ||
109 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | 109 | bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) |
110 | { | 110 | { |
111 | bool result = FALSE; | 111 | bool result = FALSE; |
112 | 112 | ||
113 | QStringList typs = folder->types(); | 113 | QStringList typs = folder->types(); |
114 | QDict<QPopupMenu> typpop; | 114 | QDict<QPopupMenu> typpop; |
115 | for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) { | 115 | for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) { |
116 | if ( !(*tit).isEmpty() ) { | 116 | if ( !(*tit).isEmpty() ) { |
117 | QPopupMenu *new_menu = new StartPopupMenu( menu ); | 117 | QPopupMenu *new_menu = new StartPopupMenu( menu ); |
118 | typpop.insert(*tit, new_menu); | 118 | typpop.insert(*tit, new_menu); |
119 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 119 | connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
120 | menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu ); | 120 | menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu ); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | QListIterator<AppLnk> it( folder->children() ); | 124 | QListIterator<AppLnk> it( folder->children() ); |
125 | for ( ; it.current(); ++it ) { | 125 | for ( ; it.current(); ++it ) { |
126 | AppLnk *app = it.current(); | 126 | AppLnk *app = it.current(); |
127 | if ( app->type() == "Separator" ) { | 127 | if ( app->type() == "Separator" ) { |
128 | menu->insertSeparator(); | 128 | menu->insertSeparator(); |
129 | } else { | 129 | } else { |
130 | QString t = app->type(); | 130 | QString t = app->type(); |
131 | QPopupMenu* pmenu = typpop.find(t); | 131 | QPopupMenu* pmenu = typpop.find(t); |
132 | if ( !pmenu ) | 132 | if ( !pmenu ) |
133 | pmenu = menu; | 133 | pmenu = menu; |
134 | pmenu->insertItem( app->pixmap(), app->name(), app->id() ); | 134 | pmenu->insertItem( app->pixmap(), app->name(), app->id() ); |
135 | result=TRUE; | 135 | result=TRUE; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | if ( result ) | 139 | if ( result ) |
140 | connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); | 140 | connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); |
141 | 141 | ||
142 | return result; | 142 | return result; |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void StartMenu::launch() | 146 | void StartMenu::launch() |
147 | { | 147 | { |
148 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 148 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); |
149 | 149 | ||
150 | if ( launchMenu->isVisible() ) | 150 | if ( launchMenu->isVisible() ) |
151 | launchMenu->hide(); | 151 | launchMenu->hide(); |
152 | else | 152 | else |
153 | launchMenu->popup( QPoint( 1, y ) ); | 153 | launchMenu->popup( QPoint( 1, y ) ); |
154 | } | 154 | } |
155 | 155 | ||
156 | const AppLnk* StartMenu::execToLink(const QString& appname) | 156 | const AppLnk* StartMenu::execToLink(const QString& appname) |
157 | { | 157 | { |
158 | const AppLnk* a = apps->findExec( appname ); | 158 | const AppLnk* a = apps->findExec( appname ); |
159 | return a; | 159 | return a; |
160 | } | 160 | } |
161 | 161 | ||
162 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 162 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
163 | { | 163 | { |
164 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 164 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
165 | // "OK" button, little hacky | 165 | // "OK" button, little hacky |
166 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 166 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
167 | QPopupMenu::keyPressEvent( &ke ); | 167 | QPopupMenu::keyPressEvent( &ke ); |
168 | } else { | 168 | } else { |
169 | QPopupMenu::keyPressEvent( e ); | 169 | QPopupMenu::keyPressEvent( e ); |
170 | } | 170 | } |
171 | } | 171 | } |
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index e38b9fe..9f397eb 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -1,316 +1,323 @@ | |||
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 "runningappbar.h" | ||
24 | #include "systray.h" | 25 | #include "systray.h" |
25 | #include "calibrate.h" | 26 | #include "calibrate.h" |
26 | #include "wait.h" | 27 | #include "wait.h" |
27 | #include "appicons.h" | 28 | #include "appicons.h" |
28 | 29 | ||
29 | #include "taskbar.h" | 30 | #include "taskbar.h" |
30 | #include "desktop.h" | 31 | #include "desktop.h" |
31 | 32 | ||
32 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
35 | 36 | ||
36 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) | 37 | #if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) |
37 | #include <qpe/custom.h> | 38 | #include <qpe/custom.h> |
38 | #endif | 39 | #endif |
39 | 40 | ||
40 | #include <opie/odevice.h> | 41 | #include <opie/odevice.h> |
41 | 42 | ||
42 | #include <qlabel.h> | 43 | #include <qlabel.h> |
43 | #include <qlayout.h> | 44 | #include <qlayout.h> |
44 | #include <qtimer.h> | 45 | #include <qtimer.h> |
45 | #include <qwindowsystem_qws.h> | 46 | #include <qwindowsystem_qws.h> |
46 | #include <qwidgetstack.h> | 47 | #include <qwidgetstack.h> |
47 | 48 | ||
48 | #if defined( Q_WS_QWS ) | 49 | #if defined( Q_WS_QWS ) |
49 | #include <qwsdisplay_qws.h> | 50 | #include <qwsdisplay_qws.h> |
50 | #include <qgfx_qws.h> | 51 | #include <qgfx_qws.h> |
51 | #endif | 52 | #endif |
52 | 53 | ||
53 | 54 | ||
54 | #define FACTORY(T) \ | 55 | #define FACTORY(T) \ |
55 | static QWidget *new##T( bool maximized ) { \ | 56 | static QWidget *new##T( bool maximized ) { \ |
56 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ | 57 | QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ |
57 | if ( maximized ) { \ | 58 | if ( maximized ) { \ |
58 | if ( qApp->desktop()->width() <= 350 ) { \ | 59 | if ( qApp->desktop()->width() <= 350 ) { \ |
59 | w->showMaximized(); \ | 60 | w->showMaximized(); \ |
60 | } else { \ | 61 | } else { \ |
61 | w->resize( QSize( 300, 300 ) ); \ | 62 | w->resize( QSize( 300, 300 ) ); \ |
62 | } \ | 63 | } \ |
63 | } \ | 64 | } \ |
64 | w->show(); \ | 65 | w->show(); \ |
65 | return w; \ | 66 | return w; \ |
66 | } | 67 | } |
67 | 68 | ||
68 | 69 | ||
69 | #ifdef SINGLE_APP | 70 | #ifdef SINGLE_APP |
70 | #define APP(a,b,c,d) FACTORY(b) | 71 | #define APP(a,b,c,d) FACTORY(b) |
71 | #include "../launcher/apps.h" | 72 | #include "../launcher/apps.h" |
72 | #undef APP | 73 | #undef APP |
73 | #endif // SINGLE_APP | 74 | #endif // SINGLE_APP |
74 | 75 | ||
75 | static Global::Command builtins[] = { | 76 | static Global::Command builtins[] = { |
76 | 77 | ||
77 | #ifdef SINGLE_APP | 78 | #ifdef SINGLE_APP |
78 | #define APP(a,b,c,d) { a, new##b, c }, | 79 | #define APP(a,b,c,d) { a, new##b, c }, |
79 | #include "../launcher/apps.h" | 80 | #include "../launcher/apps.h" |
80 | #undef APP | 81 | #undef APP |
81 | #endif | 82 | #endif |
82 | 83 | ||
83 | #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) |
84 | { "calibrate", TaskBar::calibrate, 1, 0 }, | 85 | { "calibrate", TaskBar::calibrate, 1, 0 }, |
85 | #endif | 86 | #endif |
86 | #if !defined(QT_QWS_CASSIOPEIA) | 87 | #if !defined(QT_QWS_CASSIOPEIA) |
87 | { "shutdown", Global::shutdown, 1, 0 }, | 88 | { "shutdown", Global::shutdown, 1, 0 }, |
88 | // { "run", run, 1, 0 }, | 89 | // { "run", run, 1, 0 }, |
89 | #endif | 90 | #endif |
90 | 91 | ||
91 | { 0, TaskBar::calibrate, 0, 0 }, | 92 | { 0, TaskBar::calibrate, 0, 0 }, |
92 | }; | 93 | }; |
93 | 94 | ||
94 | static bool initNumLock() | 95 | static bool initNumLock() |
95 | { | 96 | { |
96 | #ifdef QPE_INITIAL_NUMLOCK_STATE | 97 | #ifdef QPE_INITIAL_NUMLOCK_STATE |
97 | QPE_INITIAL_NUMLOCK_STATE | 98 | QPE_INITIAL_NUMLOCK_STATE |
98 | #endif | 99 | #endif |
99 | return FALSE; | 100 | return FALSE; |
100 | } | 101 | } |
101 | 102 | ||
102 | class LockKeyState : public QWidget | 103 | class LockKeyState : public QWidget |
103 | { | 104 | { |
104 | public: | 105 | public: |
105 | LockKeyState( QWidget *parent ) : | 106 | LockKeyState( QWidget *parent ) : |
106 | QWidget(parent), | 107 | QWidget(parent), |
107 | nl(initNumLock()), cl(FALSE) | 108 | nl(initNumLock()), cl(FALSE) |
108 | { | 109 | { |
109 | nl_pm = Resource::loadPixmap("numlock"); | 110 | nl_pm = Resource::loadPixmap("numlock"); |
110 | cl_pm = Resource::loadPixmap("capslock"); | 111 | cl_pm = Resource::loadPixmap("capslock"); |
111 | } | 112 | } |
112 | QSize sizeHint() const | 113 | QSize sizeHint() const |
113 | { | 114 | { |
114 | 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); |
115 | } | 116 | } |
116 | void toggleNumLockState() | 117 | void toggleNumLockState() |
117 | { | 118 | { |
118 | nl = !nl; repaint(); | 119 | nl = !nl; repaint(); |
119 | } | 120 | } |
120 | void toggleCapsLockState() | 121 | void toggleCapsLockState() |
121 | { | 122 | { |
122 | cl = !cl; repaint(); | 123 | cl = !cl; repaint(); |
123 | } | 124 | } |
124 | void paintEvent( QPaintEvent * ) | 125 | void paintEvent( QPaintEvent * ) |
125 | { | 126 | { |
126 | int y = (height()-sizeHint().height())/2; | 127 | int y = (height()-sizeHint().height())/2; |
127 | QPainter p(this); | 128 | QPainter p(this); |
128 | if ( nl ) | 129 | if ( nl ) |
129 | p.drawPixmap(1,y,nl_pm); | 130 | p.drawPixmap(1,y,nl_pm); |
130 | if ( cl ) | 131 | if ( cl ) |
131 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); | 132 | p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); |
132 | } | 133 | } |
133 | private: | 134 | private: |
134 | QPixmap nl_pm, cl_pm; | 135 | QPixmap nl_pm, cl_pm; |
135 | bool nl, cl; | 136 | bool nl, cl; |
136 | }; | 137 | }; |
137 | 138 | ||
138 | TaskBar::~TaskBar() | 139 | TaskBar::~TaskBar() |
139 | { | 140 | { |
140 | } | 141 | } |
141 | 142 | ||
142 | 143 | ||
143 | 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) |
144 | { | 145 | { |
145 | Global::setBuiltinCommands(builtins); | 146 | Global::setBuiltinCommands(builtins); |
146 | 147 | ||
147 | sm = new StartMenu( this ); | 148 | sm = new StartMenu( this ); |
148 | 149 | ||
149 | inputMethods = new InputMethods( this ); | 150 | inputMethods = new InputMethods( this ); |
150 | connect( inputMethods, SIGNAL(inputToggled(bool)), | 151 | connect( inputMethods, SIGNAL(inputToggled(bool)), |
151 | this, SLOT(calcMaxWindowRect()) ); | 152 | this, SLOT(calcMaxWindowRect()) ); |
152 | //new QuickLauncher( this ); | 153 | //new QuickLauncher( this ); |
153 | 154 | ||
154 | stack = new QWidgetStack( this ); | 155 | stack = new QWidgetStack( this ); |
155 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); | 156 | stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); |
156 | label = new QLabel(stack); | 157 | label = new QLabel(stack); |
157 | 158 | ||
158 | mru = new MRUList( stack ); | 159 | //mru = new MRUList( stack ); |
159 | stack->raiseWidget( mru ); | 160 | //stack->raiseWidget( mru ); |
161 | |||
162 | runningAppBar = new RunningAppBar(stack); | ||
163 | stack->raiseWidget(runningAppBar); | ||
160 | 164 | ||
161 | waitIcon = new Wait( this ); | 165 | waitIcon = new Wait( this ); |
162 | (void) new AppIcons( this ); | 166 | (void) new AppIcons( this ); |
163 | 167 | ||
164 | sysTray = new SysTray( this ); | 168 | sysTray = new SysTray( this ); |
165 | 169 | ||
166 | // ## make customizable in some way? | 170 | // ## make customizable in some way? |
167 | #ifdef QT_QWS_CUSTOM | 171 | #ifdef QT_QWS_CUSTOM |
168 | lockState = new LockKeyState( this ); | 172 | lockState = new LockKeyState( this ); |
169 | #else | 173 | y#else |
170 | lockState = 0; | 174 | lockState = 0; |
171 | #endif | 175 | #endif |
172 | 176 | ||
173 | #if defined(Q_WS_QWS) | 177 | #if defined(Q_WS_QWS) |
174 | #if !defined(QT_NO_COP) | 178 | #if !defined(QT_NO_COP) |
175 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); | 179 | QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); |
176 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 180 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
177 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 181 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
178 | #endif | 182 | #endif |
179 | #endif | 183 | #endif |
180 | waitTimer = new QTimer( this ); | 184 | waitTimer = new QTimer( this ); |
181 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); | 185 | connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); |
182 | clearer = new QTimer( this ); | 186 | clearer = new QTimer( this ); |
183 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); | 187 | QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); |
184 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); | 188 | QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); |
185 | } | 189 | } |
186 | 190 | ||
187 | void TaskBar::setStatusMessage( const QString &text ) | 191 | void TaskBar::setStatusMessage( const QString &text ) |
188 | { | 192 | { |
189 | label->setText( text ); | 193 | label->setText( text ); |
190 | stack->raiseWidget( label ); | 194 | stack->raiseWidget( label ); |
191 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) | 195 | if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) |
192 | sysTray->hide(); | 196 | sysTray->hide(); |
193 | clearer->start( 3000 ); | 197 | clearer->start( 3000 ); |
194 | } | 198 | } |
195 | 199 | ||
196 | void TaskBar::clearStatusBar() | 200 | void TaskBar::clearStatusBar() |
197 | { | 201 | { |
198 | label->clear(); | 202 | label->clear(); |
199 | stack->raiseWidget( mru ); | 203 | stack->raiseWidget(runningAppBar); |
204 | // stack->raiseWidget( mru ); | ||
200 | } | 205 | } |
201 | 206 | ||
202 | void TaskBar::startWait() | 207 | void TaskBar::startWait() |
203 | { | 208 | { |
204 | waitIcon->setWaiting( true ); | 209 | waitIcon->setWaiting( true ); |
205 | // a catchall stop after 10 seconds... | 210 | // a catchall stop after 10 seconds... |
206 | waitTimer->start( 10 * 1000, true ); | 211 | waitTimer->start( 10 * 1000, true ); |
207 | } | 212 | } |
208 | 213 | ||
209 | void TaskBar::stopWait(const QString& app) | 214 | void TaskBar::stopWait(const QString& app) |
210 | { | 215 | { |
211 | waitTimer->stop(); | 216 | waitTimer->stop(); |
212 | mru->addTask(sm->execToLink(app)); | 217 | //mru->addTask(sm->execToLink(app)); |
213 | waitIcon->setWaiting( false ); | 218 | waitIcon->setWaiting( false ); |
214 | } | 219 | } |
215 | 220 | ||
216 | void TaskBar::stopWait() | 221 | void TaskBar::stopWait() |
217 | { | 222 | { |
218 | waitTimer->stop(); | 223 | waitTimer->stop(); |
224 | |||
219 | waitIcon->setWaiting( false ); | 225 | waitIcon->setWaiting( false ); |
220 | } | 226 | } |
221 | 227 | ||
222 | void TaskBar::resizeEvent( QResizeEvent *e ) | 228 | void TaskBar::resizeEvent( QResizeEvent *e ) |
223 | { | 229 | { |
224 | QHBox::resizeEvent( e ); | 230 | QHBox::resizeEvent( e ); |
225 | calcMaxWindowRect(); | 231 | calcMaxWindowRect(); |
226 | } | 232 | } |
227 | 233 | ||
228 | void TaskBar::styleChange( QStyle &s ) | 234 | void TaskBar::styleChange( QStyle &s ) |
229 | { | 235 | { |
230 | QHBox::styleChange( s ); | 236 | QHBox::styleChange( s ); |
231 | calcMaxWindowRect(); | 237 | calcMaxWindowRect(); |
232 | } | 238 | } |
233 | 239 | ||
234 | void TaskBar::calcMaxWindowRect() | 240 | void TaskBar::calcMaxWindowRect() |
235 | { | 241 | { |
236 | #ifdef Q_WS_QWS | 242 | #ifdef Q_WS_QWS |
237 | QRect wr; | 243 | QRect wr; |
238 | int displayWidth = qApp->desktop()->width(); | 244 | int displayWidth = qApp->desktop()->width(); |
239 | QRect ir = inputMethods->inputRect(); | 245 | QRect ir = inputMethods->inputRect(); |
240 | if ( ir.isValid() ) { | 246 | if ( ir.isValid() ) { |
241 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); | 247 | wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); |
242 | } else { | 248 | } else { |
243 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); | 249 | wr.setCoords( 0, 0, displayWidth-1, y()-1 ); |
244 | } | 250 | } |
245 | 251 | ||
246 | #if QT_VERSION < 300 | 252 | #if QT_VERSION < 300 |
247 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, | 253 | QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, |
248 | QSize(qt_screen->width(),qt_screen->height())) | 254 | QSize(qt_screen->width(),qt_screen->height())) |
249 | ); | 255 | ); |
250 | #else | 256 | #else |
251 | QWSServer::setMaxWindowRect( wr ); | 257 | QWSServer::setMaxWindowRect( wr ); |
252 | #endif | 258 | #endif |
253 | #endif | 259 | #endif |
254 | } | 260 | } |
255 | 261 | ||
256 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) | 262 | void TaskBar::receive( const QCString &msg, const QByteArray &data ) |
257 | { | 263 | { |
258 | QDataStream stream( data, IO_ReadOnly ); | 264 | QDataStream stream( data, IO_ReadOnly ); |
259 | if ( msg == "message(QString)" ) { | 265 | if ( msg == "message(QString)" ) { |
260 | QString text; | 266 | QString text; |
261 | stream >> text; | 267 | stream >> text; |
262 | setStatusMessage( text ); | 268 | setStatusMessage( text ); |
263 | } else if ( msg == "hideInputMethod()" ) { | 269 | } else if ( msg == "hideInputMethod()" ) { |
264 | inputMethods->hideInputMethod(); | 270 | inputMethods->hideInputMethod(); |
265 | } else if ( msg == "showInputMethod()" ) { | 271 | } else if ( msg == "showInputMethod()" ) { |
266 | inputMethods->showInputMethod(); | 272 | inputMethods->showInputMethod(); |
267 | } else if ( msg == "reloadInputMethods()" ) { | 273 | } else if ( msg == "reloadInputMethods()" ) { |
268 | inputMethods->loadInputMethods(); | 274 | inputMethods->loadInputMethods(); |
269 | } else if ( msg == "reloadApplets()" ) { | 275 | } else if ( msg == "reloadApplets()" ) { |
270 | sysTray->loadApplets(); | 276 | sysTray->loadApplets(); |
271 | } else if ( msg == "soundAlarm()" ) { | 277 | } else if ( msg == "soundAlarm()" ) { |
272 | Desktop::soundAlarm(); | 278 | Desktop::soundAlarm(); |
273 | } | 279 | } |
274 | else if ( msg == "setLed(int,bool)" ) { | 280 | else if ( msg == "setLed(int,bool)" ) { |
275 | int led, status; | 281 | int led, status; |
276 | stream >> led >> status; | 282 | stream >> led >> status; |
277 | 283 | ||
278 | ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); | 284 | ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); |
279 | } | 285 | } |
280 | } | 286 | } |
281 | 287 | ||
282 | QWidget *TaskBar::calibrate(bool) | 288 | QWidget *TaskBar::calibrate(bool) |
283 | { | 289 | { |
284 | #ifdef Q_WS_QWS | 290 | #ifdef Q_WS_QWS |
285 | Calibrate *c = new Calibrate; | 291 | Calibrate *c = new Calibrate; |
286 | c->show(); | 292 | c->show(); |
287 | return c; | 293 | return c; |
288 | #else | 294 | #else |
289 | return 0; | 295 | return 0; |
290 | #endif | 296 | #endif |
291 | } | 297 | } |
292 | 298 | ||
293 | void TaskBar::toggleNumLockState() | 299 | void TaskBar::toggleNumLockState() |
294 | { | 300 | { |
295 | if ( lockState ) lockState->toggleNumLockState(); | 301 | if ( lockState ) lockState->toggleNumLockState(); |
296 | } | 302 | } |
297 | 303 | ||
298 | void TaskBar::toggleCapsLockState() | 304 | void TaskBar::toggleCapsLockState() |
299 | { | 305 | { |
300 | if ( lockState ) lockState->toggleCapsLockState(); | 306 | if ( lockState ) lockState->toggleCapsLockState(); |
301 | } | 307 | } |
302 | 308 | ||
303 | void TaskBar::toggleSymbolInput() | 309 | void TaskBar::toggleSymbolInput() |
304 | { | 310 | { |
305 | if ( inputMethods->currentShown() == "Unicode" ) { | 311 | if ( inputMethods->currentShown() == "Unicode" ) { |
306 | inputMethods->hideInputMethod(); | 312 | inputMethods->hideInputMethod(); |
307 | } else { | 313 | } else { |
308 | inputMethods->showInputMethod("Unicode"); | 314 | inputMethods->showInputMethod("Unicode"); |
309 | } | 315 | } |
310 | } | 316 | } |
311 | 317 | ||
312 | bool TaskBar::recoverMemory() | 318 | bool TaskBar::recoverMemory() |
313 | { | 319 | { |
314 | return mru->quitOldApps(); | 320 | //eturn mru->quitOldApps(); |
321 | return true; | ||
315 | } | 322 | } |
316 | 323 | ||
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h index 40983af..cd631ef 100644 --- a/core/launcher/taskbar.h +++ b/core/launcher/taskbar.h | |||
@@ -1,82 +1,84 @@ | |||
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 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | 25 | ||
26 | class QLabel; | 26 | class QLabel; |
27 | class QTimer; | 27 | class QTimer; |
28 | class InputMethods; | 28 | class InputMethods; |
29 | class Wait; | 29 | class Wait; |
30 | class SysTray; | 30 | class SysTray; |
31 | class MRUList; | 31 | //class MRUList; |
32 | class RunningAppBar; | ||
32 | class QWidgetStack; | 33 | class QWidgetStack; |
33 | class QTimer; | 34 | class QTimer; |
34 | class QLabel; | 35 | class QLabel; |
35 | class StartMenu; | 36 | class StartMenu; |
36 | class LockKeyState; | 37 | class LockKeyState; |
37 | 38 | ||
38 | class TaskBar : public QHBox { | 39 | class TaskBar : public QHBox { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | public: | 41 | public: |
41 | TaskBar(); | 42 | TaskBar(); |
42 | ~TaskBar(); | 43 | ~TaskBar(); |
43 | 44 | ||
44 | static QWidget *calibrate( bool ); | 45 | static QWidget *calibrate( bool ); |
45 | 46 | ||
46 | bool recoverMemory(); | 47 | bool recoverMemory(); |
47 | 48 | ||
48 | StartMenu *startMenu() const { return sm; } | 49 | StartMenu *startMenu() const { return sm; } |
49 | public slots: | 50 | public slots: |
50 | void startWait(); | 51 | void startWait(); |
51 | void stopWait(const QString&); | 52 | void stopWait(const QString&); |
52 | void stopWait(); | 53 | void stopWait(); |
53 | void clearStatusBar(); | 54 | void clearStatusBar(); |
54 | void toggleNumLockState(); | 55 | void toggleNumLockState(); |
55 | void toggleCapsLockState(); | 56 | void toggleCapsLockState(); |
56 | void toggleSymbolInput(); | 57 | void toggleSymbolInput(); |
57 | 58 | ||
58 | protected: | 59 | protected: |
59 | void resizeEvent( QResizeEvent * ); | 60 | void resizeEvent( QResizeEvent * ); |
60 | void styleChange( QStyle & ); | 61 | void styleChange( QStyle & ); |
61 | void setStatusMessage( const QString &text ); | 62 | void setStatusMessage( const QString &text ); |
62 | 63 | ||
63 | private slots: | 64 | private slots: |
64 | void calcMaxWindowRect(); | 65 | void calcMaxWindowRect(); |
65 | void receive( const QCString &msg, const QByteArray &data ); | 66 | void receive( const QCString &msg, const QByteArray &data ); |
66 | 67 | ||
67 | private: | 68 | private: |
68 | 69 | ||
69 | QTimer *waitTimer; | 70 | QTimer *waitTimer; |
70 | Wait *waitIcon; | 71 | Wait *waitIcon; |
71 | InputMethods *inputMethods; | 72 | InputMethods *inputMethods; |
72 | SysTray *sysTray; | 73 | SysTray *sysTray; |
73 | MRUList *mru; | 74 | // MRUList *mru; |
75 | RunningAppBar* runningAppBar; | ||
74 | QWidgetStack *stack; | 76 | QWidgetStack *stack; |
75 | QTimer *clearer; | 77 | QTimer *clearer; |
76 | QLabel *label; | 78 | QLabel *label; |
77 | LockKeyState* lockState; | 79 | LockKeyState* lockState; |
78 | StartMenu *sm; | 80 | StartMenu *sm; |
79 | }; | 81 | }; |
80 | 82 | ||
81 | 83 | ||
82 | #endif // __TASKBAR_H__ | 84 | #endif // __TASKBAR_H__ |