-rw-r--r-- | core/launcher/desktop.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 03a23dc..4c239a6 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -9,24 +9,26 @@ | |||
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 <syslog.h> | ||
22 | |||
21 | #include "desktop.h" | 23 | #include "desktop.h" |
22 | #include "info.h" | 24 | #include "info.h" |
23 | #include "launcher.h" | 25 | #include "launcher.h" |
24 | #include "qcopbridge.h" | 26 | #include "qcopbridge.h" |
25 | #include "shutdownimpl.h" | 27 | #include "shutdownimpl.h" |
26 | #include "startmenu.h" | 28 | #include "startmenu.h" |
27 | #include "taskbar.h" | 29 | #include "taskbar.h" |
28 | #include "transferserver.h" | 30 | #include "transferserver.h" |
29 | #include "irserver.h" | 31 | #include "irserver.h" |
30 | #include "packageslave.h" | 32 | #include "packageslave.h" |
31 | #include "screensaver.h" | 33 | #include "screensaver.h" |
32 | 34 | ||
@@ -729,30 +731,38 @@ void Desktop::styleChange( QStyle &s ) | |||
729 | void DesktopApplication::shutdown() | 731 | void DesktopApplication::shutdown() |
730 | { | 732 | { |
731 | if ( type() != GuiServer ) | 733 | if ( type() != GuiServer ) |
732 | return ; | 734 | return ; |
733 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); | 735 | ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); |
734 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), | 736 | connect( sd, SIGNAL( shutdown( ShutdownImpl::Type ) ), |
735 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); | 737 | this, SLOT( shutdown( ShutdownImpl::Type ) ) ); |
736 | sd->showMaximized(); | 738 | sd->showMaximized(); |
737 | } | 739 | } |
738 | 740 | ||
739 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) | 741 | void DesktopApplication::shutdown( ShutdownImpl::Type t ) |
740 | { | 742 | { |
743 | |||
744 | char *opt = 0; | ||
745 | |||
741 | switch ( t ) { | 746 | switch ( t ) { |
742 | case ShutdownImpl::ShutdownSystem: | 747 | case ShutdownImpl::ShutdownSystem: |
743 | execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); | 748 | opt = "-h"; |
744 | break; | 749 | // fall through |
745 | case ShutdownImpl::RebootSystem: | 750 | case ShutdownImpl::RebootSystem: |
746 | execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); | 751 | if ( opt == 0 ) |
752 | opt = "-r"; | ||
753 | |||
754 | if ( execle( "shutdown", "shutdown", opt, "now", ( void* ) 0, "/sbin", "/usr/sbin", ( void* ) 0 ) < 0 ) | ||
755 | ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); | ||
756 | |||
747 | break; | 757 | break; |
748 | case ShutdownImpl::RestartDesktop: | 758 | case ShutdownImpl::RestartDesktop: |
749 | restart(); | 759 | restart(); |
750 | break; | 760 | break; |
751 | case ShutdownImpl::TerminateDesktop: | 761 | case ShutdownImpl::TerminateDesktop: |
752 | prepareForTermination( FALSE ); | 762 | prepareForTermination( FALSE ); |
753 | 763 | ||
754 | // This is a workaround for a Qt bug | 764 | // This is a workaround for a Qt bug |
755 | // clipboard applet has to stop its poll timer, or Qt/E | 765 | // clipboard applet has to stop its poll timer, or Qt/E |
756 | // will hang on quit() right before it emits aboutToQuit() | 766 | // will hang on quit() right before it emits aboutToQuit() |
757 | emit aboutToQuit ( ); | 767 | emit aboutToQuit ( ); |
758 | 768 | ||