summaryrefslogtreecommitdiffstats
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-01-27 00:55:25 -0600
committerTimothy Pearson <[email protected]>2013-01-27 00:55:25 -0600
commit9e9cce8733ec19475057389be3f00f5a4a6a72ba (patch)
tree15e471f606a59dd8a13f03472ec53f817c37db76 /src/settings.cpp
parent8567e7d693d9ec1a0aba23873fcc9430f1f11489 (diff)
downloadtdepowersave-9e9cce8733ec19475057389be3f00f5a4a6a72ba.tar.gz
tdepowersave-9e9cce8733ec19475057389be3f00f5a4a6a72ba.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp220
1 files changed, 110 insertions, 110 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 753d4dd..d806680 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -35,7 +35,7 @@
/*! This is the default constructor of the class Settings. */
Settings::Settings()
{
- kconfig = new TDEConfig("kpowersaverc", true );
+ tdeconfig = new TDEConfig("kpowersaverc", true );
kde = new KDE_Settings();
load_kde();
load_general_settings();
@@ -44,7 +44,7 @@ Settings::Settings()
/*! This is the default destructor of the class Settings. */
Settings::~Settings()
{
- delete kconfig;
+ delete tdeconfig;
delete kde;
}
@@ -60,7 +60,7 @@ Settings::~Settings()
*/
bool Settings::load_scheme_settings(TQString schemeName){
- kconfig->reparseConfiguration();
+ tdeconfig->reparseConfiguration();
bool setToDefault = false;
if( schemeName == "Performance" || schemeName == i18n("Performance"))
@@ -72,138 +72,138 @@ bool Settings::load_scheme_settings(TQString schemeName){
else if( schemeName == "Acoustic" || schemeName == i18n("Acoustic"))
schemeName = "Acoustic";
- if(kconfig->hasGroup(schemeName) || kconfig->hasGroup("default-scheme") ){
- if(kconfig->hasGroup(schemeName)) kconfig->setGroup(schemeName);
+ if(tdeconfig->hasGroup(schemeName) || tdeconfig->hasGroup("default-scheme") ){
+ if(tdeconfig->hasGroup(schemeName)) tdeconfig->setGroup(schemeName);
else {
// fallback to 'default-scheme'
- kconfig->setGroup("default-scheme");
+ tdeconfig->setGroup("default-scheme");
schemeName = "default-scheme";
setToDefault = true;
}
currentScheme = schemeName;
- specSsSettings = kconfig->readBoolEntry("specSsSettings",false);
- disableSs = kconfig->readBoolEntry("disableSs",false);
- blankSs = kconfig->readBoolEntry("blankSs",false);
- specPMSettings = kconfig->readBoolEntry("specPMSettings",false);
- disableDPMS = kconfig->readBoolEntry("disableDPMS",false);
+ specSsSettings = tdeconfig->readBoolEntry("specSsSettings",false);
+ disableSs = tdeconfig->readBoolEntry("disableSs",false);
+ blankSs = tdeconfig->readBoolEntry("blankSs",false);
+ specPMSettings = tdeconfig->readBoolEntry("specPMSettings",false);
+ disableDPMS = tdeconfig->readBoolEntry("disableDPMS",false);
- int i_standby = kconfig->readNumEntry("standbyAfter", -1);
+ int i_standby = tdeconfig->readNumEntry("standbyAfter", -1);
if (i_standby >= 0) standbyAfter = i_standby;
else {
- kconfig->setGroup("default-scheme");
- i_standby = kconfig->readNumEntry("standbyAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_standby = tdeconfig->readNumEntry("standbyAfter", -1);
if(i_standby >= 0) {
standbyAfter = i_standby;
}
else standbyAfter = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- int i_suspend = kconfig->readNumEntry("suspendAfter", -1);
+ int i_suspend = tdeconfig->readNumEntry("suspendAfter", -1);
if (i_suspend >= 0) suspendAfter = i_suspend;
else {
- kconfig->setGroup("default-scheme");
- i_suspend = kconfig->readNumEntry("suspendAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_suspend = tdeconfig->readNumEntry("suspendAfter", -1);
if(i_suspend >= 0) {
suspendAfter = i_suspend;
}
else suspendAfter = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- int i_poweroff = kconfig->readNumEntry("powerOffAfter", -1);
+ int i_poweroff = tdeconfig->readNumEntry("powerOffAfter", -1);
if (i_poweroff >= 0) powerOffAfter = i_poweroff;
else {
- kconfig->setGroup("default-scheme");
- i_poweroff = kconfig->readNumEntry("powerOffAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_poweroff = tdeconfig->readNumEntry("powerOffAfter", -1);
if(i_poweroff >= 0) {
powerOffAfter = i_poweroff;
}
else powerOffAfter = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- brightness = kconfig->readBoolEntry("enableBrightness",false);
- brightnessValue = kconfig->readNumEntry("brightnessPercent", -1);
+ brightness = tdeconfig->readBoolEntry("enableBrightness",false);
+ brightnessValue = tdeconfig->readNumEntry("brightnessPercent", -1);
if (brightnessValue == -1) {
- kconfig->setGroup("default-scheme");
- brightnessValue = kconfig->readNumEntry("brightnessPercent", 100);
+ tdeconfig->setGroup("default-scheme");
+ brightnessValue = tdeconfig->readNumEntry("brightnessPercent", 100);
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- int i_autoInactiveActionAfter = kconfig->readNumEntry("autoInactiveActionAfter", -1);
+ int i_autoInactiveActionAfter = tdeconfig->readNumEntry("autoInactiveActionAfter", -1);
if (i_autoInactiveActionAfter >= 0) autoInactiveActionAfter = i_autoInactiveActionAfter;
else {
- kconfig->setGroup("default-scheme");
- i_autoInactiveActionAfter = kconfig->readNumEntry("autoInactiveActionAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_autoInactiveActionAfter = tdeconfig->readNumEntry("autoInactiveActionAfter", -1);
if(i_autoInactiveActionAfter >= 0) {
autoInactiveActionAfter = i_autoInactiveActionAfter;
}
else autoInactiveActionAfter = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- TQString _autoInactiveAction = kconfig->readEntry("autoInactiveAction", "NULL");
+ TQString _autoInactiveAction = tdeconfig->readEntry("autoInactiveAction", "NULL");
if( _autoInactiveAction != "NULL") {
autoInactiveAction = _autoInactiveAction;
}
else {
- kconfig->setGroup("default-scheme");
- _autoInactiveAction = kconfig->readEntry("autoInactiveAction", "NULL");
+ tdeconfig->setGroup("default-scheme");
+ _autoInactiveAction = tdeconfig->readEntry("autoInactiveAction", "NULL");
if(_autoInactiveAction != "NULL") autoInactiveAction = _autoInactiveAction;
else autoInactiveAction = "_NONE_";
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- autoSuspend = kconfig->readBoolEntry("autoSuspend",false);
- autoInactiveSBlistEnabled = kconfig->readBoolEntry("autoInactiveSchemeBlacklistEnabled",false);
- autoInactiveSBlist = kconfig->readListEntry("autoInactiveSchemeBlacklist", ',');
+ autoSuspend = tdeconfig->readBoolEntry("autoSuspend",false);
+ autoInactiveSBlistEnabled = tdeconfig->readBoolEntry("autoInactiveSchemeBlacklistEnabled",false);
+ autoInactiveSBlist = tdeconfig->readListEntry("autoInactiveSchemeBlacklist", ',');
- int i_autoDimmAfter = kconfig->readNumEntry("autoDimmAfter", -1);
+ int i_autoDimmAfter = tdeconfig->readNumEntry("autoDimmAfter", -1);
if (i_autoDimmAfter >= 0) autoDimmAfter = i_autoDimmAfter;
else {
- kconfig->setGroup("default-scheme");
- i_autoDimmAfter = kconfig->readNumEntry("autoDimmAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_autoDimmAfter = tdeconfig->readNumEntry("autoDimmAfter", -1);
if(i_autoDimmAfter >= 0) {
autoDimmAfter = i_autoDimmAfter;
}
else autoDimmAfter = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- int i_autoDimmTo = kconfig->readNumEntry("autoDimmTo", -1);
+ int i_autoDimmTo = tdeconfig->readNumEntry("autoDimmTo", -1);
if (i_autoDimmTo >= 0) autoDimmTo = i_autoDimmTo;
else {
- kconfig->setGroup("default-scheme");
- i_autoDimmTo = kconfig->readNumEntry("autoDimmAfter", -1);
+ tdeconfig->setGroup("default-scheme");
+ i_autoDimmTo = tdeconfig->readNumEntry("autoDimmAfter", -1);
if(i_autoDimmTo >= 0) {
autoDimmTo = i_autoDimmTo;
}
else autoDimmTo = 0;
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
- autoDimm = kconfig->readBoolEntry("autoDimm",false);
- autoDimmSBlistEnabled = kconfig->readBoolEntry("autoDimmSchemeBlacklistEnabled",false);
- autoDimmSBlist = kconfig->readListEntry("autoDimmSchemeBlacklist", ',');
+ autoDimm = tdeconfig->readBoolEntry("autoDimm",false);
+ autoDimmSBlistEnabled = tdeconfig->readBoolEntry("autoDimmSchemeBlacklistEnabled",false);
+ autoDimmSBlist = tdeconfig->readListEntry("autoDimmSchemeBlacklist", ',');
- disableNotifications = kconfig->readBoolEntry("disableNotifications",false);
+ disableNotifications = tdeconfig->readBoolEntry("disableNotifications",false);
- TQString _cpufreqpolicy = kconfig->readEntry("cpuFreqPolicy", "NULL");
+ TQString _cpufreqpolicy = tdeconfig->readEntry("cpuFreqPolicy", "NULL");
if( _cpufreqpolicy == "NULL") {
- kconfig->setGroup("default-scheme");
- _cpufreqpolicy = kconfig->readEntry("cpuFreqPolicy", "NULL");
+ tdeconfig->setGroup("default-scheme");
+ _cpufreqpolicy = tdeconfig->readEntry("cpuFreqPolicy", "NULL");
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
if (_cpufreqpolicy.startsWith("DYNAMIC")) {
cpuFreqPolicy = DYNAMIC;
@@ -216,12 +216,12 @@ bool Settings::load_scheme_settings(TQString schemeName){
cpuFreqPolicy = DYNAMIC;
}
- cpuFreqDynamicPerformance = kconfig->readNumEntry("cpuFreqDynamicPerformance", -1);
+ cpuFreqDynamicPerformance = tdeconfig->readNumEntry("cpuFreqDynamicPerformance", -1);
if( cpuFreqDynamicPerformance == -1) {
- kconfig->setGroup("default-scheme");
- cpuFreqDynamicPerformance = kconfig->readNumEntry("cpuFreqDynamicPerformance", 51);
+ tdeconfig->setGroup("default-scheme");
+ cpuFreqDynamicPerformance = tdeconfig->readNumEntry("cpuFreqDynamicPerformance", 51);
// reset the group
- kconfig->setGroup(schemeName);
+ tdeconfig->setGroup(schemeName);
}
return true;
@@ -238,73 +238,73 @@ bool Settings::load_scheme_settings(TQString schemeName){
*/
bool Settings::load_general_settings(){
- kconfig->reparseConfiguration();
+ tdeconfig->reparseConfiguration();
- if(kconfig->hasGroup("General")) {
- kconfig->setGroup("General");
+ if(tdeconfig->hasGroup("General")) {
+ tdeconfig->setGroup("General");
- lockOnSuspend = kconfig->readBoolEntry("lockOnSuspend",true);
- lockOnLidClose = kconfig->readBoolEntry("lockOnLidClose",true);
- autostart = kconfig->readBoolEntry("Autostart",false);
- autostartNeverAsk = kconfig->readBoolEntry("AutostartNeverAsk",false);
- psMsgAsPassivePopup = kconfig->readBoolEntry("psMsgAsPassivePopup",false);
- forceDpmsOffOnLidClose = kconfig->readBoolEntry("forceDpmsOffOnLidClose",false);
- unmountExternalOnSuspend = kconfig->readBoolEntry("unmountExternalOnSuspend",true);
- callSetPowerSaveOnAC = kconfig->readBoolEntry("callSetPowerSaveOnAC",true);
-
- lockmethod = kconfig->readEntry("lockMethod", "NULL");
+ lockOnSuspend = tdeconfig->readBoolEntry("lockOnSuspend",true);
+ lockOnLidClose = tdeconfig->readBoolEntry("lockOnLidClose",true);
+ autostart = tdeconfig->readBoolEntry("Autostart",false);
+ autostartNeverAsk = tdeconfig->readBoolEntry("AutostartNeverAsk",false);
+ psMsgAsPassivePopup = tdeconfig->readBoolEntry("psMsgAsPassivePopup",false);
+ forceDpmsOffOnLidClose = tdeconfig->readBoolEntry("forceDpmsOffOnLidClose",false);
+ unmountExternalOnSuspend = tdeconfig->readBoolEntry("unmountExternalOnSuspend",true);
+ callSetPowerSaveOnAC = tdeconfig->readBoolEntry("callSetPowerSaveOnAC",true);
+
+ lockmethod = tdeconfig->readEntry("lockMethod", "NULL");
if(lockmethod == "NULL") lockmethod = "automatic";
- autoInactiveGBlist = kconfig->readListEntry("autoInactiveBlacklist", ',');
- autoDimmGBlist = kconfig->readListEntry("autoDimmBlacklist", ',');
+ autoInactiveGBlist = tdeconfig->readListEntry("autoInactiveBlacklist", ',');
+ autoDimmGBlist = tdeconfig->readListEntry("autoDimmBlacklist", ',');
- autoSuspendCountdown = kconfig->readBoolEntry("AutoSuspendCountdown", false);
- autoSuspendCountdownTimeout = kconfig->readNumEntry("AutoSuspendCountdownTimeOut", 30);
+ autoSuspendCountdown = tdeconfig->readBoolEntry("AutoSuspendCountdown", false);
+ autoSuspendCountdownTimeout = tdeconfig->readNumEntry("AutoSuspendCountdownTimeOut", 30);
- timeToFakeKeyAfterLock = kconfig->readNumEntry("timeToFakeKeyAfterLock", 5000);
+ timeToFakeKeyAfterLock = tdeconfig->readNumEntry("timeToFakeKeyAfterLock", 5000);
- schemes = kconfig->readListEntry("schemes", ',');
- ac_scheme = kconfig->readEntry("ac_scheme", "Performance");
- battery_scheme = kconfig->readEntry("battery_scheme", "Powersave");
+ schemes = tdeconfig->readListEntry("schemes", ',');
+ ac_scheme = tdeconfig->readEntry("ac_scheme", "Performance");
+ battery_scheme = tdeconfig->readEntry("battery_scheme", "Powersave");
// Read battery levels and related actions
- batteryWarningLevel = kconfig->readNumEntry("batteryWarning", 12);
- batteryLowLevel = kconfig->readNumEntry("batteryLow", 7);
- batteryCriticalLevel = kconfig->readNumEntry("batteryCritical", 2);
+ batteryWarningLevel = tdeconfig->readNumEntry("batteryWarning", 12);
+ batteryLowLevel = tdeconfig->readNumEntry("batteryLow", 7);
+ batteryCriticalLevel = tdeconfig->readNumEntry("batteryCritical", 2);
- batteryWarningLevelAction = mapActionToType(kconfig->readEntry("batteryWarningAction",""));
+ batteryWarningLevelAction = mapActionToType(tdeconfig->readEntry("batteryWarningAction",""));
if (batteryWarningLevelAction == BRIGHTNESS) {
- batteryWarningLevelActionValue = kconfig->readNumEntry("batteryWarningActionValue", -1);
+ batteryWarningLevelActionValue = tdeconfig->readNumEntry("batteryWarningActionValue", -1);
}
- batteryLowLevelAction = mapActionToType(kconfig->readEntry("batteryLowAction",""));
+ batteryLowLevelAction = mapActionToType(tdeconfig->readEntry("batteryLowAction",""));
if (batteryLowLevelAction == BRIGHTNESS) {
- batteryLowLevelActionValue = kconfig->readNumEntry("batteryLowActionValue", -1);
+ batteryLowLevelActionValue = tdeconfig->readNumEntry("batteryLowActionValue", -1);
}
- batteryCriticalLevelAction = mapActionToType(kconfig->readEntry("batteryCriticalAction",""));
+ batteryCriticalLevelAction = mapActionToType(tdeconfig->readEntry("batteryCriticalAction",""));
if (batteryCriticalLevelAction == BRIGHTNESS) {
- batteryCriticalLevelActionValue = kconfig->readNumEntry("batteryCriticalActionValue", -1);
+ batteryCriticalLevelActionValue = tdeconfig->readNumEntry("batteryCriticalActionValue", -1);
}
- lidcloseAction = mapActionToType(kconfig->readEntry("ActionOnLidClose",""));
+ lidcloseAction = mapActionToType(tdeconfig->readEntry("ActionOnLidClose",""));
if (lidcloseAction == BRIGHTNESS) {
- lidcloseActionValue = kconfig->readNumEntry("ActionOnLidCloseValue", -1);
+ lidcloseActionValue = tdeconfig->readNumEntry("ActionOnLidCloseValue", -1);
}
// avoid logout dialog since this make no sence with lidclose
if (lidcloseAction == LOGOUT_DIALOG) {
lidcloseAction = NONE;
}
- powerButtonAction = mapActionToType(kconfig->readEntry("ActionOnPowerButton",""));
+ powerButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnPowerButton",""));
if (powerButtonAction == BRIGHTNESS) {
- powerButtonActionValue = kconfig->readNumEntry("ActionOnPowerButtonValue", -1);
+ powerButtonActionValue = tdeconfig->readNumEntry("ActionOnPowerButtonValue", -1);
}
- sleepButtonAction = mapActionToType(kconfig->readEntry("ActionOnSleepButton",""));
+ sleepButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnSleepButton",""));
if ((sleepButtonAction != GO_SUSPEND2RAM) && (sleepButtonAction != GO_SUSPEND2DISK)) {
sleepButtonAction = NONE;
}
- s2diskButtonAction = mapActionToType(kconfig->readEntry("ActionOnS2DiskButton",""));
+ s2diskButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnS2DiskButton",""));
if ((s2diskButtonAction != GO_SUSPEND2RAM) && (s2diskButtonAction != GO_SUSPEND2DISK)) {
s2diskButtonAction = NONE;
}
@@ -352,30 +352,30 @@ action Settings::mapActionToType (TQString _action) {
* \retval false if there was a error/problem
*/
void Settings::load_kde(){
- TDEConfig *_kconfig = new TDEConfig("kcmdisplayrc", true );
+ TDEConfig *_tdeconfig = new TDEConfig("kcmdisplayrc", true );
/* KDE settings [DisplayEnergy] from kcmdisplayrc */
- if(_kconfig->hasGroup("DisplayEnergy")) {
- _kconfig->setGroup("DisplayEnergy");
- kde->displayEnergySaving = _kconfig->readBoolEntry("displayEnergySaving", true);
- kde->displayStandby = _kconfig->readNumEntry("displayStandby", 7);
- kde->displaySuspend = _kconfig->readNumEntry("displaySuspend", 13);
- kde->displayPowerOff = _kconfig->readNumEntry("displayPowerOff", 19);
+ if(_tdeconfig->hasGroup("DisplayEnergy")) {
+ _tdeconfig->setGroup("DisplayEnergy");
+ kde->displayEnergySaving = _tdeconfig->readBoolEntry("displayEnergySaving", true);
+ kde->displayStandby = _tdeconfig->readNumEntry("displayStandby", 7);
+ kde->displaySuspend = _tdeconfig->readNumEntry("displaySuspend", 13);
+ kde->displayPowerOff = _tdeconfig->readNumEntry("displayPowerOff", 19);
}
- delete _kconfig;
- _kconfig = new TDEConfig("kdesktoprc", true );
+ delete _tdeconfig;
+ _tdeconfig = new TDEConfig("kdesktoprc", true );
/* KDE settings [ScreenSaver] from kdesktoprc */
- if(_kconfig->hasGroup("ScreenSaver")) {
- _kconfig->setGroup("ScreenSaver");
- kde->enabled = _kconfig->readBoolEntry("Enabled", true);
- kde->lock = _kconfig->readBoolEntry("Lock", true);
+ if(_tdeconfig->hasGroup("ScreenSaver")) {
+ _tdeconfig->setGroup("ScreenSaver");
+ kde->enabled = _tdeconfig->readBoolEntry("Enabled", true);
+ kde->lock = _tdeconfig->readBoolEntry("Lock", true);
- TQString _savername = _kconfig->readEntry("Saver", "KBlankscreen.desktop");
+ TQString _savername = _tdeconfig->readEntry("Saver", "KBlankscreen.desktop");
if (_savername.startsWith("KBlankscreen.desktop"))
kde->blanked = true;
else
kde->blanked = false;
}
- delete _kconfig;
+ delete _tdeconfig;
}