summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp11
-rw-r--r--core/launcher/launcher.pro2
-rw-r--r--core/launcher/main.cpp91
3 files changed, 99 insertions, 5 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index aa51898..ab4f14a 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -197,100 +197,103 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
197 KeyRegisterList::Iterator it; 197 KeyRegisterList::Iterator it;
198 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) 198 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it )
199 { 199 {
200 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { 200 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) {
201 if(press) qDebug("press"); else qDebug("release"); 201 if(press) qDebug("press"); else qDebug("release");
202 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); 202 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8());
203 } 203 }
204 } 204 }
205 } 205 }
206 206
207 if ( !keyboardGrabbed() ) { 207 if ( !keyboardGrabbed() ) {
208 if ( ke->simpleData.keycode == Key_F9 ) { 208 if ( ke->simpleData.keycode == Key_F9 ) {
209 if ( press ) emit datebook(); 209 if ( press ) emit datebook();
210 return TRUE; 210 return TRUE;
211 } 211 }
212 if ( ke->simpleData.keycode == Key_F10 ) { 212 if ( ke->simpleData.keycode == Key_F10 ) {
213 if ( !press && cardSendTimer ) { 213 if ( !press && cardSendTimer ) {
214 emit contacts(); 214 emit contacts();
215 delete cardSendTimer; 215 delete cardSendTimer;
216 } else if ( press ) { 216 } else if ( press ) {
217 cardSendTimer = new QTimer(); 217 cardSendTimer = new QTimer();
218 cardSendTimer->start( 2000, TRUE ); 218 cardSendTimer->start( 2000, TRUE );
219 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); 219 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
220 } 220 }
221 return TRUE; 221 return TRUE;
222 } 222 }
223 /* menu key now opens application menu/toolbar 223 /* menu key now opens application menu/toolbar
224 if ( ke->simpleData.keycode == Key_F11 ) { 224 if ( ke->simpleData.keycode == Key_F11 ) {
225 if ( press ) emit menu(); 225 if ( press ) emit menu();
226 return TRUE; 226 return TRUE;
227 } 227 }
228 */ 228 */
229 if ( ke->simpleData.keycode == Key_F12 ) { 229 if ( ke->simpleData.keycode == Key_F12 ) {
230 while( activePopupWidget() ) 230 while( activePopupWidget() )
231 activePopupWidget()->close(); 231 activePopupWidget()->close();
232 if ( press ) emit launch(); 232 if ( press ) emit launch();
233 return TRUE; 233 return TRUE;
234 } 234 }
235 if ( ke->simpleData.keycode == Key_F13 ) { 235 if ( ke->simpleData.keycode == Key_F13 ) {
236 if ( press ) emit email(); 236 if ( press ) emit email();
237 return TRUE; 237 return TRUE;
238 } 238 }
239 } 239 }
240 240
241 if ( ke->simpleData.keycode == Key_F34 ) { 241 if ( ke->simpleData.keycode == Key_F34 ) {
242 if ( press ) emit power(); 242 if ( press ) emit power();
243 return TRUE; 243 return TRUE;
244 } 244 }
245 if ( ke->simpleData.keycode == Key_SysReq ) { 245// This was used for the iPAQ PowerButton
246 if ( press ) emit power(); 246// See main.cpp for new KeyboardFilter
247 return TRUE; 247//
248 } 248// if ( ke->simpleData.keycode == Key_SysReq ) {
249// if ( press ) emit power();
250// return TRUE;
251// }
249 if ( ke->simpleData.keycode == Key_F35 ) { 252 if ( ke->simpleData.keycode == Key_F35 ) {
250 if ( press ) emit backlight(); 253 if ( press ) emit backlight();
251 return TRUE; 254 return TRUE;
252 } 255 }
253 if ( ke->simpleData.keycode == Key_F32 ) { 256 if ( ke->simpleData.keycode == Key_F32 ) {
254 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); 257 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" );
255 return TRUE; 258 return TRUE;
256 } 259 }
257 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { 260 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) {
258 if ( press ) emit symbol(); 261 if ( press ) emit symbol();
259 return TRUE; 262 return TRUE;
260 } 263 }
261 if ( ke->simpleData.keycode == Key_NumLock ) { 264 if ( ke->simpleData.keycode == Key_NumLock ) {
262 if ( press ) emit numLockStateToggle(); 265 if ( press ) emit numLockStateToggle();
263 } 266 }
264 if ( ke->simpleData.keycode == Key_CapsLock ) { 267 if ( ke->simpleData.keycode == Key_CapsLock ) {
265 if ( press ) emit capsLockStateToggle(); 268 if ( press ) emit capsLockStateToggle();
266 } 269 }
267 if ( press ) 270 if ( press )
268 qpedesktop->keyClick(); 271 qpedesktop->keyClick();
269 } else { 272 } else {
270 if ( e->type == QWSEvent::Mouse ) { 273 if ( e->type == QWSEvent::Mouse ) {
271 QWSMouseEvent *me = (QWSMouseEvent *)e; 274 QWSMouseEvent *me = (QWSMouseEvent *)e;
272 static bool up = TRUE; 275 static bool up = TRUE;
273 if ( me->simpleData.state&LeftButton ) { 276 if ( me->simpleData.state&LeftButton ) {
274 if ( up ) { 277 if ( up ) {
275 up = FALSE; 278 up = FALSE;
276 qpedesktop->screenClick(); 279 qpedesktop->screenClick();
277 } 280 }
278 } else { 281 } else {
279 up = TRUE; 282 up = TRUE;
280 } 283 }
281 } 284 }
282 } 285 }
283 286
284 return QPEApplication::qwsEventFilter( e ); 287 return QPEApplication::qwsEventFilter( e );
285} 288}
286#endif 289#endif
287 290
288void DesktopApplication::psTimeout() 291void DesktopApplication::psTimeout()
289{ 292{
290 qpedesktop->checkMemory(); // in case no events are being generated 293 qpedesktop->checkMemory(); // in case no events are being generated
291 294
292 *ps = PowerStatusManager::readStatus(); 295 *ps = PowerStatusManager::readStatus();
293 296
294 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { 297 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) {
295 pa->alert( tr( "Battery is running very low." ), 6 ); 298 pa->alert( tr( "Battery is running very low." ), 6 );
296 } 299 }
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index c77da50..f94f338 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -64,60 +64,60 @@ SOURCES = background.cpp \
64 launcherview.cpp \ 64 launcherview.cpp \
65 $(OPIEDIR)/calibrate/calibrate.cpp \ 65 $(OPIEDIR)/calibrate/calibrate.cpp \
66 transferserver.cpp \ 66 transferserver.cpp \
67 packageslave.cpp \ 67 packageslave.cpp \
68 irserver.cpp \ 68 irserver.cpp \
69 qcopbridge.cpp \ 69 qcopbridge.cpp \
70 startmenu.cpp \ 70 startmenu.cpp \
71 main.cpp \ 71 main.cpp \
72 $(OPIEDIR)/rsync/base64.c \ 72 $(OPIEDIR)/rsync/base64.c \
73 $(OPIEDIR)/rsync/buf.c \ 73 $(OPIEDIR)/rsync/buf.c \
74 $(OPIEDIR)/rsync/checksum.c \ 74 $(OPIEDIR)/rsync/checksum.c \
75 $(OPIEDIR)/rsync/command.c \ 75 $(OPIEDIR)/rsync/command.c \
76 $(OPIEDIR)/rsync/delta.c \ 76 $(OPIEDIR)/rsync/delta.c \
77 $(OPIEDIR)/rsync/emit.c \ 77 $(OPIEDIR)/rsync/emit.c \
78 $(OPIEDIR)/rsync/hex.c \ 78 $(OPIEDIR)/rsync/hex.c \
79 $(OPIEDIR)/rsync/job.c \ 79 $(OPIEDIR)/rsync/job.c \
80 $(OPIEDIR)/rsync/mdfour.c \ 80 $(OPIEDIR)/rsync/mdfour.c \
81 $(OPIEDIR)/rsync/mksum.c \ 81 $(OPIEDIR)/rsync/mksum.c \
82 $(OPIEDIR)/rsync/msg.c \ 82 $(OPIEDIR)/rsync/msg.c \
83 $(OPIEDIR)/rsync/netint.c \ 83 $(OPIEDIR)/rsync/netint.c \
84 $(OPIEDIR)/rsync/patch.c \ 84 $(OPIEDIR)/rsync/patch.c \
85 $(OPIEDIR)/rsync/prototab.c \ 85 $(OPIEDIR)/rsync/prototab.c \
86 $(OPIEDIR)/rsync/readsums.c \ 86 $(OPIEDIR)/rsync/readsums.c \
87 $(OPIEDIR)/rsync/scoop.c \ 87 $(OPIEDIR)/rsync/scoop.c \
88 $(OPIEDIR)/rsync/search.c \ 88 $(OPIEDIR)/rsync/search.c \
89 $(OPIEDIR)/rsync/stats.c \ 89 $(OPIEDIR)/rsync/stats.c \
90 $(OPIEDIR)/rsync/stream.c \ 90 $(OPIEDIR)/rsync/stream.c \
91 $(OPIEDIR)/rsync/sumset.c \ 91 $(OPIEDIR)/rsync/sumset.c \
92 $(OPIEDIR)/rsync/trace.c \ 92 $(OPIEDIR)/rsync/trace.c \
93 $(OPIEDIR)/rsync/tube.c \ 93 $(OPIEDIR)/rsync/tube.c \
94 $(OPIEDIR)/rsync/util.c \ 94 $(OPIEDIR)/rsync/util.c \
95 $(OPIEDIR)/rsync/version.c \ 95 $(OPIEDIR)/rsync/version.c \
96 $(OPIEDIR)/rsync/whole.c \ 96 $(OPIEDIR)/rsync/whole.c \
97 $(OPIEDIR)/rsync/qrsync.cpp 97 $(OPIEDIR)/rsync/qrsync.cpp
98 98
99 INTERFACES= shutdown.ui syncdialog.ui 99 INTERFACES= shutdown.ui syncdialog.ui
100 100
101INCLUDEPATH += $(OPIEDIR)/include 101INCLUDEPATH += $(OPIEDIR)/include
102 DEPENDPATH+= $(OPIEDIR)/include . 102 DEPENDPATH+= $(OPIEDIR)/include .
103 103
104INCLUDEPATH += $(OPIEDIR)/calibrate 104INCLUDEPATH += $(OPIEDIR)/calibrate
105 DEPENDPATH+= $(OPIEDIR)/calibrate 105 DEPENDPATH+= $(OPIEDIR)/calibrate
106 106
107INCLUDEPATH += $(OPIEDIR)/rsync 107INCLUDEPATH += $(OPIEDIR)/rsync
108 DEPENDPATH+= $(OPIEDIR)/rsync 108 DEPENDPATH+= $(OPIEDIR)/rsync
109 109
110 TARGET = qpe 110 TARGET = qpe
111 111
112 LIBS += -lqpe -lcrypt 112 LIBS += -lqpe -lcrypt -lopie
113 113
114TRANSLATIONS = ../i18n/de/qpe.ts 114TRANSLATIONS = ../i18n/de/qpe.ts
115TRANSLATIONS += ../i18n/pt_BR/qpe.ts 115TRANSLATIONS += ../i18n/pt_BR/qpe.ts
116TRANSLATIONS += ../i18n/en/qpe.ts 116TRANSLATIONS += ../i18n/en/qpe.ts
117TRANSLATIONS += ../i18n/hu/qpe.ts 117TRANSLATIONS += ../i18n/hu/qpe.ts
118TRANSLATIONS += ../i18n/ja/qpe.ts 118TRANSLATIONS += ../i18n/ja/qpe.ts
119TRANSLATIONS += ../i18n/fr/qpe.ts 119TRANSLATIONS += ../i18n/fr/qpe.ts
120TRANSLATIONS += ../i18n/ko/qpe.ts 120TRANSLATIONS += ../i18n/ko/qpe.ts
121TRANSLATIONS += ../i18n/no/qpe.ts 121TRANSLATIONS += ../i18n/no/qpe.ts
122TRANSLATIONS += ../i18n/zh_CN/qpe.ts 122TRANSLATIONS += ../i18n/zh_CN/qpe.ts
123TRANSLATIONS += ../i18n/zh_TW/qpe.ts 123TRANSLATIONS += ../i18n/zh_TW/qpe.ts
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index fc6d829..347eee9 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,84 +1,86 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "desktop.h" 21#include "desktop.h"
22#include "taskbar.h" 22#include "taskbar.h"
23#include "stabmon.h" 23#include "stabmon.h"
24 24
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/network.h> 26#include <qpe/network.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 28#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
29#include <qpe/custom.h> 29#include <qpe/custom.h>
30#endif 30#endif
31 31
32#include <qfile.h> 32#include <qfile.h>
33#include <qwindowsystem_qws.h> 33#include <qwindowsystem_qws.h>
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/alarmserver.h> 35#include <qpe/alarmserver.h>
36 36
37#include <opie/ohwinfo.h>
38
37#include <stdlib.h> 39#include <stdlib.h>
38#include <stdio.h> 40#include <stdio.h>
39#include <signal.h> 41#include <signal.h>
40#include <unistd.h> 42#include <unistd.h>
41 43
42#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 44#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
43#include "../calibrate/calibrate.h" 45#include "../calibrate/calibrate.h"
44#endif 46#endif
45 47
46#ifdef QT_QWS_LOGIN 48#ifdef QT_QWS_LOGIN
47#include "../login/qdmdialogimpl.h" 49#include "../login/qdmdialogimpl.h"
48#endif 50#endif
49 51
50#ifdef QT_QWS_CASSIOPEIA 52#ifdef QT_QWS_CASSIOPEIA
51static void ignoreMessage( QtMsgType, const char * ) 53static void ignoreMessage( QtMsgType, const char * )
52{ 54{
53} 55}
54#include <sys/mount.h> 56#include <sys/mount.h>
55#include <sys/types.h> 57#include <sys/types.h>
56#include <sys/stat.h> 58#include <sys/stat.h>
57#include <sys/time.h> 59#include <sys/time.h>
58#include <fcntl.h> 60#include <fcntl.h>
59#include <qdatetime.h> 61#include <qdatetime.h>
60 62
61void initCassiopeia() 63void initCassiopeia()
62{ 64{
63 // MIPSEL-specific init - make sure /proc exists for shm 65 // MIPSEL-specific init - make sure /proc exists for shm
64/* 66/*
65 if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) { 67 if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) {
66 perror("Remounting - / read/write"); 68 perror("Remounting - / read/write");
67 } 69 }
68*/ 70*/
69 if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) { 71 if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) {
70 perror("mounting ramfs /tmp"); 72 perror("mounting ramfs /tmp");
71 } else { 73 } else {
72 fprintf( stderr, "mounted /tmp\n" ); 74 fprintf( stderr, "mounted /tmp\n" );
73 } 75 }
74 if ( mount("none", "/home", "ramfs", 0, 0 ) ) { 76 if ( mount("none", "/home", "ramfs", 0, 0 ) ) {
75 perror("mounting ramfs /home"); 77 perror("mounting ramfs /home");
76 } else { 78 } else {
77 fprintf( stderr, "mounted /home\n" ); 79 fprintf( stderr, "mounted /home\n" );
78 } 80 }
79 if ( mount("none","/proc","proc",0,0) ) { 81 if ( mount("none","/proc","proc",0,0) ) {
80 perror("Mounting - /proc"); 82 perror("Mounting - /proc");
81 } else { 83 } else {
82 fprintf( stderr, "mounted /proc\n" ); 84 fprintf( stderr, "mounted /proc\n" );
83 } 85 }
84 if ( mount("none","/mnt","shm",0,0) ) { 86 if ( mount("none","/mnt","shm",0,0) ) {
@@ -139,121 +141,210 @@ static void disableAPM()
139} 141}
140 142
141static void initAPM() 143static void initAPM()
142{ 144{
143 // So that we have to do it ourself, but better. 145 // So that we have to do it ourself, but better.
144 disableAPM(); 146 disableAPM();
145} 147}
146#endif 148#endif
147 149
148#ifdef QT_DEMO_SINGLE_FLOPPY 150#ifdef QT_DEMO_SINGLE_FLOPPY
149#include <sys/mount.h> 151#include <sys/mount.h>
150 152
151void initFloppy() 153void initFloppy()
152{ 154{
153 mount("none","/proc","proc",0,0); 155 mount("none","/proc","proc",0,0);
154 setenv( "QTDIR", "/", 0 ); 156 setenv( "QTDIR", "/", 0 );
155 setenv( "HOME", "/root", 0 ); 157 setenv( "HOME", "/root", 0 );
156 setenv( "QWS_SIZE", "240x320", 0 ); 158 setenv( "QWS_SIZE", "240x320", 0 );
157} 159}
158#endif 160#endif
159 161
160 162
161void initEnvironment() 163void initEnvironment()
162{ 164{
163 Config config("locale"); 165 Config config("locale");
164 config.setGroup( "Location" ); 166 config.setGroup( "Location" );
165 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 167 QString tz = config.readEntry( "Timezone", getenv("TZ") );
166 168
167 // if not timezone set, pick New York 169 // if not timezone set, pick New York
168 if (tz.isNull()) 170 if (tz.isNull())
169 tz = "America/New_York"; 171 tz = "America/New_York";
170 172
171 setenv( "TZ", tz, 1 ); 173 setenv( "TZ", tz, 1 );
172 config.writeEntry( "Timezone", tz); 174 config.writeEntry( "Timezone", tz);
173 175
174 config.setGroup( "Language" ); 176 config.setGroup( "Language" );
175 QString lang = config.readEntry( "Language", getenv("LANG") ); 177 QString lang = config.readEntry( "Language", getenv("LANG") );
176 if ( !lang.isNull() ) 178 if ( !lang.isNull() )
177 setenv( "LANG", lang, 1 ); 179 setenv( "LANG", lang, 1 );
178} 180}
179 181
180static void initBacklight() 182static void initBacklight()
181{ 183{
182 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 184 QCopEnvelope e("QPE/System", "setBacklight(int)" );
183 e << -3; // Forced on 185 e << -3; // Forced on
184} 186}
185 187
186 188
189class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
190{
191public:
192 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
193 {
194 bool doinst = false;
195
196 m_model = OHwInfo::inst ( )-> model ( );
197 m_power_timer = 0;
198
199 switch ( m_model ) {
200 case OMODEL_iPAQ_H31xx:
201 case OMODEL_iPAQ_H36xx:
202 case OMODEL_iPAQ_H37xx:
203 case OMODEL_iPAQ_H38xx: doinst = true;
204 break;
205 default : break;
206 }
207 if ( doinst )
208 QWSServer::setKeyboardFilter ( this );
209 }
210
211 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )
212 {
213 bool kill = false;
214
215 // Rotate cursor keys 180°
216 switch ( m_model ) {
217 case OMODEL_iPAQ_H31xx:
218 case OMODEL_iPAQ_H38xx: {
219 int newkeycode = keycode;
220
221 switch ( keycode ) {
222 case Key_Left : newkeycode = Key_Right; break;
223 case Key_Right: newkeycode = Key_Left; break;
224 case Key_Up : newkeycode = Key_Down; break;
225 case Key_Down : newkeycode = Key_Up; break;
226 }
227 if ( newkeycode != keycode ) {
228 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
229 kill = true;
230 }
231 break;
232 }
233 default: break;
234 }
235
236 // map Power Button short/long press to F34/F35
237 switch ( m_model ) {
238 case OMODEL_iPAQ_H31xx:
239 case OMODEL_iPAQ_H36xx:
240 case OMODEL_iPAQ_H37xx:
241 case OMODEL_iPAQ_H38xx: {
242 if ( keycode == Key_SysReq ) {
243 if ( isPress ) {
244 m_power_timer = startTimer ( 500 );
245 }
246 else if ( m_power_timer ) {
247 killTimer ( m_power_timer );
248 m_power_timer = 0;
249 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
250 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
251 }
252 kill = true;
253 }
254 break;
255 }
256 default: break;
257 }
258 return kill;
259 }
260
261 virtual void timerEvent ( QTimerEvent * )
262 {
263 killTimer ( m_power_timer );
264 m_power_timer = 0;
265 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
266 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
267 }
268
269private:
270 OHwModel m_model;
271 bool m_power_press;
272 int m_power_timer;
273};
274
275
187 276
188int initApplication( int argc, char ** argv ) 277int initApplication( int argc, char ** argv )
189{ 278{
190#ifdef QT_QWS_CASSIOPEIA 279#ifdef QT_QWS_CASSIOPEIA
191 initCassiopeia(); 280 initCassiopeia();
192#endif 281#endif
193 282
194#ifdef QPE_OWNAPM 283#ifdef QPE_OWNAPM
195 initAPM(); 284 initAPM();
196#endif 285#endif
197 286
198#ifdef QT_DEMO_SINGLE_FLOPPY 287#ifdef QT_DEMO_SINGLE_FLOPPY
199 initFloppy(); 288 initFloppy();
200#endif 289#endif
201 290
202 initEnvironment(); 291 initEnvironment();
203 292
204#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 293#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
205 setenv( "QWS_SIZE", "240x320", 0 ); 294 setenv( "QWS_SIZE", "240x320", 0 );
206#endif 295#endif
207 296
208 //Don't flicker at startup: 297 //Don't flicker at startup:
209 QWSServer::setDesktopBackground( QImage() ); 298 QWSServer::setDesktopBackground( QImage() );
210 DesktopApplication a( argc, argv, QApplication::GuiServer ); 299 DesktopApplication a( argc, argv, QApplication::GuiServer );
211 300
301 (void) new ModelKeyFilter ( );
302
212 initBacklight(); 303 initBacklight();
213 304
214 AlarmServer::initialize(); 305 AlarmServer::initialize();
215 306
216#if defined(QT_QWS_LOGIN) 307#if defined(QT_QWS_LOGIN)
217 for( int i=0; i<a.argc(); i++ ) 308 for( int i=0; i<a.argc(); i++ )
218 if( strcmp( a.argv()[i], "-login" ) == 0 ) { 309 if( strcmp( a.argv()[i], "-login" ) == 0 ) {
219 QDMDialogImpl::login( ); 310 QDMDialogImpl::login( );
220 return 0; 311 return 0;
221 } 312 }
222#endif 313#endif
223 314
224 Desktop *d = new Desktop(); 315 Desktop *d = new Desktop();
225 316
226 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); 317 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) );
227 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); 318 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
228 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); 319 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
229 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); 320 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
230 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 321 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
231 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 322 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
232 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 323 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
233 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 324 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
234 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 325 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
235 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 326 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
236 327
237 (void)new SysFileMonitor(d); 328 (void)new SysFileMonitor(d);
238 Network::createServer(d); 329 Network::createServer(d);
239 330
240#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 331#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
241 if ( !QFile::exists( "/etc/pointercal" ) ) { 332 if ( !QFile::exists( "/etc/pointercal" ) ) {
242 // Make sure calibration widget starts on top. 333 // Make sure calibration widget starts on top.
243 Calibrate *cal = new Calibrate; 334 Calibrate *cal = new Calibrate;
244 cal->exec(); 335 cal->exec();
245 delete cal; 336 delete cal;
246 } 337 }
247#endif 338#endif
248 339
249 d->show(); 340 d->show();
250 341
251 int rv = a.exec(); 342 int rv = a.exec();
252 343
253 delete d; 344 delete d;
254 345
255 return rv; 346 return rv;
256} 347}
257 348
258int main( int argc, char ** argv ) 349int main( int argc, char ** argv )
259{ 350{