summaryrefslogtreecommitdiffstats
path: root/ksmserver/server.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-25 16:08:46 +0000
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-25 16:08:46 +0000
commit55a0cc423fbf014b8f016d4b0128ce2924bba6ce (patch)
tree9cd21a9be467d25b01cbb80d26cb8d478d84164b /ksmserver/server.cpp
parent704eedf364cefe87cf5c63cb61a3c6051a37a585 (diff)
downloadtdebase-55a0cc423fbf014b8f016d4b0128ce2924bba6ce.tar.gz
tdebase-55a0cc423fbf014b8f016d4b0128ce2924bba6ce.zip
Use TDE hardware library to authorize and control shutdown related session options
This resolves Bug 1071
Diffstat (limited to 'ksmserver/server.cpp')
-rw-r--r--ksmserver/server.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index 780213897..1c9c18cec 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -579,7 +579,7 @@ extern "C" int _IceTransNoListen(const char * protocol);
#endif
KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManagerAddArgs, bool _only_local )
- : DCOPObject("ksmserver"), sessionGroup( "" ), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0)
+ : DCOPObject("ksmserver"), startupNotifierIPDlg(0), shutdownNotifierIPDlg(0), sessionGroup( "" )
{
the_server = this;
clean = false;
@@ -596,7 +596,9 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag
config->setGroup("General" );
clientInteracting = 0;
xonCommand = config->readEntry( "xonCommand", "xon" );
-
+
+ hwDevices = TDEGlobal::hardwareDevices();
+
connect( &knotifyTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( knotifyTimeout()));
connect( &startupSuspendTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( startupSuspendTimeout()));
connect( &pendingShutdown, TQT_SIGNAL( timeout()), TQT_SLOT( pendingShutdownTimeout()));
@@ -700,8 +702,9 @@ void KSMServer::cleanUp()
// strip the screen number from the display
display.replace(TQRegExp("\\.[0-9]+$"), "");
int i;
- while( (i = display.find(':')) >= 0)
+ while( (i = display.find(':')) >= 0) {
display[i] = '_';
+ }
fName += "_"+display;
::unlink(fName.data());
@@ -710,7 +713,20 @@ void KSMServer::cleanUp()
signal(SIGTERM, SIG_DFL);
signal(SIGINT, SIG_DFL);
- DM().shutdown( shutdownType, shutdownMode, bootOption );
+ if (DM().canShutdown()) {
+ DM().shutdown( shutdownType, shutdownMode, bootOption );
+ }
+ else {
+ TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice();
+ if (rootDevice) {
+ if (shutdownType == TDEApplication::ShutdownTypeHalt) {
+ rootDevice->setPowerState(TDESystemPowerState::PowerOff);
+ }
+ if (shutdownType == TDEApplication::ShutdownTypeReboot) {
+ rootDevice->setPowerState(TDESystemPowerState::Reboot);
+ }
+ }
+ }
}