summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-26 06:42:17 (UTC)
committer llornkcor <llornkcor>2004-04-26 06:42:17 (UTC)
commit4f6f06bab5c52c645ac33bdf77d4ed462b7c6a96 (patch) (unidiff)
treec1c6adc8c197ea923b1cb8c784f5968ca5fe906b
parent0e3e74030b2a38cfc754d253ab098a1126f382ef (diff)
downloadopie-4f6f06bab5c52c645ac33bdf77d4ed462b7c6a96.zip
opie-4f6f06bab5c52c645ac33bdf77d4ed462b7c6a96.tar.gz
opie-4f6f06bab5c52c645ac33bdf77d4ed462b7c6a96.tar.bz2
make shutdown app move to more proper position so it doesn't cut off the titlebar
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index cf543ce..807942d 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -612,192 +612,194 @@ void ServerApplication::toggleLight()
612#ifndef QT_NO_COP 612#ifndef QT_NO_COP
613 QCopEnvelope e("QPE/System", "setBacklight(int)"); 613 QCopEnvelope e("QPE/System", "setBacklight(int)");
614 e << -2; // toggle 614 e << -2; // toggle
615#endif 615#endif
616} 616}
617 617
618 618
619/* 619/*
620 * We still listen to key events but handle them in 620 * We still listen to key events but handle them in
621 * a special class 621 * a special class
622 */ 622 */
623 623
624bool ServerApplication::eventFilter( QObject *o, QEvent *e) { 624bool ServerApplication::eventFilter( QObject *o, QEvent *e) {
625 if ( e->type() != QEvent::KeyPress && 625 if ( e->type() != QEvent::KeyPress &&
626 e->type() != QEvent::KeyRelease ) 626 e->type() != QEvent::KeyRelease )
627 return QPEApplication::eventFilter( o, e ); 627 return QPEApplication::eventFilter( o, e );
628 628
629 QKeyEvent *ke = static_cast<QKeyEvent*>( e ); 629 QKeyEvent *ke = static_cast<QKeyEvent*>( e );
630 if ( kf->checkButtonAction( true, ke->key(), 630 if ( kf->checkButtonAction( true, ke->key(),
631 e->type() == QEvent::KeyPress, 631 e->type() == QEvent::KeyPress,
632 ke-> isAutoRepeat() )) 632 ke-> isAutoRepeat() ))
633 return true; 633 return true;
634 634
635 return QPEApplication::eventFilter( o, e ); 635 return QPEApplication::eventFilter( o, e );
636 636
637} 637}
638 638
639#ifdef Q_WS_QWS 639#ifdef Q_WS_QWS
640bool ServerApplication::qwsEventFilter( QWSEvent *e ) 640bool ServerApplication::qwsEventFilter( QWSEvent *e )
641{ 641{
642 checkMemory(); 642 checkMemory();
643 643
644 if ( e->type == QWSEvent::Mouse ) { 644 if ( e->type == QWSEvent::Mouse ) {
645 QWSMouseEvent *me = (QWSMouseEvent *)e; 645 QWSMouseEvent *me = (QWSMouseEvent *)e;
646 static bool up = TRUE; 646 static bool up = TRUE;
647 if ( me->simpleData.state&LeftButton ) { 647 if ( me->simpleData.state&LeftButton ) {
648 if ( up ) { 648 if ( up ) {
649 up = FALSE; 649 up = FALSE;
650 screenClick(TRUE); 650 screenClick(TRUE);
651 } 651 }
652 } else if ( !up ) { 652 } else if ( !up ) {
653 up = TRUE; 653 up = TRUE;
654 screenClick(FALSE); 654 screenClick(FALSE);
655 } 655 }
656 }else if ( e->type == QWSEvent::Key ) { 656 }else if ( e->type == QWSEvent::Key ) {
657 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); 657 QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e );
658 if ( kf->checkButtonAction( false, 658 if ( kf->checkButtonAction( false,
659 ke-> simpleData.keycode, 659 ke-> simpleData.keycode,
660 ke-> simpleData.is_press, 660 ke-> simpleData.is_press,
661 ke-> simpleData.is_auto_repeat ) ) 661 ke-> simpleData.is_auto_repeat ) )
662 return true; 662 return true;
663 } 663 }
664 664
665 return QPEApplication::qwsEventFilter( e ); 665 return QPEApplication::qwsEventFilter( e );
666} 666}
667#endif 667#endif
668 668
669 669
670/* ### FIXME libqtopia Plugin Safe Mode */ 670/* ### FIXME libqtopia Plugin Safe Mode */
671 671
672void ServerApplication::showSafeMode() 672void ServerApplication::showSafeMode()
673{ 673{
674#if 0 674#if 0
675 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " 675 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, "
676 "and the system is now in Safe Mode. " 676 "and the system is now in Safe Mode. "
677 "Plugins are not loaded in Safe Mode. " 677 "Plugins are not loaded in Safe Mode. "
678 "You can use the Plugin Manager to " 678 "You can use the Plugin Manager to "
679 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) { 679 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) {
680 Global::execute( "pluginmanager" ); 680 Global::execute( "pluginmanager" );
681 } 681 }
682#endif 682#endif
683} 683}
684 684
685void ServerApplication::clearSafeMode() 685void ServerApplication::clearSafeMode()
686{ 686{
687#if 0 687#if 0
688 // If we've been running OK for a while then we won't bother going into 688 // If we've been running OK for a while then we won't bother going into
689 // safe mode immediately on the next crash. 689 // safe mode immediately on the next crash.
690 Config cfg( "PluginLoader" ); 690 Config cfg( "PluginLoader" );
691 cfg.setGroup( "Global" ); 691 cfg.setGroup( "Global" );
692 QString mode = cfg.readEntry( "Mode", "Normal" ); 692 QString mode = cfg.readEntry( "Mode", "Normal" );
693 if ( mode == "MaybeSafe" ) { 693 if ( mode == "MaybeSafe" ) {
694 cfg.writeEntry( "Mode", "Normal" ); 694 cfg.writeEntry( "Mode", "Normal" );
695 } 695 }
696#endif 696#endif
697} 697}
698 698
699 699
700void ServerApplication::shutdown() 700void ServerApplication::shutdown()
701{ 701{
702 if ( type() != GuiServer ) 702 if ( type() != GuiServer )
703 return; 703 return;
704 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 704 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
705 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), 705 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
706 this, SLOT(shutdown(ShutdownImpl::Type)) ); 706 this, SLOT(shutdown(ShutdownImpl::Type)) );
707 QPEApplication::showWidget( sd ); 707 QPEApplication::showWidget( sd );
708 sd->move(0,0);
709
708} 710}
709 711
710void ServerApplication::shutdown( ShutdownImpl::Type t ) 712void ServerApplication::shutdown( ShutdownImpl::Type t )
711{ 713{
712 char *opt = 0; 714 char *opt = 0;
713 715
714 switch ( t ) { 716 switch ( t ) {
715 case ShutdownImpl::ShutdownSystem: 717 case ShutdownImpl::ShutdownSystem:
716 opt = "-h"; 718 opt = "-h";
717 // fall through 719 // fall through
718 case ShutdownImpl::RebootSystem: 720 case ShutdownImpl::RebootSystem:
719 if ( opt == 0 ) 721 if ( opt == 0 )
720 opt = "-r"; 722 opt = "-r";
721 723
722 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) 724 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 )
723 perror("shutdown"); 725 perror("shutdown");
724 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); 726 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" );
725 727
726 break; 728 break;
727 case ShutdownImpl::RestartDesktop: 729 case ShutdownImpl::RestartDesktop:
728 restart(); 730 restart();
729 break; 731 break;
730 case ShutdownImpl::TerminateDesktop: 732 case ShutdownImpl::TerminateDesktop:
731 prepareForTermination( FALSE ); 733 prepareForTermination( FALSE );
732 734
733 // This is a workaround for a Qt bug 735 // This is a workaround for a Qt bug
734 // clipboard applet has to stop its poll timer, or Qt/E 736 // clipboard applet has to stop its poll timer, or Qt/E
735 // will hang on quit() right before it emits aboutToQuit() 737 // will hang on quit() right before it emits aboutToQuit()
736 emit aboutToQuit ( ); 738 emit aboutToQuit ( );
737 739
738 quit(); 740 quit();
739 break; 741 break;
740 } 742 }
741} 743}
742 744
743void ServerApplication::restart() 745void ServerApplication::restart()
744{ 746{
745 if ( allowRestart ) { 747 if ( allowRestart ) {
746 748
747 /* 749 /*
748 * Applets and restart is a problem. Some applets delete 750 * Applets and restart is a problem. Some applets delete
749 * their widgets even if ownership gets transfered to the 751 * their widgets even if ownership gets transfered to the
750 * parent (Systray ) but deleting the applet may be unsafe 752 * parent (Systray ) but deleting the applet may be unsafe
751 * as well ( double deletion ). Some have topLevel widgets 753 * as well ( double deletion ). Some have topLevel widgets
752 * and when we dlclose and then delete the widget we will 754 * and when we dlclose and then delete the widget we will
753 * crash and an crash during restart is not nice 755 * crash and an crash during restart is not nice
754 */ 756 */
755#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED 757#ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED
756 /* same as above */ 758 /* same as above */
757 emit aboutToQuit(); 759 emit aboutToQuit();
758 prepareForTermination(TRUE); 760 prepareForTermination(TRUE);
759 doRestart = TRUE; 761 doRestart = TRUE;
760 quit(); 762 quit();
761#else 763#else
762 prepareForTermination( true ); 764 prepareForTermination( true );
763 for ( int fd = 3; fd < 100; fd++ ) 765 for ( int fd = 3; fd < 100; fd++ )
764 close( fd ); 766 close( fd );
765 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 767 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 );
766 exit( 1 ); 768 exit( 1 );
767#endif 769#endif
768 } 770 }
769} 771}
770 772
771void ServerApplication::rereadVolumes() 773void ServerApplication::rereadVolumes()
772{ 774{
773 Config cfg( "qpe" ); 775 Config cfg( "qpe" );
774 cfg. setGroup ( "Volume" ); 776 cfg. setGroup ( "Volume" );
775 777
776 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 778 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
777 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 779 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
778 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 780 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
779} 781}
780 782
781 783
782void ServerApplication::checkMemory() 784void ServerApplication::checkMemory()
783{ 785{
784#if defined(QPE_HAVE_MEMALERTER) 786#if defined(QPE_HAVE_MEMALERTER)
785 static bool ignoreNormal=TRUE; 787 static bool ignoreNormal=TRUE;
786 static bool existingMessage=FALSE; 788 static bool existingMessage=FALSE;
787 789
788 if(existingMessage) 790 if(existingMessage)
789 return; // don't show a second message while still on first 791 return; // don't show a second message while still on first
790 792
791 existingMessage = TRUE; 793 existingMessage = TRUE;
792 switch ( memstate ) { 794 switch ( memstate ) {
793 case MemUnknown: 795 case MemUnknown:
794 break; 796 break;
795 case MemLow: 797 case MemLow:
796 memstate = MemUnknown; 798 memstate = MemUnknown;
797 if ( !recoverMemory() ) { 799 if ( !recoverMemory() ) {
798 QMessageBox::warning( 0 , tr("Memory Status"), 800 QMessageBox::warning( 0 , tr("Memory Status"),
799 tr("Memory Low\nPlease save data.") ); 801 tr("Memory Low\nPlease save data.") );
800 ignoreNormal = FALSE; 802 ignoreNormal = FALSE;
801 } 803 }
802 break; 804 break;
803 case MemNormal: 805 case MemNormal: