summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp107
-rw-r--r--core/launcher/taskbar.cpp10
2 files changed, 16 insertions, 101 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 490af39..073e19a 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,265 +1,172 @@
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> 32#include <opie/odevice.h>
33 33
34#include <qfile.h> 34#include <qfile.h>
35#include <qwindowsystem_qws.h> 35#include <qwindowsystem_qws.h>
36#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37#include <qpe/alarmserver.h> 37#include <qpe/alarmserver.h>
38 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_IPAQ) || defined(QT_QWS_EBX) 44#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
45#include "../calibrate/calibrate.h" 45#include "../calibrate/calibrate.h"
46#endif 46#endif
47 47
48using namespace Opie;
48 49
49void initEnvironment() 50void initEnvironment()
50{ 51{
51 Config config("locale"); 52 Config config("locale");
52 config.setGroup( "Location" ); 53 config.setGroup( "Location" );
53 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 54 QString tz = config.readEntry( "Timezone", getenv("TZ") );
54 55
55 // if not timezone set, pick New York 56 // if not timezone set, pick New York
56 if (tz.isNull()) 57 if (tz.isNull())
57 tz = "America/New_York"; 58 tz = "America/New_York";
58 59
59 setenv( "TZ", tz, 1 ); 60 setenv( "TZ", tz, 1 );
60 config.writeEntry( "Timezone", tz); 61 config.writeEntry( "Timezone", tz);
61 62
62 config.setGroup( "Language" ); 63 config.setGroup( "Language" );
63 QString lang = config.readEntry( "Language", getenv("LANG") ); 64 QString lang = config.readEntry( "Language", getenv("LANG") );
64 if ( !lang.isNull() ) 65 if ( !lang.isNull() )
65 setenv( "LANG", lang, 1 ); 66 setenv( "LANG", lang, 1 );
66} 67}
67 68
68static void initBacklight()
69{
70 QCopEnvelope e("QPE/System", "setBacklight(int)" );
71 e << -3; // Forced on
72}
73
74
75class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
76{
77public:
78 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
79 {
80 bool doinst = false;
81
82 m_model = ODevice::inst ( )-> model ( );
83 m_power_timer = 0;
84
85 switch ( m_model ) {
86 case OMODEL_iPAQ_H31xx:
87 case OMODEL_iPAQ_H36xx:
88 case OMODEL_iPAQ_H37xx:
89 case OMODEL_iPAQ_H38xx: doinst = true;
90 break;
91 default : break;
92 }
93 if ( doinst )
94 QWSServer::setKeyboardFilter ( this );
95 }
96
97 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
98 {
99 bool kill = false;
100
101 // Rotate cursor keys 180°
102 switch ( m_model ) {
103 case OMODEL_iPAQ_H31xx:
104 case OMODEL_iPAQ_H38xx: {
105 int newkeycode = keycode;
106
107 switch ( keycode ) {
108 case Key_Left : newkeycode = Key_Right; break;
109 case Key_Right: newkeycode = Key_Left; break;
110 case Key_Up : newkeycode = Key_Down; break;
111 case Key_Down : newkeycode = Key_Up; break;
112 }
113 if ( newkeycode != keycode ) {
114 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
115 kill = true;
116 }
117 break;
118 }
119 default: break;
120 }
121
122 // map Power Button short/long press to F34/F35
123 switch ( m_model ) {
124 case OMODEL_iPAQ_H31xx:
125 case OMODEL_iPAQ_H36xx:
126 case OMODEL_iPAQ_H37xx:
127 case OMODEL_iPAQ_H38xx: {
128 if ( keycode == Key_SysReq ) {
129 if ( isPress ) {
130 if ( m_power_timer )
131 killTimer ( m_power_timer );
132 m_power_timer = startTimer ( 500 );
133 }
134 else if ( m_power_timer ) {
135 killTimer ( m_power_timer );
136 m_power_timer = 0;
137 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
138 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
139 }
140 kill = true;
141 }
142 break;
143 }
144 default: break;
145 }
146 return kill;
147 }
148
149 virtual void timerEvent ( QTimerEvent * )
150 {
151 killTimer ( m_power_timer );
152 m_power_timer = 0;
153 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
154 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
155 }
156
157private:
158 OModel m_model;
159 int m_power_timer;
160};
161
162
163 69
164int initApplication( int argc, char ** argv ) 70int initApplication( int argc, char ** argv )
165{ 71{
166 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE );
167
168 initEnvironment(); 72 initEnvironment();
169 73
170#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 74#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
171 setenv( "QWS_SIZE", "240x320", 0 ); 75 setenv( "QWS_SIZE", "240x320", 0 );
172#endif 76#endif
173 77
174 //Don't flicker at startup: 78 //Don't flicker at startup:
175 QWSServer::setDesktopBackground( QImage() ); 79 QWSServer::setDesktopBackground( QImage() );
176 DesktopApplication a( argc, argv, QApplication::GuiServer ); 80 DesktopApplication a( argc, argv, QApplication::GuiServer );
177 81
178 (void) new ModelKeyFilter ( ); 82 ODevice::inst ( )-> setSoftSuspend ( true );
179 83
180 initBacklight(); 84 { // init backlight
85 QCopEnvelope e("QPE/System", "setBacklight(int)" );
86 e << -3; // Forced on
87 }
181 88
182 AlarmServer::initialize(); 89 AlarmServer::initialize();
183 90
184 Desktop *d = new Desktop(); 91 Desktop *d = new Desktop();
185 92
186 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); 93 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) );
187 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); 94 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
188 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); 95 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
189 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); 96 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
190 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 97 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
191 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 98 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
192 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 99 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
193 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 100 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
194 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 101 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
195 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 102 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
196 103
197 (void)new SysFileMonitor(d); 104 (void)new SysFileMonitor(d);
198 Network::createServer(d); 105 Network::createServer(d);
199 106
200#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 107#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
201 if ( !QFile::exists( "/etc/pointercal" ) ) { 108 if ( !QFile::exists( "/etc/pointercal" ) ) {
202 // Make sure calibration widget starts on top. 109 // Make sure calibration widget starts on top.
203 Calibrate *cal = new Calibrate; 110 Calibrate *cal = new Calibrate;
204 cal->exec(); 111 cal->exec();
205 delete cal; 112 delete cal;
206 } 113 }
207#endif 114#endif
208 115
209 d->show(); 116 d->show();
210 117
211 int rv = a.exec(); 118 int rv = a.exec();
212 119
213 delete d; 120 delete d;
214 121
215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); 122 ODevice::inst ( )-> setSoftSuspend ( false );
216 123
217 return rv; 124 return rv;
218} 125}
219 126
220static const char *pidfile_path = "/var/run/opie.pid"; 127static const char *pidfile_path = "/var/run/opie.pid";
221 128
222void create_pidfile ( ) 129void create_pidfile ( )
223{ 130{
224 FILE *f; 131 FILE *f;
225 132
226 if (( f = ::fopen ( pidfile_path, "w" ))) { 133 if (( f = ::fopen ( pidfile_path, "w" ))) {
227 ::fprintf ( f, "%d", getpid ( )); 134 ::fprintf ( f, "%d", getpid ( ));
228 ::fclose ( f ); 135 ::fclose ( f );
229 } 136 }
230} 137}
231 138
232void remove_pidfile ( ) 139void remove_pidfile ( )
233{ 140{
234 ::unlink ( pidfile_path ); 141 ::unlink ( pidfile_path );
235} 142}
236 143
237void handle_sigterm ( int /* sig */ ) 144void handle_sigterm ( int /* sig */ )
238{ 145{
239 if ( qApp ) 146 if ( qApp )
240 qApp-> quit ( ); 147 qApp-> quit ( );
241} 148}
242 149
243int main( int argc, char ** argv ) 150int main( int argc, char ** argv )
244{ 151{
245 ::signal ( SIGCHLD, SIG_IGN ); 152 ::signal ( SIGCHLD, SIG_IGN );
246 153
247 ::signal ( SIGTERM, handle_sigterm ); 154 ::signal ( SIGTERM, handle_sigterm );
248 ::signal ( SIGINT, handle_sigterm ); 155 ::signal ( SIGINT, handle_sigterm );
249 156
250 ::setsid ( ); 157 ::setsid ( );
251 ::setpgid ( 0, 0 ); 158 ::setpgid ( 0, 0 );
252 159
253 ::atexit ( remove_pidfile ); 160 ::atexit ( remove_pidfile );
254 create_pidfile ( ); 161 create_pidfile ( );
255 162
256 int retVal = initApplication ( argc, argv ); 163 int retVal = initApplication ( argc, argv );
257 164
258 // Kill them. Kill them all. 165 // Kill them. Kill them all.
259 ::kill ( 0, SIGTERM ); 166 ::kill ( 0, SIGTERM );
260 ::sleep ( 1 ); 167 ::sleep ( 1 );
261 ::kill ( 0, SIGKILL ); 168 ::kill ( 0, SIGKILL );
262 169
263 return retVal; 170 return retVal;
264} 171}
265 172
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 1feae4a..46bcdb3 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,323 +1,331 @@
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 "runningappbar.h" 23#include "runningappbar.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> 40#include <opie/odevice.h>
41 41
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qtimer.h> 44#include <qtimer.h>
45#include <qwindowsystem_qws.h> 45#include <qwindowsystem_qws.h>
46#include <qwidgetstack.h> 46#include <qwidgetstack.h>
47 47
48#if defined( Q_WS_QWS ) 48#if defined( Q_WS_QWS )
49#include <qwsdisplay_qws.h> 49#include <qwsdisplay_qws.h>
50#include <qgfx_qws.h> 50#include <qgfx_qws.h>
51#endif 51#endif
52 52
53 53
54using namespace Opie;
55
54#define FACTORY(T) \ 56#define FACTORY(T) \
55 static QWidget *new##T( bool maximized ) { \ 57 static QWidget *new##T( bool maximized ) { \
56 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 58 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
57 if ( maximized ) { \ 59 if ( maximized ) { \
58 if ( qApp->desktop()->width() <= 350 ) { \ 60 if ( qApp->desktop()->width() <= 350 ) { \
59 w->showMaximized(); \ 61 w->showMaximized(); \
60 } else { \ 62 } else { \
61 w->resize( QSize( 300, 300 ) ); \ 63 w->resize( QSize( 300, 300 ) ); \
62 } \ 64 } \
63 } \ 65 } \
64 w->show(); \ 66 w->show(); \
65 return w; \ 67 return w; \
66 } 68 }
67 69
68 70
69#ifdef SINGLE_APP 71#ifdef SINGLE_APP
70#define APP(a,b,c,d) FACTORY(b) 72#define APP(a,b,c,d) FACTORY(b)
71#include "../launcher/apps.h" 73#include "../launcher/apps.h"
72#undef APP 74#undef APP
73#endif // SINGLE_APP 75#endif // SINGLE_APP
74 76
75static Global::Command builtins[] = { 77static Global::Command builtins[] = {
76 78
77#ifdef SINGLE_APP 79#ifdef SINGLE_APP
78#define APP(a,b,c,d) { a, new##b, c }, 80#define APP(a,b,c,d) { a, new##b, c },
79#include "../launcher/apps.h" 81#include "../launcher/apps.h"
80#undef APP 82#undef APP
81#endif 83#endif
82 84
83#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 85#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
84 { "calibrate", TaskBar::calibrate, 1, 0 }, 86 { "calibrate", TaskBar::calibrate, 1, 0 },
85#endif 87#endif
86#if !defined(QT_QWS_CASSIOPEIA) 88#if !defined(QT_QWS_CASSIOPEIA)
87 { "shutdown", Global::shutdown, 1, 0 }, 89 { "shutdown", Global::shutdown, 1, 0 },
88// { "run", run, 1, 0 }, 90// { "run", run, 1, 0 },
89#endif 91#endif
90 92
91 { 0, TaskBar::calibrate, 0, 0 }, 93 { 0, TaskBar::calibrate, 0, 0 },
92}; 94};
93 95
94static bool initNumLock() 96static bool initNumLock()
95{ 97{
96#ifdef QPE_INITIAL_NUMLOCK_STATE 98#ifdef QPE_INITIAL_NUMLOCK_STATE
97 QPE_INITIAL_NUMLOCK_STATE 99 QPE_INITIAL_NUMLOCK_STATE
98#endif 100#endif
99 return FALSE; 101 return FALSE;
100} 102}
101 103
102class LockKeyState : public QWidget 104class LockKeyState : public QWidget
103{ 105{
104public: 106public:
105 LockKeyState( QWidget *parent ) : 107 LockKeyState( QWidget *parent ) :
106 QWidget(parent), 108 QWidget(parent),
107 nl(initNumLock()), cl(FALSE) 109 nl(initNumLock()), cl(FALSE)
108 { 110 {
109 nl_pm = Resource::loadPixmap("numlock"); 111 nl_pm = Resource::loadPixmap("numlock");
110 cl_pm = Resource::loadPixmap("capslock"); 112 cl_pm = Resource::loadPixmap("capslock");
111 } 113 }
112 QSize sizeHint() const 114 QSize sizeHint() const
113 { 115 {
114 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 116 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
115 } 117 }
116 void toggleNumLockState() 118 void toggleNumLockState()
117 { 119 {
118 nl = !nl; repaint(); 120 nl = !nl; repaint();
119 } 121 }
120 void toggleCapsLockState() 122 void toggleCapsLockState()
121 { 123 {
122 cl = !cl; repaint(); 124 cl = !cl; repaint();
123 } 125 }
124 void paintEvent( QPaintEvent * ) 126 void paintEvent( QPaintEvent * )
125 { 127 {
126 int y = (height()-sizeHint().height())/2; 128 int y = (height()-sizeHint().height())/2;
127 QPainter p(this); 129 QPainter p(this);
128 if ( nl ) 130 if ( nl )
129 p.drawPixmap(1,y,nl_pm); 131 p.drawPixmap(1,y,nl_pm);
130 if ( cl ) 132 if ( cl )
131 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 133 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
132 } 134 }
133private: 135private:
134 QPixmap nl_pm, cl_pm; 136 QPixmap nl_pm, cl_pm;
135 bool nl, cl; 137 bool nl, cl;
136}; 138};
137 139
138TaskBar::~TaskBar() 140TaskBar::~TaskBar()
139{ 141{
140} 142}
141 143
142 144
143TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 145TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
144{ 146{
145 Global::setBuiltinCommands(builtins); 147 Global::setBuiltinCommands(builtins);
146 148
147 sm = new StartMenu( this ); 149 sm = new StartMenu( this );
148 150
149 inputMethods = new InputMethods( this ); 151 inputMethods = new InputMethods( this );
150 connect( inputMethods, SIGNAL(inputToggled(bool)), 152 connect( inputMethods, SIGNAL(inputToggled(bool)),
151 this, SLOT(calcMaxWindowRect()) ); 153 this, SLOT(calcMaxWindowRect()) );
152 //new QuickLauncher( this ); 154 //new QuickLauncher( this );
153 155
154 stack = new QWidgetStack( this ); 156 stack = new QWidgetStack( this );
155 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 157 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
156 label = new QLabel(stack); 158 label = new QLabel(stack);
157 159
158 //mru = new MRUList( stack ); 160 //mru = new MRUList( stack );
159 //stack->raiseWidget( mru ); 161 //stack->raiseWidget( mru );
160 162
161 runningAppBar = new RunningAppBar(stack); 163 runningAppBar = new RunningAppBar(stack);
162 stack->raiseWidget(runningAppBar); 164 stack->raiseWidget(runningAppBar);
163 165
164 waitIcon = new Wait( this ); 166 waitIcon = new Wait( this );
165 (void) new AppIcons( this ); 167 (void) new AppIcons( this );
166 168
167 sysTray = new SysTray( this ); 169 sysTray = new SysTray( this );
168 170
169 // ## make customizable in some way? 171 // ## make customizable in some way?
170#ifdef QT_QWS_CUSTOM 172#ifdef QT_QWS_CUSTOM
171 lockState = new LockKeyState( this ); 173 lockState = new LockKeyState( this );
172#else 174#else
173 lockState = 0; 175 lockState = 0;
174#endif 176#endif
175 177
176#if defined(Q_WS_QWS) 178#if defined(Q_WS_QWS)
177#if !defined(QT_NO_COP) 179#if !defined(QT_NO_COP)
178 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 180 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
179 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 181 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
180 this, SLOT(receive(const QCString&, const QByteArray&)) ); 182 this, SLOT(receive(const QCString&, const QByteArray&)) );
181#endif 183#endif
182#endif 184#endif
183 waitTimer = new QTimer( this ); 185 waitTimer = new QTimer( this );
184 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 186 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
185 clearer = new QTimer( this ); 187 clearer = new QTimer( this );
186 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 188 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
187 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 189 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
188} 190}
189 191
190void TaskBar::setStatusMessage( const QString &text ) 192void TaskBar::setStatusMessage( const QString &text )
191{ 193{
192 label->setText( text ); 194 label->setText( text );
193 stack->raiseWidget( label ); 195 stack->raiseWidget( label );
194 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 196 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
195 sysTray->hide(); 197 sysTray->hide();
196 clearer->start( 3000 ); 198 clearer->start( 3000 );
197} 199}
198 200
199void TaskBar::clearStatusBar() 201void TaskBar::clearStatusBar()
200{ 202{
201 label->clear(); 203 label->clear();
202 stack->raiseWidget(runningAppBar); 204 stack->raiseWidget(runningAppBar);
203 // stack->raiseWidget( mru ); 205 // stack->raiseWidget( mru );
204} 206}
205 207
206void TaskBar::startWait() 208void TaskBar::startWait()
207{ 209{
208 waitIcon->setWaiting( true ); 210 waitIcon->setWaiting( true );
209 // a catchall stop after 10 seconds... 211 // a catchall stop after 10 seconds...
210 waitTimer->start( 10 * 1000, true ); 212 waitTimer->start( 10 * 1000, true );
211} 213}
212 214
213void TaskBar::stopWait(const QString& app) 215void TaskBar::stopWait(const QString& app)
214{ 216{
215 waitTimer->stop(); 217 waitTimer->stop();
216 //mru->addTask(sm->execToLink(app)); 218 //mru->addTask(sm->execToLink(app));
217 waitIcon->setWaiting( false ); 219 waitIcon->setWaiting( false );
218} 220}
219 221
220void TaskBar::stopWait() 222void TaskBar::stopWait()
221{ 223{
222 waitTimer->stop(); 224 waitTimer->stop();
223 225
224 waitIcon->setWaiting( false ); 226 waitIcon->setWaiting( false );
225} 227}
226 228
227void TaskBar::resizeEvent( QResizeEvent *e ) 229void TaskBar::resizeEvent( QResizeEvent *e )
228{ 230{
229 QHBox::resizeEvent( e ); 231 QHBox::resizeEvent( e );
230 calcMaxWindowRect(); 232 calcMaxWindowRect();
231} 233}
232 234
233void TaskBar::styleChange( QStyle &s ) 235void TaskBar::styleChange( QStyle &s )
234{ 236{
235 QHBox::styleChange( s ); 237 QHBox::styleChange( s );
236 calcMaxWindowRect(); 238 calcMaxWindowRect();
237} 239}
238 240
239void TaskBar::calcMaxWindowRect() 241void TaskBar::calcMaxWindowRect()
240{ 242{
241#ifdef Q_WS_QWS 243#ifdef Q_WS_QWS
242 QRect wr; 244 QRect wr;
243 int displayWidth = qApp->desktop()->width(); 245 int displayWidth = qApp->desktop()->width();
244 QRect ir = inputMethods->inputRect(); 246 QRect ir = inputMethods->inputRect();
245 if ( ir.isValid() ) { 247 if ( ir.isValid() ) {
246 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 248 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
247 } else { 249 } else {
248 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 250 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
249 } 251 }
250 252
251#if QT_VERSION < 300 253#if QT_VERSION < 300
252 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 254 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
253 QSize(qt_screen->width(),qt_screen->height())) 255 QSize(qt_screen->width(),qt_screen->height()))
254 ); 256 );
255#else 257#else
256 QWSServer::setMaxWindowRect( wr ); 258 QWSServer::setMaxWindowRect( wr );
257#endif 259#endif
258#endif 260#endif
259} 261}
260 262
261void TaskBar::receive( const QCString &msg, const QByteArray &data ) 263void TaskBar::receive( const QCString &msg, const QByteArray &data )
262{ 264{
263 QDataStream stream( data, IO_ReadOnly ); 265 QDataStream stream( data, IO_ReadOnly );
264 if ( msg == "message(QString)" ) { 266 if ( msg == "message(QString)" ) {
265 QString text; 267 QString text;
266 stream >> text; 268 stream >> text;
267 setStatusMessage( text ); 269 setStatusMessage( text );
268 } else if ( msg == "hideInputMethod()" ) { 270 } else if ( msg == "hideInputMethod()" ) {
269 inputMethods->hideInputMethod(); 271 inputMethods->hideInputMethod();
270 } else if ( msg == "showInputMethod()" ) { 272 } else if ( msg == "showInputMethod()" ) {
271 inputMethods->showInputMethod(); 273 inputMethods->showInputMethod();
272 } else if ( msg == "reloadInputMethods()" ) { 274 } else if ( msg == "reloadInputMethods()" ) {
273 inputMethods->loadInputMethods(); 275 inputMethods->loadInputMethods();
274 } else if ( msg == "reloadApplets()" ) { 276 } else if ( msg == "reloadApplets()" ) {
275 sysTray->clearApplets(); 277 sysTray->clearApplets();
276 sysTray->addApplets(); 278 sysTray->addApplets();
277 } else if ( msg == "soundAlarm()" ) { 279 } else if ( msg == "soundAlarm()" ) {
278 Desktop::soundAlarm(); 280 Desktop::soundAlarm();
279 } 281 }
280 else if ( msg == "setLed(int,bool)" ) { 282 else if ( msg == "setLed(int,bool)" ) {
281 int led, status; 283 int led, status;
282 stream >> led >> status; 284 stream >> led >> status;
283 285
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 286 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
287 if ( ll. count ( )){
288 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
289 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
290
291 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
292 }
285 } 293 }
286} 294}
287 295
288QWidget *TaskBar::calibrate(bool) 296QWidget *TaskBar::calibrate(bool)
289{ 297{
290#ifdef Q_WS_QWS 298#ifdef Q_WS_QWS
291 Calibrate *c = new Calibrate; 299 Calibrate *c = new Calibrate;
292 c->show(); 300 c->show();
293 return c; 301 return c;
294#else 302#else
295 return 0; 303 return 0;
296#endif 304#endif
297} 305}
298 306
299void TaskBar::toggleNumLockState() 307void TaskBar::toggleNumLockState()
300{ 308{
301 if ( lockState ) lockState->toggleNumLockState(); 309 if ( lockState ) lockState->toggleNumLockState();
302} 310}
303 311
304void TaskBar::toggleCapsLockState() 312void TaskBar::toggleCapsLockState()
305{ 313{
306 if ( lockState ) lockState->toggleCapsLockState(); 314 if ( lockState ) lockState->toggleCapsLockState();
307} 315}
308 316
309void TaskBar::toggleSymbolInput() 317void TaskBar::toggleSymbolInput()
310{ 318{
311 if ( inputMethods->currentShown() == "Unicode" ) { 319 if ( inputMethods->currentShown() == "Unicode" ) {
312 inputMethods->hideInputMethod(); 320 inputMethods->hideInputMethod();
313 } else { 321 } else {
314 inputMethods->showInputMethod("Unicode"); 322 inputMethods->showInputMethod("Unicode");
315 } 323 }
316} 324}
317 325
318bool TaskBar::recoverMemory() 326bool TaskBar::recoverMemory()
319{ 327{
320 //eturn mru->quitOldApps(); 328 //eturn mru->quitOldApps();
321 return true; 329 return true;
322} 330}
323 331