Fix use offerShutdown in TDE hardware library

This relates to Bug 1931
pull/16/head
Slávek Banko 11 years ago
parent 6f5618209f
commit 5960db66c9

@ -442,11 +442,9 @@ bool TDERootSystemDevice::canHibernate() {
} }
bool TDERootSystemDevice::canPowerOff() { bool TDERootSystemDevice::canPowerOff() {
TDEConfig *config = TDEGlobal::config(); TDEConfig config("ksmserverrc", true);
config->reparseConfiguration(); // config may have changed in the KControl module config.setGroup("General" );
if (!config.readBoolEntry( "offerShutdown", true )) {
config->setGroup("General" );
if (!config->readBoolEntry( "offerShutdown", true )) {
return FALSE; return FALSE;
} }
@ -496,11 +494,9 @@ bool TDERootSystemDevice::canPowerOff() {
} }
bool TDERootSystemDevice::canReboot() { bool TDERootSystemDevice::canReboot() {
TDEConfig *config = TDEGlobal::config(); TDEConfig config("ksmserverrc", true);
config->reparseConfiguration(); // config may have changed in the KControl module config.setGroup("General" );
if (!config.readBoolEntry( "offerShutdown", true )) {
config->setGroup("General" );
if (!config->readBoolEntry( "offerShutdown", true )) {
return FALSE; return FALSE;
} }
@ -817,10 +813,9 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
return false; return false;
} }
else if (ps == TDESystemPowerState::PowerOff) { else if (ps == TDESystemPowerState::PowerOff) {
TDEConfig *config = TDEGlobal::config(); TDEConfig config("ksmserverrc", true);
config->reparseConfiguration(); // config may have changed in the KControl module config.setGroup("General" );
config->setGroup("General" ); if (!config.readBoolEntry( "offerShutdown", true )) {
if (!config->readBoolEntry( "offerShutdown", true )) {
return false; return false;
} }
#ifdef WITH_LOGINDPOWER #ifdef WITH_LOGINDPOWER
@ -868,10 +863,9 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
return false; return false;
} }
else if (ps == TDESystemPowerState::Reboot) { else if (ps == TDESystemPowerState::Reboot) {
TDEConfig *config = TDEGlobal::config(); TDEConfig config("ksmserverrc", true);
config->reparseConfiguration(); // config may have changed in the KControl module config.setGroup("General" );
config->setGroup("General" ); if (!config.readBoolEntry( "offerShutdown", true )) {
if (!config->readBoolEntry( "offerShutdown", true )) {
return false; return false;
} }
#ifdef WITH_LOGINDPOWER #ifdef WITH_LOGINDPOWER

Loading…
Cancel
Save