summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-20 04:30:34 (UTC)
committer llornkcor <llornkcor>2002-10-20 04:30:34 (UTC)
commite2694c5aedb3697a373e363cebe72cddb3114a8f (patch) (unidiff)
tree5ba5910a40cfc151e01a956c609f1bdd0243668e
parentf6a0af65b96edf63135d2b88c17b8510eebbbd51 (diff)
downloadopie-e2694c5aedb3697a373e363cebe72cddb3114a8f.zip
opie-e2694c5aedb3697a373e363cebe72cddb3114a8f.tar.gz
opie-e2694c5aedb3697a373e363cebe72cddb3114a8f.tar.bz2
fix menu button on zaurus F11 raising opie menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp10
-rw-r--r--core/launcher/desktop.h131
-rw-r--r--core/launcher/main.cpp1
3 files changed, 72 insertions, 70 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 3546e28..9863187 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -393,51 +393,51 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray &
393{ 393{
394 QDataStream stream ( data, IO_ReadOnly ); 394 QDataStream stream ( data, IO_ReadOnly );
395 395
396 if ( msg == "setScreenSaverInterval(int)" ) { 396 if ( msg == "setScreenSaverInterval(int)" ) {
397 int time; 397 int time;
398 stream >> time; 398 stream >> time;
399 m_screensaver-> setInterval( time ); 399 m_screensaver-> setInterval( time );
400 } 400 }
401 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { 401 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) {
402 int t1, t2, t3; 402 int t1, t2, t3;
403 stream >> t1 >> t2 >> t3; 403 stream >> t1 >> t2 >> t3;
404 m_screensaver-> setIntervals( t1, t2, t3 ); 404 m_screensaver-> setIntervals( t1, t2, t3 );
405 } 405 }
406 else if ( msg == "setBacklight(int)" ) { 406 else if ( msg == "setBacklight(int)" ) {
407 int bright; 407 int bright;
408 stream >> bright; 408 stream >> bright;
409 m_screensaver-> setBacklight( bright ); 409 m_screensaver-> setBacklight( bright );
410 } 410 }
411 else if ( msg == "setScreenSaverMode(int)" ) { 411 else if ( msg == "setScreenSaverMode(int)" ) {
412 int mode; 412 int mode;
413 stream >> mode; 413 stream >> mode;
414 m_screensaver-> setMode ( mode ); 414 m_screensaver-> setMode ( mode );
415 } 415 }
416 else if ( msg == "setDisplayState(int)" ) { 416 else if ( msg == "setDisplayState(int)" ) {
417 int state; 417 int state;
418 stream >> state; 418 stream >> state;
419 m_screensaver-> setDisplayState ( state != 0 ); 419 m_screensaver-> setDisplayState ( state != 0 );
420 } 420 }
421 else if ( msg == "suspend()" ) { 421 else if ( msg == "suspend()" ) {
422 emit power(); 422 emit power();
423 } 423 }
424} 424}
425 425
426enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; 426enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown;
427 427
428#ifdef Q_WS_QWS 428#ifdef Q_WS_QWS
429bool DesktopApplication::qwsEventFilter( QWSEvent *e ) 429bool DesktopApplication::qwsEventFilter( QWSEvent *e )
430{ 430{
431 qpedesktop->checkMemory(); 431 qpedesktop->checkMemory();
432 432
433 if ( e->type == QWSEvent::Key ) { 433 if ( e->type == QWSEvent::Key ) {
434 QWSKeyEvent * ke = ( QWSKeyEvent * ) e; 434 QWSKeyEvent * ke = ( QWSKeyEvent * ) e;
435 if ( !loggedin && ke->simpleData.keycode != Key_F34 ) 435 if ( !loggedin && ke->simpleData.keycode != Key_F34 )
436 return TRUE; 436 return TRUE;
437 bool press = ke->simpleData.is_press; 437 bool press = ke->simpleData.is_press;
438 bool autoRepeat = ke->simpleData.is_auto_repeat; 438 bool autoRepeat = ke->simpleData.is_auto_repeat;
439 439
440 /* 440 /*
441 app that registers key/message to be sent back to the app, when it doesn't have focus, 441 app that registers key/message to be sent back to the app, when it doesn't have focus,
442 when user presses key, unless keyboard has been requested from app. 442 when user presses key, unless keyboard has been requested from app.
443 will not send multiple repeats if user holds key 443 will not send multiple repeats if user holds key
@@ -454,54 +454,54 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
454 qDebug( "release" ); 454 qDebug( "release" );
455 QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() ); 455 QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() );
456 } 456 }
457 } 457 }
458 } 458 }
459 459
460 if ( !keyboardGrabbed() ) { 460 if ( !keyboardGrabbed() ) {
461 if ( ke->simpleData.keycode == Key_F9 ) { 461 if ( ke->simpleData.keycode == Key_F9 ) {
462 if ( press ) 462 if ( press )
463 emit datebook(); 463 emit datebook();
464 return TRUE; 464 return TRUE;
465 } 465 }
466 if ( ke->simpleData.keycode == Key_F10 ) { 466 if ( ke->simpleData.keycode == Key_F10 ) {
467 if ( !press && cardSendTimer ) { 467 if ( !press && cardSendTimer ) {
468 emit contacts(); 468 emit contacts();
469 delete cardSendTimer; 469 delete cardSendTimer;
470 } 470 }
471 else if ( press ) { 471 else if ( press ) {
472 cardSendTimer = new QTimer(); 472 cardSendTimer = new QTimer();
473 cardSendTimer->start( 2000, TRUE ); 473 cardSendTimer->start( 2000, TRUE );
474 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); 474 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
475 } 475 }
476 return TRUE; 476 return TRUE;
477 } 477 }
478 /* menu key now opens application menu/toolbar 478// menu key now opens application menu/toolbar
479 if ( ke->simpleData.keycode == Key_F11 ) { 479 if ( ke->simpleData.keycode == Key_F11 ) {
480 if ( press ) emit menu(); 480 if ( press ) emit menu();
481 return TRUE; 481 return TRUE;
482 } 482 }
483 */ 483
484 if ( ke->simpleData.keycode == Key_F12 ) { 484 if ( ke->simpleData.keycode == Key_F12 ) {
485 while ( activePopupWidget() ) 485 while ( activePopupWidget() )
486 activePopupWidget() ->close(); 486 activePopupWidget() ->close();
487 if ( press ) 487 if ( press )
488 emit launch(); 488 emit launch();
489 return TRUE; 489 return TRUE;
490 } 490 }
491 if ( ke->simpleData.keycode == Key_F13 ) { 491 if ( ke->simpleData.keycode == Key_F13 ) {
492 if ( press ) 492 if ( press )
493 emit email(); 493 emit email();
494 return TRUE; 494 return TRUE;
495 } 495 }
496 } 496 }
497 497
498 if ( ke->simpleData.keycode == Key_F34 ) { 498 if ( ke->simpleData.keycode == Key_F34 ) {
499 if ( press ) 499 if ( press )
500 emit power(); 500 emit power();
501 return TRUE; 501 return TRUE;
502 } 502 }
503 // This was used for the iPAQ PowerButton 503 // This was used for the iPAQ PowerButton
504 // See main.cpp for new KeyboardFilter 504 // See main.cpp for new KeyboardFilter
505 // 505 //
506 // if ( ke->simpleData.keycode == Key_SysReq ) { 506 // if ( ke->simpleData.keycode == Key_SysReq ) {
507 // if ( press ) emit power(); 507 // if ( press ) emit power();
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index 09ffe1c..5de85f4 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -20,127 +20,128 @@
20 20
21#ifndef __DESKTOP_H__ 21#ifndef __DESKTOP_H__
22#define __DESKTOP_H__ 22#define __DESKTOP_H__
23 23
24 24
25#include "shutdownimpl.h" 25#include "shutdownimpl.h"
26 26
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31 31
32class Background; 32class Background;
33class Launcher; 33class Launcher;
34class TaskBar; 34class TaskBar;
35class PowerStatus; 35class PowerStatus;
36class QCopBridge; 36class QCopBridge;
37class TransferServer; 37class TransferServer;
38class DesktopPowerAlerter; 38class DesktopPowerAlerter;
39class PackageSlave; 39class PackageSlave;
40class QPEScreenSaver; 40class QPEScreenSaver;
41 41
42class DesktopApplication : public QPEApplication 42class DesktopApplication : public QPEApplication
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45public: 45public:
46 DesktopApplication( int& argc, char **argv, Type t ); 46 DesktopApplication( int& argc, char **argv, Type t );
47 ~DesktopApplication(); 47 ~DesktopApplication();
48 48
49 static void switchLCD ( bool on ); // only for togglePower in Desktop 49 static void switchLCD ( bool on ); // only for togglePower in Desktop
50 50
51signals: 51signals:
52 void home(); 52 void menu();
53 void datebook(); 53 void home();
54 void contacts(); 54 void datebook();
55 void launch(); 55 void contacts();
56 void email(); 56 void launch();
57 void backlight(); 57 void email();
58 void power(); 58 void backlight();
59 void symbol(); 59 void power();
60 void numLockStateToggle(); 60 void symbol();
61 void capsLockStateToggle(); 61 void numLockStateToggle();
62 void prepareForRestart(); 62 void capsLockStateToggle();
63 void prepareForRestart();
63 64
64protected: 65protected:
65#ifdef Q_WS_QWS 66#ifdef Q_WS_QWS
66 67
67 bool qwsEventFilter( QWSEvent * ); 68 bool qwsEventFilter( QWSEvent * );
68#endif 69#endif
69 70
70 void shutdown(); 71 void shutdown();
71 void restart(); 72 void restart();
72 73
73public slots: 74public slots:
74 virtual void desktopMessage ( const QCString &msg, const QByteArray &data ); 75 virtual void desktopMessage ( const QCString &msg, const QByteArray &data );
75 virtual void systemMessage ( const QCString &msg, const QByteArray &data ); 76 virtual void systemMessage ( const QCString &msg, const QByteArray &data );
76 77
77protected slots: 78protected slots:
78 void shutdown( ShutdownImpl::Type ); 79 void shutdown( ShutdownImpl::Type );
79 void psTimeout(); 80 void psTimeout();
80 void sendCard(); 81 void sendCard();
81private: 82private:
82 DesktopPowerAlerter *pa; 83 DesktopPowerAlerter *pa;
83 PowerStatus *ps; 84 PowerStatus *ps;
84 QTimer *cardSendTimer; 85 QTimer *cardSendTimer;
85 QCopChannel *channel; 86 QCopChannel *channel;
86 QPEScreenSaver *m_screensaver; 87 QPEScreenSaver *m_screensaver;
87}; 88};
88 89
89 90
90class Desktop : public QWidget 91class Desktop : public QWidget
91{ 92{
92 Q_OBJECT 93 Q_OBJECT
93public: 94public:
94 Desktop(); 95 Desktop();
95 ~Desktop(); 96 ~Desktop();
96 97
97 static bool screenLocked(); 98 static bool screenLocked();
98 99
99 void show(); 100 void show();
100 void checkMemory(); 101 void checkMemory();
101 102
102 void keyClick(); 103 void keyClick();
103 void screenClick(); 104 void screenClick();
104 static void soundAlarm(); 105 static void soundAlarm();
105 106
106public slots: 107public slots:
107 void raiseDatebook(); 108 void raiseDatebook();
108 void raiseContacts(); 109 void raiseContacts();
109 void raiseMenu(); 110 void raiseMenu();
110 void raiseLauncher(); 111 void raiseLauncher();
111 void raiseEmail(); 112 void raiseEmail();
112 void execAutoStart(); 113 void execAutoStart();
113 void togglePower(); 114 void togglePower();
114 void toggleLight(); 115 void toggleLight();
115 void toggleNumLockState(); 116 void toggleNumLockState();
116 void toggleCapsLockState(); 117 void toggleCapsLockState();
117 void toggleSymbolInput(); 118 void toggleSymbolInput();
118 void terminateServers(); 119 void terminateServers();
119 void rereadVolumes(); 120 void rereadVolumes();
120 121
121 void home ( ); 122 void home ( );
122 123
123protected: 124protected:
124 void executeOrModify( const QString& appLnkFile ); 125 void executeOrModify( const QString& appLnkFile );
125 void styleChange( QStyle & ); 126 void styleChange( QStyle & );
126 void timerEvent( QTimerEvent *e ); 127 void timerEvent( QTimerEvent *e );
127 128
128 QWidget *bg; 129 QWidget *bg;
129 Launcher *launcher; 130 Launcher *launcher;
130 TaskBar *tb; 131 TaskBar *tb;
131 132
132private: 133private:
133 void startTransferServer(); 134 void startTransferServer();
134 bool recoverMemory(); 135 bool recoverMemory();
135 136
136 QCopBridge *qcopBridge; 137 QCopBridge *qcopBridge;
137 TransferServer *transferServer; 138 TransferServer *transferServer;
138 PackageSlave *packageSlave; 139 PackageSlave *packageSlave;
139 140
140 QDateTime suspendTime; 141 QDateTime suspendTime;
141 bool keyclick, touchclick, alarmsound; 142 bool keyclick, touchclick, alarmsound;
142}; 143};
143 144
144 145
145#endif // __DESKTOP_H__ 146#endif // __DESKTOP_H__
146 147
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 762a596..8974ced 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -70,48 +70,49 @@ void initEnvironment()
70 70
71int initApplication( int argc, char ** argv ) 71int initApplication( int argc, char ** argv )
72{ 72{
73 initEnvironment(); 73 initEnvironment();
74 74
75#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 75#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
76 setenv( "QWS_SIZE", "240x320", 0 ); 76 setenv( "QWS_SIZE", "240x320", 0 );
77#endif 77#endif
78 78
79 //Don't flicker at startup: 79 //Don't flicker at startup:
80 QWSServer::setDesktopBackground( QImage() ); 80 QWSServer::setDesktopBackground( QImage() );
81 DesktopApplication a( argc, argv, QApplication::GuiServer ); 81 DesktopApplication a( argc, argv, QApplication::GuiServer );
82 82
83 ODevice::inst ( )-> setSoftSuspend ( true ); 83 ODevice::inst ( )-> setSoftSuspend ( true );
84 84
85 { // init backlight 85 { // init backlight
86 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 86 QCopEnvelope e("QPE/System", "setBacklight(int)" );
87 e << -3; // Forced on 87 e << -3; // Forced on
88 } 88 }
89 89
90 AlarmServer::initialize(); 90 AlarmServer::initialize();
91 91
92 Desktop *d = new Desktop(); 92 Desktop *d = new Desktop();
93 93
94 QObject::connect( &a, SIGNAL(menu()), d, SLOT(raiseMenu()) );
94 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); 95 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) );
95 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); 96 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
96 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); 97 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
97 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); 98 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
98 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 99 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
99 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 100 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
100 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 101 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
101 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 102 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
102 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 103 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
103 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 104 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
104 105
105 (void)new SysFileMonitor(d); 106 (void)new SysFileMonitor(d);
106 Network::createServer(d); 107 Network::createServer(d);
107 108
108#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 109#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
109 if ( !QFile::exists( "/etc/pointercal" ) ) { 110 if ( !QFile::exists( "/etc/pointercal" ) ) {
110 // Make sure calibration widget starts on top. 111 // Make sure calibration widget starts on top.
111 Calibrate *cal = new Calibrate; 112 Calibrate *cal = new Calibrate;
112 cal->exec(); 113 cal->exec();
113 delete cal; 114 delete cal;
114 } 115 }
115#endif 116#endif
116 117
117 d->show(); 118 d->show();