summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp58
-rw-r--r--core/launcher/main.cpp13
-rw-r--r--core/launcher/taskbar.cpp47
-rw-r--r--core/launcher/taskbar.h4
4 files changed, 53 insertions, 69 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index ab4f14a..7662e48 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -14,64 +14,66 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "desktop.h" 21#include "desktop.h"
22#include "info.h" 22#include "info.h"
23#include "launcher.h" 23#include "launcher.h"
24#include "mrulist.h" 24#include "mrulist.h"
25#include "qcopbridge.h" 25#include "qcopbridge.h"
26#include "shutdownimpl.h" 26#include "shutdownimpl.h"
27#include "startmenu.h" 27#include "startmenu.h"
28#include "taskbar.h" 28#include "taskbar.h"
29#include "transferserver.h" 29#include "transferserver.h"
30#include "irserver.h" 30#include "irserver.h"
31#include "packageslave.h" 31#include "packageslave.h"
32 32
33#include <qpe/applnk.h> 33#include <qpe/applnk.h>
34#include <qpe/mimetype.h> 34#include <qpe/mimetype.h>
35#include <qpe/password.h> 35#include <qpe/password.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/power.h> 37#include <qpe/power.h>
38#include <qpe/timeconversion.h> 38#include <qpe/timeconversion.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/global.h> 40#include <qpe/global.h>
41 41
42#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 42#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
43#include <qpe/custom.h> 43#include <qpe/custom.h>
44#endif 44#endif
45 45
46#include <opie/odevice.h>
47
46#include <qgfx_qws.h> 48#include <qgfx_qws.h>
47#include <qmainwindow.h> 49#include <qmainwindow.h>
48#include <qmessagebox.h> 50#include <qmessagebox.h>
49#include <qtimer.h> 51#include <qtimer.h>
50#include <qwindowsystem_qws.h> 52#include <qwindowsystem_qws.h>
51 53
52#include <qvaluelist.h> 54#include <qvaluelist.h>
53 55
54#include <stdlib.h> 56#include <stdlib.h>
55#include <unistd.h> 57#include <unistd.h>
56 58
57class QCopKeyRegister 59class QCopKeyRegister
58{ 60{
59public: 61public:
60 QCopKeyRegister() : keyCode(0) { } 62 QCopKeyRegister() : keyCode(0) { }
61 QCopKeyRegister(int k, const QString &c, const QString &m) 63 QCopKeyRegister(int k, const QString &c, const QString &m)
62 : keyCode(k), channel(c), message(m) { } 64 : keyCode(k), channel(c), message(m) { }
63 65
64 int getKeyCode() const { return keyCode; } 66 int getKeyCode() const { return keyCode; }
65 QString getChannel() const { return channel; } 67 QString getChannel() const { return channel; }
66 QString getMessage() const { return message; } 68 QString getMessage() const { return message; }
67 69
68private: 70private:
69 int keyCode; 71 int keyCode;
70 QString channel, message; 72 QString channel, message;
71}; 73};
72 74
73typedef QValueList<QCopKeyRegister> KeyRegisterList; 75typedef QValueList<QCopKeyRegister> KeyRegisterList;
74KeyRegisterList keyRegisterList; 76KeyRegisterList keyRegisterList;
75 77
76static Desktop* qpedesktop = 0; 78static Desktop* qpedesktop = 0;
77static int loggedin=0; 79static int loggedin=0;
@@ -238,140 +240,132 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
238 } 240 }
239 } 241 }
240 242
241 if ( ke->simpleData.keycode == Key_F34 ) { 243 if ( ke->simpleData.keycode == Key_F34 ) {
242 if ( press ) emit power(); 244 if ( press ) emit power();
243 return TRUE; 245 return TRUE;
244 } 246 }
245// This was used for the iPAQ PowerButton 247// This was used for the iPAQ PowerButton
246// See main.cpp for new KeyboardFilter 248// See main.cpp for new KeyboardFilter
247// 249//
248// if ( ke->simpleData.keycode == Key_SysReq ) { 250// if ( ke->simpleData.keycode == Key_SysReq ) {
249// if ( press ) emit power(); 251// if ( press ) emit power();
250// return TRUE; 252// return TRUE;
251// } 253// }
252 if ( ke->simpleData.keycode == Key_F35 ) { 254 if ( ke->simpleData.keycode == Key_F35 ) {
253 if ( press ) emit backlight(); 255 if ( press ) emit backlight();
254 return TRUE; 256 return TRUE;
255 } 257 }
256 if ( ke->simpleData.keycode == Key_F32 ) { 258 if ( ke->simpleData.keycode == Key_F32 ) {
257 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); 259 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" );
258 return TRUE; 260 return TRUE;
259 } 261 }
260 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { 262 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) {
261 if ( press ) emit symbol(); 263 if ( press ) emit symbol();
262 return TRUE; 264 return TRUE;
263 } 265 }
264 if ( ke->simpleData.keycode == Key_NumLock ) { 266 if ( ke->simpleData.keycode == Key_NumLock ) {
265 if ( press ) emit numLockStateToggle(); 267 if ( press ) emit numLockStateToggle();
266 } 268 }
267 if ( ke->simpleData.keycode == Key_CapsLock ) { 269 if ( ke->simpleData.keycode == Key_CapsLock ) {
268 if ( press ) emit capsLockStateToggle(); 270 if ( press ) emit capsLockStateToggle();
269 } 271 }
270 if ( press ) 272 if (( press && !autoRepeat ) || ( !press && autoRepeat ))
271 qpedesktop->keyClick(); 273 qpedesktop->keyClick();
272 } else { 274 } else {
273 if ( e->type == QWSEvent::Mouse ) { 275 if ( e->type == QWSEvent::Mouse ) {
274 QWSMouseEvent *me = (QWSMouseEvent *)e; 276 QWSMouseEvent *me = (QWSMouseEvent *)e;
275 static bool up = TRUE; 277 static bool up = TRUE;
276 if ( me->simpleData.state&LeftButton ) { 278 if ( me->simpleData.state&LeftButton ) {
277 if ( up ) { 279 if ( up ) {
278 up = FALSE; 280 up = FALSE;
279 qpedesktop->screenClick(); 281 qpedesktop->screenClick();
280 } 282 }
281 } else { 283 } else {
282 up = TRUE; 284 up = TRUE;
283 } 285 }
284 } 286 }
285 } 287 }
286 288
287 return QPEApplication::qwsEventFilter( e ); 289 return QPEApplication::qwsEventFilter( e );
288} 290}
289#endif 291#endif
290 292
291void DesktopApplication::psTimeout() 293void DesktopApplication::psTimeout()
292{ 294{
293 qpedesktop->checkMemory(); // in case no events are being generated 295 qpedesktop->checkMemory(); // in case no events are being generated
294 296
295 *ps = PowerStatusManager::readStatus(); 297 *ps = PowerStatusManager::readStatus();
296 298
297 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { 299 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) {
298 pa->alert( tr( "Battery is running very low." ), 6 ); 300 pa->alert( tr( "Battery is running very low." ), 6 );
299 } 301 }
300 302
301 if ( ps->batteryStatus() == PowerStatus::Critical ) { 303 if ( ps->batteryStatus() == PowerStatus::Critical ) {
302 pa->alert( tr( "Battery level is critical!\n" 304 pa->alert( tr( "Battery level is critical!\n"
303 "Keep power off until power restored!" ), 1 ); 305 "Keep power off until power restored!" ), 1 );
304 } 306 }
305 307
306 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { 308 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) {
307 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); 309 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 );
308 } 310 }
309} 311}
310 312
311 313
312void DesktopApplication::sendCard() 314void DesktopApplication::sendCard()
313{ 315{
314 delete cardSendTimer; 316 delete cardSendTimer;
315 cardSendTimer = 0; 317 cardSendTimer = 0;
316 QString card = getenv("HOME"); 318 QString card = getenv("HOME");
317 card += "/Applications/addressbook/businesscard.vcf"; 319 card += "/Applications/addressbook/businesscard.vcf";
318 320
319 if ( QFile::exists( card ) ) { 321 if ( QFile::exists( card ) ) {
320 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 322 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
321 QString mimetype = "text/x-vCard"; 323 QString mimetype = "text/x-vCard";
322 e << tr("business card") << card << mimetype; 324 e << tr("business card") << card << mimetype;
323 } 325 }
324} 326}
325 327
326#if defined(QPE_HAVE_MEMALERTER) 328#if defined(QPE_HAVE_MEMALERTER)
327QPE_MEMALERTER_IMPL 329QPE_MEMALERTER_IMPL
328#endif 330#endif
329 331
330#if defined(CUSTOM_SOUND_IMPL)
331CUSTOM_SOUND_IMPL
332#endif
333
334//=========================================================================== 332//===========================================================================
335 333
336Desktop::Desktop() : 334Desktop::Desktop() :
337 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 335 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
338 qcopBridge( 0 ), 336 qcopBridge( 0 ),
339 transferServer( 0 ), 337 transferServer( 0 ),
340 packageSlave( 0 ) 338 packageSlave( 0 )
341{ 339{
342#ifdef CUSTOM_SOUND_INIT
343 CUSTOM_SOUND_INIT;
344#endif
345
346 qpedesktop = this; 340 qpedesktop = this;
347 341
348// bg = new Info( this ); 342// bg = new Info( this );
349 tb = new TaskBar; 343 tb = new TaskBar;
350 344
351 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); 345 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader );
352 346
353 connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); 347 connect(launcher, SIGNAL(busy()), tb, SLOT(startWait()));
354 connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); 348 connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&)));
355 349
356 int displayw = qApp->desktop()->width(); 350 int displayw = qApp->desktop()->width();
357 int displayh = qApp->desktop()->height(); 351 int displayh = qApp->desktop()->height();
358 352
359 353
360 QSize sz = tb->sizeHint(); 354 QSize sz = tb->sizeHint();
361 355
362 setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 356 setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
363 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 357 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
364 358
365 tb->show(); 359 tb->show();
366 launcher->showMaximized(); 360 launcher->showMaximized();
367 launcher->show(); 361 launcher->show();
368 launcher->raise(); 362 launcher->raise();
369#if defined(QPE_HAVE_MEMALERTER) 363#if defined(QPE_HAVE_MEMALERTER)
370 initMemalerter(); 364 initMemalerter();
371#endif 365#endif
372 // start services 366 // start services
373 startTransferServer(); 367 startTransferServer();
374 (void) new IrServer( this ); 368 (void) new IrServer( this );
375 rereadVolumes(); 369 rereadVolumes();
376 370
377 packageSlave = new PackageSlave( this ); 371 packageSlave = new PackageSlave( this );
@@ -727,70 +721,64 @@ void Desktop::startTransferServer()
727 startTimer( 2000 ); 721 startTimer( 2000 );
728} 722}
729 723
730void Desktop::timerEvent( QTimerEvent *e ) 724void Desktop::timerEvent( QTimerEvent *e )
731{ 725{
732 killTimer( e->timerId() ); 726 killTimer( e->timerId() );
733 startTransferServer(); 727 startTransferServer();
734} 728}
735 729
736void Desktop::terminateServers() 730void Desktop::terminateServers()
737{ 731{
738 delete transferServer; 732 delete transferServer;
739 delete qcopBridge; 733 delete qcopBridge;
740 transferServer = 0; 734 transferServer = 0;
741 qcopBridge = 0; 735 qcopBridge = 0;
742} 736}
743 737
744void Desktop::rereadVolumes() 738void Desktop::rereadVolumes()
745{ 739{
746 Config cfg("qpe"); 740 Config cfg("qpe");
747 cfg.setGroup("Volume"); 741 cfg.setGroup("Volume");
748 touchclick = cfg.readBoolEntry("TouchSound"); 742 touchclick = cfg.readBoolEntry("TouchSound");
749 keyclick = cfg.readBoolEntry("KeySound"); 743 keyclick = cfg.readBoolEntry("KeySound");
750 alarmsound = cfg.readBoolEntry("AlarmSound"); 744 alarmsound = cfg.readBoolEntry("AlarmSound");
751// Config cfg("Sound"); 745// Config cfg("Sound");
752// cfg.setGroup("System"); 746// cfg.setGroup("System");
753// touchclick = cfg.readBoolEntry("Touch"); 747// touchclick = cfg.readBoolEntry("Touch");
754// keyclick = cfg.readBoolEntry("Key"); 748// keyclick = cfg.readBoolEntry("Key");
755} 749}
756 750
757void Desktop::keyClick() 751void Desktop::keyClick()
758{ 752{
759#ifdef CUSTOM_SOUND_KEYCLICK 753 if ( keyclick )
760 if ( keyclick ) 754 ODevice::inst ( )-> keySound ( );
761 CUSTOM_SOUND_KEYCLICK;
762#endif
763} 755}
764 756
765void Desktop::screenClick() 757void Desktop::screenClick()
766{ 758{
767#ifdef CUSTOM_SOUND_TOUCH 759 if ( touchclick )
768 if ( touchclick ) 760 ODevice::inst ( )-> touchSound ( );
769 CUSTOM_SOUND_TOUCH;
770#endif
771} 761}
772 762
773void Desktop::soundAlarm() 763void Desktop::soundAlarm()
774{ 764{
775#ifdef CUSTOM_SOUND_ALARM 765 if ( qpedesktop-> alarmsound )
776 if (qpedesktop->alarmsound) 766 ODevice::inst ( )-> alarmSound ( );
777 CUSTOM_SOUND_ALARM;
778#endif
779} 767}
780 768
781bool Desktop::eventFilter( QObject *w, QEvent *ev ) 769bool Desktop::eventFilter( QObject *, QEvent *ev )
782{ 770{
783 if ( ev->type() == QEvent::KeyPress ) { 771 if ( ev-> type ( ) == QEvent::KeyPress ) {
784 QKeyEvent *ke = (QKeyEvent *)ev; 772 QKeyEvent *ke = (QKeyEvent *) ev;
785 if ( ke->key() == Qt::Key_F11 ) { // menu key 773 if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key
786 QWidget *active = qApp->activeWindow(); 774 QWidget *active = qApp-> activeWindow ( );
787 if ( active && active->isPopup() ) { 775
788 active->close(); 776 if ( active && active-> isPopup ( ))
789 } 777 active->close();
790 raiseMenu();
791 return TRUE;
792 }
793 }
794 return FALSE;
795}
796 778
779 raiseMenu ( );
780 return true;
781 }
782 }
783 return false;
784}
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 347eee9..b3c331b 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,70 +1,70 @@
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 <opie/odevice.h>
33
32#include <qfile.h> 34#include <qfile.h>
33#include <qwindowsystem_qws.h> 35#include <qwindowsystem_qws.h>
34#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
35#include <qpe/alarmserver.h> 37#include <qpe/alarmserver.h>
36 38
37#include <opie/ohwinfo.h>
38
39#include <stdlib.h> 39#include <stdlib.h>
40#include <stdio.h> 40#include <stdio.h>
41#include <signal.h> 41#include <signal.h>
42#include <unistd.h> 42#include <unistd.h>
43 43
44#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)
45#include "../calibrate/calibrate.h" 45#include "../calibrate/calibrate.h"
46#endif 46#endif
47 47
48#ifdef QT_QWS_LOGIN 48#ifdef QT_QWS_LOGIN
49#include "../login/qdmdialogimpl.h" 49#include "../login/qdmdialogimpl.h"
50#endif 50#endif
51 51
52#ifdef QT_QWS_CASSIOPEIA 52#ifdef QT_QWS_CASSIOPEIA
53static void ignoreMessage( QtMsgType, const char * ) 53static void ignoreMessage( QtMsgType, const char * )
54{ 54{
55} 55}
56#include <sys/mount.h> 56#include <sys/mount.h>
57#include <sys/types.h> 57#include <sys/types.h>
58#include <sys/stat.h> 58#include <sys/stat.h>
59#include <sys/time.h> 59#include <sys/time.h>
60#include <fcntl.h> 60#include <fcntl.h>
61#include <qdatetime.h> 61#include <qdatetime.h>
62 62
63void initCassiopeia() 63void initCassiopeia()
64{ 64{
65 // MIPSEL-specific init - make sure /proc exists for shm 65 // MIPSEL-specific init - make sure /proc exists for shm
66/* 66/*
67 if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) { 67 if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) {
68 perror("Remounting - / read/write"); 68 perror("Remounting - / read/write");
69 } 69 }
70*/ 70*/
@@ -164,141 +164,140 @@ void initEnvironment()
164{ 164{
165 Config config("locale"); 165 Config config("locale");
166 config.setGroup( "Location" ); 166 config.setGroup( "Location" );
167 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 167 QString tz = config.readEntry( "Timezone", getenv("TZ") );
168 168
169 // if not timezone set, pick New York 169 // if not timezone set, pick New York
170 if (tz.isNull()) 170 if (tz.isNull())
171 tz = "America/New_York"; 171 tz = "America/New_York";
172 172
173 setenv( "TZ", tz, 1 ); 173 setenv( "TZ", tz, 1 );
174 config.writeEntry( "Timezone", tz); 174 config.writeEntry( "Timezone", tz);
175 175
176 config.setGroup( "Language" ); 176 config.setGroup( "Language" );
177 QString lang = config.readEntry( "Language", getenv("LANG") ); 177 QString lang = config.readEntry( "Language", getenv("LANG") );
178 if ( !lang.isNull() ) 178 if ( !lang.isNull() )
179 setenv( "LANG", lang, 1 ); 179 setenv( "LANG", lang, 1 );
180} 180}
181 181
182static void initBacklight() 182static void initBacklight()
183{ 183{
184 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 184 QCopEnvelope e("QPE/System", "setBacklight(int)" );
185 e << -3; // Forced on 185 e << -3; // Forced on
186} 186}
187 187
188 188
189class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter 189class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
190{ 190{
191public: 191public:
192 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" ) 192 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
193 { 193 {
194 bool doinst = false; 194 bool doinst = false;
195 195
196 m_model = OHwInfo::inst ( )-> model ( ); 196 m_model = ODevice::inst ( )-> model ( );
197 m_power_timer = 0; 197 m_power_timer = 0;
198 198
199 switch ( m_model ) { 199 switch ( m_model ) {
200 case OMODEL_iPAQ_H31xx: 200 case OMODEL_iPAQ_H31xx:
201 case OMODEL_iPAQ_H36xx: 201 case OMODEL_iPAQ_H36xx:
202 case OMODEL_iPAQ_H37xx: 202 case OMODEL_iPAQ_H37xx:
203 case OMODEL_iPAQ_H38xx: doinst = true; 203 case OMODEL_iPAQ_H38xx: doinst = true;
204 break; 204 break;
205 default : break; 205 default : break;
206 } 206 }
207 if ( doinst ) 207 if ( doinst )
208 QWSServer::setKeyboardFilter ( this ); 208 QWSServer::setKeyboardFilter ( this );
209 } 209 }
210 210
211 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) 211 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
212 { 212 {
213 bool kill = false; 213 bool kill = false;
214 214
215 // Rotate cursor keys 180° 215 // Rotate cursor keys 180°
216 switch ( m_model ) { 216 switch ( m_model ) {
217 case OMODEL_iPAQ_H31xx: 217 case OMODEL_iPAQ_H31xx:
218 case OMODEL_iPAQ_H38xx: { 218 case OMODEL_iPAQ_H38xx: {
219 int newkeycode = keycode; 219 int newkeycode = keycode;
220 220
221 switch ( keycode ) { 221 switch ( keycode ) {
222 case Key_Left : newkeycode = Key_Right; break; 222 case Key_Left : newkeycode = Key_Right; break;
223 case Key_Right: newkeycode = Key_Left; break; 223 case Key_Right: newkeycode = Key_Left; break;
224 case Key_Up : newkeycode = Key_Down; break; 224 case Key_Up : newkeycode = Key_Down; break;
225 case Key_Down : newkeycode = Key_Up; break; 225 case Key_Down : newkeycode = Key_Up; break;
226 } 226 }
227 if ( newkeycode != keycode ) { 227 if ( newkeycode != keycode ) {
228 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 228 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
229 kill = true; 229 kill = true;
230 } 230 }
231 break; 231 break;
232 } 232 }
233 default: break; 233 default: break;
234 } 234 }
235 235
236 // map Power Button short/long press to F34/F35 236 // map Power Button short/long press to F34/F35
237 switch ( m_model ) { 237 switch ( m_model ) {
238 case OMODEL_iPAQ_H31xx: 238 case OMODEL_iPAQ_H31xx:
239 case OMODEL_iPAQ_H36xx: 239 case OMODEL_iPAQ_H36xx:
240 case OMODEL_iPAQ_H37xx: 240 case OMODEL_iPAQ_H37xx:
241 case OMODEL_iPAQ_H38xx: { 241 case OMODEL_iPAQ_H38xx: {
242 if ( keycode == Key_SysReq ) { 242 if ( keycode == Key_SysReq ) {
243 if ( isPress ) { 243 if ( isPress ) {
244 m_power_timer = startTimer ( 500 ); 244 m_power_timer = startTimer ( 500 );
245 } 245 }
246 else if ( m_power_timer ) { 246 else if ( m_power_timer ) {
247 killTimer ( m_power_timer ); 247 killTimer ( m_power_timer );
248 m_power_timer = 0; 248 m_power_timer = 0;
249 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false ); 249 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
250 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false ); 250 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
251 } 251 }
252 kill = true; 252 kill = true;
253 } 253 }
254 break; 254 break;
255 } 255 }
256 default: break; 256 default: break;
257 } 257 }
258 return kill; 258 return kill;
259 } 259 }
260 260
261 virtual void timerEvent ( QTimerEvent * ) 261 virtual void timerEvent ( QTimerEvent * )
262 { 262 {
263 killTimer ( m_power_timer ); 263 killTimer ( m_power_timer );
264 m_power_timer = 0; 264 m_power_timer = 0;
265 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false ); 265 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
266 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false ); 266 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
267 } 267 }
268 268
269private: 269private:
270 OHwModel m_model; 270 OModel m_model;
271 bool m_power_press; 271 int m_power_timer;
272 int m_power_timer;
273}; 272};
274 273
275 274
276 275
277int initApplication( int argc, char ** argv ) 276int initApplication( int argc, char ** argv )
278{ 277{
279#ifdef QT_QWS_CASSIOPEIA 278#ifdef QT_QWS_CASSIOPEIA
280 initCassiopeia(); 279 initCassiopeia();
281#endif 280#endif
282 281
283#ifdef QPE_OWNAPM 282#ifdef QPE_OWNAPM
284 initAPM(); 283 initAPM();
285#endif 284#endif
286 285
287#ifdef QT_DEMO_SINGLE_FLOPPY 286#ifdef QT_DEMO_SINGLE_FLOPPY
288 initFloppy(); 287 initFloppy();
289#endif 288#endif
290 289
291 initEnvironment(); 290 initEnvironment();
292 291
293#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 292#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
294 setenv( "QWS_SIZE", "240x320", 0 ); 293 setenv( "QWS_SIZE", "240x320", 0 );
295#endif 294#endif
296 295
297 //Don't flicker at startup: 296 //Don't flicker at startup:
298 QWSServer::setDesktopBackground( QImage() ); 297 QWSServer::setDesktopBackground( QImage() );
299 DesktopApplication a( argc, argv, QApplication::GuiServer ); 298 DesktopApplication a( argc, argv, QApplication::GuiServer );
300 299
301 (void) new ModelKeyFilter ( ); 300 (void) new ModelKeyFilter ( );
302 301
303 initBacklight(); 302 initBacklight();
304 303
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 5e95c99..e38b9fe 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -8,64 +8,66 @@
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19*********************************************************************/ 19*********************************************************************/
20 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "mrulist.h" 23#include "mrulist.h"
24#include "systray.h" 24#include "systray.h"
25#include "calibrate.h" 25#include "calibrate.h"
26#include "wait.h" 26#include "wait.h"
27#include "appicons.h" 27#include "appicons.h"
28 28
29#include "taskbar.h" 29#include "taskbar.h"
30#include "desktop.h" 30#include "desktop.h"
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35 35
36#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 36#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
37#include <qpe/custom.h> 37#include <qpe/custom.h>
38#endif 38#endif
39 39
40#include <opie/odevice.h>
41
40#include <qlabel.h> 42#include <qlabel.h>
41#include <qlayout.h> 43#include <qlayout.h>
42#include <qtimer.h> 44#include <qtimer.h>
43#include <qwindowsystem_qws.h> 45#include <qwindowsystem_qws.h>
44#include <qwidgetstack.h> 46#include <qwidgetstack.h>
45 47
46#if defined( Q_WS_QWS ) 48#if defined( Q_WS_QWS )
47#include <qwsdisplay_qws.h> 49#include <qwsdisplay_qws.h>
48#include <qgfx_qws.h> 50#include <qgfx_qws.h>
49#endif 51#endif
50 52
51 53
52#define FACTORY(T) \ 54#define FACTORY(T) \
53 static QWidget *new##T( bool maximized ) { \ 55 static QWidget *new##T( bool maximized ) { \
54 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 56 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
55 if ( maximized ) { \ 57 if ( maximized ) { \
56 if ( qApp->desktop()->width() <= 350 ) { \ 58 if ( qApp->desktop()->width() <= 350 ) { \
57 w->showMaximized(); \ 59 w->showMaximized(); \
58 } else { \ 60 } else { \
59 w->resize( QSize( 300, 300 ) ); \ 61 w->resize( QSize( 300, 300 ) ); \
60 } \ 62 } \
61 } \ 63 } \
62 w->show(); \ 64 w->show(); \
63 return w; \ 65 return w; \
64 } 66 }
65 67
66 68
67#ifdef SINGLE_APP 69#ifdef SINGLE_APP
68#define APP(a,b,c,d) FACTORY(b) 70#define APP(a,b,c,d) FACTORY(b)
69#include "../launcher/apps.h" 71#include "../launcher/apps.h"
70#undef APP 72#undef APP
71#endif // SINGLE_APP 73#endif // SINGLE_APP
@@ -224,87 +226,86 @@ void TaskBar::resizeEvent( QResizeEvent *e )
224} 226}
225 227
226void TaskBar::styleChange( QStyle &s ) 228void TaskBar::styleChange( QStyle &s )
227{ 229{
228 QHBox::styleChange( s ); 230 QHBox::styleChange( s );
229 calcMaxWindowRect(); 231 calcMaxWindowRect();
230} 232}
231 233
232void TaskBar::calcMaxWindowRect() 234void TaskBar::calcMaxWindowRect()
233{ 235{
234#ifdef Q_WS_QWS 236#ifdef Q_WS_QWS
235 QRect wr; 237 QRect wr;
236 int displayWidth = qApp->desktop()->width(); 238 int displayWidth = qApp->desktop()->width();
237 QRect ir = inputMethods->inputRect(); 239 QRect ir = inputMethods->inputRect();
238 if ( ir.isValid() ) { 240 if ( ir.isValid() ) {
239 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 241 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
240 } else { 242 } else {
241 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 243 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
242 } 244 }
243 245
244#if QT_VERSION < 300 246#if QT_VERSION < 300
245 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 247 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
246 QSize(qt_screen->width(),qt_screen->height())) 248 QSize(qt_screen->width(),qt_screen->height()))
247 ); 249 );
248#else 250#else
249 QWSServer::setMaxWindowRect( wr ); 251 QWSServer::setMaxWindowRect( wr );
250#endif 252#endif
251#endif 253#endif
252} 254}
253 255
254void TaskBar::receive( const QCString &msg, const QByteArray &data ) 256void TaskBar::receive( const QCString &msg, const QByteArray &data )
255{ 257{
256 QDataStream stream( data, IO_ReadOnly ); 258 QDataStream stream( data, IO_ReadOnly );
257 if ( msg == "message(QString)" ) { 259 if ( msg == "message(QString)" ) {
258 QString text; 260 QString text;
259 stream >> text; 261 stream >> text;
260 setStatusMessage( text ); 262 setStatusMessage( text );
261 } else if ( msg == "hideInputMethod()" ) { 263 } else if ( msg == "hideInputMethod()" ) {
262 inputMethods->hideInputMethod(); 264 inputMethods->hideInputMethod();
263 } else if ( msg == "showInputMethod()" ) { 265 } else if ( msg == "showInputMethod()" ) {
264 inputMethods->showInputMethod(); 266 inputMethods->showInputMethod();
265 } else if ( msg == "reloadInputMethods()" ) { 267 } else if ( msg == "reloadInputMethods()" ) {
266 inputMethods->loadInputMethods(); 268 inputMethods->loadInputMethods();
267 } else if ( msg == "reloadApplets()" ) { 269 } else if ( msg == "reloadApplets()" ) {
268 sysTray->loadApplets(); 270 sysTray->loadApplets();
269 } else if ( msg == "soundAlarm()" ) { 271 } else if ( msg == "soundAlarm()" ) {
270 Desktop::soundAlarm(); 272 Desktop::soundAlarm();
271 } 273 }
272#ifdef CUSTOM_LEDS 274 else if ( msg == "setLed(int,bool)" ) {
273 else if ( msg == "setLed(int,bool)" ) { 275 int led, status;
274 int led, status; 276 stream >> led >> status;
275 stream >> led >> status; 277
276 CUSTOM_LEDS( led, status ); 278 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
277 } 279 }
278#endif
279} 280}
280 281
281QWidget *TaskBar::calibrate(bool) 282QWidget *TaskBar::calibrate(bool)
282{ 283{
283#ifdef Q_WS_QWS 284#ifdef Q_WS_QWS
284 Calibrate *c = new Calibrate; 285 Calibrate *c = new Calibrate;
285 c->show(); 286 c->show();
286 return c; 287 return c;
287#else 288#else
288 return 0; 289 return 0;
289#endif 290#endif
290} 291}
291 292
292void TaskBar::toggleNumLockState() 293void TaskBar::toggleNumLockState()
293{ 294{
294 if ( lockState ) lockState->toggleNumLockState(); 295 if ( lockState ) lockState->toggleNumLockState();
295} 296}
296 297
297void TaskBar::toggleCapsLockState() 298void TaskBar::toggleCapsLockState()
298{ 299{
299 if ( lockState ) lockState->toggleCapsLockState(); 300 if ( lockState ) lockState->toggleCapsLockState();
300} 301}
301 302
302void TaskBar::toggleSymbolInput() 303void TaskBar::toggleSymbolInput()
303{ 304{
304 if ( inputMethods->currentShown() == "Unicode" ) { 305 if ( inputMethods->currentShown() == "Unicode" ) {
305 inputMethods->hideInputMethod(); 306 inputMethods->hideInputMethod();
306 } else { 307 } else {
307 inputMethods->showInputMethod("Unicode"); 308 inputMethods->showInputMethod("Unicode");
308 } 309 }
309} 310}
310 311
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index 78c4722..40983af 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -1,59 +1,55 @@
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#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
25#include <qpe/custom.h>
26#endif
27
28#include <qhbox.h> 24#include <qhbox.h>
29 25
30class QLabel; 26class QLabel;
31class QTimer; 27class QTimer;
32class InputMethods; 28class InputMethods;
33class Wait; 29class Wait;
34class SysTray; 30class SysTray;
35class MRUList; 31class MRUList;
36class QWidgetStack; 32class QWidgetStack;
37class QTimer; 33class QTimer;
38class QLabel; 34class QLabel;
39class StartMenu; 35class StartMenu;
40class LockKeyState; 36class LockKeyState;
41 37
42class TaskBar : public QHBox { 38class TaskBar : public QHBox {
43 Q_OBJECT 39 Q_OBJECT
44public: 40public:
45 TaskBar(); 41 TaskBar();
46 ~TaskBar(); 42 ~TaskBar();
47 43
48 static QWidget *calibrate( bool ); 44 static QWidget *calibrate( bool );
49 45
50 bool recoverMemory(); 46 bool recoverMemory();
51 47
52 StartMenu *startMenu() const { return sm; } 48 StartMenu *startMenu() const { return sm; }
53public slots: 49public slots:
54 void startWait(); 50 void startWait();
55 void stopWait(const QString&); 51 void stopWait(const QString&);
56 void stopWait(); 52 void stopWait();
57 void clearStatusBar(); 53 void clearStatusBar();
58 void toggleNumLockState(); 54 void toggleNumLockState();
59 void toggleCapsLockState(); 55 void toggleCapsLockState();