summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 5ecc8bf..ba4fd66 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -647,203 +647,203 @@ void Desktop::execAutoStart()
647#include <fcntl.h> 647#include <fcntl.h>
648#include <unistd.h> 648#include <unistd.h>
649#include <errno.h> 649#include <errno.h>
650#include <linux/ioctl.h> 650#include <linux/ioctl.h>
651#include <time.h> 651#include <time.h>
652#endif 652#endif
653 653
654 654
655void Desktop::togglePower() 655void Desktop::togglePower()
656{ 656{
657 static bool excllock = false; 657 static bool excllock = false;
658 658
659 qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); 659 qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 );
660 660
661 if ( excllock ) 661 if ( excllock )
662 return ; 662 return ;
663 663
664 excllock = true; 664 excllock = true;
665 665
666 bool wasloggedin = loggedin; 666 bool wasloggedin = loggedin;
667 loggedin = 0; 667 loggedin = 0;
668 suspendTime = QDateTime::currentDateTime(); 668 suspendTime = QDateTime::currentDateTime();
669 669
670#ifdef QWS 670#ifdef QWS
671 671
672 if ( Password::needToAuthenticate ( true ) && qt_screen ) { 672 if ( Password::needToAuthenticate ( true ) && qt_screen ) {
673 // Should use a big black window instead. 673 // Should use a big black window instead.
674 // But this would not show up fast enough 674 // But this would not show up fast enough
675 QGfx *g = qt_screen-> screenGfx ( ); 675 QGfx *g = qt_screen-> screenGfx ( );
676 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); 676 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
677 delete g; 677 delete g;
678 } 678 }
679#endif 679#endif
680 680
681 ODevice::inst ( )-> suspend ( ); 681 ODevice::inst ( )-> suspend ( );
682 682
683 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call 683 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call
684 QWSServer::screenSaverActivate ( false ); 684 QWSServer::screenSaverActivate ( false );
685 685
686 { 686 {
687 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep 687 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep
688 } 688 }
689 689
690 if ( wasloggedin ) 690 if ( wasloggedin )
691 login ( true ); 691 login ( true );
692 692
693 execAutoStart(); 693 execAutoStart();
694 //qcopBridge->closeOpenConnections(); 694 //qcopBridge->closeOpenConnections();
695 695
696 excllock = false; 696 excllock = false;
697} 697}
698 698
699void Desktop::toggleLight() 699void Desktop::toggleLight()
700{ 700{
701 QCopEnvelope e( "QPE/System", "setBacklight(int)" ); 701 QCopEnvelope e( "QPE/System", "setBacklight(int)" );
702 e << -2; // toggle 702 e << -2; // toggle
703} 703}
704 704
705void Desktop::toggleSymbolInput() 705void Desktop::toggleSymbolInput()
706{ 706{
707 tb->toggleSymbolInput(); 707 tb->toggleSymbolInput();
708} 708}
709 709
710void Desktop::toggleNumLockState() 710void Desktop::toggleNumLockState()
711{ 711{
712 tb->toggleNumLockState(); 712 tb->toggleNumLockState();
713} 713}
714 714
715void Desktop::toggleCapsLockState() 715void Desktop::toggleCapsLockState()
716{ 716{
717 tb->toggleCapsLockState(); 717 tb->toggleCapsLockState();
718} 718}
719 719
720void Desktop::styleChange( QStyle &s ) 720void Desktop::styleChange( QStyle &s )
721{ 721{
722 QWidget::styleChange( s ); 722 QWidget::styleChange( s );
723 int displayw = qApp->desktop() ->width(); 723 int displayw = qApp->desktop() ->width();
724 int displayh = qApp->desktop() ->height(); 724 int displayh = qApp->desktop() ->height();
725 725
726 QSize sz = tb->sizeHint(); 726 QSize sz = tb->sizeHint();
727 727
728 tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() ); 728 tb->setGeometry( 0, displayh - sz.height(), displayw, sz.height() );
729} 729}
730 730
731void DesktopApplication::shutdown() 731void DesktopApplication::shutdown()
732{ 732{
733 if ( type() != GuiServer ) 733 if ( type() != GuiServer )
734 return ; 734 return ;
735 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 735 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
736 connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), 736 connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ),
737 this, SLOT( shutdown( ShutdownImpl::Type ) ) ); 737 this, SLOT( shutdown( ShutdownImpl::Type ) ) );
738 sd->showMaximized(); 738 sd->showMaximized();
739} 739}
740 740
741void DesktopApplication::shutdown( ShutdownImpl::Type t ) 741void DesktopApplication::shutdown( ShutdownImpl::Type t )
742{ 742{
743 char *path[] = { "/sbin", "/usr/sbin", 0 };
744 char *opt = 0; 743 char *opt = 0;
745 744
746 switch ( t ) { 745 switch ( t ) {
747 case ShutdownImpl::ShutdownSystem: 746 case ShutdownImpl::ShutdownSystem:
748 opt = "-h"; 747 opt = "-h";
749 // fall through 748 // fall through
750 case ShutdownImpl::RebootSystem: 749 case ShutdownImpl::RebootSystem:
751 if ( opt == 0 ) 750 if ( opt == 0 )
752 opt = "-r"; 751 opt = "-r";
753 752
754 if ( execle( "shutdown", "shutdown", opt, "now", ( void* ) 0, path ) < 0 ) 753 if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 )
755 ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); 754 perror("shutdown");
755 // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" );
756 756
757 break; 757 break;
758 case ShutdownImpl::RestartDesktop: 758 case ShutdownImpl::RestartDesktop:
759 restart(); 759 restart();
760 break; 760 break;
761 case ShutdownImpl::TerminateDesktop: 761 case ShutdownImpl::TerminateDesktop:
762 prepareForTermination( FALSE ); 762 prepareForTermination( FALSE );
763 763
764 // This is a workaround for a Qt bug 764 // This is a workaround for a Qt bug
765 // clipboard applet has to stop its poll timer, or Qt/E 765 // clipboard applet has to stop its poll timer, or Qt/E
766 // will hang on quit() right before it emits aboutToQuit() 766 // will hang on quit() right before it emits aboutToQuit()
767 emit aboutToQuit ( ); 767 emit aboutToQuit ( );
768 768
769 quit(); 769 quit();
770 break; 770 break;
771 } 771 }
772} 772}
773 773
774void DesktopApplication::restart() 774void DesktopApplication::restart()
775{ 775{
776 prepareForTermination( TRUE ); 776 prepareForTermination( TRUE );
777 777
778#ifdef Q_WS_QWS 778#ifdef Q_WS_QWS
779 779
780 for ( int fd = 3; fd < 100; fd++ ) 780 for ( int fd = 3; fd < 100; fd++ )
781 close( fd ); 781 close( fd );
782#if defined(QT_DEMO_SINGLE_FLOPPY) 782#if defined(QT_DEMO_SINGLE_FLOPPY)
783 783
784 execl( "/sbin/init", "qpe", 0 ); 784 execl( "/sbin/init", "qpe", 0 );
785#elif defined(QT_QWS_CASSIOPEIA) 785#elif defined(QT_QWS_CASSIOPEIA)
786 786
787 execl( "/bin/sh", "sh", 0 ); 787 execl( "/bin/sh", "sh", 0 );
788#else 788#else
789 789
790 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); 790 execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 );
791#endif 791#endif
792 792
793 exit( 1 ); 793 exit( 1 );
794#endif 794#endif
795} 795}
796 796
797void Desktop::startTransferServer() 797void Desktop::startTransferServer()
798{ 798{
799 // start qcop bridge server 799 // start qcop bridge server
800 qcopBridge = new QCopBridge( 4243 ); 800 qcopBridge = new QCopBridge( 4243 );
801 if ( !qcopBridge->ok() ) { 801 if ( !qcopBridge->ok() ) {
802 delete qcopBridge; 802 delete qcopBridge;
803 qcopBridge = 0; 803 qcopBridge = 0;
804 } 804 }
805 // start transfer server 805 // start transfer server
806 transferServer = new TransferServer( 4242 ); 806 transferServer = new TransferServer( 4242 );
807 if ( !transferServer->ok() ) { 807 if ( !transferServer->ok() ) {
808 delete transferServer; 808 delete transferServer;
809 transferServer = 0; 809 transferServer = 0;
810 } 810 }
811 if ( !transferServer || !qcopBridge ) 811 if ( !transferServer || !qcopBridge )
812 startTimer( 2000 ); 812 startTimer( 2000 );
813} 813}
814 814
815void Desktop::timerEvent( QTimerEvent *e ) 815void Desktop::timerEvent( QTimerEvent *e )
816{ 816{
817 killTimer( e->timerId() ); 817 killTimer( e->timerId() );
818 startTransferServer(); 818 startTransferServer();
819} 819}
820 820
821void Desktop::terminateServers() 821void Desktop::terminateServers()
822{ 822{
823 delete transferServer; 823 delete transferServer;
824 delete qcopBridge; 824 delete qcopBridge;
825 transferServer = 0; 825 transferServer = 0;
826 qcopBridge = 0; 826 qcopBridge = 0;
827} 827}
828 828
829void DesktopApplication::rereadVolumes() 829void DesktopApplication::rereadVolumes()
830{ 830{
831 Config cfg( "qpe" ); 831 Config cfg( "qpe" );
832 cfg. setGroup ( "Volume" ); 832 cfg. setGroup ( "Volume" );
833 833
834 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); 834 m_screentap_sound = cfg. readBoolEntry ( "TouchSound" );
835 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); 835 m_keyclick_sound = cfg. readBoolEntry ( "KeySound" );
836 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); 836 m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" );
837} 837}
838 838
839void DesktopApplication::soundAlarm() 839void DesktopApplication::soundAlarm()
840{ 840{
841 if ( me ( )-> m_alarm_sound ) 841 if ( me ( )-> m_alarm_sound )
842 ODevice::inst ( )-> alarmSound ( ); 842 ODevice::inst ( )-> alarmSound ( );
843} 843}
844 844
845DesktopApplication *DesktopApplication::me ( ) 845DesktopApplication *DesktopApplication::me ( )
846{ 846{
847 return (DesktopApplication *) qApp; 847 return (DesktopApplication *) qApp;
848} 848}
849 849