summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-21 23:26:23 (UTC)
committer zecke <zecke>2004-02-21 23:26:23 (UTC)
commit7595c4c5e1004efb0b4a3f6dcbd4d2baf7b9c8ac (patch) (unidiff)
treea3fb948d40018eb43c2541d602607b0db7d1fe47
parented771f43dee91ffd1a260581187c7d50453f70ef (diff)
downloadopie-7595c4c5e1004efb0b4a3f6dcbd4d2baf7b9c8ac.zip
opie-7595c4c5e1004efb0b4a3f6dcbd4d2baf7b9c8ac.tar.gz
opie-7595c4c5e1004efb0b4a3f6dcbd4d2baf7b9c8ac.tar.bz2
Randomly jumping in the vtable is fun :)
use libopie2 odevice
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index e18bcee..11381e6 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -1,119 +1,119 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the 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 "serverapp.h" 21#include "serverapp.h"
22 22
23#include <opie/odevice.h> 23#include <opie2/odevice.h>
24 24
25#include <qtopia/password.h> 25#include <qtopia/password.h>
26#include <qtopia/config.h> 26#include <qtopia/config.h>
27#include <qtopia/power.h> 27#include <qtopia/power.h>
28 28
29#ifdef Q_WS_QWS 29#ifdef Q_WS_QWS
30#include <qtopia/qcopenvelope_qws.h> 30#include <qtopia/qcopenvelope_qws.h>
31#endif 31#endif
32#include <qtopia/global.h> 32#include <qtopia/global.h>
33//#include <qtopia/custom.h> 33//#include <qtopia/custom.h>
34 34
35#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
36#include <qgfx_qws.h> 36#include <qgfx_qws.h>
37#endif 37#endif
38#ifdef Q_OS_WIN32 38#ifdef Q_OS_WIN32
39#include <io.h> 39#include <io.h>
40#include <process.h> 40#include <process.h>
41#else 41#else
42#include <unistd.h> 42#include <unistd.h>
43#endif 43#endif
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qtimer.h> 45#include <qtimer.h>
46#include <qpainter.h> 46#include <qpainter.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qpixmapcache.h> 48#include <qpixmapcache.h>
49 49
50#include <stdlib.h> 50#include <stdlib.h>
51#include "screensaver.h" 51#include "screensaver.h"
52 52
53static ServerApplication *serverApp = 0; 53static ServerApplication *serverApp = 0;
54static int loggedin=0; 54static int loggedin=0;
55 55
56using namespace Opie; 56using namespace Opie;
57 57
58QCopKeyRegister::QCopKeyRegister() 58QCopKeyRegister::QCopKeyRegister()
59 : m_keyCode( 0 ) { 59 : m_keyCode( 0 ) {
60} 60}
61 61
62QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) 62QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m )
63 :m_keyCode( k ), m_channel( c ), m_message( m ) { 63 :m_keyCode( k ), m_channel( c ), m_message( m ) {
64} 64}
65 65
66int QCopKeyRegister::keyCode()const { 66int QCopKeyRegister::keyCode()const {
67 return m_keyCode; 67 return m_keyCode;
68} 68}
69 69
70QCString QCopKeyRegister::channel()const { 70QCString QCopKeyRegister::channel()const {
71 return m_channel; 71 return m_channel;
72} 72}
73 73
74QCString QCopKeyRegister::message()const { 74QCString QCopKeyRegister::message()const {
75 return m_message; 75 return m_message;
76} 76}
77 77
78bool QCopKeyRegister::send() { 78bool QCopKeyRegister::send() {
79 if (m_channel.isNull() ) 79 if (m_channel.isNull() )
80 return false; 80 return false;
81 81
82 QCopEnvelope( m_channel, m_message ); 82 QCopEnvelope( m_channel, m_message );
83 83
84 return true; 84 return true;
85} 85}
86 86
87//--------------------------------------------------------------------------- 87//---------------------------------------------------------------------------
88 88
89/* 89/*
90 Priority is number of alerts that are needed to pop up 90 Priority is number of alerts that are needed to pop up
91 alert. 91 alert.
92 */ 92 */
93class DesktopPowerAlerter : public QMessageBox 93class DesktopPowerAlerter : public QMessageBox
94{ 94{
95 Q_OBJECT 95 Q_OBJECT
96public: 96public:
97 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 97 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
98 : QMessageBox( tr("Battery Status"), tr("Low Battery"), 98 : QMessageBox( tr("Battery Status"), tr("Low Battery"),
99 QMessageBox::Critical, 99 QMessageBox::Critical,
100 QMessageBox::Ok | QMessageBox::Default, 100 QMessageBox::Ok | QMessageBox::Default,
101 QMessageBox::NoButton, QMessageBox::NoButton, 101 QMessageBox::NoButton, QMessageBox::NoButton,
102 parent, name, FALSE ) 102 parent, name, FALSE )
103 { 103 {
104 currentPriority = INT_MAX; 104 currentPriority = INT_MAX;
105 alertCount = 0; 105 alertCount = 0;
106 } 106 }
107 107
108 void alert( const QString &text, int priority ); 108 void alert( const QString &text, int priority );
109 void hideEvent( QHideEvent * ); 109 void hideEvent( QHideEvent * );
110private: 110private:
111 int currentPriority; 111 int currentPriority;
112 int alertCount; 112 int alertCount;
113}; 113};
114 114
115void DesktopPowerAlerter::alert( const QString &text, int priority ) 115void DesktopPowerAlerter::alert( const QString &text, int priority )
116{ 116{
117 alertCount++; 117 alertCount++;
118 if ( alertCount < priority ) 118 if ( alertCount < priority )
119 return; 119 return;
@@ -276,224 +276,224 @@ void ServerApplication::switchLCD( bool on ) {
276 dapp-> m_screensaver-> setDisplayState ( true ); 276 dapp-> m_screensaver-> setDisplayState ( true );
277 dapp-> m_screensaver-> setBacklight ( -3 ); 277 dapp-> m_screensaver-> setBacklight ( -3 );
278 }else 278 }else
279 dapp-> m_screensaver-> setDisplayState ( false ); 279 dapp-> m_screensaver-> setDisplayState ( false );
280 280
281 281
282} 282}
283 283
284ServerApplication::ServerApplication( int& argc, char **argv, Type t ) 284ServerApplication::ServerApplication( int& argc, char **argv, Type t )
285 : QPEApplication( argc, argv, t ) 285 : QPEApplication( argc, argv, t )
286{ 286{
287 287
288 288
289 // We know we'll have lots of cached pixmaps due to App/DocLnks 289 // We know we'll have lots of cached pixmaps due to App/DocLnks
290 QPixmapCache::setCacheLimit(512); 290 QPixmapCache::setCacheLimit(512);
291 291
292 m_ps = new PowerStatus; 292 m_ps = new PowerStatus;
293 m_ps_last = new PowerStatus; 293 m_ps_last = new PowerStatus;
294 pa = new DesktopPowerAlerter( 0 ); 294 pa = new DesktopPowerAlerter( 0 );
295 295
296 m_apm_timer = new QTimer( this ); 296 m_apm_timer = new QTimer( this );
297 connect(m_apm_timer, SIGNAL( timeout() ), 297 connect(m_apm_timer, SIGNAL( timeout() ),
298 this, SLOT( apmTimeout() ) ); 298 this, SLOT( apmTimeout() ) );
299 299
300 reloadPowerWarnSettings(); 300 reloadPowerWarnSettings();
301 301
302 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 302 QCopChannel *channel = new QCopChannel( "QPE/System", this );
303 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), 303 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ),
304 this, SLOT(systemMessage(const QCString&, const QByteArray& ) ) ); 304 this, SLOT(systemMessage(const QCString&, const QByteArray& ) ) );
305 305
306 channel = new QCopChannel("QPE/Launcher", this ); 306 channel = new QCopChannel("QPE/Launcher", this );
307 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), 307 connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ),
308 this, SLOT(launcherMessage( const QCString&, const QByteArray& ) ) ); 308 this, SLOT(launcherMessage( const QCString&, const QByteArray& ) ) );
309 309
310 m_screensaver = new OpieScreenSaver(); 310 m_screensaver = new OpieScreenSaver();
311 m_screensaver->setInterval( -1 ); 311 m_screensaver->setInterval( -1 );
312 QWSServer::setScreenSaver( m_screensaver ); 312 QWSServer::setScreenSaver( m_screensaver );
313 313
314 connect( qApp, SIGNAL( volumeChanged( bool ) ), 314 connect( qApp, SIGNAL( volumeChanged( bool ) ),
315 this, SLOT( rereadVolumes() ) ); 315 this, SLOT( rereadVolumes() ) );
316 316
317 317
318 /* ### PluginLoader libqtopia SafeMode */ 318 /* ### PluginLoader libqtopia SafeMode */
319#if 0 319#if 0
320 if ( PluginLoader::inSafeMode() ) 320 if ( PluginLoader::inSafeMode() )
321 QTimer::singleShot(500, this, SLOT(showSafeMode()) ); 321 QTimer::singleShot(500, this, SLOT(showSafeMode()) );
322 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) ); 322 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
323#endif 323#endif
324 324
325 kf = new KeyFilter(this); 325 kf = new KeyFilter(this);
326 326
327 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); 327 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
328 connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); 328 connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
329 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); 329 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
330 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); 330 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
331 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); 331 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
332 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); 332 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
333 connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)), 333 connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
334 this,SIGNAL(activate(const Opie::ODeviceButton*,bool))); 334 this,SIGNAL(activate(const Opie::ODeviceButton*,bool)));
335 335
336 336
337 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); 337 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
338 338
339 connect( this, SIGNAL(power() ), 339 connect( this, SIGNAL(power() ),
340 SLOT(togglePower() ) ); 340 SLOT(togglePower() ) );
341 341
342 rereadVolumes(); 342 rereadVolumes();
343 343
344 serverApp = this; 344 serverApp = this;
345 345
346 apmTimeout(); 346 apmTimeout();
347 grabKeyboard(); 347 grabKeyboard();
348 348
349 /* make sure the event filter is installed */ 349 /* make sure the event filter is installed */
350 const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 ); 350 const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 );
351} 351}
352 352
353 353
354ServerApplication::~ServerApplication() 354ServerApplication::~ServerApplication()
355{ 355{
356 ungrabKeyboard(); 356 ungrabKeyboard();
357 357
358 358
359 delete pa; 359 delete pa;
360 delete m_ps; 360 delete m_ps;
361 delete m_ps_last; 361 delete m_ps_last;
362} 362}
363 363
364void ServerApplication::apmTimeout() { 364void ServerApplication::apmTimeout() {
365 serverApp-> checkMemory( ); // in case no events are generated 365 serverApp-> checkMemory( ); // in case no events are generated
366 *m_ps_last = *m_ps; 366 *m_ps_last = *m_ps;
367 *m_ps = PowerStatusManager::readStatus(); 367 *m_ps = PowerStatusManager::readStatus();
368 368
369 if ( m_ps->acStatus() != m_ps_last-> acStatus() ) 369 if ( m_ps->acStatus() != m_ps_last-> acStatus() )
370 m_screensaver-> powerStatusChanged( *m_ps ); 370 m_screensaver-> powerStatusChanged( *m_ps );
371 371
372 if ( m_ps->acStatus() == PowerStatus::Online ) { 372 if ( m_ps->acStatus() == PowerStatus::Online ) {
373 return; 373 return;
374 } 374 }
375 375
376 int bat = m_ps-> batteryPercentRemaining(); 376 int bat = m_ps-> batteryPercentRemaining();
377 377
378 if ( bat < m_ps_last-> batteryPercentRemaining() ) { 378 if ( bat < m_ps_last-> batteryPercentRemaining() ) {
379 if ( bat <= m_powerCritical ) { 379 if ( bat <= m_powerCritical ) {
380 QMessageBox battlow( 380 QMessageBox battlow(
381 tr("WARNING"), 381 tr("WARNING"),
382 tr("<p>The battery level is critical!" 382 tr("<p>The battery level is critical!"
383 "<p>Keep power off until AC is restored"), 383 "<p>Keep power off until AC is restored"),
384 QMessageBox::Warning, 384 QMessageBox::Warning,
385 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 385 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
386 0, QString::null, TRUE, WStyle_StaysOnTop); 386 0, QString::null, TRUE, WStyle_StaysOnTop);
387 battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); 387 battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
388 battlow.exec(); 388 battlow.exec();
389 } else if ( bat <= m_powerVeryLow ) 389 } else if ( bat <= m_powerVeryLow )
390 pa->alert( tr( "The battery is running very low. "), 2 ); 390 pa->alert( tr( "The battery is running very low. "), 2 );
391 } 391 }
392 392
393 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { 393 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) {
394 QMessageBox battlow( 394 QMessageBox battlow(
395 tr("WARNING"), 395 tr("WARNING"),
396 tr("<p>The Back-up battery is very low" 396 tr("<p>The Back-up battery is very low"
397 "<p>Please charge the back-up battery"), 397 "<p>Please charge the back-up battery"),
398 QMessageBox::Warning, 398 QMessageBox::Warning,
399 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 399 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
400 0, QString::null, TRUE, WStyle_StaysOnTop); 400 0, QString::null, TRUE, WStyle_StaysOnTop);
401 battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); 401 battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
402 battlow.exec(); 402 battlow.exec();
403 } 403 }
404} 404}
405 405
406void ServerApplication::systemMessage( const QCString& msg, 406void ServerApplication::systemMessage( const QCString& msg,
407 const QByteArray& data ) { 407 const QByteArray& data ) {
408 QDataStream stream ( data, IO_ReadOnly ); 408 QDataStream stream ( data, IO_ReadOnly );
409 409
410 if ( msg == "setScreenSaverInterval(int)" ) { 410 if ( msg == "setScreenSaverInterval(int)" ) {
411 int time; 411 int time;
412 stream >> time; 412 stream >> time;
413 m_screensaver-> setInterval( time ); 413 m_screensaver-> setInterval( time );
414 } 414 }
415 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { 415 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) {
416 int t1, t2, t3; 416 int t1, t2, t3;
417 stream >> t1 >> t2 >> t3; 417 stream >> t1 >> t2 >> t3;
418 m_screensaver-> setIntervals( t1, t2, t3 ); 418 m_screensaver-> setIntervals( t1, t2, t3 );
419 } 419 }
420 else if ( msg == "setBacklight(int)" ) { 420 else if ( msg == "setBacklight(int)" ) {
421 int bright; 421 int bright;
422 stream >> bright; 422 stream >> bright;
423 m_screensaver-> setBacklight( bright ); 423 m_screensaver-> setBacklight( bright );
424 } 424 }
425 else if ( msg == "setScreenSaverMode(int)" ) { 425 else if ( msg == "setScreenSaverMode(int)" ) {
426 int mode; 426 int mode;
427 stream >> mode; 427 stream >> mode;
428 m_screensaver-> setMode ( mode ); 428 m_screensaver-> setMode ( mode );
429 } 429 }
430 else if ( msg == "reloadPowerWarnSettings()" ) { 430 else if ( msg == "reloadPowerWarnSettings()" ) {
431 reloadPowerWarnSettings(); 431 reloadPowerWarnSettings();
432 } 432 }
433 else if ( msg == "setDisplayState(int)" ) { 433 else if ( msg == "setDisplayState(int)" ) {
434 int state; 434 int state;
435 stream >> state; 435 stream >> state;
436 m_screensaver-> setDisplayState ( state != 0 ); 436 m_screensaver-> setDisplayState ( state != 0 );
437 } 437 }
438 else if ( msg == "suspend()" ) { 438 else if ( msg == "suspend()" ) {
439 emit power(); 439 emit power();
440 } 440 }
441 else if ( msg == "sendBusinessCard()" ) { 441 else if ( msg == "sendBusinessCard()" ) {
442 QString card = ::getenv ( "HOME" ); 442 QString card = ::getenv ( "HOME" );
443 card += "/Applications/addressbook/businesscard.vcf"; 443 card += "/Applications/addressbook/businesscard.vcf";
444 444
445 if ( QFile::exists( card ) ) { 445 if ( QFile::exists( card ) ) {
446 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); 446 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" );
447 QString mimetype = "text/x-vCard"; 447 QString mimetype = "text/x-vCard";
448 e << tr( "business card" ) << card << mimetype; 448 e << tr( "business card" ) << card << mimetype;
449 } 449 }
450 } 450 }
451} 451}
452 452
453void ServerApplication::reloadPowerWarnSettings ( ) 453void ServerApplication::reloadPowerWarnSettings ( )
454{ 454{
455 Config cfg ( "apm" ); 455 Config cfg ( "apm" );
456 cfg. setGroup ( "Warnings" ); 456 cfg. setGroup ( "Warnings" );
457 457
458 int iv = cfg. readNumEntry ( "checkinterval", 10000 ); 458 int iv = cfg. readNumEntry ( "checkinterval", 10000 );
459 459
460 m_apm_timer-> stop ( ); 460 m_apm_timer-> stop ( );
461 if ( iv ) 461 if ( iv )
462 m_apm_timer-> start ( iv ); 462 m_apm_timer-> start ( iv );
463 463
464 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); 464 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 );
465 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); 465 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 );
466} 466}
467 467
468void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data ) 468void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data )
469{ 469{
470 QDataStream stream ( data, IO_ReadOnly ); 470 QDataStream stream ( data, IO_ReadOnly );
471 471
472 if ( msg == "deviceButton(int,int,int)" ) { 472 if ( msg == "deviceButton(int,int,int)" ) {
473 int keycode, press, autoRepeat; 473 int keycode, press, autoRepeat;
474 stream >> keycode >> press >> autoRepeat; 474 stream >> keycode >> press >> autoRepeat;
475 475
476 kf->checkButtonAction ( true, keycode, press, autoRepeat ); 476 kf->checkButtonAction ( true, keycode, press, autoRepeat );
477 } 477 }
478 else if ( msg == "keyRegister(int,QCString,QCString)" ) { 478 else if ( msg == "keyRegister(int,QCString,QCString)" ) {
479 int k; 479 int k;
480 QCString c, m; 480 QCString c, m;
481 stream >> k >> c >> m; 481 stream >> k >> c >> m;
482 482
483 kf -> registerKey( QCopKeyRegister(k, c, m) ); 483 kf -> registerKey( QCopKeyRegister(k, c, m) );
484 } 484 }
485} 485}
486 486
487 487
488bool ServerApplication::screenLocked() 488bool ServerApplication::screenLocked()
489{ 489{
490 return loggedin == 0; 490 return loggedin == 0;
491} 491}
492 492
493void ServerApplication::login(bool at_poweron) 493void ServerApplication::login(bool at_poweron)
494{ 494{
495 if ( !loggedin ) { 495 if ( !loggedin ) {
496 Global::terminateBuiltin("calibrate"); // No tr 496 Global::terminateBuiltin("calibrate"); // No tr
497 Password::authenticate(at_poweron); 497 Password::authenticate(at_poweron);
498 loggedin=1; 498 loggedin=1;
499#ifndef QT_NO_COP 499#ifndef QT_NO_COP
@@ -733,118 +733,118 @@ void ServerApplication::shutdown( ShutdownImpl::Type t )
733 // will hang on quit() right before it emits aboutToQuit() 733 // will hang on quit() right before it emits aboutToQuit()
734 emit aboutToQuit ( ); 734 emit aboutToQuit ( );
735 735
736 quit(); 736 quit();
737 break; 737 break;
738 } 738 }
739} 739}
740 740
741void ServerApplication::restart() 741void ServerApplication::restart()
742{ 742{
743 if ( allowRestart ) { 743 if ( allowRestart ) {
744 744
745 /* 745 /*
746 * Applets and restart is a problem. Some applets delete 746 * Applets and restart is a problem. Some applets delete
747 * their widgets even if ownership gets transfered to the 747 * their widgets even if ownership gets transfered to the
748 * parent (Systray ) but deleting the applet may be unsafe 748 * parent (Systray ) but deleting the applet may be unsafe
749 * as well ( double deletion ). Some have topLevel widgets 749 * as well ( double deletion ). Some have topLevel widgets
750 * and when we dlclose and then delete the widget we will 750 * and when we dlclose and then delete the widget we will
751 * crash and an crash during restart is not nice 751 * crash and an crash during restart is not nice
752 */ 752 */
753#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED 753#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED
754 /* same as above */ 754 /* same as above */
755 emit aboutToQuit(); 755 emit aboutToQuit();
756 prepareForTermination(TRUE); 756 prepareForTermination(TRUE);
757 doRestart = TRUE; 757 doRestart = TRUE;
758 quit(); 758 quit();
759#else 759#else
760 prepareForTermination( true ); 760 prepareForTermination( true );
761 for ( int fd = 3; fd < 100; fd++ ) 761 for ( int fd = 3; fd < 100; fd++ )
762 close( fd ); 762 close( fd );
763 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 763 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 );
764 exit( 1 ); 764 exit( 1 );
765#endif 765#endif
766 } 766 }
767} 767}
768 768
769void ServerApplication::rereadVolumes() 769void ServerApplication::rereadVolumes()
770{ 770{
771 Config cfg( "qpe" ); 771 Config cfg( "qpe" );
772 cfg. setGroup ( "Volume" ); 772 cfg. setGroup ( "Volume" );
773 773
774 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 774 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
775 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 775 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
776 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 776 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
777} 777}
778 778
779 779
780void ServerApplication::checkMemory() 780void ServerApplication::checkMemory()
781{ 781{
782#if defined(QPE_HAVE_MEMALERTER) 782#if defined(QPE_HAVE_MEMALERTER)
783 static bool ignoreNormal=TRUE; 783 static bool ignoreNormal=TRUE;
784 static bool existingMessage=FALSE; 784 static bool existingMessage=FALSE;
785 785
786 if(existingMessage) 786 if(existingMessage)
787 return; // don't show a second message while still on first 787 return; // don't show a second message while still on first
788 788
789 existingMessage = TRUE; 789 existingMessage = TRUE;
790 switch ( memstate ) { 790 switch ( memstate ) {
791 case MemUnknown: 791 case MemUnknown:
792 break; 792 break;
793 case MemLow: 793 case MemLow:
794 memstate = MemUnknown; 794 memstate = MemUnknown;
795 if ( !recoverMemory() ) { 795 if ( !recoverMemory() ) {
796 QMessageBox::warning( 0 , tr("Memory Status"), 796 QMessageBox::warning( 0 , tr("Memory Status"),
797 tr("Memory Low\nPlease save data.") ); 797 tr("Memory Low\nPlease save data.") );
798 ignoreNormal = FALSE; 798 ignoreNormal = FALSE;
799 } 799 }
800 break; 800 break;
801 case MemNormal: 801 case MemNormal:
802 memstate = MemUnknown; 802 memstate = MemUnknown;
803 if ( !ignoreNormal ) { 803 if ( !ignoreNormal ) {
804 ignoreNormal = TRUE; 804 ignoreNormal = TRUE;
805 QMessageBox::information ( 0 , tr("Memory Status"), 805 QMessageBox::information ( 0 , tr("Memory Status"),
806 "Memory OK" ); 806 "Memory OK" );
807 } 807 }
808 break; 808 break;
809 case MemVeryLow: 809 case MemVeryLow:
810 memstate = MemUnknown; 810 memstate = MemUnknown;
811 QMessageBox::critical( 0 , tr("Memory Status"), 811 QMessageBox::critical( 0 , tr("Memory Status"),
812 tr("Critical Memory Shortage\n" 812 tr("Critical Memory Shortage\n"
813 "Please end this application\n" 813 "Please end this application\n"
814 "immediately.") ); 814 "immediately.") );
815 recoverMemory(); 815 recoverMemory();
816 } 816 }
817 existingMessage = FALSE; 817 existingMessage = FALSE;
818#endif 818#endif
819} 819}
820 820
821bool ServerApplication::recoverMemory() 821bool ServerApplication::recoverMemory()
822{ 822{
823 return FALSE; 823 return FALSE;
824} 824}
825 825
826void ServerApplication::keyClick(int , bool press, bool ) 826void ServerApplication::keyClick(int , bool press, bool )
827{ 827{
828 if ( press && m_keyclick_sound ) 828 if ( press && m_keyclick_sound )
829 ODevice::inst() -> keySound(); 829 ODevice::inst() -> playKeySound();
830 830
831} 831}
832 832
833void ServerApplication::screenClick(bool press) 833void ServerApplication::screenClick(bool press)
834{ 834{
835 if ( press && m_screentap_sound ) 835 if ( press && m_screentap_sound )
836 ODevice::inst() -> touchSound(); 836 ODevice::inst() -> playTouchSound();
837} 837}
838 838
839void ServerApplication::soundAlarm() { 839void ServerApplication::soundAlarm() {
840 if ( me ()->m_alarm_sound ) 840 if ( me ()->m_alarm_sound )
841 ODevice::inst()->alarmSound(); 841 ODevice::inst()->playAlarmSound();
842} 842}
843 843
844ServerApplication *ServerApplication::me ( ) 844ServerApplication *ServerApplication::me ( )
845{ 845{
846 return static_cast<ServerApplication*>( qApp ); 846 return static_cast<ServerApplication*>( qApp );
847} 847}
848 848
849 849
850#include "serverapp.moc" 850#include "serverapp.moc"