summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-04-19 22:07:06 (UTC)
committer kergoth <kergoth>2003-04-19 22:07:06 (UTC)
commit29c556ffc9b1497cd996ceb46d646b1eaf1288be (patch) (unidiff)
treeb89c424de93f541bc80908c93172eb4e601e8c02
parentc502394063598e63591e06072802f1c5a9e0c266 (diff)
downloadopie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.zip
opie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.tar.gz
opie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.tar.bz2
Split calibrate out as a standalone application, and ensure taskbar depends
on it. This makes ts debugging easier, having a seperate calibration tool around, and as a side affect fixes calibration on the C700, which previously required a reboot to take effect.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/calibrate/main.cpp20
-rw-r--r--core/apps/calibrate/opie-calibrate.control8
-rw-r--r--core/launcher/desktop.cpp2
-rw-r--r--core/launcher/launcher.pro4
-rw-r--r--core/launcher/main.cpp15
-rw-r--r--core/launcher/opie-taskbar.control4
-rw-r--r--core/launcher/taskbar.cpp17
-rw-r--r--core/launcher/taskbar.h2
8 files changed, 32 insertions, 40 deletions
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp
index d1ad083..1c295eb 100644
--- a/core/apps/calibrate/main.cpp
+++ b/core/apps/calibrate/main.cpp
@@ -1,42 +1,46 @@
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 "calibrate.h" 21#include "calibrate.h"
22 22
23#include <qfile.h> 23#include <qfile.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26#ifdef QWS
27#include <qwindowsystem_qws.h>
28#endif
29
26int main( int argc, char ** argv ) 30int main( int argc, char ** argv )
27{ 31{
28 QPEApplication a( argc, argv ); 32 QPEApplication a( argc, argv );
29 int retval = 0; 33 int retval = 0;
30 34
31#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 35#ifdef QWS
32 if ( !QFile::exists( "/etc/pointercal" ) ) { 36 if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
37#endif
33 // Make sure calibration widget starts on top. 38 // Make sure calibration widget starts on top.
34 Calibrate *cal = new Calibrate; 39 Calibrate cal;
35 a.setMainWidget(cal); 40 a.setMainWidget(&cal);
36 a.showMainWidget(cal); 41 a.showMainWidget(&cal);
37 retval = a.exec(); 42 return a.exec();
38 delete cal; 43#ifdef QWS
39 } 44 }
40#endif 45#endif
41 return retval;
42} 46}
diff --git a/core/apps/calibrate/opie-calibrate.control b/core/apps/calibrate/opie-calibrate.control
new file mode 100644
index 0000000..6eafb94
--- a/dev/null
+++ b/core/apps/calibrate/opie-calibrate.control
@@ -0,0 +1,8 @@
1Files: bin/calibrate apps/Settings/Calibrate.desktop
2Priority: required
3Section: opie/system
4Maintainer: Project Opie <opie@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.3
7Depends: libqpe1, libqt2-emb
8Description: Opie calibration tool
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 6def126..ef0bf4c 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -1,878 +1,876 @@
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 <syslog.h> 21#include <syslog.h>
22 22
23#include "desktop.h" 23#include "desktop.h"
24#include "info.h" 24#include "info.h"
25#include "launcher.h" 25#include "launcher.h"
26#include "qcopbridge.h" 26#include "qcopbridge.h"
27#include "shutdownimpl.h" 27#include "shutdownimpl.h"
28#include "startmenu.h" 28#include "startmenu.h"
29#include "taskbar.h" 29#include "taskbar.h"
30#include "transferserver.h" 30#include "transferserver.h"
31#include "irserver.h" 31#include "irserver.h"
32#include "packageslave.h" 32#include "packageslave.h"
33#include "screensaver.h" 33#include "screensaver.h"
34 34
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/mimetype.h> 36#include <qpe/mimetype.h>
37#include <qpe/password.h> 37#include <qpe/password.h>
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qpe/power.h> 39#include <qpe/power.h>
40#include <qpe/timeconversion.h> 40#include <qpe/timeconversion.h>
41#include <qpe/qcopenvelope_qws.h> 41#include <qpe/qcopenvelope_qws.h>
42#include <qpe/network.h> 42#include <qpe/network.h>
43#include <qpe/global.h> 43#include <qpe/global.h>
44 44
45#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) 45#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ )
46#include <qpe/custom.h> 46#include <qpe/custom.h>
47#endif 47#endif
48 48
49#include <opie/odevice.h> 49#include <opie/odevice.h>
50 50
51#include <qgfx_qws.h> 51#include <qgfx_qws.h>
52#include <qmainwindow.h> 52#include <qmainwindow.h>
53#include <qmessagebox.h> 53#include <qmessagebox.h>
54#include <qtimer.h> 54#include <qtimer.h>
55#include <qwindowsystem_qws.h> 55#include <qwindowsystem_qws.h>
56 56
57#include <qvaluelist.h> 57#include <qvaluelist.h>
58 58
59#include <stdlib.h> 59#include <stdlib.h>
60#include <unistd.h> 60#include <unistd.h>
61#include <fcntl.h> 61#include <fcntl.h>
62 62
63 63
64using namespace Opie; 64using namespace Opie;
65 65
66class QCopKeyRegister 66class QCopKeyRegister
67{ 67{
68public: 68public:
69 QCopKeyRegister() : keyCode( 0 ) 69 QCopKeyRegister() : keyCode( 0 )
70 { } 70 { }
71 QCopKeyRegister( int k, const QCString &c, const QCString &m ) 71 QCopKeyRegister( int k, const QCString &c, const QCString &m )
72 : keyCode( k ), channel( c ), message( m ) 72 : keyCode( k ), channel( c ), message( m )
73 { } 73 { }
74 74
75 int getKeyCode() const 75 int getKeyCode() const
76 { 76 {
77 return keyCode; 77 return keyCode;
78 } 78 }
79 QCString getChannel() const 79 QCString getChannel() const
80 { 80 {
81 return channel; 81 return channel;
82 } 82 }
83 QCString getMessage() const 83 QCString getMessage() const
84 { 84 {
85 return message; 85 return message;
86 } 86 }
87 87
88private: 88private:
89 int keyCode; 89 int keyCode;
90 QCString channel, message; 90 QCString channel, message;
91}; 91};
92 92
93typedef QValueList<QCopKeyRegister> KeyRegisterList; 93typedef QValueList<QCopKeyRegister> KeyRegisterList;
94KeyRegisterList keyRegisterList; 94KeyRegisterList keyRegisterList;
95 95
96static Desktop* qpedesktop = 0; 96static Desktop* qpedesktop = 0;
97static int loggedin = 0; 97static int loggedin = 0;
98static void login( bool at_poweron ) 98static void login( bool at_poweron )
99{ 99{
100 if ( !loggedin ) { 100 if ( !loggedin ) {
101 Global::terminateBuiltin( "calibrate" );
102 Password::authenticate( at_poweron ); 101 Password::authenticate( at_poweron );
103 loggedin = 1; 102 loggedin = 1;
104 QCopEnvelope e( "QPE/Desktop", "unlocked()" ); 103 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
105 } 104 }
106} 105}
107 106
108bool Desktop::screenLocked() 107bool Desktop::screenLocked()
109{ 108{
110 return loggedin == 0; 109 return loggedin == 0;
111} 110}
112 111
113/* 112/*
114 Priority is number of alerts that are needed to pop up 113 Priority is number of alerts that are needed to pop up
115 alert. 114 alert.
116 */ 115 */
117class DesktopPowerAlerter : public QMessageBox 116class DesktopPowerAlerter : public QMessageBox
118{ 117{
119public: 118public:
120 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 119 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
121 : QMessageBox( tr( "Battery Status" ), "Low Battery", 120 : QMessageBox( tr( "Battery Status" ), "Low Battery",
122 QMessageBox::Critical, 121 QMessageBox::Critical,
123 QMessageBox::Ok | QMessageBox::Default, 122 QMessageBox::Ok | QMessageBox::Default,
124 QMessageBox::NoButton, QMessageBox::NoButton, 123 QMessageBox::NoButton, QMessageBox::NoButton,
125 parent, name, FALSE ) 124 parent, name, FALSE )
126 { 125 {
127 currentPriority = INT_MAX; 126 currentPriority = INT_MAX;
128 alertCount = 0; 127 alertCount = 0;
129 } 128 }
130 129
131 void alert( const QString &text, int priority ); 130 void alert( const QString &text, int priority );
132 void hideEvent( QHideEvent * ); 131 void hideEvent( QHideEvent * );
133private: 132private:
134 int currentPriority; 133 int currentPriority;
135 int alertCount; 134 int alertCount;
136}; 135};
137 136
138void DesktopPowerAlerter::alert( const QString &text, int priority ) 137void DesktopPowerAlerter::alert( const QString &text, int priority )
139{ 138{
140 alertCount++; 139 alertCount++;
141 if ( alertCount < priority ) 140 if ( alertCount < priority )
142 return ; 141 return ;
143 if ( priority > currentPriority ) 142 if ( priority > currentPriority )
144 return ; 143 return ;
145 currentPriority = priority; 144 currentPriority = priority;
146 setText( text ); 145 setText( text );
147 show(); 146 show();
148} 147}
149 148
150 149
151void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 150void DesktopPowerAlerter::hideEvent( QHideEvent *e )
152{ 151{
153 QMessageBox::hideEvent( e ); 152 QMessageBox::hideEvent( e );
154 alertCount = 0; 153 alertCount = 0;
155 currentPriority = INT_MAX; 154 currentPriority = INT_MAX;
156} 155}
157 156
158 157
159void DesktopApplication::switchLCD ( bool on ) 158void DesktopApplication::switchLCD ( bool on )
160{ 159{
161 if ( qApp ) { 160 if ( qApp ) {
162 DesktopApplication *dapp = (DesktopApplication *) qApp; 161 DesktopApplication *dapp = (DesktopApplication *) qApp;
163 162
164 if ( dapp-> m_screensaver ) { 163 if ( dapp-> m_screensaver ) {
165 if ( on ) { 164 if ( on ) {
166 dapp-> m_screensaver-> setDisplayState ( true ); 165 dapp-> m_screensaver-> setDisplayState ( true );
167 dapp-> m_screensaver-> setBacklight ( -3 ); 166 dapp-> m_screensaver-> setBacklight ( -3 );
168 } 167 }
169 else { 168 else {
170 dapp-> m_screensaver-> setDisplayState ( false ); 169 dapp-> m_screensaver-> setDisplayState ( false );
171 } 170 }
172 } 171 }
173 } 172 }
174} 173}
175 174
176 175
177DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 176DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
178 : QPEApplication( argc, argv, appType ) 177 : QPEApplication( argc, argv, appType )
179{ 178{
180 m_ps = new PowerStatus; 179 m_ps = new PowerStatus;
181 m_ps_last = new PowerStatus; 180 m_ps_last = new PowerStatus;
182 pa = new DesktopPowerAlerter( 0 ); 181 pa = new DesktopPowerAlerter( 0 );
183 182
184 m_apm_timer = new QTimer ( this ); 183 m_apm_timer = new QTimer ( this );
185 connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( ))); 184 connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( )));
186 reloadPowerWarnSettings ( ); 185 reloadPowerWarnSettings ( );
187 186
188 m_last_button = 0; 187 m_last_button = 0;
189 m_button_timer = new QTimer ( ); 188 m_button_timer = new QTimer ( );
190 connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); 189 connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( )));
191 190
192 channel = new QCopChannel( "QPE/System", this ); 191 channel = new QCopChannel( "QPE/System", this );
193 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), 192 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
194 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); 193 this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) );
195 194
196 channel = new QCopChannel( "QPE/Launcher", this ); 195 channel = new QCopChannel( "QPE/Launcher", this );
197 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), 196 connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
198 this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) ); 197 this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) );
199 198
200 m_screensaver = new OpieScreenSaver ( ); 199 m_screensaver = new OpieScreenSaver ( );
201 m_screensaver-> setInterval ( -1 ); 200 m_screensaver-> setInterval ( -1 );
202 QWSServer::setScreenSaver( m_screensaver ); 201 QWSServer::setScreenSaver( m_screensaver );
203 202
204 rereadVolumes(); 203 rereadVolumes();
205 connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); 204 connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) );
206 205
207 apmTimeout ( ); 206 apmTimeout ( );
208 207
209 grabKeyboard ( ); 208 grabKeyboard ( );
210} 209}
211 210
212 211
213DesktopApplication::~DesktopApplication() 212DesktopApplication::~DesktopApplication()
214{ 213{
215 ungrabKeyboard ( ); 214 ungrabKeyboard ( );
216 215
217 delete m_ps; 216 delete m_ps;
218 delete m_ps_last; 217 delete m_ps_last;
219 delete pa; 218 delete pa;
220} 219}
221 220
222void DesktopApplication::apmTimeout() 221void DesktopApplication::apmTimeout()
223{ 222{
224 qpedesktop-> checkMemory ( ); // in case no events are being generated 223 qpedesktop-> checkMemory ( ); // in case no events are being generated
225 224
226 *m_ps_last = *m_ps; 225 *m_ps_last = *m_ps;
227 *m_ps = PowerStatusManager::readStatus(); 226 *m_ps = PowerStatusManager::readStatus();
228 227
229 if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( )) 228 if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( ))
230 m_screensaver-> powerStatusChanged ( *m_ps ); 229 m_screensaver-> powerStatusChanged ( *m_ps );
231 230
232 if ( m_ps-> acStatus ( ) != PowerStatus::Online ) { 231 if ( m_ps-> acStatus ( ) != PowerStatus::Online ) {
233 int bat = m_ps-> batteryPercentRemaining ( ); 232 int bat = m_ps-> batteryPercentRemaining ( );
234 233
235 if ( bat < m_ps_last-> batteryPercentRemaining ( )) { 234 if ( bat < m_ps_last-> batteryPercentRemaining ( )) {
236 if ( bat <= m_powerCritical ) 235 if ( bat <= m_powerCritical )
237 pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); 236 pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 );
238 else if ( bat <= m_powerVeryLow ) 237 else if ( bat <= m_powerVeryLow )
239 pa->alert( tr( "Battery is running very low." ), 2 ); 238 pa->alert( tr( "Battery is running very low." ), 2 );
240 } 239 }
241 if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow ) 240 if ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow )
242 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 ); 241 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 );
243 } 242 }
244} 243}
245 244
246 245
247void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) 246void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data )
248{ 247{
249 QDataStream stream ( data, IO_ReadOnly ); 248 QDataStream stream ( data, IO_ReadOnly );
250 249
251 if ( msg == "setScreenSaverInterval(int)" ) { 250 if ( msg == "setScreenSaverInterval(int)" ) {
252 int time; 251 int time;
253 stream >> time; 252 stream >> time;
254 m_screensaver-> setInterval( time ); 253 m_screensaver-> setInterval( time );
255 } 254 }
256 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { 255 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) {
257 int t1, t2, t3; 256 int t1, t2, t3;
258 stream >> t1 >> t2 >> t3; 257 stream >> t1 >> t2 >> t3;
259 m_screensaver-> setIntervals( t1, t2, t3 ); 258 m_screensaver-> setIntervals( t1, t2, t3 );
260 } 259 }
261 else if ( msg == "setBacklight(int)" ) { 260 else if ( msg == "setBacklight(int)" ) {
262 int bright; 261 int bright;
263 stream >> bright; 262 stream >> bright;
264 m_screensaver-> setBacklight( bright ); 263 m_screensaver-> setBacklight( bright );
265 } 264 }
266 else if ( msg == "setScreenSaverMode(int)" ) { 265 else if ( msg == "setScreenSaverMode(int)" ) {
267 int mode; 266 int mode;
268 stream >> mode; 267 stream >> mode;
269 m_screensaver-> setMode ( mode ); 268 m_screensaver-> setMode ( mode );
270 } 269 }
271 else if ( msg == "reloadPowerWarnSettings()" ) { 270 else if ( msg == "reloadPowerWarnSettings()" ) {
272 reloadPowerWarnSettings(); 271 reloadPowerWarnSettings();
273 } 272 }
274 else if ( msg == "setDisplayState(int)" ) { 273 else if ( msg == "setDisplayState(int)" ) {
275 int state; 274 int state;
276 stream >> state; 275 stream >> state;
277 m_screensaver-> setDisplayState ( state != 0 ); 276 m_screensaver-> setDisplayState ( state != 0 );
278 } 277 }
279 else if ( msg == "suspend()" ) { 278 else if ( msg == "suspend()" ) {
280 emit power(); 279 emit power();
281 } 280 }
282 else if ( msg == "sendBusinessCard()" ) { 281 else if ( msg == "sendBusinessCard()" ) {
283 QString card = ::getenv ( "HOME" ); 282 QString card = ::getenv ( "HOME" );
284 card += "/Applications/addressbook/businesscard.vcf"; 283 card += "/Applications/addressbook/businesscard.vcf";
285 284
286 if ( QFile::exists( card ) ) { 285 if ( QFile::exists( card ) ) {
287 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); 286 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" );
288 QString mimetype = "text/x-vCard"; 287 QString mimetype = "text/x-vCard";
289 e << tr( "business card" ) << card << mimetype; 288 e << tr( "business card" ) << card << mimetype;
290 } 289 }
291 } 290 }
292} 291}
293 292
294void DesktopApplication::reloadPowerWarnSettings ( ) 293void DesktopApplication::reloadPowerWarnSettings ( )
295{ 294{
296 Config cfg ( "apm" ); 295 Config cfg ( "apm" );
297 cfg. setGroup ( "Warnings" ); 296 cfg. setGroup ( "Warnings" );
298 297
299 int iv = cfg. readNumEntry ( "checkinterval", 10000 ); 298 int iv = cfg. readNumEntry ( "checkinterval", 10000 );
300 299
301 m_apm_timer-> stop ( ); 300 m_apm_timer-> stop ( );
302 if ( iv ) 301 if ( iv )
303 m_apm_timer-> start ( iv ); 302 m_apm_timer-> start ( iv );
304 303
305 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); 304 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 );
306 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); 305 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 );
307} 306}
308 307
309 308
310enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; 309enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown;
311 310
312 311
313void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) 312void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data )
314{ 313{
315 QDataStream stream ( data, IO_ReadOnly ); 314 QDataStream stream ( data, IO_ReadOnly );
316 315
317 if ( msg == "deviceButton(int,int,int)" ) { 316 if ( msg == "deviceButton(int,int,int)" ) {
318 int keycode, press, autoRepeat; 317 int keycode, press, autoRepeat;
319 stream >> keycode >> press >> autoRepeat; 318 stream >> keycode >> press >> autoRepeat;
320 319
321 const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); 320 const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode );
322 321
323 if ( db ) 322 if ( db )
324 checkButtonAction ( db, keycode, press, autoRepeat ); 323 checkButtonAction ( db, keycode, press, autoRepeat );
325 } 324 }
326 else if ( msg == "keyRegister(int,QCString,QCString)" ) { 325 else if ( msg == "keyRegister(int,QCString,QCString)" ) {
327 int k; 326 int k;
328 QCString c, m; 327 QCString c, m;
329 stream >> k >> c >> m; 328 stream >> k >> c >> m;
330 329
331 keyRegisterList.append ( QCopKeyRegister ( k, c, m )); 330 keyRegisterList.append ( QCopKeyRegister ( k, c, m ));
332 } 331 }
333} 332}
334 333
335void DesktopApplication::sendHeldAction ( ) 334void DesktopApplication::sendHeldAction ( )
336{ 335{
337 if ( m_last_button ) { 336 if ( m_last_button ) {
338 m_last_button-> heldAction ( ). send ( ); 337 m_last_button-> heldAction ( ). send ( );
339 m_last_button = 0; 338 m_last_button = 0;
340 } 339 }
341} 340}
342 341
343 342
344 343
345bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) 344bool DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat )
346 { 345 {
347 if ( db ) { 346 if ( db ) {
348 if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { 347 if ( !press && !autoRepeat && m_button_timer-> isActive ( )) {
349 m_button_timer-> stop ( ); 348 m_button_timer-> stop ( );
350 349
351 if (!db-> pressedAction ( ). channel ( ) .isEmpty()) 350 if (!db-> pressedAction ( ). channel ( ) .isEmpty())
352 { 351 {
353 352
354 if ( db-> pressedAction ( ). channel ( )!="ignore") { 353 if ( db-> pressedAction ( ). channel ( )!="ignore") {
355 354
356 db-> pressedAction ( ). send ( ); 355 db-> pressedAction ( ). send ( );
357 } 356 }
358 else 357 else
359 return false; 358 return false;
360 } 359 }
361 } 360 }
362 else if ( press && !autoRepeat ) { 361 else if ( press && !autoRepeat ) {
363 m_button_timer-> stop ( ); 362 m_button_timer-> stop ( );
364 if (!db-> pressedAction ( ). channel ( ) .isEmpty()) 363 if (!db-> pressedAction ( ). channel ( ) .isEmpty())
365 { 364 {
366 365
367 if ( db-> heldAction ( ). channel ( )!="ignore") { 366 if ( db-> heldAction ( ). channel ( )!="ignore") {
368 m_last_button = db; 367 m_last_button = db;
369 m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); 368 m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
370 } 369 }
371 else return false; 370 else return false;
372 } 371 }
373 } 372 }
374 } 373 }
375 return true; 374 return true;
376} 375}
377 376
378bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) 377bool DesktopApplication::eventFilter ( QObject *o, QEvent *e )
379{ 378{
380 379
381 if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { 380 if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) {
382 QKeyEvent *ke = (QKeyEvent *) e; 381 QKeyEvent *ke = (QKeyEvent *) e;
383 382
384 const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( )); 383 const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( ke-> key ( ));
385 384
386 if ( db ) { 385 if ( db ) {
387 if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( ))) 386 if (checkButtonAction ( db, ke-> key ( ), e-> type ( ) == QEvent::KeyPress, ke-> isAutoRepeat ( )))
388 return true; //checkButtonAction retrune false if events should be routed through 387 return true; //checkButtonAction retrune false if events should be routed through
389 } 388 }
390 } 389 }
391 return QPEApplication::eventFilter ( o, e ); 390 return QPEApplication::eventFilter ( o, e );
392} 391}
393 392
394#ifdef Q_WS_QWS 393#ifdef Q_WS_QWS
395 394
396bool DesktopApplication::qwsEventFilter( QWSEvent *e ) 395bool DesktopApplication::qwsEventFilter( QWSEvent *e )
397{ 396{
398 qpedesktop->checkMemory(); 397 qpedesktop->checkMemory();
399 398
400 if ( e->type == QWSEvent::Key ) { 399 if ( e->type == QWSEvent::Key ) {
401 QWSKeyEvent * ke = (QWSKeyEvent *) e; 400 QWSKeyEvent * ke = (QWSKeyEvent *) e;
402 ushort keycode = ke-> simpleData. keycode; 401 ushort keycode = ke-> simpleData. keycode;
403 402
404 if ( !loggedin && keycode != Key_F34 ) 403 if ( !loggedin && keycode != Key_F34 )
405 return true; 404 return true;
406 405
407 bool press = ke-> simpleData. is_press; 406 bool press = ke-> simpleData. is_press;
408 bool autoRepeat = ke-> simpleData. is_auto_repeat; 407 bool autoRepeat = ke-> simpleData. is_auto_repeat;
409 408
410 if ( !keyboardGrabbed ( )) { 409 if ( !keyboardGrabbed ( )) {
411 // app that registers key/message to be sent back to the app, when it doesn't have focus, 410 // app that registers key/message to be sent back to the app, when it doesn't have focus,
412 // when user presses key, unless keyboard has been requested from app. 411 // when user presses key, unless keyboard has been requested from app.
413 // will not send multiple repeats if user holds key 412 // will not send multiple repeats if user holds key
414 // i.e. one shot 413 // i.e. one shot
415 414
416 if ( keycode != 0 && press && !autoRepeat ) { 415 if ( keycode != 0 && press && !autoRepeat ) {
417 for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { 416 for ( KeyRegisterList::Iterator it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) {
418 if (( *it ). getKeyCode ( ) == keycode ) { 417 if (( *it ). getKeyCode ( ) == keycode ) {
419 QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( )); 418 QCopEnvelope (( *it ). getChannel ( ), ( *it ). getMessage ( ));
420 return true; 419 return true;
421 } 420 }
422 } 421 }
423 } 422 }
424 } 423 }
425 424
426 if ( keycode == HardKey_Suspend ) { 425 if ( keycode == HardKey_Suspend ) {
427 if ( press ) 426 if ( press )
428 emit power ( ); 427 emit power ( );
429 return true; 428 return true;
430 } 429 }
431 else if ( keycode == HardKey_Backlight ) { 430 else if ( keycode == HardKey_Backlight ) {
432 if ( press ) 431 if ( press )
433 emit backlight ( ); 432 emit backlight ( );
434 return true; 433 return true;
435 } 434 }
436 else if ( keycode == Key_F32 ) { 435 else if ( keycode == Key_F32 ) {
437 if ( press ) 436 if ( press )
438 QCopEnvelope e( "QPE/Desktop", "startSync()" ); 437 QCopEnvelope e( "QPE/Desktop", "startSync()" );
439 return true; 438 return true;
440 } 439 }
441 else if ( keycode == Key_F31 && !ke-> simpleData. modifiers ) { // Symbol Key -> show Unicode IM 440 else if ( keycode == Key_F31 && !ke-> simpleData. modifiers ) { // Symbol Key -> show Unicode IM
442 if ( press ) 441 if ( press )
443 emit symbol ( ); 442 emit symbol ( );
444 return true; 443 return true;
445 } 444 }
446 else if ( keycode == Key_NumLock ) { 445 else if ( keycode == Key_NumLock ) {
447 if ( press ) 446 if ( press )
448 emit numLockStateToggle ( ); 447 emit numLockStateToggle ( );
449 } 448 }
450 else if ( keycode == Key_CapsLock ) { 449 else if ( keycode == Key_CapsLock ) {
451 if ( press ) 450 if ( press )
452 emit capsLockStateToggle(); 451 emit capsLockStateToggle();
453 } 452 }
454 if (( press && !autoRepeat ) || ( !press && autoRepeat )) { 453 if (( press && !autoRepeat ) || ( !press && autoRepeat )) {
455 if ( m_keyclick_sound ) 454 if ( m_keyclick_sound )
456 ODevice::inst ( )-> keySound ( ); 455 ODevice::inst ( )-> keySound ( );
457 } 456 }
458 } 457 }
459 else if ( e-> type == QWSEvent::Mouse ) { 458 else if ( e-> type == QWSEvent::Mouse ) {
460 QWSMouseEvent * me = ( QWSMouseEvent * ) e; 459 QWSMouseEvent * me = ( QWSMouseEvent * ) e;
461 static bool up = true; 460 static bool up = true;
462 461
463 if ( me-> simpleData. state & LeftButton ) { 462 if ( me-> simpleData. state & LeftButton ) {
464 if ( up ) { 463 if ( up ) {
465 up = false; 464 up = false;
466 if ( m_screentap_sound ) 465 if ( m_screentap_sound )
467 ODevice::inst ( ) -> touchSound ( ); 466 ODevice::inst ( ) -> touchSound ( );
468 } 467 }
469 } 468 }
470 else { 469 else {
471 up = true; 470 up = true;
472 } 471 }
473 } 472 }
474 473
475 return QPEApplication::qwsEventFilter ( e ); 474 return QPEApplication::qwsEventFilter ( e );
476} 475}
477#endif 476#endif
478 477
479 478
480 479
481#if defined(QPE_HAVE_MEMALERTER) 480#if defined(QPE_HAVE_MEMALERTER)
482QPE_MEMALERTER_IMPL 481QPE_MEMALERTER_IMPL
483#endif 482#endif
484 483
485//=========================================================================== 484//===========================================================================
486 485
487Desktop::Desktop() : 486Desktop::Desktop() :
488 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 487 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
489 qcopBridge( 0 ), 488 qcopBridge( 0 ),
490 transferServer( 0 ), 489 transferServer( 0 ),
491 packageSlave( 0 ) 490 packageSlave( 0 )
492{ 491{
493 qpedesktop = this; 492 qpedesktop = this;
494 493
495 // bg = new Info( this ); 494 // bg = new Info( this );
496 tb = new TaskBar; 495 tb = new TaskBar;
497 496
498 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); 497 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader );
499 498
500 connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) ); 499 connect( launcher, SIGNAL( busy() ), tb, SLOT( startWait() ) );
501 connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) ); 500 connect( launcher, SIGNAL( notBusy( const QString& ) ), tb, SLOT( stopWait( const QString& ) ) );
502 501
503 int displayw = qApp->desktop() ->width(); 502 int displayw = qApp->desktop() ->width();
504 int displayh = qApp->desktop() ->height(); 503 int displayh = qApp->desktop() ->height();
505 504
506 505
507 QSize sz = tb->sizeHint(); 506 QSize sz = tb->sizeHint();
508 507
509 setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); 508 setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
510 layout(); 509 layout();
511 510
512 tb->show(); 511 tb->show();
513 launcher->showMaximized(); 512 launcher->showMaximized();
514 launcher->show(); 513 launcher->show();
515 launcher->raise(); 514 launcher->raise();
516#if defined(QPE_HAVE_MEMALERTER) 515#if defined(QPE_HAVE_MEMALERTER)
517 516
518 initMemalerter(); 517 initMemalerter();
519#endif 518#endif
520 // start services 519 // start services
521 startTransferServer(); 520 startTransferServer();
522 ( void ) new IrServer( this ); 521 ( void ) new IrServer( this );
523 522
524 packageSlave = new PackageSlave( this ); 523 packageSlave = new PackageSlave( this );
525 524
526 qApp->installEventFilter( this ); 525 qApp->installEventFilter( this );
527 qApp->desktop()->installEventFilter( this ); 526 qApp->desktop()->installEventFilter( this );
528 527
529 qApp-> setMainWidget ( launcher ); 528 qApp-> setMainWidget ( launcher );
530} 529}
531 530
532void Desktop::show() 531void Desktop::show()
533{ 532{
534 login( TRUE ); 533 login( TRUE );
535 QWidget::show(); 534 QWidget::show();
536} 535}
537 536
538Desktop::~Desktop() 537Desktop::~Desktop()
539{ 538{
540 delete launcher; 539 delete launcher;
541 delete tb; 540 delete tb;
542 delete qcopBridge; 541 delete qcopBridge;
543 delete transferServer; 542 delete transferServer;
544} 543}
545 544
546bool Desktop::recoverMemory() 545bool Desktop::recoverMemory()
547{ 546{
548 return tb->recoverMemory(); 547 return tb->recoverMemory();
549} 548}
550 549
551void Desktop::checkMemory() 550void Desktop::checkMemory()
552{ 551{
553#if defined(QPE_HAVE_MEMALERTER) 552#if defined(QPE_HAVE_MEMALERTER)
554 static bool ignoreNormal = FALSE; 553 static bool ignoreNormal = FALSE;
555 static bool existingMessage = FALSE; 554 static bool existingMessage = FALSE;
556 555
557 if ( existingMessage ) 556 if ( existingMessage )
558 return ; // don't show a second message while still on first 557 return ; // don't show a second message while still on first
559 558
560 existingMessage = TRUE; 559 existingMessage = TRUE;
561 switch ( memstate ) { 560 switch ( memstate ) {
562 case Unknown: 561 case Unknown:
563 break; 562 break;
564 case Low: 563 case Low:
565 memstate = Unknown; 564 memstate = Unknown;
566 if ( recoverMemory() ) 565 if ( recoverMemory() )
567 ignoreNormal = TRUE; 566 ignoreNormal = TRUE;
568 else 567 else
569 QMessageBox::warning( 0 , "Memory Status", 568 QMessageBox::warning( 0 , "Memory Status",
570 "The memory smacks of shortage. \n" 569 "The memory smacks of shortage. \n"
571 "Please save data. " ); 570 "Please save data. " );
572 break; 571 break;
573 case Normal: 572 case Normal:
574 memstate = Unknown; 573 memstate = Unknown;
575 if ( ignoreNormal ) 574 if ( ignoreNormal )
576 ignoreNormal = FALSE; 575 ignoreNormal = FALSE;
577 // else 576 // else
578 // QMessageBox::information ( 0 , "Memory Status", 577 // QMessageBox::information ( 0 , "Memory Status",
579 // "There is enough memory again." ); 578 // "There is enough memory again." );
580 break; 579 break;
581 case VeryLow: 580 case VeryLow:
582 memstate = Unknown; 581 memstate = Unknown;
583 QMessageBox::critical( 0 , "Memory Status", 582 QMessageBox::critical( 0 , "Memory Status",
584 "The memory is very low. \n" 583 "The memory is very low. \n"
585 "Please end this application \n" 584 "Please end this application \n"
586 "immediately." ); 585 "immediately." );
587 recoverMemory(); 586 recoverMemory();
588 } 587 }
589 existingMessage = FALSE; 588 existingMessage = FALSE;
590#endif 589#endif
591} 590}
592 591
593static bool isVisibleWindow( int wid ) 592static bool isVisibleWindow( int wid )
594{ 593{
595#ifdef QWS 594#ifdef QWS
596 const QList<QWSWindow> &list = qwsServer->clientWindows(); 595 const QList<QWSWindow> &list = qwsServer->clientWindows();
597 QWSWindow* w; 596 QWSWindow* w;
598 for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { 597 for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) {
599 if ( w->winId() == wid ) 598 if ( w->winId() == wid )
600 return !w->isFullyObscured(); 599 return !w->isFullyObscured();
601 } 600 }
602#endif 601#endif
603 return FALSE; 602 return FALSE;
604} 603}
605 604
606static bool hasVisibleWindow( const QString& clientname ) 605static bool hasVisibleWindow( const QString& clientname )
607{ 606{
608#ifdef QWS 607#ifdef QWS
609 const QList<QWSWindow> &list = qwsServer->clientWindows(); 608 const QList<QWSWindow> &list = qwsServer->clientWindows();
610 QWSWindow* w; 609 QWSWindow* w;
611 for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) { 610 for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) {
612 if ( w->client() ->identity() == clientname && !w->isFullyObscured() ) 611 if ( w->client() ->identity() == clientname && !w->isFullyObscured() )
613 return TRUE; 612 return TRUE;
614 } 613 }
615#endif 614#endif
616 return FALSE; 615 return FALSE;
617} 616}
618 617
619 618
620void Desktop::executeOrModify( const QString& appLnkFile ) 619void Desktop::executeOrModify( const QString& appLnkFile )
621{ 620{
622 AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile ); 621 AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile );
623 if ( lnk.isValid() ) { 622 if ( lnk.isValid() ) {
624 QCString app = lnk.exec().utf8(); 623 QCString app = lnk.exec().utf8();
625 Global::terminateBuiltin( "calibrate" );
626 if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) { 624 if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) {
627 // MRUList::addTask( &lnk ); 625 // MRUList::addTask( &lnk );
628 if ( hasVisibleWindow( app ) ) 626 if ( hasVisibleWindow( app ) )
629 QCopChannel::send( "QPE/Application/" + app, "nextView()" ); 627 QCopChannel::send( "QPE/Application/" + app, "nextView()" );
630 else 628 else
631 QCopChannel::send( "QPE/Application/" + app, "raise()" ); 629 QCopChannel::send( "QPE/Application/" + app, "raise()" );
632 } 630 }
633 else { 631 else {
634 lnk.execute(); 632 lnk.execute();
635 } 633 }
636 } 634 }
637} 635}
638 636
639// autoStarts apps on resume and start 637// autoStarts apps on resume and start
640void Desktop::execAutoStart() 638void Desktop::execAutoStart()
641{ 639{
642 QString appName; 640 QString appName;
643 int delay; 641 int delay;
644 QDateTime now = QDateTime::currentDateTime(); 642 QDateTime now = QDateTime::currentDateTime();
645 Config cfg( "autostart" ); 643 Config cfg( "autostart" );
646 cfg.setGroup( "AutoStart" ); 644 cfg.setGroup( "AutoStart" );
647 appName = cfg.readEntry( "Apps", "" ); 645 appName = cfg.readEntry( "Apps", "" );
648 delay = ( cfg.readEntry( "Delay", "0" ) ).toInt(); 646 delay = ( cfg.readEntry( "Delay", "0" ) ).toInt();
649 // If the time between suspend and resume was longer then the 647 // If the time between suspend and resume was longer then the
650 // value saved as delay, start the app 648 // value saved as delay, start the app
651 if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { 649 if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) {
652 QCopEnvelope e( "QPE/System", "execute(QString)" ); 650 QCopEnvelope e( "QPE/System", "execute(QString)" );
653 e << QString( appName ); 651 e << QString( appName );
654 } 652 }
655} 653}
656 654
657#if defined(QPE_HAVE_TOGGLELIGHT) 655#if defined(QPE_HAVE_TOGGLELIGHT)
658#include <qpe/config.h> 656#include <qpe/config.h>
659 657
660#include <sys/ioctl.h> 658#include <sys/ioctl.h>
661#include <sys/types.h> 659#include <sys/types.h>
662#include <fcntl.h> 660#include <fcntl.h>
663#include <unistd.h> 661#include <unistd.h>
664#include <errno.h> 662#include <errno.h>
665#include <linux/ioctl.h> 663#include <linux/ioctl.h>
666#include <time.h> 664#include <time.h>
667#endif 665#endif
668 666
669 667
670void Desktop::togglePower() 668void Desktop::togglePower()
671{ 669{
672 static bool excllock = false; 670 static bool excllock = false;
673 671
674 if ( excllock ) 672 if ( excllock )
675 return ; 673 return ;
676 674
677 excllock = true; 675 excllock = true;
678 676
679 bool wasloggedin = loggedin; 677 bool wasloggedin = loggedin;
680 loggedin = 0; 678 loggedin = 0;
681 suspendTime = QDateTime::currentDateTime(); 679 suspendTime = QDateTime::currentDateTime();
682 680
683#ifdef QWS 681#ifdef QWS
684 682
685 if ( Password::needToAuthenticate ( true ) && qt_screen ) { 683 if ( Password::needToAuthenticate ( true ) && qt_screen ) {
686 // Should use a big black window instead. 684 // Should use a big black window instead.
687 // But this would not show up fast enough 685 // But this would not show up fast enough
688 QGfx *g = qt_screen-> screenGfx ( ); 686 QGfx *g = qt_screen-> screenGfx ( );
689 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); 687 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
690 delete g; 688 delete g;
691 } 689 }
692#endif 690#endif
693 691
694 ODevice::inst ( )-> suspend ( ); 692 ODevice::inst ( )-> suspend ( );
695 693
696 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call 694 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call
697 QWSServer::screenSaverActivate ( false ); 695 QWSServer::screenSaverActivate ( false );
698 696
699 { 697 {
700 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep 698 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep
701 } 699 }
702 700
703 if ( wasloggedin ) 701 if ( wasloggedin )
704 login ( true ); 702 login ( true );
705 703
706 execAutoStart(); 704 execAutoStart();
707 //qcopBridge->closeOpenConnections(); 705 //qcopBridge->closeOpenConnections();
708 706
709 excllock = false; 707 excllock = false;
710} 708}
711 709
712void Desktop::toggleLight() 710void Desktop::toggleLight()
713{ 711{
714 QCopEnvelope e( "QPE/System", "setBacklight(int)" ); 712 QCopEnvelope e( "QPE/System", "setBacklight(int)" );
715 e << -2; // toggle 713 e << -2; // toggle
716} 714}
717 715
718void Desktop::toggleSymbolInput() 716void Desktop::toggleSymbolInput()
719{ 717{
720 tb->toggleSymbolInput(); 718 tb->toggleSymbolInput();
721} 719}
722 720
723void Desktop::toggleNumLockState() 721void Desktop::toggleNumLockState()
724{ 722{
725 tb->toggleNumLockState(); 723 tb->toggleNumLockState();
726} 724}
727 725
728void Desktop::toggleCapsLockState() 726void Desktop::toggleCapsLockState()
729{ 727{
730 tb->toggleCapsLockState(); 728 tb->toggleCapsLockState();
731} 729}
732 730
733void Desktop::styleChange( QStyle &s ) 731void Desktop::styleChange( QStyle &s )
734{ 732{
735 QWidget::styleChange( s ); 733 QWidget::styleChange( s );
736 layout(); 734 layout();
737} 735}
738 736
739void DesktopApplication::shutdown() 737void DesktopApplication::shutdown()
740{ 738{
741 if ( type() != GuiServer ) 739 if ( type() != GuiServer )
742 return ; 740 return ;
743 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 741 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
744 connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), 742 connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ),
745 this, SLOT( shutdown( ShutdownImpl::Type ) ) ); 743 this, SLOT( shutdown( ShutdownImpl::Type ) ) );
746 sd->showMaximized(); 744 sd->showMaximized();
747} 745}
748 746
749void DesktopApplication::shutdown( ShutdownImpl::Type t ) 747void DesktopApplication::shutdown( ShutdownImpl::Type t )
750{ 748{
751 char *opt = 0; 749 char *opt = 0;
752 750
753 switch ( t ) { 751 switch ( t ) {
754 case ShutdownImpl::ShutdownSystem: 752 case ShutdownImpl::ShutdownSystem:
755 opt = "-h"; 753 opt = "-h";
756 // fall through 754 // fall through
757 case ShutdownImpl::RebootSystem: 755 case ShutdownImpl::RebootSystem:
758 if ( opt == 0 ) 756 if ( opt == 0 )
759 opt = "-r"; 757 opt = "-r";
760 758
761 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) 759 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 )
762 perror("shutdown"); 760 perror("shutdown");
763 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); 761 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" );
764 762
765 break; 763 break;
766 case ShutdownImpl::RestartDesktop: 764 case ShutdownImpl::RestartDesktop:
767 restart(); 765 restart();
768 break; 766 break;
769 case ShutdownImpl::TerminateDesktop: 767 case ShutdownImpl::TerminateDesktop:
770 prepareForTermination( FALSE ); 768 prepareForTermination( FALSE );
771 769
772 // This is a workaround for a Qt bug 770 // This is a workaround for a Qt bug
773 // clipboard applet has to stop its poll timer, or Qt/E 771 // clipboard applet has to stop its poll timer, or Qt/E
774 // will hang on quit() right before it emits aboutToQuit() 772 // will hang on quit() right before it emits aboutToQuit()
775 emit aboutToQuit ( ); 773 emit aboutToQuit ( );
776 774
777 quit(); 775 quit();
778 break; 776 break;
779 } 777 }
780} 778}
781 779
782void DesktopApplication::restart() 780void DesktopApplication::restart()
783{ 781{
784 prepareForTermination( TRUE ); 782 prepareForTermination( TRUE );
785 783
786#ifdef Q_WS_QWS 784#ifdef Q_WS_QWS
787 785
788 for ( int fd = 3; fd < 100; fd++ ) 786 for ( int fd = 3; fd < 100; fd++ )
789 close( fd ); 787 close( fd );
790#if defined(QT_DEMO_SINGLE_FLOPPY) 788#if defined(QT_DEMO_SINGLE_FLOPPY)
791 789
792 execl( "/sbin/init", "qpe", 0 ); 790 execl( "/sbin/init", "qpe", 0 );
793#elif defined(QT_QWS_CASSIOPEIA) 791#elif defined(QT_QWS_CASSIOPEIA)
794 792
795 execl( "/bin/sh", "sh", 0 ); 793 execl( "/bin/sh", "sh", 0 );
796#else 794#else
797 795
798 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 796 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 );
799#endif 797#endif
800 798
801 exit( 1 ); 799 exit( 1 );
802#endif 800#endif
803} 801}
804 802
805void Desktop::layout() 803void Desktop::layout()
806{ 804{
807 int displayw = qApp->desktop() ->width(); 805 int displayw = qApp->desktop() ->width();
808 int displayh = qApp->desktop() ->height(); 806 int displayh = qApp->desktop() ->height();
809 807
810 QSize sz = tb->sizeHint(); 808 QSize sz = tb->sizeHint();
811 809
812 tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); 810 tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
813 tb->calcMaxWindowRect(); 811 tb->calcMaxWindowRect();
814} 812}
815 813
816void Desktop::startTransferServer() 814void Desktop::startTransferServer()
817{ 815{
818 // start qcop bridge server 816 // start qcop bridge server
819 qcopBridge = new QCopBridge( 4243 ); 817 qcopBridge = new QCopBridge( 4243 );
820 if ( !qcopBridge->ok() ) { 818 if ( !qcopBridge->ok() ) {
821 delete qcopBridge; 819 delete qcopBridge;
822 qcopBridge = 0; 820 qcopBridge = 0;
823 } 821 }
824 // start transfer server 822 // start transfer server
825 transferServer = new TransferServer( 4242 ); 823 transferServer = new TransferServer( 4242 );
826 if ( !transferServer->ok() ) { 824 if ( !transferServer->ok() ) {
827 delete transferServer; 825 delete transferServer;
828 transferServer = 0; 826 transferServer = 0;
829 } 827 }
830 if ( !transferServer || !qcopBridge ) 828 if ( !transferServer || !qcopBridge )
831 startTimer( 2000 ); 829 startTimer( 2000 );
832} 830}
833 831
834void Desktop::timerEvent( QTimerEvent *e ) 832void Desktop::timerEvent( QTimerEvent *e )
835{ 833{
836 killTimer( e->timerId() ); 834 killTimer( e->timerId() );
837 startTransferServer(); 835 startTransferServer();
838} 836}
839 837
840bool Desktop::eventFilter( QObject *o, QEvent *ev ) 838bool Desktop::eventFilter( QObject *o, QEvent *ev )
841{ 839{
842 if ( o != qApp->desktop() || ev->type() != QEvent::Resize ) 840 if ( o != qApp->desktop() || ev->type() != QEvent::Resize )
843 return QWidget::eventFilter( o, ev ); 841 return QWidget::eventFilter( o, ev );
844 842
845 layout(); 843 layout();
846 844
847 return QWidget::eventFilter( o, ev ); 845 return QWidget::eventFilter( o, ev );
848} 846}
849 847
850void Desktop::terminateServers() 848void Desktop::terminateServers()
851{ 849{
852 delete transferServer; 850 delete transferServer;
853 delete qcopBridge; 851 delete qcopBridge;
854 transferServer = 0; 852 transferServer = 0;
855 qcopBridge = 0; 853 qcopBridge = 0;
856} 854}
857 855
858void DesktopApplication::rereadVolumes() 856void DesktopApplication::rereadVolumes()
859{ 857{
860 Config cfg( "qpe" ); 858 Config cfg( "qpe" );
861 cfg. setGroup ( "Volume" ); 859 cfg. setGroup ( "Volume" );
862 860
863 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 861 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
864 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 862 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
865 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 863 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
866} 864}
867 865
868void DesktopApplication::soundAlarm() 866void DesktopApplication::soundAlarm()
869{ 867{
870 if ( me ( )-> m_alarm_sound ) 868 if ( me ( )-> m_alarm_sound )
871 ODevice::inst ( )-> alarmSound ( ); 869 ODevice::inst ( )-> alarmSound ( );
872} 870}
873 871
874DesktopApplication *DesktopApplication::me ( ) 872DesktopApplication *DesktopApplication::me ( )
875{ 873{
876 return (DesktopApplication *) qApp; 874 return (DesktopApplication *) qApp;
877} 875}
878 876
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index d0a573b..007e48c 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -1,124 +1,120 @@
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 screensaver.h \ 6 screensaver.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 runningappbar.h \ 12 runningappbar.h \
13 stabmon.h \ 13 stabmon.h \
14 inputmethods.h \ 14 inputmethods.h \
15 systray.h \ 15 systray.h \
16 wait.h \ 16 wait.h \
17 shutdownimpl.h \ 17 shutdownimpl.h \
18 launcher.h \ 18 launcher.h \
19 launcherview.h \ 19 launcherview.h \
20 ../../core/apps/calibrate/calibrate.h \
21 startmenu.h \ 20 startmenu.h \
22 transferserver.h \ 21 transferserver.h \
23 qcopbridge.h \ 22 qcopbridge.h \
24 packageslave.h \ 23 packageslave.h \
25 irserver.h \ 24 irserver.h \
26 ../../rsync/buf.h \ 25 ../../rsync/buf.h \
27 ../../rsync/checksum.h \ 26 ../../rsync/checksum.h \
28 ../../rsync/command.h \ 27 ../../rsync/command.h \
29 ../../rsync/emit.h \ 28 ../../rsync/emit.h \
30 ../../rsync/job.h \ 29 ../../rsync/job.h \
31 ../../rsync/netint.h \ 30 ../../rsync/netint.h \
32 ../../rsync/protocol.h \ 31 ../../rsync/protocol.h \
33 ../../rsync/prototab.h \ 32 ../../rsync/prototab.h \
34 ../../rsync/rsync.h \ 33 ../../rsync/rsync.h \
35 ../../rsync/search.h \ 34 ../../rsync/search.h \
36 ../../rsync/stream.h \ 35 ../../rsync/stream.h \
37 ../../rsync/sumset.h \ 36 ../../rsync/sumset.h \
38 ../../rsync/trace.h \ 37 ../../rsync/trace.h \
39 ../../rsync/types.h \ 38 ../../rsync/types.h \
40 ../../rsync/util.h \ 39 ../../rsync/util.h \
41 ../../rsync/whole.h \ 40 ../../rsync/whole.h \
42 ../../rsync/config_rsync.h \ 41 ../../rsync/config_rsync.h \
43 ../../rsync/qrsync.h \ 42 ../../rsync/qrsync.h \
44 quicklauncher.h 43 quicklauncher.h
45 SOURCES = background.cpp \ 44 SOURCES = background.cpp \
46 desktop.cpp \ 45 desktop.cpp \
47 screensaver.cpp \ 46 screensaver.cpp \
48 mediummountgui.cpp \ 47 mediummountgui.cpp \
49 info.cpp \ 48 info.cpp \
50 appicons.cpp \ 49 appicons.cpp \
51 taskbar.cpp \ 50 taskbar.cpp \
52 sidething.cpp \ 51 sidething.cpp \
53 runningappbar.cpp \ 52 runningappbar.cpp \
54 stabmon.cpp \ 53 stabmon.cpp \
55 inputmethods.cpp \ 54 inputmethods.cpp \
56 systray.cpp \ 55 systray.cpp \
57 wait.cpp \ 56 wait.cpp \
58 shutdownimpl.cpp \ 57 shutdownimpl.cpp \
59 launcher.cpp \ 58 launcher.cpp \
60 launcherview.cpp \ 59 launcherview.cpp \
61 ../../core/apps/calibrate/calibrate.cpp \
62 transferserver.cpp \ 60 transferserver.cpp \
63 packageslave.cpp \ 61 packageslave.cpp \
64 irserver.cpp \ 62 irserver.cpp \
65 qcopbridge.cpp \ 63 qcopbridge.cpp \
66 startmenu.cpp \ 64 startmenu.cpp \
67 main.cpp \ 65 main.cpp \
68 ../../rsync/base64.c \ 66 ../../rsync/base64.c \
69 ../../rsync/buf.c \ 67 ../../rsync/buf.c \
70 ../../rsync/checksum.c \ 68 ../../rsync/checksum.c \
71 ../../rsync/command.c \ 69 ../../rsync/command.c \
72 ../../rsync/delta.c \ 70 ../../rsync/delta.c \
73 ../../rsync/emit.c \ 71 ../../rsync/emit.c \
74 ../../rsync/hex.c \ 72 ../../rsync/hex.c \
75 ../../rsync/job.c \ 73 ../../rsync/job.c \
76 ../../rsync/mdfour.c \ 74 ../../rsync/mdfour.c \
77 ../../rsync/mksum.c \ 75 ../../rsync/mksum.c \
78 ../../rsync/msg.c \ 76 ../../rsync/msg.c \
79 ../../rsync/netint.c \ 77 ../../rsync/netint.c \
80 ../../rsync/patch.c \ 78 ../../rsync/patch.c \
81 ../../rsync/prototab.c \ 79 ../../rsync/prototab.c \
82 ../../rsync/readsums.c \ 80 ../../rsync/readsums.c \
83 ../../rsync/scoop.c \ 81 ../../rsync/scoop.c \
84 ../../rsync/search.c \ 82 ../../rsync/search.c \
85 ../../rsync/stats.c \ 83 ../../rsync/stats.c \
86 ../../rsync/stream.c \ 84 ../../rsync/stream.c \
87 ../../rsync/sumset.c \ 85 ../../rsync/sumset.c \
88 ../../rsync/trace.c \ 86 ../../rsync/trace.c \
89 ../../rsync/tube.c \ 87 ../../rsync/tube.c \
90 ../../rsync/util.c \ 88 ../../rsync/util.c \
91 ../../rsync/version.c \ 89 ../../rsync/version.c \
92 ../../rsync/whole.c \ 90 ../../rsync/whole.c \
93 ../../rsync/qrsync.cpp 91 ../../rsync/qrsync.cpp
94 INTERFACES= syncdialog.ui 92 INTERFACES= syncdialog.ui
95INCLUDEPATH += ../../include 93INCLUDEPATH += ../../include
96 DEPENDPATH+= ../../include . 94 DEPENDPATH+= ../../include .
97INCLUDEPATH += ../../core/apps/calibrate
98 DEPENDPATH+= ../../core/apps/calibrate
99INCLUDEPATH += ../../rsync 95INCLUDEPATH += ../../rsync
100 DEPENDPATH+= ../../rsync 96 DEPENDPATH+= ../../rsync
101 TARGET = qpe 97 TARGET = qpe
102 LIBS += -lqpe -lcrypt -lopie 98 LIBS += -lqpe -lcrypt -lopie
103 99
104TRANSLATIONS = ../../i18n/de/qpe.ts \ 100TRANSLATIONS = ../../i18n/de/qpe.ts \
105 ../../i18n/xx/qpe.ts \ 101 ../../i18n/xx/qpe.ts \
106 ../../i18n/en/qpe.ts \ 102 ../../i18n/en/qpe.ts \
107 ../../i18n/es/qpe.ts \ 103 ../../i18n/es/qpe.ts \
108 ../../i18n/fr/qpe.ts \ 104 ../../i18n/fr/qpe.ts \
109 ../../i18n/hu/qpe.ts \ 105 ../../i18n/hu/qpe.ts \
110 ../../i18n/ja/qpe.ts \ 106 ../../i18n/ja/qpe.ts \
111 ../../i18n/ko/qpe.ts \ 107 ../../i18n/ko/qpe.ts \
112 ../../i18n/no/qpe.ts \ 108 ../../i18n/no/qpe.ts \
113 ../../i18n/pl/qpe.ts \ 109 ../../i18n/pl/qpe.ts \
114 ../../i18n/pt/qpe.ts \ 110 ../../i18n/pt/qpe.ts \
115 ../../i18n/pt_BR/qpe.ts \ 111 ../../i18n/pt_BR/qpe.ts \
116 ../../i18n/sl/qpe.ts \ 112 ../../i18n/sl/qpe.ts \
117 ../../i18n/zh_CN/qpe.ts \ 113 ../../i18n/zh_CN/qpe.ts \
118 ../../i18n/it/qpe.ts \ 114 ../../i18n/it/qpe.ts \
119 ../../i18n/zh_TW/qpe.ts \ 115 ../../i18n/zh_TW/qpe.ts \
120 ../../i18n/da/qpe.ts 116 ../../i18n/da/qpe.ts
121 117
122 118
123 119
124include ( $(OPIEDIR)/include.pro ) 120include ( $(OPIEDIR)/include.pro )
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 20a1ecd..e96eeae 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,191 +1,194 @@
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_SL5XXX ) || defined( QT_QWS_IPAQ ) 28#if defined( QT_QWS_SL5XXX ) || 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#include <opie/oprocess.h>
33 34
34#include <qmessagebox.h> 35#include <qmessagebox.h>
35#include <qfile.h> 36#include <qfile.h>
36#include <qimage.h> 37#include <qimage.h>
37#include <qwindowsystem_qws.h> 38#include <qwindowsystem_qws.h>
38#include <qwsmouse_qws.h> 39#include <qwsmouse_qws.h>
39#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
40#include <qpe/alarmserver.h> 41#include <qpe/alarmserver.h>
41 42
42#include <stdlib.h> 43#include <stdlib.h>
43#include <stdio.h> 44#include <stdio.h>
44#include <signal.h> 45#include <signal.h>
45#include <unistd.h> 46#include <unistd.h>
46 47
47#include "../calibrate/calibrate.h"
48
49using namespace Opie; 48using namespace Opie;
50 49
51void initEnvironment() 50void initEnvironment()
52{ 51{
53 int rot; 52 int rot;
54 Config config("locale"); 53 Config config("locale");
55 54
56 config.setGroup( "Location" ); 55 config.setGroup( "Location" );
57 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 56 QString tz = config.readEntry( "Timezone", getenv("TZ") );
58 57
59 // if not timezone set, pick New York 58 // if not timezone set, pick New York
60 if (tz.isNull()) 59 if (tz.isNull())
61 tz = "America/New_York"; 60 tz = "America/New_York";
62 61
63 setenv( "TZ", tz, 1 ); 62 setenv( "TZ", tz, 1 );
64 config.writeEntry( "Timezone", tz); 63 config.writeEntry( "Timezone", tz);
65 64
66 config.setGroup( "Language" ); 65 config.setGroup( "Language" );
67 QString lang = config.readEntry( "Language", getenv("LANG") ); 66 QString lang = config.readEntry( "Language", getenv("LANG") );
68 if ( !lang.isNull() ) 67 if ( !lang.isNull() )
69 setenv( "LANG", lang, 1 ); 68 setenv( "LANG", lang, 1 );
70 69
71#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) 70#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX)
72 setenv( "QWS_SIZE", "240x320", 0 ); 71 setenv( "QWS_SIZE", "240x320", 0 );
73#endif 72#endif
74 73
75 QString env(getenv("QWS_DISPLAY")); 74 QString env(getenv("QWS_DISPLAY"));
76 if (env.contains("Transformed")) { 75 if (env.contains("Transformed")) {
77 // transformed driver default rotation is controlled by the hardware. 76 // transformed driver default rotation is controlled by the hardware.
78 Config config("qpe"); 77 Config config("qpe");
79 config.setGroup( "Rotation" ); 78 config.setGroup( "Rotation" );
80 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) 79 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 )
81 rot = ODevice::inst ( )-> rotation ( ) * 90; 80 rot = ODevice::inst ( )-> rotation ( ) * 90;
82 81
83 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 82 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
84 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ 83 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */
85 } 84 }
86} 85}
87 86
88 87
89int initApplication( int argc, char ** argv ) 88int initApplication( int argc, char ** argv )
90{ 89{
91 initEnvironment(); 90 initEnvironment();
92 91
93 //Don't flicker at startup: 92 //Don't flicker at startup:
94 QWSServer::setDesktopBackground( QImage() ); 93 QWSServer::setDesktopBackground( QImage() );
95 94
96 DesktopApplication a( argc, argv, QApplication::GuiServer ); 95 DesktopApplication a( argc, argv, QApplication::GuiServer );
97 96
98 ODevice::inst ( )-> setSoftSuspend ( true ); 97 ODevice::inst ( )-> setSoftSuspend ( true );
99 98
100 { // init backlight 99 { // init backlight
101 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 100 QCopEnvelope e("QPE/System", "setBacklight(int)" );
102 e << -3; // Forced on 101 e << -3; // Forced on
103 } 102 }
104 103
105 AlarmServer::initialize(); 104 AlarmServer::initialize();
106 105
107 Desktop *d = new Desktop(); 106 Desktop *d = new Desktop();
108 107
109 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 108 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
110 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 109 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
111 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 110 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
112 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 111 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
113 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 112 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
114 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 113 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
115 114
116 (void)new SysFileMonitor(d); 115 (void)new SysFileMonitor(d);
117 Network::createServer(d); 116 Network::createServer(d);
118 117
119 if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { 118 if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
120 if ( !QFile::exists( "/etc/pointercal" ) ) { 119 if ( !QFile::exists( "/etc/pointercal" ) ) {
121 // Make sure calibration widget starts on top. 120 OProcess cal;
122 Calibrate *cal = new Calibrate; 121 cal << "calibrate";
123 cal->exec(); 122
124 delete cal; 123 if ( ! cal.start(OProcess::Block, OProcess::NoCommunication) ) {
124 QMessageBox::warning( 0, "Unable to calibrate",
125 "Failed to start the calibration tool.\n"
126 );
127 }
125 } 128 }
126 } 129 }
127 130
128 d->show(); 131 d->show();
129 132
130 if ( QDate::currentDate ( ). year ( ) < 2000 ) { 133 if ( QDate::currentDate ( ). year ( ) < 2000 ) {
131 if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { 134 if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
132 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); 135 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" );
133 e << QString ( ); 136 e << QString ( );
134 } 137 }
135 } 138 }
136 139
137 int rv = a.exec(); 140 int rv = a.exec();
138 141
139 delete d; 142 delete d;
140 143
141 ODevice::inst ( )-> setSoftSuspend ( false ); 144 ODevice::inst ( )-> setSoftSuspend ( false );
142 145
143 return rv; 146 return rv;
144} 147}
145 148
146static const char *pidfile_path = "/var/run/opie.pid"; 149static const char *pidfile_path = "/var/run/opie.pid";
147 150
148void create_pidfile ( ) 151void create_pidfile ( )
149{ 152{
150 FILE *f; 153 FILE *f;
151 154
152 if (( f = ::fopen ( pidfile_path, "w" ))) { 155 if (( f = ::fopen ( pidfile_path, "w" ))) {
153 ::fprintf ( f, "%d", getpid ( )); 156 ::fprintf ( f, "%d", getpid ( ));
154 ::fclose ( f ); 157 ::fclose ( f );
155 } 158 }
156} 159}
157 160
158void remove_pidfile ( ) 161void remove_pidfile ( )
159{ 162{
160 ::unlink ( pidfile_path ); 163 ::unlink ( pidfile_path );
161} 164}
162 165
163void handle_sigterm ( int /* sig */ ) 166void handle_sigterm ( int /* sig */ )
164{ 167{
165 if ( qApp ) 168 if ( qApp )
166 qApp-> quit ( ); 169 qApp-> quit ( );
167} 170}
168 171
169int main( int argc, char ** argv ) 172int main( int argc, char ** argv )
170{ 173{
171 ::signal ( SIGCHLD, SIG_IGN ); 174 ::signal ( SIGCHLD, SIG_IGN );
172 175
173 ::signal ( SIGTERM, handle_sigterm ); 176 ::signal ( SIGTERM, handle_sigterm );
174 ::signal ( SIGINT, handle_sigterm ); 177 ::signal ( SIGINT, handle_sigterm );
175 178
176 ::setsid ( ); 179 ::setsid ( );
177 ::setpgid ( 0, 0 ); 180 ::setpgid ( 0, 0 );
178 181
179 ::atexit ( remove_pidfile ); 182 ::atexit ( remove_pidfile );
180 create_pidfile ( ); 183 create_pidfile ( );
181 184
182 int retVal = initApplication ( argc, argv ); 185 int retVal = initApplication ( argc, argv );
183 186
184 // Kill them. Kill them all. 187 // Kill them. Kill them all.
185 ::kill ( 0, SIGTERM ); 188 ::kill ( 0, SIGTERM );
186 ::sleep ( 1 ); 189 ::sleep ( 1 );
187 ::kill ( 0, SIGKILL ); 190 ::kill ( 0, SIGKILL );
188 191
189 return retVal; 192 return retVal;
190} 193}
191 194
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index c0430b7..db66a05 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -1,9 +1,9 @@
1Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* plugins/applets/librotateapplet.so* root/etc/init.d/opie 1Files: bin/qpe pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* plugins/applets/librotateapplet.so* root/etc/init.d/opie
2Priority: required 2Priority: required
3Section: opie/system 3Section: opie/system
4Maintainer: Project Opie <opie@handhelds.org> 4Maintainer: Project Opie <opie@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.3 6Version: $QPE_VERSION-$SUB_VERSION.3
7Depends: opie-base 7Depends: opie-base, opie-calibrate
8Replaces: opie-rotation 8Replaces: opie-rotation
9Description: Launcher for Opie 9Description: Launcher for Opie
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 8af568d..8158128 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,344 +1,329 @@
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"
26#include "wait.h" 25#include "wait.h"
27#include "appicons.h" 26#include "appicons.h"
28 27
29#include "taskbar.h" 28#include "taskbar.h"
30#include "desktop.h" 29#include "desktop.h"
31 30
32#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 32#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 33#include <qpe/global.h>
35 34
36#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ ) 35#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ )
37#include <qpe/custom.h> 36#include <qpe/custom.h>
38#endif 37#endif
39 38
40#include <opie/odevice.h> 39#include <opie/odevice.h>
41 40
42#include <qlabel.h> 41#include <qlabel.h>
43#include <qlayout.h> 42#include <qlayout.h>
44#include <qtimer.h> 43#include <qtimer.h>
45#include <qwindowsystem_qws.h> 44#include <qwindowsystem_qws.h>
46#include <qwidgetstack.h> 45#include <qwidgetstack.h>
47 46
48#if defined( Q_WS_QWS ) 47#if defined( Q_WS_QWS )
49#include <qwsdisplay_qws.h> 48#include <qwsdisplay_qws.h>
50#include <qgfx_qws.h> 49#include <qgfx_qws.h>
51#endif 50#endif
52 51
53 52
54using namespace Opie; 53using namespace Opie;
55 54
56#define FACTORY(T) \ 55#define FACTORY(T) \
57 static QWidget *new##T( bool maximized ) { \ 56 static QWidget *new##T( bool maximized ) { \
58 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 57 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
59 if ( maximized ) { \ 58 if ( maximized ) { \
60 if ( qApp->desktop()->width() <= 350 ) { \ 59 if ( qApp->desktop()->width() <= 350 ) { \
61 w->showMaximized(); \ 60 w->showMaximized(); \
62 } else { \ 61 } else { \
63 w->resize( QSize( 300, 300 ) ); \ 62 w->resize( QSize( 300, 300 ) ); \
64 } \ 63 } \
65 } \ 64 } \
66 w->show(); \ 65 w->show(); \
67 return w; \ 66 return w; \
68 } 67 }
69 68
70 69
71#ifdef SINGLE_APP 70#ifdef SINGLE_APP
72#define APP(a,b,c,d) FACTORY(b) 71#define APP(a,b,c,d) FACTORY(b)
73#include "../launcher/apps.h" 72#include "../launcher/apps.h"
74#undef APP 73#undef APP
75#endif // SINGLE_APP 74#endif // SINGLE_APP
76 75
77static Global::Command builtins[] = { 76static Global::Command builtins[] = {
78 77
79#ifdef SINGLE_APP 78#ifdef SINGLE_APP
80#define APP(a,b,c,d) { a, new##b, c }, 79#define APP(a,b,c,d) { a, new##b, c },
81#include "../launcher/apps.h" 80#include "../launcher/apps.h"
82#undef APP 81#undef APP
83#endif 82#endif
84 83
85#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX)
86 { "calibrate", TaskBar::calibrate, 1, 0 },
87#endif
88#if !defined(QT_QWS_CASSIOPEIA) 84#if !defined(QT_QWS_CASSIOPEIA)
89 { "shutdown", Global::shutdown, 1, 0 }, 85 { "shutdown", Global::shutdown, 1, 0 },
90// { "run", run, 1, 0 }, 86// { "run", run, 1, 0 },
91#endif 87#endif
92 88
93 { 0, TaskBar::calibrate, 0, 0 }, 89 { 0, 0, 0, 0 },
94}; 90};
95 91
96static bool initNumLock() 92static bool initNumLock()
97{ 93{
98#ifdef QPE_INITIAL_NUMLOCK_STATE 94#ifdef QPE_INITIAL_NUMLOCK_STATE
99 QPE_INITIAL_NUMLOCK_STATE 95 QPE_INITIAL_NUMLOCK_STATE
100#endif 96#endif
101 return FALSE; 97 return FALSE;
102} 98}
103 99
104class LockKeyState : public QWidget 100class LockKeyState : public QWidget
105{ 101{
106public: 102public:
107 LockKeyState( QWidget *parent ) : 103 LockKeyState( QWidget *parent ) :
108 QWidget(parent), 104 QWidget(parent),
109 nl(initNumLock()), cl(FALSE) 105 nl(initNumLock()), cl(FALSE)
110 { 106 {
111 nl_pm = Resource::loadPixmap("numlock"); 107 nl_pm = Resource::loadPixmap("numlock");
112 cl_pm = Resource::loadPixmap("capslock"); 108 cl_pm = Resource::loadPixmap("capslock");
113 } 109 }
114 QSize sizeHint() const 110 QSize sizeHint() const
115 { 111 {
116 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 112 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
117 } 113 }
118 void toggleNumLockState() 114 void toggleNumLockState()
119 { 115 {
120 nl = !nl; repaint(); 116 nl = !nl; repaint();
121 } 117 }
122 void toggleCapsLockState() 118 void toggleCapsLockState()
123 { 119 {
124 cl = !cl; repaint(); 120 cl = !cl; repaint();
125 } 121 }
126 void paintEvent( QPaintEvent * ) 122 void paintEvent( QPaintEvent * )
127 { 123 {
128 int y = (height()-sizeHint().height())/2; 124 int y = (height()-sizeHint().height())/2;
129 QPainter p(this); 125 QPainter p(this);
130 if ( nl ) 126 if ( nl )
131 p.drawPixmap(1,y,nl_pm); 127 p.drawPixmap(1,y,nl_pm);
132 if ( cl ) 128 if ( cl )
133 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 129 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
134 } 130 }
135private: 131private:
136 QPixmap nl_pm, cl_pm; 132 QPixmap nl_pm, cl_pm;
137 bool nl, cl; 133 bool nl, cl;
138}; 134};
139 135
140TaskBar::~TaskBar() 136TaskBar::~TaskBar()
141{ 137{
142} 138}
143 139
144 140
145TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 141TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
146{ 142{
147 Global::setBuiltinCommands(builtins); 143 Global::setBuiltinCommands(builtins);
148 144
149 sm = new StartMenu( this ); 145 sm = new StartMenu( this );
150 146
151 inputMethods = new InputMethods( this ); 147 inputMethods = new InputMethods( this );
152 connect( inputMethods, SIGNAL(inputToggled(bool)), 148 connect( inputMethods, SIGNAL(inputToggled(bool)),
153 this, SLOT(calcMaxWindowRect()) ); 149 this, SLOT(calcMaxWindowRect()) );
154 //new QuickLauncher( this ); 150 //new QuickLauncher( this );
155 151
156 stack = new QWidgetStack( this ); 152 stack = new QWidgetStack( this );
157 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 153 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
158 label = new QLabel(stack); 154 label = new QLabel(stack);
159 155
160 //mru = new MRUList( stack ); 156 //mru = new MRUList( stack );
161 //stack->raiseWidget( mru ); 157 //stack->raiseWidget( mru );
162 158
163 runningAppBar = new RunningAppBar(stack); 159 runningAppBar = new RunningAppBar(stack);
164 stack->raiseWidget(runningAppBar); 160 stack->raiseWidget(runningAppBar);
165 161
166 waitIcon = new Wait( this ); 162 waitIcon = new Wait( this );
167 (void) new AppIcons( this ); 163 (void) new AppIcons( this );
168 164
169 sysTray = new SysTray( this ); 165 sysTray = new SysTray( this );
170 166
171 // ## make customizable in some way? 167 // ## make customizable in some way?
172 lockState = new LockKeyState( this ); 168 lockState = new LockKeyState( this );
173 169
174#if defined(Q_WS_QWS) 170#if defined(Q_WS_QWS)
175#if !defined(QT_NO_COP) 171#if !defined(QT_NO_COP)
176 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
177 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
178 this, SLOT(receive(const QCString&, const QByteArray&)) ); 174 this, SLOT(receive(const QCString&, const QByteArray&)) );
179#endif 175#endif
180#endif 176#endif
181 waitTimer = new QTimer( this ); 177 waitTimer = new QTimer( this );
182 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
183 clearer = new QTimer( this ); 179 clearer = new QTimer( this );
184 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
185 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
186} 182}
187 183
188void TaskBar::setStatusMessage( const QString &text ) 184void TaskBar::setStatusMessage( const QString &text )
189{ 185{
190 if ( !text.isEmpty() ) { 186 if ( !text.isEmpty() ) {
191 label->setText( text ); 187 label->setText( text );
192 stack->raiseWidget( label ); 188 stack->raiseWidget( label );
193 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 189 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
194 sysTray->hide(); 190 sysTray->hide();
195 clearer->start( 3000, TRUE ); 191 clearer->start( 3000, TRUE );
196 } else { 192 } else {
197 clearStatusBar(); 193 clearStatusBar();
198 } 194 }
199} 195}
200 196
201void TaskBar::clearStatusBar() 197void TaskBar::clearStatusBar()
202{ 198{
203 label->clear(); 199 label->clear();
204 stack->raiseWidget(runningAppBar); 200 stack->raiseWidget(runningAppBar);
205 // stack->raiseWidget( mru ); 201 // stack->raiseWidget( mru );
206} 202}
207 203
208void TaskBar::startWait() 204void TaskBar::startWait()
209{ 205{
210 waitIcon->setWaiting( true ); 206 waitIcon->setWaiting( true );
211 // a catchall stop after 10 seconds... 207 // a catchall stop after 10 seconds...
212 waitTimer->start( 10 * 1000, true ); 208 waitTimer->start( 10 * 1000, true );
213} 209}
214 210
215void TaskBar::stopWait(const QString& /*app*/) 211void TaskBar::stopWait(const QString& /*app*/)
216{ 212{
217 waitTimer->stop(); 213 waitTimer->stop();
218 //mru->addTask(sm->execToLink(app)); 214 //mru->addTask(sm->execToLink(app));
219 waitIcon->setWaiting( false ); 215 waitIcon->setWaiting( false );
220} 216}
221 217
222void TaskBar::stopWait() 218void TaskBar::stopWait()
223{ 219{
224 waitTimer->stop(); 220 waitTimer->stop();
225 221
226 waitIcon->setWaiting( false ); 222 waitIcon->setWaiting( false );
227} 223}
228 224
229void TaskBar::resizeEvent( QResizeEvent *e ) 225void TaskBar::resizeEvent( QResizeEvent *e )
230{ 226{
231 QHBox::resizeEvent( e ); 227 QHBox::resizeEvent( e );
232 calcMaxWindowRect(); 228 calcMaxWindowRect();
233} 229}
234 230
235void TaskBar::styleChange( QStyle &s ) 231void TaskBar::styleChange( QStyle &s )
236{ 232{
237 QHBox::styleChange( s ); 233 QHBox::styleChange( s );
238 calcMaxWindowRect(); 234 calcMaxWindowRect();
239} 235}
240 236
241void TaskBar::calcMaxWindowRect() 237void TaskBar::calcMaxWindowRect()
242{ 238{
243#ifdef Q_WS_QWS 239#ifdef Q_WS_QWS
244 QRect wr; 240 QRect wr;
245 int displayWidth = qApp->desktop()->width(); 241 int displayWidth = qApp->desktop()->width();
246 QRect ir = inputMethods->inputRect(); 242 QRect ir = inputMethods->inputRect();
247 if ( ir.isValid() ) { 243 if ( ir.isValid() ) {
248 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 244 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
249 } else { 245 } else {
250 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 246 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
251 } 247 }
252 248
253#if QT_VERSION < 300 249#if QT_VERSION < 300
254 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 250 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
255 QSize(qt_screen->width(),qt_screen->height())) 251 QSize(qt_screen->width(),qt_screen->height()))
256 ); 252 );
257#else 253#else
258 QWSServer::setMaxWindowRect( wr ); 254 QWSServer::setMaxWindowRect( wr );
259#endif 255#endif
260#endif 256#endif
261} 257}
262 258
263void TaskBar::receive( const QCString &msg, const QByteArray &data ) 259void TaskBar::receive( const QCString &msg, const QByteArray &data )
264{ 260{
265 QDataStream stream( data, IO_ReadOnly ); 261 QDataStream stream( data, IO_ReadOnly );
266 if ( msg == "message(QString)" ) { 262 if ( msg == "message(QString)" ) {
267 QString text; 263 QString text;
268 stream >> text; 264 stream >> text;
269 setStatusMessage( text ); 265 setStatusMessage( text );
270 } else if ( msg == "hideInputMethod()" ) { 266 } else if ( msg == "hideInputMethod()" ) {
271 inputMethods->hideInputMethod(); 267 inputMethods->hideInputMethod();
272 } else if ( msg == "showInputMethod()" ) { 268 } else if ( msg == "showInputMethod()" ) {
273 inputMethods->showInputMethod(); 269 inputMethods->showInputMethod();
274 } else if ( msg == "reloadInputMethods()" ) { 270 } else if ( msg == "reloadInputMethods()" ) {
275 inputMethods->loadInputMethods(); 271 inputMethods->loadInputMethods();
276 } else if ( msg == "reloadApps()" ) { 272 } else if ( msg == "reloadApps()" ) {
277 sm->reloadApps(); 273 sm->reloadApps();
278 } else if ( msg == "reloadApplets()" ) { 274 } else if ( msg == "reloadApplets()" ) {
279 sysTray->clearApplets(); 275 sysTray->clearApplets();
280 sysTray->addApplets(); 276 sysTray->addApplets();
281 sm->reloadApplets(); 277 sm->reloadApplets();
282 } else if ( msg == "soundAlarm()" ) { 278 } else if ( msg == "soundAlarm()" ) {
283 DesktopApplication::soundAlarm ( ); 279 DesktopApplication::soundAlarm ( );
284 } 280 }
285 else if ( msg == "setLed(int,bool)" ) { 281 else if ( msg == "setLed(int,bool)" ) {
286 int led, status; 282 int led, status;
287 stream >> led >> status; 283 stream >> led >> status;
288 284
289 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); 285 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
290 if ( ll. count ( )){ 286 if ( ll. count ( )){
291 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; 287 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
292 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); 288 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
293 289
294 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); 290 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
295 } 291 }
296 } 292 }
297 else if ( msg == "toggleMenu()" ) { 293 else if ( msg == "toggleMenu()" ) {
298 if ( sm-> launchMenu-> isVisible ( )) 294 if ( sm-> launchMenu-> isVisible ( ))
299 sm-> launch ( ); 295 sm-> launch ( );
300 else { 296 else {
301 QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" ); 297 QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" );
302 } 298 }
303 } 299 }
304 else if ( msg == "toggleStartMenu()" ) { 300 else if ( msg == "toggleStartMenu()" ) {
305 sm-> launch ( ); 301 sm-> launch ( );
306 } 302 }
307} 303}
308 304
309QWidget *TaskBar::calibrate(bool)
310{
311#ifdef Q_WS_QWS
312 Calibrate *c = new Calibrate;
313 c->show();
314 return c;
315#else
316 return 0;
317#endif
318}
319
320void TaskBar::toggleNumLockState() 305void TaskBar::toggleNumLockState()
321{ 306{
322 if ( lockState ) lockState->toggleNumLockState(); 307 if ( lockState ) lockState->toggleNumLockState();
323} 308}
324 309
325void TaskBar::toggleCapsLockState() 310void TaskBar::toggleCapsLockState()
326{ 311{
327 if ( lockState ) lockState->toggleCapsLockState(); 312 if ( lockState ) lockState->toggleCapsLockState();
328} 313}
329 314
330void TaskBar::toggleSymbolInput() 315void TaskBar::toggleSymbolInput()
331{ 316{
332 if ( inputMethods->currentShown() == "Unicode" ) { 317 if ( inputMethods->currentShown() == "Unicode" ) {
333 inputMethods->hideInputMethod(); 318 inputMethods->hideInputMethod();
334 } else { 319 } else {
335 inputMethods->showInputMethod("Unicode"); 320 inputMethods->showInputMethod("Unicode");
336 } 321 }
337} 322}
338 323
339bool TaskBar::recoverMemory() 324bool TaskBar::recoverMemory()
340{ 325{
341 //eturn mru->quitOldApps(); 326 //eturn mru->quitOldApps();
342 return true; 327 return true;
343} 328}
344 329
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index a0bf395..575a8c9 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -1,85 +1,83 @@
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#include <qhbox.h> 24#include <qhbox.h>
25 25
26class QLabel; 26class QLabel;
27class QTimer; 27class QTimer;
28class InputMethods; 28class InputMethods;
29class Wait; 29class Wait;
30class SysTray; 30class SysTray;
31//class MRUList; 31//class MRUList;
32class RunningAppBar; 32class RunningAppBar;
33class QWidgetStack; 33class QWidgetStack;
34class QTimer; 34class QTimer;
35class QLabel; 35class QLabel;
36class StartMenu; 36class StartMenu;
37class LockKeyState; 37class LockKeyState;
38 38
39class TaskBar : public QHBox { 39class TaskBar : public QHBox {
40 Q_OBJECT 40 Q_OBJECT
41public: 41public:
42 TaskBar(); 42 TaskBar();
43 ~TaskBar(); 43 ~TaskBar();
44 44
45 static QWidget *calibrate( bool );
46
47 bool recoverMemory(); 45 bool recoverMemory();
48 46
49 StartMenu *startMenu() const { return sm; } 47 StartMenu *startMenu() const { return sm; }
50public slots: 48public slots:
51 void startWait(); 49 void startWait();
52 void stopWait(const QString&); 50 void stopWait(const QString&);
53 void stopWait(); 51 void stopWait();
54 void clearStatusBar(); 52 void clearStatusBar();
55 void toggleNumLockState(); 53 void toggleNumLockState();
56 void toggleCapsLockState(); 54 void toggleCapsLockState();
57 void toggleSymbolInput(); 55 void toggleSymbolInput();
58 56
59protected: 57protected:
60 void resizeEvent( QResizeEvent * ); 58 void resizeEvent( QResizeEvent * );
61 void styleChange( QStyle & ); 59 void styleChange( QStyle & );
62 void setStatusMessage( const QString &text ); 60 void setStatusMessage( const QString &text );
63 61
64public slots: 62public slots:
65 void calcMaxWindowRect(); 63 void calcMaxWindowRect();
66private slots: 64private slots:
67 void receive( const QCString &msg, const QByteArray &data ); 65 void receive( const QCString &msg, const QByteArray &data );
68 66
69private: 67private:
70 68
71 QTimer *waitTimer; 69 QTimer *waitTimer;
72 Wait *waitIcon; 70 Wait *waitIcon;
73 InputMethods *inputMethods; 71 InputMethods *inputMethods;
74 SysTray *sysTray; 72 SysTray *sysTray;
75 // MRUList *mru; 73 // MRUList *mru;
76 RunningAppBar* runningAppBar; 74 RunningAppBar* runningAppBar;
77 QWidgetStack *stack; 75 QWidgetStack *stack;
78 QTimer *clearer; 76 QTimer *clearer;
79 QLabel *label; 77 QLabel *label;
80 LockKeyState* lockState; 78 LockKeyState* lockState;
81 StartMenu *sm; 79 StartMenu *sm;
82}; 80};
83 81
84 82
85#endif // __TASKBAR_H__ 83#endif // __TASKBAR_H__