summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-17 18:34:36 (UTC)
committer zecke <zecke>2004-10-17 18:34:36 (UTC)
commitca65f8eba5cd7e3a2e3096b545527ced8b76e5cd (patch) (unidiff)
tree96b742d6b8f1322158cdc66a8b3f8357d73ac571
parent8eaae40a6b9db12813be60ec7c8afe21afd4478d (diff)
downloadopie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.zip
opie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.tar.gz
opie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.tar.bz2
-Use local8Bit instead of latin1
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index e541d10..be6b972 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -369,483 +369,483 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t )
369ServerApplication::~ServerApplication() 369ServerApplication::~ServerApplication()
370{ 370{
371 ungrabKeyboard(); 371 ungrabKeyboard();
372 372
373 delete pa; 373 delete pa;
374 delete m_ps; 374 delete m_ps;
375 delete m_ps_last; 375 delete m_ps_last;
376} 376}
377 377
378void ServerApplication::apmTimeout() 378void ServerApplication::apmTimeout()
379{ 379{
380 serverApp-> checkMemory( ); // in case no events are generated 380 serverApp-> checkMemory( ); // in case no events are generated
381 *m_ps_last = *m_ps; 381 *m_ps_last = *m_ps;
382 *m_ps = PowerStatusManager::readStatus(); 382 *m_ps = PowerStatusManager::readStatus();
383 383
384 if ( m_ps->acStatus() != m_ps_last-> acStatus() ) 384 if ( m_ps->acStatus() != m_ps_last-> acStatus() )
385 m_screensaver-> powerStatusChanged( *m_ps ); 385 m_screensaver-> powerStatusChanged( *m_ps );
386 386
387 if ( m_ps->acStatus() == PowerStatus::Online ) { 387 if ( m_ps->acStatus() == PowerStatus::Online ) {
388 return; 388 return;
389 } 389 }
390 390
391 int bat = m_ps-> batteryPercentRemaining(); 391 int bat = m_ps-> batteryPercentRemaining();
392 392
393 if ( bat < m_ps_last-> batteryPercentRemaining() ) { 393 if ( bat < m_ps_last-> batteryPercentRemaining() ) {
394 if ( bat <= m_powerCritical ) { 394 if ( bat <= m_powerCritical ) {
395 QMessageBox battlow( 395 QMessageBox battlow(
396 tr("WARNING"), 396 tr("WARNING"),
397 tr("<p>The battery level is critical!" 397 tr("<p>The battery level is critical!"
398 "<p>Keep power off until AC is restored"), 398 "<p>Keep power off until AC is restored"),
399 QMessageBox::Warning, 399 QMessageBox::Warning,
400 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 400 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
401 0, QString::null, TRUE, WStyle_StaysOnTop); 401 0, QString::null, TRUE, WStyle_StaysOnTop);
402 battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); 402 battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
403 battlow.exec(); 403 battlow.exec();
404 } else if ( bat <= m_powerVeryLow ) 404 } else if ( bat <= m_powerVeryLow )
405 pa->alert( tr( "The battery is running very low. "), 2 ); 405 pa->alert( tr( "The battery is running very low. "), 2 );
406 } 406 }
407 407
408 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { 408 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) {
409 QMessageBox battlow( 409 QMessageBox battlow(
410 tr("WARNING"), 410 tr("WARNING"),
411 tr("<p>The Back-up battery is very low" 411 tr("<p>The Back-up battery is very low"
412 "<p>Please charge the back-up battery"), 412 "<p>Please charge the back-up battery"),
413 QMessageBox::Warning, 413 QMessageBox::Warning,
414 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 414 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
415 0, QString::null, TRUE, WStyle_StaysOnTop); 415 0, QString::null, TRUE, WStyle_StaysOnTop);
416 battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); 416 battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
417 battlow.exec(); 417 battlow.exec();
418 } 418 }
419} 419}
420 420
421void ServerApplication::systemMessage( const QCString& msg, 421void ServerApplication::systemMessage( const QCString& msg,
422 const QByteArray& data ) 422 const QByteArray& data )
423{ 423{
424 QDataStream stream ( data, IO_ReadOnly ); 424 QDataStream stream ( data, IO_ReadOnly );
425 425
426 if ( msg == "setScreenSaverInterval(int)" ) { 426 if ( msg == "setScreenSaverInterval(int)" ) {
427 int time; 427 int time;
428 stream >> time; 428 stream >> time;
429 m_screensaver-> setInterval( time ); 429 m_screensaver-> setInterval( time );
430 } 430 }
431 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { 431 else if ( msg == "setScreenSaverIntervals(int,int,int)" ) {
432 int t1, t2, t3; 432 int t1, t2, t3;
433 stream >> t1 >> t2 >> t3; 433 stream >> t1 >> t2 >> t3;
434 m_screensaver-> setIntervals( t1, t2, t3 ); 434 m_screensaver-> setIntervals( t1, t2, t3 );
435 } 435 }
436 else if ( msg == "setBacklight(int)" ) { 436 else if ( msg == "setBacklight(int)" ) {
437 int bright; 437 int bright;
438 stream >> bright; 438 stream >> bright;
439 m_screensaver-> setBacklight( bright ); 439 m_screensaver-> setBacklight( bright );
440 } 440 }
441 else if ( msg == "setScreenSaverMode(int)" ) { 441 else if ( msg == "setScreenSaverMode(int)" ) {
442 int mode; 442 int mode;
443 stream >> mode; 443 stream >> mode;
444 m_screensaver-> setMode ( mode ); 444 m_screensaver-> setMode ( mode );
445 } 445 }
446 else if ( msg == "reloadPowerWarnSettings()" ) { 446 else if ( msg == "reloadPowerWarnSettings()" ) {
447 reloadPowerWarnSettings(); 447 reloadPowerWarnSettings();
448 } 448 }
449 else if ( msg == "setDisplayState(int)" ) { 449 else if ( msg == "setDisplayState(int)" ) {
450 int state; 450 int state;
451 stream >> state; 451 stream >> state;
452 m_screensaver-> setDisplayState ( state != 0 ); 452 m_screensaver-> setDisplayState ( state != 0 );
453 } 453 }
454 else if ( msg == "suspend()" ) { 454 else if ( msg == "suspend()" ) {
455 emit power(); 455 emit power();
456 } 456 }
457 else if ( msg == "sendBusinessCard()" ) { 457 else if ( msg == "sendBusinessCard()" ) {
458 QString card = ::getenv ( "HOME" ); 458 QString card = ::getenv ( "HOME" );
459 card += "/Applications/addressbook/businesscard.vcf"; 459 card += "/Applications/addressbook/businesscard.vcf";
460 460
461 if ( QFile::exists( card ) ) { 461 if ( QFile::exists( card ) ) {
462 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); 462 QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" );
463 QString mimetype = "text/x-vCard"; 463 QString mimetype = "text/x-vCard";
464 e << tr( "business card" ) << card << mimetype; 464 e << tr( "business card" ) << card << mimetype;
465 } 465 }
466 } 466 }
467} 467}
468 468
469void ServerApplication::reloadPowerWarnSettings ( ) 469void ServerApplication::reloadPowerWarnSettings ( )
470{ 470{
471 Config cfg ( "apm" ); 471 Config cfg ( "apm" );
472 cfg. setGroup ( "Warnings" ); 472 cfg. setGroup ( "Warnings" );
473 473
474 int iv = cfg. readNumEntry ( "checkinterval", 10000 ); 474 int iv = cfg. readNumEntry ( "checkinterval", 10000 );
475 475
476 m_apm_timer-> stop ( ); 476 m_apm_timer-> stop ( );
477 if ( iv ) 477 if ( iv )
478 m_apm_timer-> start ( iv ); 478 m_apm_timer-> start ( iv );
479 479
480 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); 480 m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 );
481 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); 481 m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 );
482} 482}
483 483
484void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data ) 484void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data )
485{ 485{
486 QDataStream stream ( data, IO_ReadOnly ); 486 QDataStream stream ( data, IO_ReadOnly );
487 487
488 if ( msg == "deviceButton(int,int,int)" ) { 488 if ( msg == "deviceButton(int,int,int)" ) {
489 int keycode, press, autoRepeat; 489 int keycode, press, autoRepeat;
490 stream >> keycode >> press >> autoRepeat; 490 stream >> keycode >> press >> autoRepeat;
491 491
492 kf->checkButtonAction ( true, keycode, press, autoRepeat ); 492 kf->checkButtonAction ( true, keycode, press, autoRepeat );
493 } 493 }
494 else if ( msg == "keyRegister(int,QCString,QCString)" ) { 494 else if ( msg == "keyRegister(int,QCString,QCString)" ) {
495 int k; 495 int k;
496 QCString c, m; 496 QCString c, m;
497 stream >> k >> c >> m; 497 stream >> k >> c >> m;
498 498
499 kf -> registerKey( QCopKeyRegister(k, c, m) ); 499 kf -> registerKey( QCopKeyRegister(k, c, m) );
500 } 500 }
501} 501}
502 502
503 503
504bool ServerApplication::screenLocked() 504bool ServerApplication::screenLocked()
505{ 505{
506 return loggedin == 0; 506 return loggedin == 0;
507} 507}
508 508
509void ServerApplication::login(bool at_poweron) 509void ServerApplication::login(bool at_poweron)
510{ 510{
511 if ( !loggedin ) { 511 if ( !loggedin ) {
512 Global::terminateBuiltin("calibrate"); // No tr 512 Global::terminateBuiltin("calibrate"); // No tr
513 int lockMode = at_poweron ? Opie::Security::IfPowerOn : Opie::Security::IfResume; 513 int lockMode = at_poweron ? Opie::Security::IfPowerOn : Opie::Security::IfResume;
514 Opie::Security::MultiauthPassword::authenticate(lockMode); 514 Opie::Security::MultiauthPassword::authenticate(lockMode);
515 loggedin=1; 515 loggedin=1;
516#ifndef QT_NO_COP 516#ifndef QT_NO_COP
517 QCopEnvelope e( "QPE/Desktop", "unlocked()" ); 517 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
518#endif 518#endif
519 } 519 }
520} 520}
521 521
522#if defined(QPE_HAVE_TOGGLELIGHT) 522#if defined(QPE_HAVE_TOGGLELIGHT)
523#include <qtopia/config.h> 523#include <qtopia/config.h>
524 524
525#include <sys/ioctl.h> 525#include <sys/ioctl.h>
526#include <sys/types.h> 526#include <sys/types.h>
527#include <fcntl.h> 527#include <fcntl.h>
528#include <unistd.h> 528#include <unistd.h>
529#include <errno.h> 529#include <errno.h>
530#include <linux/ioctl.h> 530#include <linux/ioctl.h>
531#include <time.h> 531#include <time.h>
532#endif 532#endif
533 533
534namespace { 534namespace {
535 void execAutoStart(const QDateTime& suspendTime ) { 535 void execAutoStart(const QDateTime& suspendTime ) {
536 QString appName; 536 QString appName;
537 int delay; 537 int delay;
538 QDateTime now = QDateTime::currentDateTime(); 538 QDateTime now = QDateTime::currentDateTime();
539 539
540 Config cfg( "autostart" ); 540 Config cfg( "autostart" );
541 cfg.setGroup( "AutoStart" ); 541 cfg.setGroup( "AutoStart" );
542 appName = cfg.readEntry( "Apps", "" ); 542 appName = cfg.readEntry( "Apps", "" );
543 delay = cfg.readNumEntry( "Delay", 0 ); 543 delay = cfg.readNumEntry( "Delay", 0 );
544 544
545 // If the time between suspend and resume was longer then the 545 // If the time between suspend and resume was longer then the
546 // value saved as delay, start the app 546 // value saved as delay, start the app
547 if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { 547 if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) {
548 QCopEnvelope e( "QPE/System", "execute(QString)" ); 548 QCopEnvelope e( "QPE/System", "execute(QString)" );
549 e << QString( appName ); 549 e << QString( appName );
550 } 550 }
551 } 551 }
552} 552}
553 553
554 554
555void ServerApplication::togglePower() 555void ServerApplication::togglePower()
556{ 556{
557 static bool excllock = false; 557 static bool excllock = false;
558 558
559 if ( excllock ) 559 if ( excllock )
560 return ; 560 return ;
561 561
562 excllock = true; 562 excllock = true;
563 563
564 bool wasloggedin = loggedin; 564 bool wasloggedin = loggedin;
565 loggedin = 0; 565 loggedin = 0;
566 m_suspendTime = QDateTime::currentDateTime(); 566 m_suspendTime = QDateTime::currentDateTime();
567 567
568#ifdef QWS 568#ifdef QWS
569 if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) { 569 if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) {
570 // Should use a big black window instead. 570 // Should use a big black window instead.
571 // But this would not show up fast enough 571 // But this would not show up fast enough
572 QGfx *g = qt_screen-> screenGfx ( ); 572 QGfx *g = qt_screen-> screenGfx ( );
573 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); 573 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
574 delete g; 574 delete g;
575 } 575 }
576#endif 576#endif
577 577
578 ODevice::inst ( )-> suspend ( ); 578 ODevice::inst ( )-> suspend ( );
579 579
580 ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call 580 ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call
581 QWSServer::screenSaverActivate ( false ); 581 QWSServer::screenSaverActivate ( false );
582 582
583 { 583 {
584 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep 584 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep
585 } 585 }
586 586
587 if ( wasloggedin ) 587 if ( wasloggedin )
588 login ( true ); 588 login ( true );
589 589
590 execAutoStart(m_suspendTime); 590 execAutoStart(m_suspendTime);
591 //qcopBridge->closeOpenConnections(); 591 //qcopBridge->closeOpenConnections();
592 592
593 excllock = false; 593 excllock = false;
594} 594}
595 595
596void ServerApplication::toggleLight() 596void ServerApplication::toggleLight()
597{ 597{
598#ifndef QT_NO_COP 598#ifndef QT_NO_COP
599 QCopEnvelope e("QPE/System", "setBacklight(int)"); 599 QCopEnvelope e("QPE/System", "setBacklight(int)");
600 e << -2; // toggle 600 e << -2; // toggle
601#endif 601#endif
602} 602}
603 603
604 604
605/* 605/*
606 * We still listen to key events but handle them in 606 * We still listen to key events but handle them in
607 * a special class 607 * a special class
608 */ 608 */
609 609
610bool ServerApplication::eventFilter( QObject *o, QEvent *e) { 610bool ServerApplication::eventFilter( QObject *o, QEvent *e) {
611 if ( e->type() != QEvent::KeyPress && 611 if ( e->type() != QEvent::KeyPress &&
612 e->type() != QEvent::KeyRelease ) 612 e->type() != QEvent::KeyRelease )
613 return QPEApplication::eventFilter( o, e ); 613 return QPEApplication::eventFilter( o, e );
614 614
615 QKeyEvent *ke = static_cast<QKeyEvent*>( e ); 615 QKeyEvent *ke = static_cast<QKeyEvent*>( e );
616 if ( kf->checkButtonAction( true, ke->key(), 616 if ( kf->checkButtonAction( true, ke->key(),
617 e->type() == QEvent::KeyPress, 617 e->type() == QEvent::KeyPress,
618 ke-> isAutoRepeat() )) 618 ke-> isAutoRepeat() ))
619 return true; 619 return true;
620 620
621 return QPEApplication::eventFilter( o, e ); 621 return QPEApplication::eventFilter( o, e );
622 622
623} 623}
624 624
625#ifdef Q_WS_QWS 625#ifdef Q_WS_QWS
626bool ServerApplication::qwsEventFilter( QWSEvent *e ) 626bool ServerApplication::qwsEventFilter( QWSEvent *e )
627{ 627{
628 checkMemory(); 628 checkMemory();
629 629
630 if ( e->type == QWSEvent::Mouse ) { 630 if ( e->type == QWSEvent::Mouse ) {
631 QWSMouseEvent *me = (QWSMouseEvent *)e; 631 QWSMouseEvent *me = (QWSMouseEvent *)e;
632 static bool up = TRUE; 632 static bool up = TRUE;
633 if ( me->simpleData.state&LeftButton ) { 633 if ( me->simpleData.state&LeftButton ) {
634 if ( up ) { 634 if ( up ) {
635 up = FALSE; 635 up = FALSE;
636 screenClick(TRUE); 636 screenClick(TRUE);
637 } 637 }
638 } else if ( !up ) { 638 } else if ( !up ) {
639 up = TRUE; 639 up = TRUE;
640 screenClick(FALSE); 640 screenClick(FALSE);
641 } 641 }
642 } else 642 } else
643 if ( e->type == QWSEvent::Key ) { 643 if ( e->type == QWSEvent::Key ) {
644 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); 644 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e );
645 if ( kf->checkButtonAction( false, 645 if ( kf->checkButtonAction( false,
646 ke-> simpleData.keycode, 646 ke-> simpleData.keycode,
647 ke-> simpleData.is_press, 647 ke-> simpleData.is_press,
648 ke-> simpleData.is_auto_repeat ) ) 648 ke-> simpleData.is_auto_repeat ) )
649 return true; 649 return true;
650 } 650 }
651 651
652 return QPEApplication::qwsEventFilter( e ); 652 return QPEApplication::qwsEventFilter( e );
653} 653}
654#endif 654#endif
655 655
656 656
657/* ### FIXME libqtopia Plugin Safe Mode */ 657/* ### FIXME libqtopia Plugin Safe Mode */
658 658
659void ServerApplication::showSafeMode() 659void ServerApplication::showSafeMode()
660{ 660{
661#if 0 661#if 0
662 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " 662 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, "
663 "and the system is now in Safe Mode. " 663 "and the system is now in Safe Mode. "
664 "Plugins are not loaded in Safe Mode. " 664 "Plugins are not loaded in Safe Mode. "
665 "You can use the Plugin Manager to " 665 "You can use the Plugin Manager to "
666 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) 666 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 )
667 { 667 {
668 Global::execute( "pluginmanager" ); 668 Global::execute( "pluginmanager" );
669 } 669 }
670#endif 670#endif
671} 671}
672 672
673void ServerApplication::clearSafeMode() 673void ServerApplication::clearSafeMode()
674{ 674{
675#if 0 675#if 0
676 // If we've been running OK for a while then we won't bother going into 676 // If we've been running OK for a while then we won't bother going into
677 // safe mode immediately on the next crash. 677 // safe mode immediately on the next crash.
678 Config cfg( "PluginLoader" ); 678 Config cfg( "PluginLoader" );
679 cfg.setGroup( "Global" ); 679 cfg.setGroup( "Global" );
680 QString mode = cfg.readEntry( "Mode", "Normal" ); 680 QString mode = cfg.readEntry( "Mode", "Normal" );
681 if ( mode == "MaybeSafe" ) { 681 if ( mode == "MaybeSafe" ) {
682 cfg.writeEntry( "Mode", "Normal" ); 682 cfg.writeEntry( "Mode", "Normal" );
683 } 683 }
684#endif 684#endif
685} 685}
686 686
687 687
688void ServerApplication::shutdown() 688void ServerApplication::shutdown()
689{ 689{
690 if ( type() != GuiServer ) 690 if ( type() != GuiServer )
691 return; 691 return;
692 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 692 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
693 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), 693 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
694 this, SLOT(shutdown(ShutdownImpl::Type)) ); 694 this, SLOT(shutdown(ShutdownImpl::Type)) );
695 QPEApplication::showWidget( sd ); 695 QPEApplication::showWidget( sd );
696} 696}
697 697
698void ServerApplication::shutdown( ShutdownImpl::Type t ) 698void ServerApplication::shutdown( ShutdownImpl::Type t )
699{ 699{
700 char *opt = 0; 700 char *opt = 0;
701 701
702 switch ( t ) { 702 switch ( t ) {
703 case ShutdownImpl::ShutdownSystem: 703 case ShutdownImpl::ShutdownSystem:
704 opt = "-h"; 704 opt = "-h";
705 // fall through 705 // fall through
706 case ShutdownImpl::RebootSystem: 706 case ShutdownImpl::RebootSystem:
707 if ( opt == 0 ) 707 if ( opt == 0 )
708 opt = "-r"; 708 opt = "-r";
709 709
710 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) 710 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 )
711 perror("shutdown"); 711 perror("shutdown");
712// ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); 712// ::syslog ( LOG_ERR, "Erroring execing shutdown\n" );
713 713
714 break; 714 break;
715 case ShutdownImpl::RestartDesktop: 715 case ShutdownImpl::RestartDesktop:
716 restart(); 716 restart();
717 break; 717 break;
718 case ShutdownImpl::TerminateDesktop: 718 case ShutdownImpl::TerminateDesktop:
719 prepareForTermination( FALSE ); 719 prepareForTermination( FALSE );
720 720
721 // This is a workaround for a Qt bug 721 // This is a workaround for a Qt bug
722 // clipboard applet has to stop its poll timer, or Qt/E 722 // clipboard applet has to stop its poll timer, or Qt/E
723 // will hang on quit() right before it emits aboutToQuit() 723 // will hang on quit() right before it emits aboutToQuit()
724 emit aboutToQuit ( ); 724 emit aboutToQuit ( );
725 725
726 quit(); 726 quit();
727 break; 727 break;
728 } 728 }
729} 729}
730 730
731void ServerApplication::restart() 731void ServerApplication::restart()
732{ 732{
733 if ( allowRestart ) { 733 if ( allowRestart ) {
734 734
735 /* 735 /*
736 * Applets and restart is a problem. Some applets delete 736 * Applets and restart is a problem. Some applets delete
737 * their widgets even if ownership gets transfered to the 737 * their widgets even if ownership gets transfered to the
738 * parent (Systray ) but deleting the applet may be unsafe 738 * parent (Systray ) but deleting the applet may be unsafe
739 * as well ( double deletion ). Some have topLevel widgets 739 * as well ( double deletion ). Some have topLevel widgets
740 * and when we dlclose and then delete the widget we will 740 * and when we dlclose and then delete the widget we will
741 * crash and an crash during restart is not nice 741 * crash and an crash during restart is not nice
742 */ 742 */
743#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED 743#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED
744 /* same as above */ 744 /* same as above */
745 emit aboutToQuit(); 745 emit aboutToQuit();
746 prepareForTermination(TRUE); 746 prepareForTermination(TRUE);
747 doRestart = TRUE; 747 doRestart = TRUE;
748 quit(); 748 quit();
749#else 749#else
750 prepareForTermination( true ); 750 prepareForTermination( true );
751 for ( int fd = 3; fd < 100; fd++ ) 751 for ( int fd = 3; fd < 100; fd++ )
752 close( fd ); 752 close( fd );
753 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 753 execl( ( qpeDir() + "/bin/qpe" ).local8Bit(), "qpe", NULL );
754 exit( 1 ); 754 exit( 1 );
755#endif 755#endif
756 } 756 }
757} 757}
758 758
759void ServerApplication::rereadVolumes() 759void ServerApplication::rereadVolumes()
760{ 760{
761 Config cfg( "qpe" ); 761 Config cfg( "qpe" );
762 cfg. setGroup ( "Volume" ); 762 cfg. setGroup ( "Volume" );
763 763
764 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 764 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
765 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 765 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
766 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 766 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
767} 767}
768 768
769 769
770void ServerApplication::checkMemory() 770void ServerApplication::checkMemory()
771{ 771{
772#if defined(QPE_HAVE_MEMALERTER) 772#if defined(QPE_HAVE_MEMALERTER)
773 static bool ignoreNormal=TRUE; 773 static bool ignoreNormal=TRUE;
774 static bool existingMessage=FALSE; 774 static bool existingMessage=FALSE;
775 775
776 if(existingMessage) 776 if(existingMessage)
777 return; // don't show a second message while still on first 777 return; // don't show a second message while still on first
778 778
779 existingMessage = TRUE; 779 existingMessage = TRUE;
780 switch ( memstate ) { 780 switch ( memstate ) {
781 case MemUnknown: 781 case MemUnknown:
782 break; 782 break;
783 case MemLow: 783 case MemLow:
784 memstate = MemUnknown; 784 memstate = MemUnknown;
785 if ( !recoverMemory() ) { 785 if ( !recoverMemory() ) {
786 QMessageBox::warning( 0 , tr("Memory Status"), 786 QMessageBox::warning( 0 , tr("Memory Status"),
787 tr("Memory Low\nPlease save data.") ); 787 tr("Memory Low\nPlease save data.") );
788 ignoreNormal = FALSE; 788 ignoreNormal = FALSE;
789 } 789 }
790 break; 790 break;
791 case MemNormal: 791 case MemNormal:
792 memstate = MemUnknown; 792 memstate = MemUnknown;
793 if ( !ignoreNormal ) { 793 if ( !ignoreNormal ) {
794 ignoreNormal = TRUE; 794 ignoreNormal = TRUE;
795 QMessageBox::information ( 0 , tr("Memory Status"), 795 QMessageBox::information ( 0 , tr("Memory Status"),
796 "Memory OK" ); 796 "Memory OK" );
797 } 797 }
798 break; 798 break;
799 case MemVeryLow: 799 case MemVeryLow:
800 memstate = MemUnknown; 800 memstate = MemUnknown;
801 QMessageBox::critical( 0 , tr("Memory Status"), 801 QMessageBox::critical( 0 , tr("Memory Status"),
802 tr("Critical Memory Shortage\n" 802 tr("Critical Memory Shortage\n"
803 "Please end this application\n" 803 "Please end this application\n"
804 "immediately.") ); 804 "immediately.") );
805 recoverMemory(); 805 recoverMemory();
806 } 806 }
807 existingMessage = FALSE; 807 existingMessage = FALSE;
808#endif 808#endif
809} 809}
810 810
811bool ServerApplication::recoverMemory() 811bool ServerApplication::recoverMemory()
812{ 812{
813 return FALSE; 813 return FALSE;
814} 814}
815 815
816void ServerApplication::keyClick(int , bool press, bool ) 816void ServerApplication::keyClick(int , bool press, bool )
817{ 817{
818 if ( press && m_keyclick_sound ) 818 if ( press && m_keyclick_sound )
819 ODevice::inst() -> playKeySound(); 819 ODevice::inst() -> playKeySound();
820 820
821} 821}
822 822
823void ServerApplication::screenClick(bool press) 823void ServerApplication::screenClick(bool press)
824{ 824{
825 if ( press && m_screentap_sound ) 825 if ( press && m_screentap_sound )
826 ODevice::inst() -> playTouchSound(); 826 ODevice::inst() -> playTouchSound();
827} 827}
828 828
829void ServerApplication::soundAlarm() { 829void ServerApplication::soundAlarm() {
830 if ( me ()->m_alarm_sound ) 830 if ( me ()->m_alarm_sound )
831 ODevice::inst()->playAlarmSound(); 831 ODevice::inst()->playAlarmSound();
832} 832}
833 833
834ServerApplication *ServerApplication::me ( ) 834ServerApplication *ServerApplication::me ( )
835{ 835{
836 return static_cast<ServerApplication*>( qApp ); 836 return static_cast<ServerApplication*>( qApp );
837} 837}
838 838
839bool ServerApplication::isStarting() 839bool ServerApplication::isStarting()
840{ 840{
841 return ms_is_starting; 841 return ms_is_starting;
842} 842}
843 843
844int ServerApplication::exec() 844int ServerApplication::exec()
845{ 845{
846 ms_is_starting = true; 846 ms_is_starting = true;
847 odebug << "Serverapp - exec" << oendl; 847 odebug << "Serverapp - exec" << oendl;
848 return QPEApplication::exec(); 848 return QPEApplication::exec();
849} 849}
850 850
851#include "serverapp.moc" 851#include "serverapp.moc"