summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.pro2
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/systray.cpp103
-rw-r--r--core/launcher/systray.h13
-rw-r--r--core/launcher/taskbar.cpp4
5 files changed, 83 insertions, 41 deletions
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index 0e557aa..dbe3820 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -1,120 +1,118 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 DESTDIR = ../../bin 3 DESTDIR = ../../bin
4 HEADERS = background.h \ 4 HEADERS = background.h \
5 desktop.h \ 5 desktop.h \
6 qprocess.h \ 6 qprocess.h \
7 mediummountgui.h \ 7 mediummountgui.h \
8 info.h \ 8 info.h \
9 appicons.h \ 9 appicons.h \
10 taskbar.h \ 10 taskbar.h \
11 sidething.h \ 11 sidething.h \
12 mrulist.h \
13 runningappbar.h \ 12 runningappbar.h \
14 stabmon.h \ 13 stabmon.h \
15 inputmethods.h \ 14 inputmethods.h \
16 systray.h \ 15 systray.h \
17 wait.h \ 16 wait.h \
18 shutdownimpl.h \ 17 shutdownimpl.h \
19 launcher.h \ 18 launcher.h \
20 launcherview.h \ 19 launcherview.h \
21 ../../core/apps/calibrate/calibrate.h \ 20 ../../core/apps/calibrate/calibrate.h \
22 startmenu.h \ 21 startmenu.h \
23 transferserver.h \ 22 transferserver.h \
24 qcopbridge.h \ 23 qcopbridge.h \
25 packageslave.h \ 24 packageslave.h \
26 irserver.h \ 25 irserver.h \
27 ../../rsync/buf.h \ 26 ../../rsync/buf.h \
28 ../../rsync/checksum.h \ 27 ../../rsync/checksum.h \
29 ../../rsync/command.h \ 28 ../../rsync/command.h \
30 ../../rsync/emit.h \ 29 ../../rsync/emit.h \
31 ../../rsync/job.h \ 30 ../../rsync/job.h \
32 ../../rsync/netint.h \ 31 ../../rsync/netint.h \
33 ../../rsync/protocol.h \ 32 ../../rsync/protocol.h \
34 ../../rsync/prototab.h \ 33 ../../rsync/prototab.h \
35 ../../rsync/rsync.h \ 34 ../../rsync/rsync.h \
36 ../../rsync/search.h \ 35 ../../rsync/search.h \
37 ../../rsync/stream.h \ 36 ../../rsync/stream.h \
38 ../../rsync/sumset.h \ 37 ../../rsync/sumset.h \
39 ../../rsync/trace.h \ 38 ../../rsync/trace.h \
40 ../../rsync/types.h \ 39 ../../rsync/types.h \
41 ../../rsync/util.h \ 40 ../../rsync/util.h \
42 ../../rsync/whole.h \ 41 ../../rsync/whole.h \
43 ../../rsync/config_rsync.h \ 42 ../../rsync/config_rsync.h \
44 ../../rsync/qrsync.h 43 ../../rsync/qrsync.h
45 # quicklauncher.h \ 44 # quicklauncher.h \
46 SOURCES = background.cpp \ 45 SOURCES = background.cpp \
47 desktop.cpp \ 46 desktop.cpp \
48 mediummountgui.cpp \ 47 mediummountgui.cpp \
49 qprocess.cpp qprocess_unix.cpp \ 48 qprocess.cpp qprocess_unix.cpp \
50 info.cpp \ 49 info.cpp \
51 appicons.cpp \ 50 appicons.cpp \
52 taskbar.cpp \ 51 taskbar.cpp \
53 sidething.cpp \ 52 sidething.cpp \
54 mrulist.cpp \
55 runningappbar.cpp \ 53 runningappbar.cpp \
56 stabmon.cpp \ 54 stabmon.cpp \
57 inputmethods.cpp \ 55 inputmethods.cpp \
58 systray.cpp \ 56 systray.cpp \
59 wait.cpp \ 57 wait.cpp \
60 shutdownimpl.cpp \ 58 shutdownimpl.cpp \
61 launcher.cpp \ 59 launcher.cpp \
62 launcherview.cpp \ 60 launcherview.cpp \
63 ../../core/apps/calibrate/calibrate.cpp \ 61 ../../core/apps/calibrate/calibrate.cpp \
64 transferserver.cpp \ 62 transferserver.cpp \
65 packageslave.cpp \ 63 packageslave.cpp \
66 irserver.cpp \ 64 irserver.cpp \
67 qcopbridge.cpp \ 65 qcopbridge.cpp \
68 startmenu.cpp \ 66 startmenu.cpp \
69 main.cpp \ 67 main.cpp \
70 ../../rsync/base64.c \ 68 ../../rsync/base64.c \
71 ../../rsync/buf.c \ 69 ../../rsync/buf.c \
72 ../../rsync/checksum.c \ 70 ../../rsync/checksum.c \
73 ../../rsync/command.c \ 71 ../../rsync/command.c \
74 ../../rsync/delta.c \ 72 ../../rsync/delta.c \
75 ../../rsync/emit.c \ 73 ../../rsync/emit.c \
76 ../../rsync/hex.c \ 74 ../../rsync/hex.c \
77 ../../rsync/job.c \ 75 ../../rsync/job.c \
78 ../../rsync/mdfour.c \ 76 ../../rsync/mdfour.c \
79 ../../rsync/mksum.c \ 77 ../../rsync/mksum.c \
80 ../../rsync/msg.c \ 78 ../../rsync/msg.c \
81 ../../rsync/netint.c \ 79 ../../rsync/netint.c \
82 ../../rsync/patch.c \ 80 ../../rsync/patch.c \
83 ../../rsync/prototab.c \ 81 ../../rsync/prototab.c \
84 ../../rsync/readsums.c \ 82 ../../rsync/readsums.c \
85 ../../rsync/scoop.c \ 83 ../../rsync/scoop.c \
86 ../../rsync/search.c \ 84 ../../rsync/search.c \
87 ../../rsync/stats.c \ 85 ../../rsync/stats.c \
88 ../../rsync/stream.c \ 86 ../../rsync/stream.c \
89 ../../rsync/sumset.c \ 87 ../../rsync/sumset.c \
90 ../../rsync/trace.c \ 88 ../../rsync/trace.c \
91 ../../rsync/tube.c \ 89 ../../rsync/tube.c \
92 ../../rsync/util.c \ 90 ../../rsync/util.c \
93 ../../rsync/version.c \ 91 ../../rsync/version.c \
94 ../../rsync/whole.c \ 92 ../../rsync/whole.c \
95 ../../rsync/qrsync.cpp 93 ../../rsync/qrsync.cpp
96 INTERFACES= syncdialog.ui 94 INTERFACES= syncdialog.ui
97INCLUDEPATH += ../../include 95INCLUDEPATH += ../../include
98 DEPENDPATH+= ../../include . 96 DEPENDPATH+= ../../include .
99INCLUDEPATH += ../../core/apps/calibrate 97INCLUDEPATH += ../../core/apps/calibrate
100 DEPENDPATH+= ../../core/apps/calibrate 98 DEPENDPATH+= ../../core/apps/calibrate
101INCLUDEPATH += ../../rsync 99INCLUDEPATH += ../../rsync
102 DEPENDPATH+= ../../rsync 100 DEPENDPATH+= ../../rsync
103 TARGET = qpe 101 TARGET = qpe
104 LIBS += -lqpe -lcrypt -lopie 102 LIBS += -lqpe -lcrypt -lopie
105 103
106TRANSLATIONS = ../../i18n/de/qpe.ts \ 104TRANSLATIONS = ../../i18n/de/qpe.ts \
107 ../../i18n/en/qpe.ts \ 105 ../../i18n/en/qpe.ts \
108 ../../i18n/es/qpe.ts \ 106 ../../i18n/es/qpe.ts \
109 ../../i18n/fr/qpe.ts \ 107 ../../i18n/fr/qpe.ts \
110 ../../i18n/hu/qpe.ts \ 108 ../../i18n/hu/qpe.ts \
111 ../../i18n/ja/qpe.ts \ 109 ../../i18n/ja/qpe.ts \
112 ../../i18n/ko/qpe.ts \ 110 ../../i18n/ko/qpe.ts \
113 ../../i18n/no/qpe.ts \ 111 ../../i18n/no/qpe.ts \
114 ../../i18n/pl/qpe.ts \ 112 ../../i18n/pl/qpe.ts \
115 ../../i18n/pt/qpe.ts \ 113 ../../i18n/pt/qpe.ts \
116 ../../i18n/pt_BR/qpe.ts \ 114 ../../i18n/pt_BR/qpe.ts \
117 ../../i18n/sl/qpe.ts \ 115 ../../i18n/sl/qpe.ts \
118 ../../i18n/zh_CN/qpe.ts \ 116 ../../i18n/zh_CN/qpe.ts \
119 ../../i18n/it/qpe.ts \ 117 ../../i18n/it/qpe.ts \
120 ../../i18n/zh_TW/qpe.ts 118 ../../i18n/zh_TW/qpe.ts
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index ca0bbe4..490af39 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,265 +1,265 @@
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
48 48
49void initEnvironment() 49void initEnvironment()
50{ 50{
51 Config config("locale"); 51 Config config("locale");
52 config.setGroup( "Location" ); 52 config.setGroup( "Location" );
53 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 53 QString tz = config.readEntry( "Timezone", getenv("TZ") );
54 54
55 // if not timezone set, pick New York 55 // if not timezone set, pick New York
56 if (tz.isNull()) 56 if (tz.isNull())
57 tz = "America/New_York"; 57 tz = "America/New_York";
58 58
59 setenv( "TZ", tz, 1 ); 59 setenv( "TZ", tz, 1 );
60 config.writeEntry( "Timezone", tz); 60 config.writeEntry( "Timezone", tz);
61 61
62 config.setGroup( "Language" ); 62 config.setGroup( "Language" );
63 QString lang = config.readEntry( "Language", getenv("LANG") ); 63 QString lang = config.readEntry( "Language", getenv("LANG") );
64 if ( !lang.isNull() ) 64 if ( !lang.isNull() )
65 setenv( "LANG", lang, 1 ); 65 setenv( "LANG", lang, 1 );
66} 66}
67 67
68static void initBacklight() 68static void initBacklight()
69{ 69{
70 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 70 QCopEnvelope e("QPE/System", "setBacklight(int)" );
71 e << -3; // Forced on 71 e << -3; // Forced on
72} 72}
73 73
74 74
75class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter 75class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
76{ 76{
77public: 77public:
78 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" ) 78 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
79 { 79 {
80 bool doinst = false; 80 bool doinst = false;
81 81
82 m_model = ODevice::inst ( )-> model ( ); 82 m_model = ODevice::inst ( )-> model ( );
83 m_power_timer = 0; 83 m_power_timer = 0;
84 84
85 switch ( m_model ) { 85 switch ( m_model ) {
86 case OMODEL_iPAQ_H31xx: 86 case OMODEL_iPAQ_H31xx:
87 case OMODEL_iPAQ_H36xx: 87 case OMODEL_iPAQ_H36xx:
88 case OMODEL_iPAQ_H37xx: 88 case OMODEL_iPAQ_H37xx:
89 case OMODEL_iPAQ_H38xx: doinst = true; 89 case OMODEL_iPAQ_H38xx: doinst = true;
90 break; 90 break;
91 default : break; 91 default : break;
92 } 92 }
93 if ( doinst ) 93 if ( doinst )
94 QWSServer::setKeyboardFilter ( this ); 94 QWSServer::setKeyboardFilter ( this );
95 } 95 }
96 96
97 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 97 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
98 { 98 {
99 bool kill = false; 99 bool kill = false;
100 100
101 // Rotate cursor keys 180° 101 // Rotate cursor keys 180°
102 switch ( m_model ) { 102 switch ( m_model ) {
103 case OMODEL_iPAQ_H31xx: 103 case OMODEL_iPAQ_H31xx:
104 case OMODEL_iPAQ_H38xx: { 104 case OMODEL_iPAQ_H38xx: {
105 int newkeycode = keycode; 105 int newkeycode = keycode;
106 106
107 switch ( keycode ) { 107 switch ( keycode ) {
108 case Key_Left : newkeycode = Key_Right; break; 108 case Key_Left : newkeycode = Key_Right; break;
109 case Key_Right: newkeycode = Key_Left; break; 109 case Key_Right: newkeycode = Key_Left; break;
110 case Key_Up : newkeycode = Key_Down; break; 110 case Key_Up : newkeycode = Key_Down; break;
111 case Key_Down : newkeycode = Key_Up; break; 111 case Key_Down : newkeycode = Key_Up; break;
112 } 112 }
113 if ( newkeycode != keycode ) { 113 if ( newkeycode != keycode ) {
114 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 114 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
115 kill = true; 115 kill = true;
116 } 116 }
117 break; 117 break;
118 } 118 }
119 default: break; 119 default: break;
120 } 120 }
121 121
122 // map Power Button short/long press to F34/F35 122 // map Power Button short/long press to F34/F35
123 switch ( m_model ) { 123 switch ( m_model ) {
124 case OMODEL_iPAQ_H31xx: 124 case OMODEL_iPAQ_H31xx:
125 case OMODEL_iPAQ_H36xx: 125 case OMODEL_iPAQ_H36xx:
126 case OMODEL_iPAQ_H37xx: 126 case OMODEL_iPAQ_H37xx:
127 case OMODEL_iPAQ_H38xx: { 127 case OMODEL_iPAQ_H38xx: {
128 if ( keycode == Key_SysReq ) { 128 if ( keycode == Key_SysReq ) {
129 if ( isPress ) { 129 if ( isPress ) {
130 if ( m_power_timer ) 130 if ( m_power_timer )
131 killTimer ( m_power_timer ); 131 killTimer ( m_power_timer );
132 m_power_timer = startTimer ( 500 ); 132 m_power_timer = startTimer ( 500 );
133 } 133 }
134 else if ( m_power_timer ) { 134 else if ( m_power_timer ) {
135 killTimer ( m_power_timer ); 135 killTimer ( m_power_timer );
136 m_power_timer = 0; 136 m_power_timer = 0;
137 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false ); 137 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
138 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false ); 138 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
139 } 139 }
140 kill = true; 140 kill = true;
141 } 141 }
142 break; 142 break;
143 } 143 }
144 default: break; 144 default: break;
145 } 145 }
146 return kill; 146 return kill;
147 } 147 }
148 148
149 virtual void timerEvent ( QTimerEvent * ) 149 virtual void timerEvent ( QTimerEvent * )
150 { 150 {
151 killTimer ( m_power_timer ); 151 killTimer ( m_power_timer );
152 m_power_timer = 0; 152 m_power_timer = 0;
153 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false ); 153 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
154 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false ); 154 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
155 } 155 }
156 156
157private: 157private:
158 OModel m_model; 158 OModel m_model;
159 int m_power_timer; 159 int m_power_timer;
160}; 160};
161 161
162 162
163 163
164int initApplication( int argc, char ** argv ) 164int initApplication( int argc, char ** argv )
165{ 165{
166 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE ); 166 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE );
167 167
168 initEnvironment(); 168 initEnvironment();
169 169
170#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) 170#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
171 setenv( "QWS_SIZE", "240x320", 0 ); 171 setenv( "QWS_SIZE", "240x320", 0 );
172#endif 172#endif
173 173
174 //Don't flicker at startup: 174 //Don't flicker at startup:
175 QWSServer::setDesktopBackground( QImage() ); 175 QWSServer::setDesktopBackground( QImage() );
176 DesktopApplication a( argc, argv, QApplication::GuiServer ); 176 DesktopApplication a( argc, argv, QApplication::GuiServer );
177 177
178 (void) new ModelKeyFilter ( ); 178 (void) new ModelKeyFilter ( );
179 179
180 initBacklight(); 180 initBacklight();
181 181
182 AlarmServer::initialize(); 182 AlarmServer::initialize();
183 183
184 Desktop *d = new Desktop(); 184 Desktop *d = new Desktop();
185 185
186 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) ); 186 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) );
187 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); 187 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
188 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); 188 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
189 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); 189 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
190 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 190 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
191 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 191 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
192 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 192 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
193 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 193 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
194 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 194 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
195 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 195 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
196 196
197 (void)new SysFileMonitor(d); 197 (void)new SysFileMonitor(d);
198 Network::createServer(d); 198 Network::createServer(d);
199 199
200#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 200#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
201 if ( !QFile::exists( "/etc/pointercal" ) ) { 201 if ( !QFile::exists( "/etc/pointercal" ) ) {
202 // Make sure calibration widget starts on top. 202 // Make sure calibration widget starts on top.
203 Calibrate *cal = new Calibrate; 203 Calibrate *cal = new Calibrate;
204 cal->exec(); 204 cal->exec();
205 delete cal; 205 delete cal;
206 } 206 }
207#endif 207#endif
208 208
209 d->show(); 209 d->show();
210 210
211 int rv = a.exec(); 211 int rv = a.exec();
212 212
213 delete d; 213 delete d;
214 214
215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); 215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL );
216 216
217 return rv; 217 return rv;
218} 218}
219 219
220static const char *pidfile_path = "/var/run/opie.pid"; 220static const char *pidfile_path = "/var/run/opie.pid";
221 221
222void create_pidfile ( ) 222void create_pidfile ( )
223{ 223{
224 FILE *f; 224 FILE *f;
225 225
226 if (( f = ::fopen ( pidfile_path, "w" ))) { 226 if (( f = ::fopen ( pidfile_path, "w" ))) {
227 ::fprintf ( f, "%d", getpid ( )); 227 ::fprintf ( f, "%d", getpid ( ));
228 ::fclose ( f ); 228 ::fclose ( f );
229 } 229 }
230} 230}
231 231
232void remove_pidfile ( ) 232void remove_pidfile ( )
233{ 233{
234 ::unlink ( pidfile_path ); 234 ::unlink ( pidfile_path );
235} 235}
236 236
237void handle_sigterm ( int /* sig */ ) 237void handle_sigterm ( int /* sig */ )
238{ 238{
239 if ( qApp ) 239 if ( qApp )
240 qApp-> quit ( ); 240 qApp-> quit ( );
241} 241}
242 242
243int main( int argc, char ** argv ) 243int main( int argc, char ** argv )
244{ 244{
245 ::signal( SIGCHLD, SIG_IGN ); 245 ::signal ( SIGCHLD, SIG_IGN );
246 246
247 ::signal ( SIGTERM, handle_sigterm ); 247 ::signal ( SIGTERM, handle_sigterm );
248 ::signal ( SIGINT, handle_sigterm ); 248 ::signal ( SIGINT, handle_sigterm );
249 249
250 ::setsid ( ); 250 ::setsid ( );
251 ::setpgid ( 0, 0 ); 251 ::setpgid ( 0, 0 );
252 252
253 ::atexit ( remove_pidfile ); 253 ::atexit ( remove_pidfile );
254 create_pidfile ( ); 254 create_pidfile ( );
255 255
256 int retVal = initApplication ( argc, argv ); 256 int retVal = initApplication ( argc, argv );
257 257
258 // Kill them. Kill them all. 258 // Kill them. Kill them all.
259 ::kill ( 0, SIGTERM ); 259 ::kill ( 0, SIGTERM );
260 ::sleep ( 1 ); 260 ::sleep ( 1 );
261 ::kill ( 0, SIGKILL ); 261 ::kill ( 0, SIGKILL );
262 262
263 return retVal; 263 return retVal;
264} 264}
265 265
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index ad1553f..4767150 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -1,107 +1,148 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the 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 <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/qlibrary.h> 22#include <qpe/qlibrary.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qdir.h> 26#include <qdir.h>
27#include <qtranslator.h> 27#include <qtranslator.h>
28 28
29#include "quicklauncher.h" 29#include "quicklauncher.h"
30#include "systray.h" 30#include "systray.h"
31 31
32#include <stdlib.h> 32#include <stdlib.h>
33 33
34#ifdef SINGLE_APP 34#ifdef SINGLE_APP
35#include "clockappletimpl.h" 35#include "clockappletimpl.h"
36#endif 36#endif
37 37
38SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) 38SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0)
39{ 39{
40 safety_tid = 0;
40 //setFrameStyle( QFrame::Panel | QFrame::Sunken ); 41 //setFrameStyle( QFrame::Panel | QFrame::Sunken );
41 loadApplets(); 42 loadApplets();
42} 43}
43 44
45static int compareAppletPositions(const void *a, const void *b)
46{
47 const TaskbarApplet* aa = *(const TaskbarApplet**)a;
48 const TaskbarApplet* ab = *(const TaskbarApplet**)b;
49 int d = ab->iface->position() - aa->iface->position();
50 if ( d ) return d;
51 return QString::compare(ab->library->library(),aa->library->library());
52}
53
44void SysTray::loadApplets() 54void SysTray::loadApplets()
45{ 55{
56 clearApplets();
57 addApplets();
58}
59
60void SysTray::clearApplets()
61{
62 hide();
46#ifndef SINGLE_APP 63#ifndef SINGLE_APP
47 QValueList<TaskbarApplet>::Iterator mit; 64 QValueList<TaskbarApplet>::Iterator mit;
48 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { 65 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
49 (*mit).iface->release(); 66 (*mit).iface->release();
50 (*mit).library->unload(); 67 (*mit).library->unload();
51 delete (*mit).library; 68 delete (*mit).library;
52 } 69 }
70#endif
53 appletList.clear(); 71 appletList.clear();
54 if ( layout ) 72 if ( layout )
55 delete layout; 73 delete layout;
56 layout = new QHBoxLayout( this ); 74 layout = new QHBoxLayout( this, 0, 1 );
75 layout->setAutoAdd(TRUE);
76}
77
78void SysTray::addApplets()
79{
80#ifndef SINGLE_APP
81 Config cfg( "Taskbar" );
82 cfg.setGroup( "Applets" );
83 bool safe = cfg.readBoolEntry("SafeMode",FALSE);
84 if ( safe && !safety_tid )
85 return;
86 cfg.writeEntry("SafeMode",TRUE);
87 cfg.write();
88 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
57 89
58 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 90 QString path = QPEApplication::qpeDir() + "/plugins/applets";
59 QDir dir( path, "lib*.so" ); 91 QDir dir( path, "lib*.so" );
60 QStringList list = dir.entryList(); 92 QStringList list = dir.entryList();
61 QStringList::Iterator it; 93 QStringList::Iterator it;
94 int napplets=0;
95 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
62 for ( it = list.begin(); it != list.end(); ++it ) { 96 for ( it = list.begin(); it != list.end(); ++it ) {
97 if ( exclude.find( *it ) != exclude.end() )
98 continue;
63 TaskbarAppletInterface *iface = 0; 99 TaskbarAppletInterface *iface = 0;
64 QLibrary *lib = new QLibrary( path + "/" + *it ); 100 QLibrary *lib = new QLibrary( path + "/" + *it );
65 if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) { 101 if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) {
66 TaskbarApplet applet; 102 TaskbarApplet *applet = new TaskbarApplet;
67 applet.library = lib; 103 applets[napplets++] = applet;
68 applet.iface = iface; 104 applet->library = lib;
69 applet.applet = applet.iface->applet( this ); 105 applet->iface = iface;
70 positionApplet( applet );
71 QString lang = getenv( "LANG" );
72 QTranslator * trans = new QTranslator(qApp);
73 QString type = (*it).left( (*it).find(".") );
74 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
75 qDebug("tr fpr sysapplet: %s", tfn.latin1() );
76 if ( trans->load( tfn ))
77 qApp->installTranslator( trans );
78 else
79 delete trans;
80 } else { 106 } else {
107 exclude += *it;
81 delete lib; 108 delete lib;
82 } 109 }
83 } 110 }
111 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
112 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions);
113 while (napplets--) {
114 TaskbarApplet *applet = applets[napplets];
115 applet->applet = applet->iface->applet( this );
116 appletList.append(*applet);
117 QString lang = getenv( "LANG" );
118 QTranslator * trans = new QTranslator(qApp);
119 QString type = (*it).left( (*it).find(".") );
120 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
121 if ( trans->load( tfn ))
122 qApp->installTranslator( trans );
123 else
124 delete trans;
125 }
126 delete applets;
84#else 127#else
85 layout = new QHBoxLayout( this );
86 TaskbarApplet applet; 128 TaskbarApplet applet;
87 applet.iface = new ClockAppletImpl(); 129 applet.iface = new ClockAppletImpl();
88 applet.applet = applet.iface->applet( this ); 130 applet.applet = applet.iface->applet( this );
89 positionApplet( applet ); 131 appletList.append( a );
90#endif 132#endif
133 show();
134
135 if ( !safety_tid )
136 safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman)
91} 137}
92 138
93void SysTray::positionApplet( const TaskbarApplet &a ) 139void SysTray::timerEvent(QTimerEvent* e)
94{ 140{
95 int p = 0; 141 if ( e->timerId() == safety_tid ) {
96 QValueList<TaskbarApplet>::Iterator it; 142 Config cfg( "Taskbar" );
97 for ( it = appletList.begin(); it != appletList.end(); ++it ) { 143 cfg.setGroup( "Applets" );
98 if ( (*it).iface->position() > a.iface->position() ) 144 cfg.writeEntry( "SafeMode", FALSE );
99 break; 145 killTimer(safety_tid);
100 p += 2; 146 safety_tid = 0;
101 } 147 }
102
103 appletList.insert( it, a );
104 layout->insertWidget( p, a.applet );
105 layout->insertSpacing( p, 1 );
106} 148}
107
diff --git a/core/launcher/systray.h b/core/launcher/systray.h
index 0aed348..5a6849a 100644
--- a/core/launcher/systray.h
+++ b/core/launcher/systray.h
@@ -1,58 +1,61 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the 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 __SYSTRAY_H__ 21#ifndef __SYSTRAY_H__
22#define __SYSTRAY_H__ 22#define __SYSTRAY_H__
23 23
24#include <qpe/taskbarappletinterface.h> 24#include <qpe/taskbarappletinterface.h>
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qvaluelist.h> 27#include <qvaluelist.h>
28 28
29class QHBoxLayout; 29class QHBoxLayout;
30class QLibrary; 30class QLibrary;
31 31
32struct TaskbarApplet 32struct TaskbarApplet
33{ 33{
34#ifndef QT_NO_COMPONENT 34#ifndef QT_NO_COMPONENT
35 QLibrary *library; 35 QLibrary *library;
36#endif 36#endif
37 TaskbarAppletInterface *iface; 37 TaskbarAppletInterface *iface;
38 QWidget *applet; 38 QWidget *applet;
39}; 39};
40 40
41class SysTray : public QFrame { 41class SysTray : public QFrame {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 SysTray( QWidget *parent ); 44 SysTray( QWidget *parent );
45 45
46 void loadApplets(); 46 void clearApplets();
47 void addApplets();
47 48
48private: 49protected:
49 void positionApplet( const TaskbarApplet &a ); 50 void timerEvent(QTimerEvent* e);
50 51
51private: 52private:
53 void loadApplets();
54 int safety_tid;
52 QHBoxLayout *layout; 55 QHBoxLayout *layout;
53 QValueList<TaskbarApplet> appletList; 56 QValueList<TaskbarApplet> appletList;
54}; 57};
55 58
56 59
57#endif // __SYSTRAY_H__ 60#endif // __SYSTRAY_H__
58 61
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 988d072..1feae4a 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,323 +1,323 @@
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 "mrulist.h"
24#include "runningappbar.h" 23#include "runningappbar.h"
25#include "systray.h" 24#include "systray.h"
26#include "calibrate.h" 25#include "calibrate.h"
27#include "wait.h" 26#include "wait.h"
28#include "appicons.h" 27#include "appicons.h"
29 28
30#include "taskbar.h" 29#include "taskbar.h"
31#include "desktop.h" 30#include "desktop.h"
32 31
33#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
34#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
35#include <qpe/global.h> 34#include <qpe/global.h>
36 35
37#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 36#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
38#include <qpe/custom.h> 37#include <qpe/custom.h>
39#endif 38#endif
40 39
41#include <opie/odevice.h> 40#include <opie/odevice.h>
42 41
43#include <qlabel.h> 42#include <qlabel.h>
44#include <qlayout.h> 43#include <qlayout.h>
45#include <qtimer.h> 44#include <qtimer.h>
46#include <qwindowsystem_qws.h> 45#include <qwindowsystem_qws.h>
47#include <qwidgetstack.h> 46#include <qwidgetstack.h>
48 47
49#if defined( Q_WS_QWS ) 48#if defined( Q_WS_QWS )
50#include <qwsdisplay_qws.h> 49#include <qwsdisplay_qws.h>
51#include <qgfx_qws.h> 50#include <qgfx_qws.h>
52#endif 51#endif
53 52
54 53
55#define FACTORY(T) \ 54#define FACTORY(T) \
56 static QWidget *new##T( bool maximized ) { \ 55 static QWidget *new##T( bool maximized ) { \
57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 56 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
58 if ( maximized ) { \ 57 if ( maximized ) { \
59 if ( qApp->desktop()->width() <= 350 ) { \ 58 if ( qApp->desktop()->width() <= 350 ) { \
60 w->showMaximized(); \ 59 w->showMaximized(); \
61 } else { \ 60 } else { \
62 w->resize( QSize( 300, 300 ) ); \ 61 w->resize( QSize( 300, 300 ) ); \
63 } \ 62 } \
64 } \ 63 } \
65 w->show(); \ 64 w->show(); \
66 return w; \ 65 return w; \
67 } 66 }
68 67
69 68
70#ifdef SINGLE_APP 69#ifdef SINGLE_APP
71#define APP(a,b,c,d) FACTORY(b) 70#define APP(a,b,c,d) FACTORY(b)
72#include "../launcher/apps.h" 71#include "../launcher/apps.h"
73#undef APP 72#undef APP
74#endif // SINGLE_APP 73#endif // SINGLE_APP
75 74
76static Global::Command builtins[] = { 75static Global::Command builtins[] = {
77 76
78#ifdef SINGLE_APP 77#ifdef SINGLE_APP
79#define APP(a,b,c,d) { a, new##b, c }, 78#define APP(a,b,c,d) { a, new##b, c },
80#include "../launcher/apps.h" 79#include "../launcher/apps.h"
81#undef APP 80#undef APP
82#endif 81#endif
83 82
84#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 83#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
85 { "calibrate", TaskBar::calibrate, 1, 0 }, 84 { "calibrate", TaskBar::calibrate, 1, 0 },
86#endif 85#endif
87#if !defined(QT_QWS_CASSIOPEIA) 86#if !defined(QT_QWS_CASSIOPEIA)
88 { "shutdown", Global::shutdown, 1, 0 }, 87 { "shutdown", Global::shutdown, 1, 0 },
89// { "run", run, 1, 0 }, 88// { "run", run, 1, 0 },
90#endif 89#endif
91 90
92 { 0, TaskBar::calibrate, 0, 0 }, 91 { 0, TaskBar::calibrate, 0, 0 },
93}; 92};
94 93
95static bool initNumLock() 94static bool initNumLock()
96{ 95{
97#ifdef QPE_INITIAL_NUMLOCK_STATE 96#ifdef QPE_INITIAL_NUMLOCK_STATE
98 QPE_INITIAL_NUMLOCK_STATE 97 QPE_INITIAL_NUMLOCK_STATE
99#endif 98#endif
100 return FALSE; 99 return FALSE;
101} 100}
102 101
103class LockKeyState : public QWidget 102class LockKeyState : public QWidget
104{ 103{
105public: 104public:
106 LockKeyState( QWidget *parent ) : 105 LockKeyState( QWidget *parent ) :
107 QWidget(parent), 106 QWidget(parent),
108 nl(initNumLock()), cl(FALSE) 107 nl(initNumLock()), cl(FALSE)
109 { 108 {
110 nl_pm = Resource::loadPixmap("numlock"); 109 nl_pm = Resource::loadPixmap("numlock");
111 cl_pm = Resource::loadPixmap("capslock"); 110 cl_pm = Resource::loadPixmap("capslock");
112 } 111 }
113 QSize sizeHint() const 112 QSize sizeHint() const
114 { 113 {
115 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 114 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
116 } 115 }
117 void toggleNumLockState() 116 void toggleNumLockState()
118 { 117 {
119 nl = !nl; repaint(); 118 nl = !nl; repaint();
120 } 119 }
121 void toggleCapsLockState() 120 void toggleCapsLockState()
122 { 121 {
123 cl = !cl; repaint(); 122 cl = !cl; repaint();
124 } 123 }
125 void paintEvent( QPaintEvent * ) 124 void paintEvent( QPaintEvent * )
126 { 125 {
127 int y = (height()-sizeHint().height())/2; 126 int y = (height()-sizeHint().height())/2;
128 QPainter p(this); 127 QPainter p(this);
129 if ( nl ) 128 if ( nl )
130 p.drawPixmap(1,y,nl_pm); 129 p.drawPixmap(1,y,nl_pm);
131 if ( cl ) 130 if ( cl )
132 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 131 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
133 } 132 }
134private: 133private:
135 QPixmap nl_pm, cl_pm; 134 QPixmap nl_pm, cl_pm;
136 bool nl, cl; 135 bool nl, cl;
137}; 136};
138 137
139TaskBar::~TaskBar() 138TaskBar::~TaskBar()
140{ 139{
141} 140}
142 141
143 142
144TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 143TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
145{ 144{
146 Global::setBuiltinCommands(builtins); 145 Global::setBuiltinCommands(builtins);
147 146
148 sm = new StartMenu( this ); 147 sm = new StartMenu( this );
149 148
150 inputMethods = new InputMethods( this ); 149 inputMethods = new InputMethods( this );
151 connect( inputMethods, SIGNAL(inputToggled(bool)), 150 connect( inputMethods, SIGNAL(inputToggled(bool)),
152 this, SLOT(calcMaxWindowRect()) ); 151 this, SLOT(calcMaxWindowRect()) );
153 //new QuickLauncher( this ); 152 //new QuickLauncher( this );
154 153
155 stack = new QWidgetStack( this ); 154 stack = new QWidgetStack( this );
156 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 155 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
157 label = new QLabel(stack); 156 label = new QLabel(stack);
158 157
159 //mru = new MRUList( stack ); 158 //mru = new MRUList( stack );
160 //stack->raiseWidget( mru ); 159 //stack->raiseWidget( mru );
161 160
162 runningAppBar = new RunningAppBar(stack); 161 runningAppBar = new RunningAppBar(stack);
163 stack->raiseWidget(runningAppBar); 162 stack->raiseWidget(runningAppBar);
164 163
165 waitIcon = new Wait( this ); 164 waitIcon = new Wait( this );
166 (void) new AppIcons( this ); 165 (void) new AppIcons( this );
167 166
168 sysTray = new SysTray( this ); 167 sysTray = new SysTray( this );
169 168
170 // ## make customizable in some way? 169 // ## make customizable in some way?
171#ifdef QT_QWS_CUSTOM 170#ifdef QT_QWS_CUSTOM
172 lockState = new LockKeyState( this ); 171 lockState = new LockKeyState( this );
173#else 172#else
174 lockState = 0; 173 lockState = 0;
175#endif 174#endif
176 175
177#if defined(Q_WS_QWS) 176#if defined(Q_WS_QWS)
178#if !defined(QT_NO_COP) 177#if !defined(QT_NO_COP)
179 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 178 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
180 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 179 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
181 this, SLOT(receive(const QCString&, const QByteArray&)) ); 180 this, SLOT(receive(const QCString&, const QByteArray&)) );
182#endif 181#endif
183#endif 182#endif
184 waitTimer = new QTimer( this ); 183 waitTimer = new QTimer( this );
185 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 184 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
186 clearer = new QTimer( this ); 185 clearer = new QTimer( this );
187 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 186 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
188 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 187 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
189} 188}
190 189
191void TaskBar::setStatusMessage( const QString &text ) 190void TaskBar::setStatusMessage( const QString &text )
192{ 191{
193 label->setText( text ); 192 label->setText( text );
194 stack->raiseWidget( label ); 193 stack->raiseWidget( label );
195 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 194 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
196 sysTray->hide(); 195 sysTray->hide();
197 clearer->start( 3000 ); 196 clearer->start( 3000 );
198} 197}
199 198
200void TaskBar::clearStatusBar() 199void TaskBar::clearStatusBar()
201{ 200{
202 label->clear(); 201 label->clear();
203 stack->raiseWidget(runningAppBar); 202 stack->raiseWidget(runningAppBar);
204 // stack->raiseWidget( mru ); 203 // stack->raiseWidget( mru );
205} 204}
206 205
207void TaskBar::startWait() 206void TaskBar::startWait()
208{ 207{
209 waitIcon->setWaiting( true ); 208 waitIcon->setWaiting( true );
210 // a catchall stop after 10 seconds... 209 // a catchall stop after 10 seconds...
211 waitTimer->start( 10 * 1000, true ); 210 waitTimer->start( 10 * 1000, true );
212} 211}
213 212
214void TaskBar::stopWait(const QString& app) 213void TaskBar::stopWait(const QString& app)
215{ 214{
216 waitTimer->stop(); 215 waitTimer->stop();
217 //mru->addTask(sm->execToLink(app)); 216 //mru->addTask(sm->execToLink(app));
218 waitIcon->setWaiting( false ); 217 waitIcon->setWaiting( false );
219} 218}
220 219
221void TaskBar::stopWait() 220void TaskBar::stopWait()
222{ 221{
223 waitTimer->stop(); 222 waitTimer->stop();
224 223
225 waitIcon->setWaiting( false ); 224 waitIcon->setWaiting( false );
226} 225}
227 226
228void TaskBar::resizeEvent( QResizeEvent *e ) 227void TaskBar::resizeEvent( QResizeEvent *e )
229{ 228{
230 QHBox::resizeEvent( e ); 229 QHBox::resizeEvent( e );
231 calcMaxWindowRect(); 230 calcMaxWindowRect();
232} 231}
233 232
234void TaskBar::styleChange( QStyle &s ) 233void TaskBar::styleChange( QStyle &s )
235{ 234{
236 QHBox::styleChange( s ); 235 QHBox::styleChange( s );
237 calcMaxWindowRect(); 236 calcMaxWindowRect();
238} 237}
239 238
240void TaskBar::calcMaxWindowRect() 239void TaskBar::calcMaxWindowRect()
241{ 240{
242#ifdef Q_WS_QWS 241#ifdef Q_WS_QWS
243 QRect wr; 242 QRect wr;
244 int displayWidth = qApp->desktop()->width(); 243 int displayWidth = qApp->desktop()->width();
245 QRect ir = inputMethods->inputRect(); 244 QRect ir = inputMethods->inputRect();
246 if ( ir.isValid() ) { 245 if ( ir.isValid() ) {
247 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 246 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
248 } else { 247 } else {
249 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 248 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
250 } 249 }
251 250
252#if QT_VERSION < 300 251#if QT_VERSION < 300
253 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 252 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
254 QSize(qt_screen->width(),qt_screen->height())) 253 QSize(qt_screen->width(),qt_screen->height()))
255 ); 254 );
256#else 255#else
257 QWSServer::setMaxWindowRect( wr ); 256 QWSServer::setMaxWindowRect( wr );
258#endif 257#endif
259#endif 258#endif
260} 259}
261 260
262void TaskBar::receive( const QCString &msg, const QByteArray &data ) 261void TaskBar::receive( const QCString &msg, const QByteArray &data )
263{ 262{
264 QDataStream stream( data, IO_ReadOnly ); 263 QDataStream stream( data, IO_ReadOnly );
265 if ( msg == "message(QString)" ) { 264 if ( msg == "message(QString)" ) {
266 QString text; 265 QString text;
267 stream >> text; 266 stream >> text;
268 setStatusMessage( text ); 267 setStatusMessage( text );
269 } else if ( msg == "hideInputMethod()" ) { 268 } else if ( msg == "hideInputMethod()" ) {
270 inputMethods->hideInputMethod(); 269 inputMethods->hideInputMethod();
271 } else if ( msg == "showInputMethod()" ) { 270 } else if ( msg == "showInputMethod()" ) {
272 inputMethods->showInputMethod(); 271 inputMethods->showInputMethod();
273 } else if ( msg == "reloadInputMethods()" ) { 272 } else if ( msg == "reloadInputMethods()" ) {
274 inputMethods->loadInputMethods(); 273 inputMethods->loadInputMethods();
275 } else if ( msg == "reloadApplets()" ) { 274 } else if ( msg == "reloadApplets()" ) {
276 sysTray->loadApplets(); 275 sysTray->clearApplets();
276 sysTray->addApplets();
277 } else if ( msg == "soundAlarm()" ) { 277 } else if ( msg == "soundAlarm()" ) {
278 Desktop::soundAlarm(); 278 Desktop::soundAlarm();
279 } 279 }
280 else if ( msg == "setLed(int,bool)" ) { 280 else if ( msg == "setLed(int,bool)" ) {
281 int led, status; 281 int led, status;
282 stream >> led >> status; 282 stream >> led >> status;
283 283
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off );
285 } 285 }
286} 286}
287 287
288QWidget *TaskBar::calibrate(bool) 288QWidget *TaskBar::calibrate(bool)
289{ 289{
290#ifdef Q_WS_QWS 290#ifdef Q_WS_QWS
291 Calibrate *c = new Calibrate; 291 Calibrate *c = new Calibrate;
292 c->show(); 292 c->show();
293 return c; 293 return c;
294#else 294#else
295 return 0; 295 return 0;
296#endif 296#endif
297} 297}
298 298
299void TaskBar::toggleNumLockState() 299void TaskBar::toggleNumLockState()
300{ 300{
301 if ( lockState ) lockState->toggleNumLockState(); 301 if ( lockState ) lockState->toggleNumLockState();
302} 302}
303 303
304void TaskBar::toggleCapsLockState() 304void TaskBar::toggleCapsLockState()
305{ 305{
306 if ( lockState ) lockState->toggleCapsLockState(); 306 if ( lockState ) lockState->toggleCapsLockState();
307} 307}
308 308
309void TaskBar::toggleSymbolInput() 309void TaskBar::toggleSymbolInput()
310{ 310{
311 if ( inputMethods->currentShown() == "Unicode" ) { 311 if ( inputMethods->currentShown() == "Unicode" ) {
312 inputMethods->hideInputMethod(); 312 inputMethods->hideInputMethod();
313 } else { 313 } else {
314 inputMethods->showInputMethod("Unicode"); 314 inputMethods->showInputMethod("Unicode");
315 } 315 }
316} 316}
317 317
318bool TaskBar::recoverMemory() 318bool TaskBar::recoverMemory()
319{ 319{
320 //eturn mru->quitOldApps(); 320 //eturn mru->quitOldApps();
321 return true; 321 return true;
322} 322}
323 323