Branch: master

5960db66 2014-03-14 11:05:14 Slávek Banko
Fix use offerShutdown in TDE hardware library
This relates to Bug 1931
M tdecore/tdehw/tderootsystemdevice.cpp
diff --git a/tdecore/tdehw/tderootsystemdevice.cpp b/tdecore/tdehw/tderootsystemdevice.cpp
index 3951aa7..3ece221 100644
--- a/tdecore/tdehw/tderootsystemdevice.cpp
+++ b/tdecore/tdehw/tderootsystemdevice.cpp
@@ -442,11 +442,9 @@
 }
 
 bool TDERootSystemDevice::canPowerOff() {
-	TDEConfig *config = TDEGlobal::config();
-	config->reparseConfiguration(); // config may have changed in the KControl module
-
-	config->setGroup("General" );
-	if (!config->readBoolEntry( "offerShutdown", true )) {
+	TDEConfig config("ksmserverrc", true);
+	config.setGroup("General" );
+	if (!config.readBoolEntry( "offerShutdown", true )) {
 		return FALSE;
 	}
 
@@ -496,11 +494,9 @@
 }
 
 bool TDERootSystemDevice::canReboot() {
-	TDEConfig *config = TDEGlobal::config();
-	config->reparseConfiguration(); // config may have changed in the KControl module
-
-	config->setGroup("General" );
-	if (!config->readBoolEntry( "offerShutdown", true )) {
+	TDEConfig config("ksmserverrc", true);
+	config.setGroup("General" );
+	if (!config.readBoolEntry( "offerShutdown", true )) {
 		return FALSE;
 	}
 
@@ -817,10 +813,9 @@
 		return false;
 	}
 	else if (ps == TDESystemPowerState::PowerOff) {
-		TDEConfig *config = TDEGlobal::config();
-		config->reparseConfiguration(); // config may have changed in the KControl module
-		config->setGroup("General" );
-		if (!config->readBoolEntry( "offerShutdown", true )) {
+		TDEConfig config("ksmserverrc", true);
+		config.setGroup("General" );
+		if (!config.readBoolEntry( "offerShutdown", true )) {
 			return false;
 		}
 #ifdef WITH_LOGINDPOWER
@@ -868,10 +863,9 @@
 		return false;
 	}
 	else if (ps == TDESystemPowerState::Reboot) {
-		TDEConfig *config = TDEGlobal::config();
-		config->reparseConfiguration(); // config may have changed in the KControl module
-		config->setGroup("General" );
-		if (!config->readBoolEntry( "offerShutdown", true )) {
+		TDEConfig config("ksmserverrc", true);
+		config.setGroup("General" );
+		if (!config.readBoolEntry( "offerShutdown", true )) {
 			return false;
 		}
 #ifdef WITH_LOGINDPOWER