summaryrefslogtreecommitdiffstats
path: root/src/settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index cf860e0..b0d3afe 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -17,9 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-/*!
+/*!
* \file settings.cpp
- * \brief In this file can be found the settings ( read ) related code.
+ * \brief In this file can be found the settings ( read ) related code.
* \author Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de>
* \date 2005
*/
@@ -27,7 +27,7 @@
// KDE Header
#include <tdelocale.h>
-// QT Header
+// QT Header
// own headers
#include "settings.h"
@@ -51,7 +51,7 @@ Settings::~Settings()
/*!
* Loads the scheme settings from tdepowersaverc and fills the related variables.
- * \param schemeName TQString with the name (realname not i18n() version) of the
+ * \param schemeName TQString with the name (realname not i18n() version) of the
* scheme which setting should be load. If the scheme could not
* be loaded, this function try to load "default-scheme"
* \return the result of the load
@@ -59,7 +59,7 @@ Settings::~Settings()
* \retval false if there was no group named like schemeName or named "default-scheme"
*/
bool Settings::load_scheme_settings(TQString schemeName){
-
+
tdeconfig->reparseConfiguration();
bool setToDefault = false;
@@ -71,7 +71,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
schemeName = "Presentation";
else if( schemeName == "Acoustic" || schemeName == i18n("Acoustic"))
schemeName = "Acoustic";
-
+
if(tdeconfig->hasGroup(schemeName) || tdeconfig->hasGroup("default-scheme") ){
if(tdeconfig->hasGroup(schemeName)) tdeconfig->setGroup(schemeName);
else {
@@ -81,13 +81,13 @@ bool Settings::load_scheme_settings(TQString schemeName){
setToDefault = true;
}
currentScheme = schemeName;
-
+
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 = tdeconfig->readNumEntry("standbyAfter", -1);
if (i_standby >= 0) standbyAfter = i_standby;
else {
@@ -100,7 +100,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
// reset the group
tdeconfig->setGroup(schemeName);
}
-
+
int i_suspend = tdeconfig->readNumEntry("suspendAfter", -1);
if (i_suspend >= 0) suspendAfter = i_suspend;
else {
@@ -113,7 +113,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
// reset the group
tdeconfig->setGroup(schemeName);
}
-
+
int i_poweroff = tdeconfig->readNumEntry("powerOffAfter", -1);
if (i_poweroff >= 0) powerOffAfter = i_poweroff;
else {
@@ -126,7 +126,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
// reset the group
tdeconfig->setGroup(schemeName);
}
-
+
brightness = tdeconfig->readBoolEntry("enableBrightness",false);
brightnessValue = tdeconfig->readNumEntry("brightnessPercent", -1);
if (brightnessValue == -1) {
@@ -148,7 +148,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
// reset the group
tdeconfig->setGroup(schemeName);
}
-
+
TQString _autoInactiveAction = tdeconfig->readEntry("autoInactiveAction", "NULL");
if( _autoInactiveAction != "NULL") {
autoInactiveAction = _autoInactiveAction;
@@ -161,11 +161,11 @@ bool Settings::load_scheme_settings(TQString schemeName){
// reset the group
tdeconfig->setGroup(schemeName);
}
-
+
autoSuspend = tdeconfig->readBoolEntry("autoSuspend",false);
autoInactiveSBlistEnabled = tdeconfig->readBoolEntry("autoInactiveSchemeBlacklistEnabled",false);
autoInactiveSBlist = tdeconfig->readListEntry("autoInactiveSchemeBlacklist", ',');
-
+
int i_autoDimmAfter = tdeconfig->readNumEntry("autoDimmAfter", -1);
if (i_autoDimmAfter >= 0) autoDimmAfter = i_autoDimmAfter;
else {
@@ -197,14 +197,14 @@ bool Settings::load_scheme_settings(TQString schemeName){
autoDimmSBlist = tdeconfig->readListEntry("autoDimmSchemeBlacklist", ',');
disableNotifications = tdeconfig->readBoolEntry("disableNotifications",false);
-
+
TQString _cpufreqpolicy = tdeconfig->readEntry("cpuFreqPolicy", "NULL");
if( _cpufreqpolicy == "NULL") {
tdeconfig->setGroup("default-scheme");
_cpufreqpolicy = tdeconfig->readEntry("cpuFreqPolicy", "NULL");
// reset the group
tdeconfig->setGroup(schemeName);
- }
+ }
if (_cpufreqpolicy.startsWith("DYNAMIC")) {
cpuFreqPolicy = DYNAMIC;
} else if (_cpufreqpolicy.startsWith("PERFORMANCE")) {
@@ -222,7 +222,7 @@ bool Settings::load_scheme_settings(TQString schemeName){
cpuFreqDynamicPerformance = tdeconfig->readNumEntry("cpuFreqDynamicPerformance", 51);
// reset the group
tdeconfig->setGroup(schemeName);
- }
+ }
return true;
}
@@ -237,12 +237,12 @@ bool Settings::load_scheme_settings(TQString schemeName){
* \retval false if there was no group named 'General'
*/
bool Settings::load_general_settings(){
-
+
tdeconfig->reparseConfiguration();
if(tdeconfig->hasGroup("General")) {
tdeconfig->setGroup("General");
-
+
lockOnSuspend = tdeconfig->readBoolEntry("lockOnSuspend",true);
lockOnLidClose = tdeconfig->readBoolEntry("lockOnLidClose",true);
autostart = tdeconfig->readBoolEntry("Autostart",false);
@@ -254,10 +254,10 @@ bool Settings::load_general_settings(){
lockmethod = tdeconfig->readEntry("lockMethod", "NULL");
if(lockmethod == "NULL") lockmethod = "automatic";
-
+
autoInactiveGBlist = tdeconfig->readListEntry("autoInactiveBlacklist", ',');
autoDimmGBlist = tdeconfig->readListEntry("autoDimmBlacklist", ',');
-
+
autoSuspendCountdown = tdeconfig->readBoolEntry("AutoSuspendCountdown", false);
autoSuspendCountdownTimeout = tdeconfig->readNumEntry("AutoSuspendCountdownTimeOut", 30);
@@ -300,12 +300,12 @@ bool Settings::load_general_settings(){
}
sleepButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnSleepButton",""));
- if ((sleepButtonAction != GO_SUSPEND2RAM) && (sleepButtonAction != GO_SUSPEND2DISK)) {
+ if ((sleepButtonAction != GO_SUSPEND2RAM) && (sleepButtonAction != GO_SUSPEND2DISK) && (sleepButtonAction != GO_FREEZE)) {
sleepButtonAction = NONE;
}
s2diskButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnS2DiskButton",""));
- if ((s2diskButtonAction != GO_SUSPEND2RAM) && (s2diskButtonAction != GO_SUSPEND2DISK)) {
+ if ((s2diskButtonAction != GO_SUSPEND2RAM) && (s2diskButtonAction != GO_SUSPEND2DISK) && (s2diskButtonAction != GO_FREEZE)) {
s2diskButtonAction = NONE;
}
@@ -321,7 +321,7 @@ bool Settings::load_general_settings(){
* \return a integer value with the result of the mapping as \ref action
*/
action Settings::mapActionToType (TQString _action) {
-
+
if (_action.isEmpty()) {
return NONE;
} else if (_action.startsWith("SHUTDOWN")) {
@@ -332,6 +332,8 @@ action Settings::mapActionToType (TQString _action) {
return GO_SUSPEND2DISK;
} else if (_action.startsWith("SUSPEND2RAM")) {
return GO_SUSPEND2RAM;
+ } else if (_action.startsWith("FREEZE")) {
+ return GO_FREEZE;
} else if (_action.startsWith("CPUFRETQ_POWERSAVE")) {
return CPUFRETQ_POWERSAVE;
} else if (_action.startsWith("CPUFRETQ_DYNAMIC")) {
@@ -341,7 +343,7 @@ action Settings::mapActionToType (TQString _action) {
} else if (_action.startsWith("BRIGHTNESS")) {
return BRIGHTNESS;
} else {
- return UNKNOWN_ACTION;
+ return UNKNOWN_ACTION;
}
}
@@ -349,11 +351,11 @@ action Settings::mapActionToType (TQString _action) {
* Loads the default KDE Settings from the different configfiles and store
* them to a \ref KDE_Settings 'object'.
* \retval true if the settings could be loaded
- * \retval false if there was a error/problem
+ * \retval false if there was a error/problem
*/
void Settings::load_kde(){
TDEConfig *_tdeconfig = new TDEConfig("kcmdisplayrc", true );
-
+
/* KDE settings [DisplayEnergy] from kcmdisplayrc */
if(_tdeconfig->hasGroup("DisplayEnergy")) {
_tdeconfig->setGroup("DisplayEnergy");
@@ -362,7 +364,7 @@ void Settings::load_kde(){
kde->displaySuspend = _tdeconfig->readNumEntry("displaySuspend", 13);
kde->displayPowerOff = _tdeconfig->readNumEntry("displayPowerOff", 19);
}
- delete _tdeconfig;
+ delete _tdeconfig;
_tdeconfig = new TDEConfig("kdesktoprc", true );
/* KDE settings [ScreenSaver] from kdesktoprc */
if(_tdeconfig->hasGroup("ScreenSaver")) {
@@ -373,7 +375,7 @@ void Settings::load_kde(){
TQString _savername = _tdeconfig->readEntry("Saver", "KBlankscreen.desktop");
if (_savername.startsWith("KBlankscreen.desktop"))
kde->blanked = true;
- else
+ else
kde->blanked = false;
}
delete _tdeconfig;