-rw-r--r-- | core/launcher/serverapp.cpp | 2 |
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 | |||
@@ -657,193 +657,193 @@ bool ServerApplication::qwsEventFilter( QWSEvent *e ) | |||
657 | /* ### FIXME libqtopia Plugin Safe Mode */ | 657 | /* ### FIXME libqtopia Plugin Safe Mode */ |
658 | 658 | ||
659 | void ServerApplication::showSafeMode() | 659 | void 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 | ||
673 | void ServerApplication::clearSafeMode() | 673 | void 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 | ||
688 | void ServerApplication::shutdown() | 688 | void 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 | ||
698 | void ServerApplication::shutdown( ShutdownImpl::Type t ) | 698 | void 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 | ||
731 | void ServerApplication::restart() | 731 | void 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 | ||
759 | void ServerApplication::rereadVolumes() | 759 | void 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 | ||
770 | void ServerApplication::checkMemory() | 770 | void 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 | ||
811 | bool ServerApplication::recoverMemory() | 811 | bool ServerApplication::recoverMemory() |
812 | { | 812 | { |
813 | return FALSE; | 813 | return FALSE; |
814 | } | 814 | } |
815 | 815 | ||
816 | void ServerApplication::keyClick(int , bool press, bool ) | 816 | void 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 | ||
823 | void ServerApplication::screenClick(bool press) | 823 | void 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 | ||
829 | void ServerApplication::soundAlarm() { | 829 | void 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 | ||
834 | ServerApplication *ServerApplication::me ( ) | 834 | ServerApplication *ServerApplication::me ( ) |
835 | { | 835 | { |
836 | return static_cast<ServerApplication*>( qApp ); | 836 | return static_cast<ServerApplication*>( qApp ); |
837 | } | 837 | } |
838 | 838 | ||
839 | bool ServerApplication::isStarting() | 839 | bool ServerApplication::isStarting() |
840 | { | 840 | { |
841 | return ms_is_starting; | 841 | return ms_is_starting; |
842 | } | 842 | } |
843 | 843 | ||
844 | int ServerApplication::exec() | 844 | int 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 | } |