summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 23:09:04 (UTC)
committer sandman <sandman>2002-09-30 23:09:04 (UTC)
commit61fdbd044d40cb3c93eab5a1ba262964a9413c66 (patch) (unidiff)
treedb5cadc832dc402b53fc910b1d0ba3c7f26474ee
parent37a8266f4a32d07a27d453897febf1f25963a4d0 (diff)
downloadopie-61fdbd044d40cb3c93eab5a1ba262964a9413c66.zip
opie-61fdbd044d40cb3c93eab5a1ba262964a9413c66.tar.gz
opie-61fdbd044d40cb3c93eab5a1ba262964a9413c66.tar.bz2
Removed the button mapping for H3800, since this is now handled in the
ODevice iPAQ keyfilter
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp40
-rw-r--r--core/launcher/desktop.h1
2 files changed, 10 insertions, 31 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 4640a12..68949e6 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -37,48 +37,50 @@
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
61using namespace Opie;
62
61class QCopKeyRegister 63class QCopKeyRegister
62{ 64{
63public: 65public:
64 QCopKeyRegister() : keyCode( 0 ) 66 QCopKeyRegister() : keyCode( 0 )
65 { } 67 { }
66 QCopKeyRegister( int k, const QString &c, const QString &m ) 68 QCopKeyRegister( int k, const QString &c, const QString &m )
67 : keyCode( k ), channel( c ), message( m ) 69 : keyCode( k ), channel( c ), message( m )
68 { } 70 { }
69 71
70 int getKeyCode() const 72 int getKeyCode() const
71 { 73 {
72 return keyCode; 74 return keyCode;
73 } 75 }
74 QString getChannel() const 76 QString getChannel() const
75 { 77 {
76 return channel; 78 return channel;
77 } 79 }
78 QString getMessage() const 80 QString getMessage() const
79 { 81 {
80 return message; 82 return message;
81 } 83 }
82 84
83private: 85private:
84 int keyCode; 86 int keyCode;
@@ -156,49 +158,49 @@ class QPEScreenSaver : public QWSScreenSaver
156private: 158private:
157 int LcdOn; 159 int LcdOn;
158 160
159public: 161public:
160 QPEScreenSaver() 162 QPEScreenSaver()
161 { 163 {
162 m_disable_suspend = 100; 164 m_disable_suspend = 100;
163 m_enable_dim = false; 165 m_enable_dim = false;
164 m_enable_lightoff = false; 166 m_enable_lightoff = false;
165 m_enable_onlylcdoff = false; 167 m_enable_onlylcdoff = false;
166 168
167 m_lcd_status = true; 169 m_lcd_status = true;
168 170
169 m_backlight_bright = -1; 171 m_backlight_bright = -1;
170 m_backlight_forcedoff = false; 172 m_backlight_forcedoff = false;
171 173
172 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) 174 // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
173 ODevice::inst ( ) -> setDisplayStatus ( true ); 175 ODevice::inst ( ) -> setDisplayStatus ( true );
174 } 176 }
175 void restore() 177 void restore()
176 { 178 {
177 if ( !m_lcd_status ) // We must have turned it off 179 if ( !m_lcd_status ) // We must have turned it off
178 ODevice::inst ( ) -> setDisplayStatus ( true ); 180 ODevice::inst ( ) -> setDisplayStatus ( true );
179 181
180 setBacklight ( -1 ); 182 setBacklight ( -3 );
181 } 183 }
182 bool save( int level ) 184 bool save( int level )
183 { 185 {
184 switch ( level ) { 186 switch ( level ) {
185 case 0: 187 case 0:
186 if ( m_disable_suspend > 0 && m_enable_dim ) { 188 if ( m_disable_suspend > 0 && m_enable_dim ) {
187 if ( backlight() > 1 ) 189 if ( backlight() > 1 )
188 setBacklight( 1 ); // lowest non-off 190 setBacklight( 1 ); // lowest non-off
189 } 191 }
190 return true; 192 return true;
191 break; 193 break;
192 case 1: 194 case 1:
193 if ( m_disable_suspend > 1 && m_enable_lightoff ) { 195 if ( m_disable_suspend > 1 && m_enable_lightoff ) {
194 setBacklight( 0 ); // off 196 setBacklight( 0 ); // off
195 } 197 }
196 return true; 198 return true;
197 break; 199 break;
198 case 2: 200 case 2:
199 if ( m_enable_onlylcdoff ) { 201 if ( m_enable_onlylcdoff ) {
200 ODevice::inst ( ) -> setDisplayStatus ( false ); 202 ODevice::inst ( ) -> setDisplayStatus ( false );
201 m_lcd_status = false; 203 m_lcd_status = false;
202 return true; 204 return true;
203 } 205 }
204 else // We're going to suspend the whole machine 206 else // We're going to suspend the whole machine
@@ -298,50 +300,55 @@ public:
298 bright = backlight ( ); 300 bright = backlight ( );
299 ODevice::inst ( ) -> setDisplayBrightness ( bright ); 301 ODevice::inst ( ) -> setDisplayBrightness ( bright );
300 302
301 m_backlight_bright = bright; 303 m_backlight_bright = bright;
302 } 304 }
303 305
304private: 306private:
305 int m_disable_suspend; 307 int m_disable_suspend;
306 bool m_enable_dim; 308 bool m_enable_dim;
307 bool m_enable_lightoff; 309 bool m_enable_lightoff;
308 bool m_enable_onlylcdoff; 310 bool m_enable_onlylcdoff;
309 311
310 bool m_lcd_status; 312 bool m_lcd_status;
311 313
312 int m_backlight_bright; 314 int m_backlight_bright;
313 bool m_backlight_forcedoff; 315 bool m_backlight_forcedoff;
314}; 316};
315 317
316 318
317void DesktopApplication::switchLCD ( bool on ) 319void DesktopApplication::switchLCD ( bool on )
318{ 320{
319 if ( qApp ) { 321 if ( qApp ) {
320 DesktopApplication *dapp = (DesktopApplication *) qApp; 322 DesktopApplication *dapp = (DesktopApplication *) qApp;
321 323
322 if ( dapp-> m_screensaver ) 324 if ( dapp-> m_screensaver ) {
323 dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 ); 325 if ( on )
326 dapp-> m_screensaver-> restore ( ); //setBacklight ( on ? -3 : -1 );
327 else
328 dapp-> m_screensaver-> save ( 1 );
329
330 }
324 } 331 }
325} 332}
326 333
327 334
328DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 335DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
329 : QPEApplication( argc, argv, appType ) 336 : QPEApplication( argc, argv, appType )
330{ 337{
331 338
332 QTimer * t = new QTimer( this ); 339 QTimer * t = new QTimer( this );
333 connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) ); 340 connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) );
334 t->start( 10000 ); 341 t->start( 10000 );
335 ps = new PowerStatus; 342 ps = new PowerStatus;
336 pa = new DesktopPowerAlerter( 0 ); 343 pa = new DesktopPowerAlerter( 0 );
337 344
338 channel = new QCopChannel( "QPE/Desktop", this ); 345 channel = new QCopChannel( "QPE/Desktop", this );
339 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), 346 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
340 this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) ); 347 this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) );
341 348
342 channel = new QCopChannel( "QPE/System", this ); 349 channel = new QCopChannel( "QPE/System", this );
343 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), 350 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
344 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); 351 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) );
345 352
346 m_screensaver = new QPEScreenSaver; 353 m_screensaver = new QPEScreenSaver;
347 354
@@ -985,51 +992,24 @@ void Desktop::rereadVolumes()
985 cfg.setGroup( "Volume" ); 992 cfg.setGroup( "Volume" );
986 touchclick = cfg.readBoolEntry( "TouchSound" ); 993 touchclick = cfg.readBoolEntry( "TouchSound" );
987 keyclick = cfg.readBoolEntry( "KeySound" ); 994 keyclick = cfg.readBoolEntry( "KeySound" );
988 alarmsound = cfg.readBoolEntry( "AlarmSound" ); 995 alarmsound = cfg.readBoolEntry( "AlarmSound" );
989} 996}
990 997
991void Desktop::keyClick() 998void Desktop::keyClick()
992{ 999{
993 if ( keyclick ) 1000 if ( keyclick )
994 ODevice::inst ( ) -> keySound ( ); 1001 ODevice::inst ( ) -> keySound ( );
995} 1002}
996 1003
997void Desktop::screenClick() 1004void Desktop::screenClick()
998{ 1005{
999 if ( touchclick ) 1006 if ( touchclick )
1000 ODevice::inst ( ) -> touchSound ( ); 1007 ODevice::inst ( ) -> touchSound ( );
1001} 1008}
1002 1009
1003void Desktop::soundAlarm() 1010void Desktop::soundAlarm()
1004{ 1011{
1005 if ( qpedesktop-> alarmsound ) 1012 if ( qpedesktop-> alarmsound )
1006 ODevice::inst ( ) -> alarmSound ( ); 1013 ODevice::inst ( ) -> alarmSound ( );
1007} 1014}
1008 1015
1009bool Desktop::eventFilter( QObject *, QEvent *ev )
1010{
1011 if ( ev-> type ( ) == QEvent::KeyPress ) {
1012 QKeyEvent * ke = ( QKeyEvent * ) ev;
1013 if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key
1014 QWidget * active = qApp-> activeWindow ( );
1015
1016 if ( active && active-> isPopup ( ) )
1017 active->close();
1018
1019 /*
1020 * On iPAQ 38xx that key is not the "menu key" but the mail key
1021 * To not confuse the users, make it launch the mail app on 38xx
1022 */
1023 if ( ODevice::inst() ->model() == OMODEL_iPAQ_H38xx ) {
1024 QCopEnvelope e( "QPE/System", "execute(QString)" );
1025 e << QString( "mail" );
1026 return true;
1027 }
1028 else {
1029 raiseMenu ( );
1030 return true;
1031 }
1032 }
1033 }
1034 return false;
1035}
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index b9ff39f..f7c3e3f 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -101,45 +101,44 @@ public:
101 101
102 void keyClick(); 102 void keyClick();
103 void screenClick(); 103 void screenClick();
104 static void soundAlarm(); 104 static void soundAlarm();
105 105
106public slots: 106public slots:
107 void raiseDatebook(); 107 void raiseDatebook();
108 void raiseContacts(); 108 void raiseContacts();
109 void raiseMenu(); 109 void raiseMenu();
110 void raiseLauncher(); 110 void raiseLauncher();
111 void raiseEmail(); 111 void raiseEmail();
112 void execAutoStart(); 112 void execAutoStart();
113 void togglePower(); 113 void togglePower();
114 void toggleLight(); 114 void toggleLight();
115 void toggleNumLockState(); 115 void toggleNumLockState();
116 void toggleCapsLockState(); 116 void toggleCapsLockState();
117 void toggleSymbolInput(); 117 void toggleSymbolInput();
118 void terminateServers(); 118 void terminateServers();
119 void rereadVolumes(); 119 void rereadVolumes();
120 120
121protected: 121protected:
122 void executeOrModify( const QString& appLnkFile ); 122 void executeOrModify( const QString& appLnkFile );
123 void styleChange( QStyle & ); 123 void styleChange( QStyle & );
124 void timerEvent( QTimerEvent *e ); 124 void timerEvent( QTimerEvent *e );
125 bool eventFilter( QObject *, QEvent * );
126 125
127 QWidget *bg; 126 QWidget *bg;
128 Launcher *launcher; 127 Launcher *launcher;
129 TaskBar *tb; 128 TaskBar *tb;
130 129
131private: 130private:
132 void startTransferServer(); 131 void startTransferServer();
133 bool recoverMemory(); 132 bool recoverMemory();
134 133
135 QCopBridge *qcopBridge; 134 QCopBridge *qcopBridge;
136 TransferServer *transferServer; 135 TransferServer *transferServer;
137 PackageSlave *packageSlave; 136 PackageSlave *packageSlave;
138 137
139 QDateTime suspendTime; 138 QDateTime suspendTime;
140 bool keyclick, touchclick, alarmsound; 139 bool keyclick, touchclick, alarmsound;
141}; 140};
142 141
143 142
144#endif // __DESKTOP_H__ 143#endif // __DESKTOP_H__
145 144