summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2013-09-22 14:56:47 +0200
committerSlávek Banko <[email protected]>2013-09-22 14:56:47 +0200
commit160e6f21b8d578aeaba5105082cbb61f46811ef1 (patch)
tree62a3660023eefc4efc498c6025bde1759d6b2e1c
parente113ed917ca8d86e607c7fc70accd681cfefb0a4 (diff)
downloadtdepowersave-160e6f21b8d578aeaba5105082cbb61f46811ef1.tar.gz
tdepowersave-160e6f21b8d578aeaba5105082cbb61f46811ef1.zip
Add support for freeze suspend state
-rw-r--r--src/config/tdepowersaverc_default4
-rw-r--r--src/configuredialog.cpp216
-rw-r--r--src/countdowndialog.cpp14
-rw-r--r--src/eventsrc12
-rw-r--r--src/hardware.cpp217
-rw-r--r--src/hardware.h112
-rw-r--r--src/settings.cpp60
-rw-r--r--src/settings.h105
-rw-r--r--src/suspenddialog.cpp18
-rw-r--r--src/tdepowersave.cpp137
-rw-r--r--src/tdepowersave.h9
11 files changed, 548 insertions, 356 deletions
diff --git a/src/config/tdepowersaverc_default b/src/config/tdepowersaverc_default
index 61e6e05..7f230af 100644
--- a/src/config/tdepowersaverc_default
+++ b/src/config/tdepowersaverc_default
@@ -7,7 +7,7 @@ ActionOnPowerButton=SHUTDOWN
ActionOnPowerButtonValue=
ActionOnSleepButton=SUSPEND2RAM
ActionOnS2DiskButton=SUSPEND2DISK
-buttonsAllowedActions=SHUTDOWN,LOGOUT_DIALOG,SUSPEND2DISK,SUSPEND2RAM
+buttonsAllowedActions=SHUTDOWN,LOGOUT_DIALOG,SUSPEND2DISK,SUSPEND2RAM,FREEZE
AutoSuspendCountdown=true
AutoSuspendCountdownTimeOut=30
Autostart=true
@@ -32,7 +32,7 @@ batteryLowActionValue=1
batteryCritical=2
batteryCriticalAction=SHUTDOWN
batteryCriticalActionValue=
-batteryAllowedActions=SHUTDOWN,SUSPEND2DISK,SUSPEND2RAM,CPUFREQ_POWERSAVE,CPUFREQ_PERFORMANCE,CPUFREQ_DYNAMIC,BRIGHTNESS
+batteryAllowedActions=SHUTDOWN,SUSPEND2DISK,SUSPEND2RAM,FREEZE,CPUFREQ_POWERSAVE,CPUFREQ_PERFORMANCE,CPUFREQ_DYNAMIC,BRIGHTNESS
[default-scheme]
specSsSettings=false
diff --git a/src/configuredialog.cpp b/src/configuredialog.cpp
index 3bc968e..3533e75 100644
--- a/src/configuredialog.cpp
+++ b/src/configuredialog.cpp
@@ -16,11 +16,11 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-
+
/*! \file configuredialog.cpp
- * All here displayed file members of configureDialog.cpp are related to operations with the
+ * All here displayed file members of configureDialog.cpp are related to operations with the
* configure dialog for tdepowersave
- * \brief In this file can be found all configure dialog related code.
+ * \brief In this file can be found all configure dialog related code.
* \author Danny Kukawka, <[email protected]>, <[email protected]>
* \date 2005
*/
@@ -78,7 +78,7 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
if(hwinfo->supportBrightness()) {
brightnessLevels = hwinfo->getMaxBrightnessLevel() -1;
brightness_last = hwinfo->getCurrentBrightnessLevel();
- } else {
+ } else {
brightnessLevels = -1;
brightness_last = -1;
}
@@ -94,6 +94,9 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
actions.append("Suspend to Disk");
}
+ if ( suspend.freeze && (suspend.freeze_allowed || suspend.freeze_allowed == -1)) {
+ actions.append("Freeze");
+ }
if ( suspend.standby && (suspend.standby_allowed || suspend.standby_allowed == -1)) {
actions.append("Standby");
}
@@ -101,11 +104,11 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
setIcons();
setTooltips();
getSchemeList();
- setSchemeList();
+ setSchemeList();
setGeneralSettings();
setInactivityBox();
selectScheme(settings->currentScheme);
-
+
tL_valueBrightness->setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
tL_valueBrightness->setBackgroundMode(TQt::PaletteBase);
tL_valueBrightness->setAlignment(TQt::AlignCenter);
@@ -137,7 +140,7 @@ ConfigureDialog::~ConfigureDialog(){
/* ---- START General setup SECTION ---- */
-/*!
+/*!
* This used to fill the TQListBox listBox_schemes and the scheme related TQComboBoxes
* with the existing schemes.
*/
@@ -170,7 +173,7 @@ void ConfigureDialog::setSchemeList(){
cB_acScheme->insertItem(i18n(_tmp));
cB_batteryScheme->insertItem(i18n(_tmp));
} else if((*it) == "AdvancedPowersave" || (*it) == i18n("Advanced Powersave")) {
- listBox_schemes->insertItem(SmallIcon("scheme_advanced_powersave",
+ listBox_schemes->insertItem(SmallIcon("scheme_advanced_powersave",
TQIconSet::Automatic), i18n("Advanced Powersave"));
cB_acScheme->insertItem(i18n("Advanced Powersave"));
cB_batteryScheme->insertItem(i18n("Advanced Powersave"));
@@ -185,7 +188,7 @@ void ConfigureDialog::setSchemeList(){
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to get the list of schemes in from the config
*/
void ConfigureDialog::getSchemeList(){
@@ -199,7 +202,7 @@ void ConfigureDialog::getSchemeList(){
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to set the current scheme based on the name of the scheme
* \param _scheme TQString with the name of the scheme
*/
@@ -218,11 +221,11 @@ void ConfigureDialog::selectScheme (TQString _scheme){
} else {
listBox_schemes->setCurrentItem(0);
}
-
+
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to set all needed Icons for the dialog.
*/
void ConfigureDialog::setIcons(){
@@ -242,17 +245,20 @@ void ConfigureDialog::setIcons(){
tB_scheme->setItemIconSet( 0 ,SmallIcon("tdescreensaver", TQIconSet::Automatic));
tB_scheme->setItemIconSet( 1 ,SmallIcon("display", TQIconSet::Automatic));
-
+
if(actions[0] == "Suspend to Disk") {
tB_scheme->setItemIconSet( 2 ,SmallIcon("suspend_to_disk", TQIconSet::Automatic));
}
else if(actions[0] == "Suspend to RAM") {
tB_scheme->setItemIconSet( 2 ,SmallIcon("suspend_to_ram", TQIconSet::Automatic));
}
+ else if(actions[0] == "Freeze") {
+ tB_scheme->setItemIconSet( 2 ,SmallIcon("suspend_to_ram", TQIconSet::Automatic));
+ }
else if(actions[0] == "Standby") {
tB_scheme->setItemIconSet( 2 ,SmallIcon("stand_by", TQIconSet::Automatic));
}
-
+
tB_scheme->setItemIconSet( 3 ,SmallIcon("autodimm", TQIconSet::Automatic));
tB_scheme->setItemIconSet( 4 ,SmallIcon("processor", TQIconSet::Automatic));
tB_scheme->setItemIconSet( 5 ,SmallIcon("misc", TQIconSet::Automatic));
@@ -267,7 +273,7 @@ void ConfigureDialog::setIcons(){
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to set all needed Tooltips for the dialog.
*/
void ConfigureDialog::setTooltips(){
@@ -288,12 +294,12 @@ void ConfigureDialog::setTooltips(){
TQToolTip::add(cB_disablePM, i18n("This disables DPMS support."));
TQToolTip::add(cB_lockSuspend, i18n("If selected, the screen is locked on suspend or standby."));
TQToolTip::add(cB_lockLid, i18n("If selected, the screen is locked if the lid close event is triggered."));
-
+
TQToolTip::add(cB_autoSuspend, i18n("Check this box to enable or disable automatic suspension of "
"the computer."));
TQToolTip::add(cB_autoInactivity, i18n("Activate this action if the user was inactive for the defined "
"time \n(greater than 0 minutes). If empty, nothing happens."));
-
+
tB_scheme->setItemToolTip ( 0, i18n("All scheme-related screen saver and DPMS settings."));
tB_scheme->setItemToolTip ( 1, i18n("All scheme-related display brightness settings."));
tB_scheme->setItemToolTip ( 2, i18n("All scheme-related automatic suspend settings."));
@@ -310,11 +316,11 @@ void ConfigureDialog::setTooltips(){
/*!
* This function is used to get the real name of the predefined schemes.
- * This is a workaround for the case if Yast translated the name of the
+ * This is a workaround for the case if Yast translated the name of the
* scheme In this case is a new config section created and the old settings
* would be lost.
* \param s_scheme TQString with the 'current' name of the scheme
- * \return TQString with the english name of the scheme
+ * \return TQString with the english name of the scheme
*/
TQString ConfigureDialog::getSchemeRealName(TQString s_scheme) {
kdDebugFuncIn(trace);
@@ -336,22 +342,22 @@ TQString ConfigureDialog::getSchemeRealName(TQString s_scheme) {
/*!
* This function is used to read the settings from configfile and
* set the values to the related dialog elements.
- * \param schemeID Integer value, represent the position of the
+ * \param schemeID Integer value, represent the position of the
* scheme in the TQListBox and within the pdaemon-list.
*/
void ConfigureDialog::setConfigToDialog( int schemeID ){
if (trace) kdDebug() << funcinfo << "IN , scheme: " << schemeID << endl;
initalised = false;
-
+
TQString s_scheme = getSchemeRealName(schemes[schemeID]);
if (tdeconfig->hasGroup(s_scheme)){
settings->load_general_settings();
-
+
// set the delete scheme button enabled if needed
- if (!s_scheme.startsWith("Performance") && !s_scheme.startsWith("Powersave") &&
+ if (!s_scheme.startsWith("Performance") && !s_scheme.startsWith("Powersave") &&
!s_scheme.startsWith("Presentation") && !s_scheme.startsWith("Acoustic")) {
- if (!s_scheme.startsWith(settings->ac_scheme) ||
+ if (!s_scheme.startsWith(settings->ac_scheme) ||
!s_scheme.startsWith(settings->battery_scheme)) {
// enable delete button
pB_deleteScheme->setEnabled( true );
@@ -372,19 +378,19 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
tdeconfig->setGroup(s_scheme);
}
// no configuration found, set to default values ?!
- else {
+ else {
if(tdeconfig->hasGroup("default-scheme"))
tdeconfig->setGroup("default-scheme");
- else {
+ else {
kdDebugFuncOut(trace);
return;
}
}
-
+
cB_disable_Ss_toggled(tdeconfig->readBoolEntry("disableSs",false));
cB_blankScreen->setChecked(tdeconfig->readBoolEntry("blankSs",false));
cB_specificSettings_toggled(tdeconfig->readBoolEntry("specSsSettings",false));
-
+
int i_standby = tdeconfig->readNumEntry("standbyAfter", -1);
if(i_standby >= 0) {
sB_standby->setValue(i_standby);
@@ -406,7 +412,7 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
if (tdeconfig->hasGroup(s_scheme)) tdeconfig->setGroup(s_scheme);
else tdeconfig->setGroup("default-scheme");
}
-
+
int i_suspend = tdeconfig->readNumEntry("suspendAfter", -1);
if(i_suspend >= 0) {
sB_suspend->setValue(i_suspend);
@@ -428,7 +434,7 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
if (tdeconfig->hasGroup(s_scheme)) tdeconfig->setGroup(s_scheme);
else tdeconfig->setGroup("default-scheme");
}
-
+
int i_poweroff = tdeconfig->readNumEntry("powerOffAfter", -1);
if(i_poweroff >= 0) {
sB_powerOff->setValue(i_poweroff);
@@ -450,15 +456,15 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
if (tdeconfig->hasGroup(s_scheme)) tdeconfig->setGroup(s_scheme);
else tdeconfig->setGroup("default-scheme");
}
-
+
cB_SpecificPM_toggled(tdeconfig->readBoolEntry("specPMSettings",false));
cB_disablePM_toggled(tdeconfig->readBoolEntry("disableDPMS",false));
-
+
// set autosuspend related settings
TQString _action = tdeconfig->readEntry("autoInactiveAction", "NULL");
if( _action != "NULL") {
int _index = actions.findIndex(_action);
- if( _index != -1) {
+ if( _index != -1) {
cB_autoInactivity->setCurrentItem( _index );
cB_autoInactivity_activated( _index );
cB_Blacklist->setEnabled(true);
@@ -474,13 +480,13 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
else {
// set to disabled (to reduce code), if a entry found set to enabled !
cB_Blacklist->setEnabled(false);
-
+
if(tdeconfig->hasGroup("default-scheme")){
tdeconfig->setGroup("default-scheme");
_action = tdeconfig->readEntry("autoInactiveAction", "NULL");
if(_action != "NULL") {
int _index = actions.findIndex(_action);
- if( _index != -1) {
+ if( _index != -1) {
cB_autoInactivity->setCurrentItem( _index );
tL_autoInactivity_After->setEnabled(true);
cB_Blacklist->setEnabled(true);
@@ -504,7 +510,7 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
sB_autoInactivity->setEnabled(false);
tL_autoInactivity_After->setEnabled(false);
}
-
+
int i_autoInactivityAfter = tdeconfig->readNumEntry("autoInactiveActionAfter", -1);
if(i_autoInactivityAfter >= 0) {
sB_autoInactivity->setValue(i_autoInactivityAfter);
@@ -532,9 +538,9 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
cB_Brightness->setEnabled(true);
cB_Brightness_toggled(tdeconfig->readBoolEntry("enableBrightness",false));
- if (brightnessLevels > 33)
+ if (brightnessLevels > 33)
brightnessSlider->setLineStep(3);
- else
+ else
brightnessSlider->setLineStep(100/brightnessLevels);
brightnessSlider->setPageStep(10);
@@ -546,9 +552,9 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
}
else {
brightnessSlider->setValue(100);
- tL_valueBrightness->setText(TQString::number(100)+ " %");
+ tL_valueBrightness->setText(TQString::number(100)+ " %");
}
-
+
tL_brightness->setText(i18n("Your hardware supports to change the brightness. The "
"values of the slider are in percent and mapped "
"to the available brightness levels of your hardware."));
@@ -560,7 +566,7 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
"of your display."));
}
- // no need to enable autodimm if not support change brightness
+ // no need to enable autodimm if not support change brightness
if (hwinfo->supportBrightness()) {
int i_autoDimmAfter = tdeconfig->readNumEntry("autoDimmAfter", -1);
if(i_autoDimmAfter >= 0) {
@@ -609,13 +615,13 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
if (hwinfo->supportCPUFreq()) {
TQString cpuFreqPolicy = tdeconfig->readEntry("cpuFreqPolicy");
-
+
if (cpuFreqPolicy.isEmpty()) {
// load value from default-scheme
if(tdeconfig->hasGroup("default-scheme")){
tdeconfig->setGroup("default-scheme");
- cpuFreqPolicy = tdeconfig->readEntry("cpuFreqPolicy");
- }
+ cpuFreqPolicy = tdeconfig->readEntry("cpuFreqPolicy");
+ }
if (cpuFreqPolicy.isEmpty()) {
cpuFreqPolicy = "DYNAMIC";
}
@@ -657,35 +663,35 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
}
/*!
- * This is used to set the values from the section general in configfile to the
+ * This is used to set the values from the section general in configfile to the
* related items in the dialog.
*/
void ConfigureDialog::setGeneralSettings() {
kdDebugFuncIn(trace);
tdeconfig->setGroup("General");
-
+
cB_lockSuspend->setChecked(tdeconfig->readBoolEntry("lockOnSuspend",false));
cB_lockLid->setChecked(tdeconfig->readBoolEntry("lockOnLidClose",false));
cB_autostart->setChecked(tdeconfig->readBoolEntry("Autostart",false));
cB_autostart_neverAsk->setChecked(tdeconfig->readBoolEntry("AutostartNeverAsk",false));
-
+
TQString lockmethod = tdeconfig->readEntry("lockMethod", "NULL");
if(comboB_lock->count() == 0 ){
- comboB_lock->insertItem(i18n("Select Automatically"),0);
+ comboB_lock->insertItem(i18n("Select Automatically"),0);
comboB_lock->insertItem(i18n("TDEScreensaver"),1);
comboB_lock->insertItem(i18n("XScreensaver"),2);
comboB_lock->insertItem(i18n("xlock"),3);
if (gnome_session) comboB_lock->insertItem(i18n("GNOME Screensaver"),4);
}
-
+
if (lockmethod == "automatic") comboB_lock->setCurrentItem(0);
else if (lockmethod == "tdescreensaver") comboB_lock->setCurrentItem(1);
else if (lockmethod == "xscreensaver") comboB_lock->setCurrentItem(2);
else if (lockmethod == "xlock") comboB_lock->setCurrentItem(3);
else if (gnome_session && (lockmethod == "gnomescreensaver")) comboB_lock->setCurrentItem(4);
else comboB_lock->setCurrentItem(0);
-
+
if(cB_lockSuspend->isOn() || cB_lockLid->isOn() ) {
tL_lockWith->setEnabled(true);
comboB_lock->setEnabled(true);
@@ -728,7 +734,7 @@ void ConfigureDialog::setGeneralSettings() {
sB_batCritAction_value->setValue(tdeconfig->readNumEntry("batteryCriticalActionValue",0));
}
} else {
- // disable tab
+ // disable tab
tB_general->setItemLabel( 0, tB_scheme->itemLabel(0) + i18n(" - not supported"));
tB_general->setItemEnabled( 0, false);
}
@@ -755,7 +761,7 @@ void ConfigureDialog::setGeneralSettings() {
/* ---- START store settings SECTION ---- */
-/*!
+/*!
* This used to save changes in settings of the current scheme.
*/
void ConfigureDialog::saveSchemeSettings() {
@@ -769,13 +775,13 @@ void ConfigureDialog::saveSchemeSettings() {
tdeconfig->writeEntry("blankSs",cB_blankScreen->isOn());
tdeconfig->writeEntry("specPMSettings",cB_SpecificPM->isOn());
tdeconfig->writeEntry("disableDPMS",cB_disablePM->isOn());
-
+
tdeconfig->writeEntry("standbyAfter",sB_standby->value());
tdeconfig->writeEntry("suspendAfter",sB_suspend->value());
tdeconfig->writeEntry("powerOffAfter",sB_powerOff->value());
tdeconfig->writeEntry("disableNotifications",cB_disableNotifications->isOn());
-
+
if(cB_autoInactivity->currentText() == " "){
tdeconfig->writeEntry("autoInactiveAction", "_NONE_");
}
@@ -783,7 +789,7 @@ void ConfigureDialog::saveSchemeSettings() {
int _index = cB_autoInactivity->currentItem();
if(_index > 0) {
/*if(_index == (cB_autoInactivity->count()-1)) {
- tdeconfig->writeEntry("autoInactiveAction","shutdown");
+ tdeconfig->writeEntry("autoInactiveAction","shutdown");
}
else {
tdeconfig->writeEntry("autoInactiveAction",actions[(_index)]);
@@ -794,7 +800,7 @@ void ConfigureDialog::saveSchemeSettings() {
}
tdeconfig->writeEntry("autoSuspend",cB_autoSuspend->isOn());
tdeconfig->writeEntry("autoInactiveSchemeBlacklistEnabled",cB_Blacklist->isOn());
-
+
tdeconfig->writeEntry("autoDimm",cB_autoDimm->isOn());
tdeconfig->writeEntry("autoDimmAfter", sB_autoDimmTime->value());
tdeconfig->writeEntry("autoDimmTo", sB_autoDimmTo->value());
@@ -827,19 +833,19 @@ void ConfigureDialog::saveSchemeSettings() {
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to save changes in settings of the current scheme.
*/
void ConfigureDialog::saveGeneralSettings() {
kdDebugFuncIn(trace);
tdeconfig->setGroup("General");
-
+
tdeconfig->writeEntry("lockOnSuspend",cB_lockSuspend->isOn());
tdeconfig->writeEntry("lockOnLidClose",cB_lockLid->isOn());
tdeconfig->writeEntry("Autostart",cB_autostart->isOn());
tdeconfig->writeEntry("AutostartNeverAsk",cB_autostart_neverAsk->isOn());
-
+
TQString selected_method = "";
int _selected = comboB_lock->currentItem();
if(_selected == 0) selected_method = "automatic";
@@ -848,7 +854,7 @@ void ConfigureDialog::saveGeneralSettings() {
else if(_selected == 3) selected_method = "xlock";
else if(gnome_session && (_selected == 4)) selected_method = "gnomescreensaver";
tdeconfig->writeEntry( "lockMethod", selected_method );
-
+
tdeconfig->writeEntry("batteryWarning", sB_batWarning->value());
tdeconfig->writeEntry("batteryLow", sB_batLow->value());
tdeconfig->writeEntry("batteryCritical", sB_batCritical->value());
@@ -940,10 +946,10 @@ void ConfigureDialog::listBox_schemes_currentChanged(){
int res = KMessageBox::warningYesNo(this,
i18n("There are unsaved changes in the active scheme.\n"
"Apply the changes before jumping to the next scheme "
- "or discard the changes?"),
+ "or discard the changes?"),
i18n("Unsaved Changes"), KStdGuiItem::apply(),
KStdGuiItem::discard());
-
+
if (res == KMessageBox::Yes) {
// Save changes
saveSchemeSettings();
@@ -990,7 +996,7 @@ void ConfigureDialog::buttonCancel_clicked(){
if (scheme_changed || general_changed) {
int res = KMessageBox::warningYesNoCancel(this,
i18n("There are unsaved changes.\nApply the changes "
- "before cancel or discard the changes?"),
+ "before cancel or discard the changes?"),
i18n("Unsaved Changes"), KStdGuiItem::apply(),
KStdGuiItem::discard());
if (res == KMessageBox::Yes) {
@@ -1011,7 +1017,7 @@ void ConfigureDialog::buttonOk_clicked(){
buttonApply_clicked();
buttonApply->setEnabled(false);
-
+
kdDebugFuncOut(trace);
close();
}
@@ -1046,7 +1052,7 @@ void ConfigureDialog::pB_newScheme_clicked(){
getSchemeList();
while (!_end) {
- _new = KInputDialog::getText( i18n("TDEPowersave Configuration"),
+ _new = KInputDialog::getText( i18n("TDEPowersave Configuration"),
_error + _text, TQString(), &_ok, this);
if (!_ok ) {
_end = true;
@@ -1055,7 +1061,7 @@ void ConfigureDialog::pB_newScheme_clicked(){
if (!_new.isEmpty()) {
if ( schemes.contains(_new))
_error = i18n("Error: A scheme with this name already exist.\n");
- else
+ else
_end = true;
}
}
@@ -1073,7 +1079,7 @@ void ConfigureDialog::pB_newScheme_clicked(){
selectScheme(_new);
saveSchemeSettings();
}
-
+
kdDebugFuncOut(trace);
}
@@ -1102,7 +1108,7 @@ void ConfigureDialog::pB_deleteScheme_clicked(){
selectScheme(settings->currentScheme);
} else {
// could not delete the scheme ... error case
- KMessageBox::queuedMessageBox(this, KMessageBox::Error,
+ KMessageBox::queuedMessageBox(this, KMessageBox::Error,
i18n("Could not delete the selected scheme."));
}
}
@@ -1124,7 +1130,7 @@ void ConfigureDialog::cB_specificSettings_toggled(bool state){
kdDebugFuncIn(trace);
if(!initalised) cB_specificSettings->setChecked(state);
-
+
/* set widgets visible/disabled */
if(state){
cB_disable_Ss->setEnabled(true);
@@ -1154,7 +1160,7 @@ void ConfigureDialog::cB_disable_Ss_toggled(bool state){
/* set widgets visible/disabled */
if(!initalised) cB_disable_Ss->setChecked(state);
cB_blankScreen->setEnabled(!state);
-
+
kdDebugFuncOut(trace);
}
@@ -1172,7 +1178,7 @@ void ConfigureDialog::cB_SpecificPM_toggled(bool state){
kdDebugFuncIn(trace);
if(!initalised) cB_SpecificPM->setChecked(state);
-
+
/* set widgets visible/disabled */
cB_disablePM->setEnabled(state);
if(cB_disablePM->isOn()) {
@@ -1216,7 +1222,7 @@ void ConfigureDialog::sB_standby_valueChanged() {
kdDebugFuncIn(trace);
if (initalised) {
- if (sB_standby->value() == 0 )
+ if (sB_standby->value() == 0 )
return;
if ( sB_standby->value() > sB_suspend->value()) {
sB_suspend->setValue(sB_standby->value());
@@ -1233,7 +1239,7 @@ void ConfigureDialog::sB_suspend_valueChanged() {
kdDebugFuncIn(trace);
if (initalised) {
- if (sB_suspend->value() == 0 )
+ if (sB_suspend->value() == 0 )
return;
if ( sB_suspend->value() < sB_standby->value()) {
@@ -1243,7 +1249,7 @@ void ConfigureDialog::sB_suspend_valueChanged() {
sB_powerOff->setValue(sB_suspend->value());
}
}
-
+
kdDebugFuncOut(trace);
}
@@ -1254,7 +1260,7 @@ void ConfigureDialog::sB_powerOff_valueChanged() {
kdDebugFuncIn(trace);
if (initalised) {
- if (sB_powerOff->value() == 0 )
+ if (sB_powerOff->value() == 0 )
return;
if ( sB_powerOff->value() < sB_suspend->value()) {
sB_suspend->setValue(sB_powerOff->value());
@@ -1268,7 +1274,7 @@ void ConfigureDialog::sB_powerOff_valueChanged() {
/* ---- START Inactivity SECTION ---- */
-/*!
+/*!
* This used to set the inactivity related combobox cB_autoInactivity .
*/
void ConfigureDialog::setInactivityBox(){
@@ -1280,7 +1286,7 @@ void ConfigureDialog::setInactivityBox(){
// add "Turn Off Computer" at end of the list
// TQString _to_i18n = i18n("Turn Off Computer");
// actions.append("Turn Off Computer");
-
+
for ( TQStringList::Iterator it = actions.begin(); it != actions.end(); ++it ) {
cB_autoInactivity->insertItem( i18n( (*it).ascii() ) );
}
@@ -1355,7 +1361,7 @@ void ConfigureDialog::cB_autoInactivity_activated( int selectedItem ) {
tL_autoInactivity_After->setEnabled(true);
cB_Blacklist->setEnabled(true);
if(cB_Blacklist->isChecked()) pB_editBlacklist->setEnabled(true);
-
+
}
else {
sB_autoInactivity->setEnabled(false);
@@ -1363,9 +1369,9 @@ void ConfigureDialog::cB_autoInactivity_activated( int selectedItem ) {
cB_Blacklist->setEnabled(false);
pB_editBlacklist->setEnabled(false);
}
-
+
cB_autoInactivity->setCurrentItem( selectedItem );
-
+
if(initalised) {
scheme_changed = true;
buttonApply->setEnabled(true);
@@ -1383,7 +1389,7 @@ void ConfigureDialog::cB_Blacklist_toggled( bool toggled ){
kdDebugFuncIn(trace);
pB_editBlacklist->setEnabled(toggled);
-
+
if(initalised) {
buttonApply->setEnabled(true);
scheme_changed = true;
@@ -1431,8 +1437,8 @@ void ConfigureDialog::pB_editBlacklistSuspend_clicked(){
}
}
blacklistEDlgAS = new blacklistEditDialog(blacklist, _top_text, initialiseImport, this);
-
- connect( blacklistEDlgAS, TQT_SIGNAL(config_finished(TQStringList)), this,
+
+ connect( blacklistEDlgAS, TQT_SIGNAL(config_finished(TQStringList)), this,
TQT_SLOT(saveSchemeSuspendBlacklist(TQStringList)));
blacklistEDlgAS->exec();
@@ -1466,14 +1472,14 @@ void ConfigureDialog::saveSchemeSuspendBlacklist( TQStringList new_blacklist){
/* ---- START Autodimm SECTION ---- */
-/*!
+/*!
* This used to set the autodimm related widgets.
*/
void ConfigureDialog::cB_autoDimm_toggled( bool toggled ) {
kdDebugFuncIn(trace);
if(cB_autoDimm->isOn() != toggled)
- cB_autoDimm->setChecked(toggled);
+ cB_autoDimm->setChecked(toggled);
if (toggled)
tL_autoDimmExplain->setEnabled(toggled);
@@ -1487,7 +1493,7 @@ void ConfigureDialog::cB_autoDimm_toggled( bool toggled ) {
if (cB_BlacklistDimm->isOn())
pB_editBlacklistDimm->setEnabled(toggled);
-
+
if (toggled) {
if (sB_autoDimmTime->value() > 0) {
tL_autoDimmTo->setEnabled(true);
@@ -1513,7 +1519,7 @@ void ConfigureDialog::cB_BlacklistDimm_toggled( bool toggled ){
kdDebugFuncIn(trace);
pB_editBlacklistDimm->setEnabled(toggled);
-
+
if(initalised) {
buttonApply->setEnabled(true);
scheme_changed = true;
@@ -1561,8 +1567,8 @@ void ConfigureDialog::pB_editBlacklistDimm_clicked(){
}
}
blacklistEDlgAD = new blacklistEditDialog(blacklist, _top_text, initialiseImport, this);
-
- connect( blacklistEDlgAD, TQT_SIGNAL(config_finished(TQStringList)), this,
+
+ connect( blacklistEDlgAD, TQT_SIGNAL(config_finished(TQStringList)), this,
TQT_SLOT(saveSchemeDimmBlacklist(TQStringList)));
blacklistEDlgAD->exec();
@@ -1667,9 +1673,9 @@ void ConfigureDialog::pB_resetBrightness_clicked( ) {
*/
void ConfigureDialog::sB_batWarning_valueChanged() {
kdDebugFuncIn(trace);
-
+
if (initalised) {
- if (sB_batWarning->value() == 0 )
+ if (sB_batWarning->value() == 0 )
sB_batWarning->setValue(1);
if ( sB_batWarning->value() <= sB_batLow->value()) {
sB_batLow->setValue(sB_batWarning->value()-1);
@@ -1686,7 +1692,7 @@ void ConfigureDialog::sB_batLow_valueChanged() {
kdDebugFuncIn(trace);
if (initalised) {
- if (sB_batLow->value() == 0 )
+ if (sB_batLow->value() == 0 )
sB_batLow->setValue(1);
if ( sB_batLow->value() >= sB_batWarning->value()) {
@@ -1707,7 +1713,7 @@ void ConfigureDialog::sB_batCritical_valueChanged() {
kdDebugFuncIn(trace);
if (initalised) {
- if (sB_batCritical->value() == 0 )
+ if (sB_batCritical->value() == 0 )
sB_batCritical->setValue(1);
if ( sB_batCritical->value() >= sB_batLow->value()) {
sB_batLow->setValue(sB_batCritical->value()+1);
@@ -1797,6 +1803,9 @@ TQString ConfigureDialog::mapActionToDescription( TQString action ) {
} else if (action.startsWith("SUSPEND2RAM")) {
if (actions.contains("Suspend to RAM"))
ret = i18n("Suspend to RAM");
+ } else if (action.startsWith("FREEZE")) {
+ if (actions.contains("Freeze"))
+ ret = i18n("Freeze");
} else if (action.startsWith("CPUFRETQ_POWERSAVE")) {
if (hwinfo->supportCPUFreq())
ret = i18n("CPU Powersave policy");
@@ -1809,7 +1818,7 @@ TQString ConfigureDialog::mapActionToDescription( TQString action ) {
} else if (action.startsWith("BRIGHTNESS")) {
if (hwinfo->supportBrightness())
ret = i18n("Set Brightness to");
- }
+ }
kdDebugFuncOut(trace);
return ret;
@@ -1827,28 +1836,31 @@ TQString ConfigureDialog::mapDescriptionToAction( TQString description ) {
if (description.startsWith("Shutdown") || description.startsWith(i18n("Shutdown"))) {
ret = "SHUTDOWN";
- } else if (description.startsWith("Logout Dialog") ||
+ } else if (description.startsWith("Logout Dialog") ||
description.startsWith(i18n("Logout Dialog"))) {
ret = "LOGOUT_DIALOG";
- } else if (description.startsWith("Suspend to Disk") ||
+ } else if (description.startsWith("Suspend to Disk") ||
description.startsWith(i18n("Suspend to Disk"))) {
ret = "SUSPEND2DISK";
- } else if (description.startsWith("Suspend to RAM") ||
+ } else if (description.startsWith("Suspend to RAM") ||
description.startsWith(i18n("Suspend to RAM"))) {
ret = "SUSPEND2RAM";
- } else if (description.startsWith("CPU Powersave policy") ||
+ } else if (description.startsWith("Freeze") ||
+ description.startsWith(i18n("Freeze"))) {
+ ret = "FREEZE";
+ } else if (description.startsWith("CPU Powersave policy") ||
description.startsWith(i18n("CPU Powersave policy"))) {
ret = "CPUFRETQ_POWERSAVE";
- } else if (description.startsWith("CPU Dynamic policy") ||
+ } else if (description.startsWith("CPU Dynamic policy") ||
description.startsWith(i18n("CPU Dynamic policy"))) {
ret = "CPUFRETQ_DYNAMIC";
- } else if (description.startsWith("CPU Performance policy") ||
+ } else if (description.startsWith("CPU Performance policy") ||
description.startsWith(i18n("CPU Performance policy"))) {
ret = "CPUFRETQ_PERFORMANCE";
- } else if (description.startsWith("Set Brightness to") ||
+ } else if (description.startsWith("Set Brightness to") ||
description.startsWith(i18n("Set Brightness to"))) {
ret = "BRIGHTNESS";
- }
+ }
kdDebugFuncOut(trace);
return ret;
diff --git a/src/countdowndialog.cpp b/src/countdowndialog.cpp
index 0adf891..99b519e 100644
--- a/src/countdowndialog.cpp
+++ b/src/countdowndialog.cpp
@@ -18,7 +18,7 @@
***************************************************************************/
/*! \file countdowndialog.cpp
- * \brief In this file can be found the countdown dialog related code.
+ * \brief In this file can be found the countdown dialog related code.
* \author Danny Kukawka, <[email protected], [email protected]>
* \date 2007
*/
@@ -34,7 +34,7 @@
// QT headers:
#include <tqdialog.h>
-#include <tqlabel.h>
+#include <tqlabel.h>
#include <tqprogressbar.h>
#include <tqpushbutton.h>
#include <tqstring.h>
@@ -66,7 +66,7 @@ countDownDialog::~countDownDialog() {
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This used to set Icon/pixmap for the dialog.
* \param type TQString with the type of the current suspend
* to set the pixmap in the dialog
@@ -79,6 +79,8 @@ void countDownDialog::setPixmap( TQString type )
pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_disk", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else if (type.startsWith("suspend2ram")) {
pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_ram", TDEIcon::NoGroup, TDEIcon::SizeLarge);
+ } else if (type.startsWith("freeze")) {
+ pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_ram", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else if (type.startsWith("standby")) {
pixmap = TDEGlobal::iconLoader()->loadIcon("stand_by", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else {
@@ -89,7 +91,7 @@ void countDownDialog::setPixmap( TQString type )
/*!
* To set the message to the dialog, which should be shown to the user.
- * \param text TQString with the message.
+ * \param text TQString with the message.
*/
void countDownDialog::setMessageText(TQString text) {
kdDebugFuncIn(trace);
@@ -153,12 +155,12 @@ void countDownDialog::updateProgress() {
if (remaining == 0 ) {
if (PROGRESS->isActive())
PROGRESS->stop();
-
+
chancel = false;
close();
} else if ( remaining > 0) {
int setTo = (int)((100.0/(float)timeOut)*(float)remaining);
-
+
// set the progressBar
progressBar->setFormat(i18n("%1 seconds").arg(remaining));
progressBar->setPercentageVisible(true);
diff --git a/src/eventsrc b/src/eventsrc
index 8da795e..f379275 100644
--- a/src/eventsrc
+++ b/src/eventsrc
@@ -251,6 +251,12 @@ Comment[zh_CN]=启动暂挂到 RAM
Comment[zh_TW]=已啟動「暫停寫入到 RAM」
default_presentation=0
+[freeze_event]
+Name=FreezeEvent
+Comment=Freeze is started
+Comment[cs]=Přepínání do zmrazeného stavu
+default_presentation=0
+
[standby_event]
Name=StandbyEvent
Comment=Standby is started
@@ -302,6 +308,12 @@ Comment[zh_CN]=从“暂挂到 RAM”继续执行
Comment[zh_TW]=從「暫停寫入到 RAM」繼續執行
default_presentation=0
+[resume_from_freeze_event]
+Name=ResumeFromFreezeEvent
+Comment=Resumed from Freeze
+Comment[cs]=Probouzení ze zmrazeného stavu
+default_presentation=0
+
[resume_from_standby_event]
Name=ResumeFromStandbyEvent
Comment=Resumed from Standby
diff --git a/src/hardware.cpp b/src/hardware.cpp
index cf1cdd9..bb4f21f 100644
--- a/src/hardware.cpp
+++ b/src/hardware.cpp
@@ -17,9 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-/*!
+/*!
* \file hardware.cpp
- * \brief In this file can be found the hardware information related code.
+ * \brief In this file can be found the hardware information related code.
* \author Danny Kukawka, <[email protected]>, <[email protected]>
* \date 2006-2007
*/
@@ -66,7 +66,7 @@ HardwareInfo::HardwareInfo() {
update_info_ac_changed = true;
update_info_cpufreq_policy_changed = true;
update_info_primBattery_changed = true;
-
+
currentCPUFreqPolicy = UNKNOWN_CPUFREQ;
primaryBatteriesWarnLevel = 12;
primaryBatteriesLowLevel = 7;
@@ -75,7 +75,7 @@ HardwareInfo::HardwareInfo() {
allUDIs = TQStringList();
consoleKitSession = TQString();
BatteryList.setAutoDelete( true ); // the list owns the objects
-
+
primaryBatteries = new BatteryCollection(BAT_PRIMARY);
setPrimaryBatteriesWarningLevel(); // force default settings
@@ -92,7 +92,7 @@ HardwareInfo::HardwareInfo() {
checkIsLaptop();
checkBrightness();
checkCPUFreq();
- // getSchedPowerSavings();
+ // getSchedPowerSavings();
checkSuspend();
intialiseHWInfo();
@@ -116,7 +116,7 @@ HardwareInfo::~HardwareInfo() {
*/
bool HardwareInfo::reinitHardwareInfos () {
kdDebugFuncIn(trace);
-
+
/* first cleanup */
acadapter = true;
lidclose = false;
@@ -128,7 +128,7 @@ bool HardwareInfo::reinitHardwareInfos () {
update_info_ac_changed = true;
update_info_cpufreq_policy_changed = true;
update_info_primBattery_changed = true;
-
+
allUDIs = TQStringList();
BatteryList.clear();
@@ -144,7 +144,7 @@ bool HardwareInfo::reinitHardwareInfos () {
// getSchedPowerSavings();
updatePrimaryBatteries();
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
return true;
}
@@ -189,7 +189,7 @@ void HardwareInfo::processKeyPressEvent(unsigned int keycode, TDEEventDevice* ed
// FIXME
// How can I get specific button press/release information (instead of just "something happened to the button") from the TDE hardware library?
- // TODO: Check if we really need to monitor this events. We get maybe also
+ // TODO: Check if we really need to monitor this events. We get maybe also
// HAL_PROPERTY_CHANGED event for the key
// if (message.startsWith("ButtonPressed")) {
kdDebug() << "ButtonPressed event from TDE HW library " << endl;
@@ -216,7 +216,7 @@ void HardwareInfo::processKeyPressEvent(unsigned int keycode, TDEEventDevice* ed
}
/*!
- * This funtion is used to parse a message from D-Bus for the different
+ * This funtion is used to parse a message from D-Bus for the different
* messagetypes and events.
* \param type a \ref msg_type which should be parse/processed
* \param message the message
@@ -241,7 +241,7 @@ void HardwareInfo::processMessage (msg_type type, TQString message, TQString val
case BUTTON_SLEEP:
case BUTTON_POWER:
case LID:
- // TODO: handle code if needed actually not
+ // TODO: handle code if needed actually not
break;
case LAPTOP_PANEL:
checkBrightness();
@@ -317,7 +317,7 @@ void HardwareInfo::handleResumeSignal (int result) {
if (trace) kdDebug() << funcinfo << "IN: " << "(int result: " << result << ")"<< endl;
if (result == -1) {
- // check if time since suspend is higher than 6 hours,
+ // check if time since suspend is higher than 6 hours,
// the magic D-Bus timeout for pending calls
if (calledSuspend.elapsed() > 21600000) {
emit resumed(INT_MAX);
@@ -325,12 +325,12 @@ void HardwareInfo::handleResumeSignal (int result) {
} else {
emit resumed(result);
}
-
+
calledSuspend = TQTime();
kdDebugFuncOut(trace);
}
-/*!
+/*!
* This function checks the session for the running TDEPowersave instance
* \return Boolean with result of operation
* \retval true if the query/check could get finished
@@ -349,30 +349,30 @@ bool HardwareInfo::checkConsoleKitSession () {
kdDebug() << "Could not get XDG_SESSION_COOKIE from environment" << endl;
sessionIsActive = true;
} else {
- if (dbus_HAL->dbusSystemMethodCall( CK_SERVICE, CK_MANAGER_OBJECT,
- CK_MANAGER_IFACE, "GetSessionForCookie",
+ if (dbus_HAL->dbusSystemMethodCall( CK_SERVICE, CK_MANAGER_OBJECT,
+ CK_MANAGER_IFACE, "GetSessionForCookie",
&reply, DBUS_TYPE_OBJECT_PATH,
DBUS_TYPE_STRING, &cookie,
DBUS_TYPE_INVALID)) {
- if (trace)
+ if (trace)
kdDebug() << "GetSessionForCookie returned: " << reply << endl;
-
+
if (reply != NULL) {
dbus_bool_t i_reply;
consoleKitSession = reply;
-
- if (dbus_HAL->dbusSystemMethodCall( CK_SERVICE, consoleKitSession,
- CK_SESSION_IFACE, "IsActive",
+
+ if (dbus_HAL->dbusSystemMethodCall( CK_SERVICE, consoleKitSession,
+ CK_SESSION_IFACE, "IsActive",
&i_reply, DBUS_TYPE_BOOLEAN,
DBUS_TYPE_INVALID)) {
sessionIsActive = ((i_reply != 0) ? true: false);
- if (trace)
+ if (trace)
kdDebug() << "IsActive returned: " << sessionIsActive << endl;
-
+
retval = true;
} else {
kdError() << "Could get session cookie and session name, but not "
- << "but not the status of the session. Assume for now "
+ << "but not the status of the session. Assume for now "
<< "the Session is inactive!" << endl;
sessionIsActive = false;
}
@@ -385,7 +385,7 @@ bool HardwareInfo::checkConsoleKitSession () {
return retval;
}
-/*!
+/*!
* This function check for a given UDI, if we should handle a device
* \param _udi TQString with the UDI of the device
* \param *type pointer to a integer to return the type of the device, see \ref device_type
@@ -395,12 +395,12 @@ bool HardwareInfo::checkConsoleKitSession () {
*/
bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
kdDebugFuncIn(trace);
-
+
TQStringList _cap;
bool ret = true;
TDEGenericDevice* hwdevice = m_hwdevices->findByUniqueID(_udi);
-
+
if (hwdevice) {
TDEGenericDeviceType::TDEGenericDeviceType devtype = hwdevice->type();
if (devtype == TDEGenericDeviceType::PowerSupply) {
@@ -431,9 +431,9 @@ bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
} else {
ret = false;
}
-
+
if (!ret) *type = UNKNOWN_DEVICE;
-
+
kdDebugFuncOut(trace);
return ret;
}
@@ -441,7 +441,7 @@ bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
// --> set some values for devices
/*!
* This function set the warning level for the primary battery collection
- * If all give param are -1 or not set this function force the current
+ * If all give param are -1 or not set this function force the current
* settings to the primary battery collection.
* \param _warn value for the state BAT_WARN or -1
* \param _low value for the state BAT_LOW or -1
@@ -479,7 +479,7 @@ void HardwareInfo::checkIsLaptop () {
TQString ret;
TDERootSystemDevice* rdevice = m_hwdevices->rootSystemDevice();
-
+
if (rdevice->formFactor() == TDESystemFormFactor::Laptop) {
laptop = true;
}
@@ -495,7 +495,7 @@ void HardwareInfo::checkIsLaptop () {
*/
void HardwareInfo::checkPowermanagement() {
kdDebugFuncIn(trace);
-
+
TQString ret;
has_APM = false;
@@ -506,7 +506,7 @@ void HardwareInfo::checkPowermanagement() {
if (hwlist.count() > 0) {
has_ACPI = true;
}
-
+
// FIXME
// Do we even need to detect APM and PMU devices in the year 2012?!?
@@ -519,7 +519,7 @@ void HardwareInfo::checkPowermanagement() {
*/
void HardwareInfo::checkSuspend() {
kdDebugFuncIn(trace);
-
+
suspend_states = SuspendStates();
suspend_states.suspend2ram = false;
@@ -528,6 +528,9 @@ void HardwareInfo::checkSuspend() {
suspend_states.suspend2disk = false;
suspend_states.suspend2disk_can = false;
suspend_states.suspend2disk_allowed = -1;
+ suspend_states.freeze = false;
+ suspend_states.freeze_can = false;
+ suspend_states.freeze_allowed = -1;
suspend_states.standby = false;
suspend_states.standby_can = false;
suspend_states.standby_allowed = -1;
@@ -545,6 +548,11 @@ void HardwareInfo::checkSuspend() {
suspend_states.standby_allowed = rdevice->canStandby();
suspend_states.standby_can = suspend_states.standby_allowed & suspend_states.standby;
}
+ if ((*it) == TDESystemPowerState::Freeze) {
+ suspend_states.freeze = true;
+ suspend_states.freeze_allowed = rdevice->canFreeze();
+ suspend_states.freeze_can = suspend_states.freeze_allowed & suspend_states.freeze;
+ }
if ((*it) == TDESystemPowerState::Suspend) {
suspend_states.suspend2ram = true;
suspend_states.suspend2ram_allowed = rdevice->canSuspend();
@@ -575,7 +583,7 @@ void HardwareInfo::checkCPUFreq() {
TDEGenericDevice *hwdevice;
hwdevice = hwlist.first();
TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
-
+
if (!cpudevice->scalingDriver().isNull()) {
cpuFreq = true;
cpuFreqAllowed = cpudevice->canSetGovernor();
@@ -600,7 +608,7 @@ cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy() {
TDEGenericDevice *hwdevice;
hwdevice = hwlist.first();
TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
-
+
TQString gov = cpudevice->governor();
cpufreq_type _current = UNKNOWN_CPUFREQ;
@@ -622,7 +630,7 @@ cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy() {
kdWarning() << "Could not get information about current governor" << endl;
}
} else {
- kdWarning() << "CPU Frequency interface not supported by machine or HAL" << endl;
+ kdWarning() << "CPU Frequency interface not supported by machine or TDE hardware library" << endl;
}
if (_current != currentCPUFreqPolicy) {
@@ -632,14 +640,14 @@ cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy() {
} else {
update_info_cpufreq_policy_changed = false;
}
-
+
kdDebugFuncOut(trace);
return currentCPUFreqPolicy;
}
/*!
- * The function checks whether the machine provide a brightness interface and init
+ * The function checks whether the machine provide a brightness interface and init
* (if needed) brightness information.
*/
void HardwareInfo::checkBrightness() {
@@ -682,7 +690,7 @@ void HardwareInfo::checkBrightness() {
kdDebugFuncOut(trace);
return;
}
-
+
kdDebugFuncOut(trace);
}
@@ -699,19 +707,19 @@ void HardwareInfo::checkCurrentBrightness() {
TDEGenericDevice *hwdevice;
hwdevice = hwlist.first();
TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
-
+
if (backlightdevice) {
currentBrightnessLevel = backlightdevice->rawBrightness();
}
}
-
+
kdDebugFuncOut(trace);
}
/*!
* The function initialise the hardware information and collect all
- * initial information from HAL.
+ * initial information from TDE hardware library.
* \return boolean with result of the operation
* \retval true if successful
* \retval false else, if a error occurs
@@ -817,7 +825,7 @@ void HardwareInfo::checkLidcloseState() {
}
/*!
- * This funtion is used to call a update of a battery value for a given
+ * This funtion is used to call a update of a battery value for a given
* UDI and the given changed property
* \param udi TQString with the UDI of the battery
* \param property TQString with the changed property
@@ -855,7 +863,7 @@ void HardwareInfo::updatePrimaryBatteries () {
if (primaryBatteries->getNumBatteries() < 1) {
setPrimaryBatteriesWarningLevel();
primaryBatteries->refreshInfo( BatteryList );
- connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this,
+ connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this,
TQT_SLOT(setPrimaryBatteriesChanges()));
connect(primaryBatteries, TQT_SIGNAL(batteryWarnState(int,int)), this,
TQT_SLOT(emitBatteryWARNState(int,int)));
@@ -888,7 +896,7 @@ void HardwareInfo::setPrimaryBatteriesChanges () {
void HardwareInfo::emitBatteryWARNState (int type, int state) {
kdDebugFuncIn(trace);
- if (type == BAT_PRIMARY)
+ if (type == BAT_PRIMARY)
emit primaryBatteryChanged();
else
emit generalDataChanged();
@@ -899,10 +907,10 @@ void HardwareInfo::emitBatteryWARNState (int type, int state) {
}
// --> init HW information section -- END <---
-// --> HAL method call (trigger actions) section -- START <---
+// --> TDE hardware library method call (trigger actions) section -- START <---
/*!
- * Function to trigger a suspend via HAL
+ * Function to trigger a suspend via TDE hardware library
* \param suspend enum of suspend_type with the requested suspend
* \return boolean with result of the operation
* \retval true if successful
@@ -928,7 +936,7 @@ bool HardwareInfo::suspend( suspend_type suspend ) {
return false;
}
} else {
- if ( !suspend_states.suspend2disk )
+ if ( !suspend_states.suspend2disk )
kdDebug() << "The machine does not support suspend to disk." << endl;
else
kdWarning() << "Policy forbid user to trigger suspend to disk" << endl;
@@ -947,11 +955,30 @@ bool HardwareInfo::suspend( suspend_type suspend ) {
return false;
}
} else {
- if ( !suspend_states.suspend2ram )
+ if ( !suspend_states.suspend2ram )
kdDebug() << "The machine does not support suspend to ram." << endl;
else
kdWarning() << "Policy forbid user to trigger suspend to ram" << endl;
-
+
+ return false;
+ }
+ break;
+ case FREEZE:
+ if (suspend_states.freeze && (suspend_states.freeze_allowed != 0)) {
+ if (rdevice->setPowerState(TDESystemPowerState::Freeze)) {
+ calledSuspend.start();
+ handleResumeSignal(0);
+ return true;
+ } else {
+ handleResumeSignal(-1);
+ return false;
+ }
+ } else {
+ if ( !suspend_states.freeze )
+ kdDebug() << "The machine does not support freeze." << endl;
+ else
+ kdWarning() << "Policy forbid user to trigger freeze" << endl;
+
return false;
}
break;
@@ -966,7 +993,7 @@ bool HardwareInfo::suspend( suspend_type suspend ) {
return false;
}
} else {
- if ( !suspend_states.standby )
+ if ( !suspend_states.standby )
kdDebug() << "The machine does not support standby." << endl;
else
kdWarning() << "Policy forbid user to trigger standby" << endl;
@@ -978,13 +1005,13 @@ bool HardwareInfo::suspend( suspend_type suspend ) {
return false;
}
}
-
+
kdDebugFuncOut(trace);
return false;
}
/*!
- * Function to set brightness via HAL (if supported by hardware)
+ * Function to set brightness via TDE hardware library (if supported by hardware)
* \param level Integer with the level to set, (range: 0 - \ref availableBrightnessLevels )
* \param percent Integer with the brightness percentage to set
* \return boolean with result of the operation
@@ -1037,10 +1064,10 @@ bool HardwareInfo::setBrightness ( int level, int percent ){
checkCurrentBrightness();
kdDebugFuncOut(trace);
return retval;
-}
+}
/*!
- * Function to set the CPU frequency policy via HAL.
+ * Function to set the CPU frequency policy via TDE hardware library.
* \param cpufreq enum of cpufreq_type with the policy to set
* \param limit integer with range 0 - 100 (only if cpufreq == DYNAMIC)
* \return boolean with result of the operation
@@ -1051,10 +1078,10 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
if (trace) kdDebug() << funcinfo << "IN: " << "cpufreq_type: " << cpufreq << " limit: " << limit << endl;
if (!cpuFreq) {
- kdError() << "This machine does not support change the CPU Freq via HAL" << endl;
+ kdError() << "This machine does not support change the CPU Freq via TDE hardware library" << endl;
return false;
}
-
+
if (cpuFreqAllowed == 0) {
kdError() << "Could not set CPU Freq, this not the needed privileges." << endl;
return false;
@@ -1088,7 +1115,7 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
for (TQStringList::Iterator it = dynamic.begin(); it != dynamic.end(); it++){
kdDebug() << "Try to set dynamic CPUFreq to: " << *it << endl;
-
+
if (setCPUFreqGovernor((*it).latin1())) {
kdDebug() << "Set dynamic successful to: " << *it << endl;
break;
@@ -1120,7 +1147,7 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
cpuLimit = (cpuLimit * limit) / 100.0;
cpuLimit = cpudevice->maxFrequency() + cpuLimit;
cpudevice->setMaximumScalingFrequency(cpuLimit);
-
+
}
break;
@@ -1134,7 +1161,7 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
kdWarning() << "Unknown cpufreq_type: " << cpufreq << endl;
return false;
}
-
+
// check if the policy was really set (and emit signal)
if (checkCurrentCPUFreqPolicy() == cpufreq) {
// update_info_cpufreq_policy_changed = true;
@@ -1143,13 +1170,13 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
} else {
return false;
}
- } else {
+ } else {
return false;
}
}
/*!
- * Function to set the CPU governor via HAL.
+ * Function to set the CPU governor via TDE hardware library.
* \param governor char * with the name of the governor
* \return boolean with result of the operation
* \retval true if successful
@@ -1172,14 +1199,14 @@ bool HardwareInfo::setCPUFreqGovernor( const char *governor ) {
ret = false;
}
}
-
+
kdDebugFuncOut(trace);
return ret;
}
/*!
- * Function to set the powersave mode (incl. e.g. disk settings) via HAL.
+ * Function to set the powersave mode (incl. e.g. disk settings) via TDE hardware library.
* \param on boolean which tell if enable/disable powersave mode
* \return boolean with result of the operation
* \retval true if successful
@@ -1192,14 +1219,14 @@ bool HardwareInfo::setPowerSave( bool on ) {
// FIXME
// Set up power saving to the best of our ability using "raw" functions
- printf("[FIXME] HardwareInfo::setPowerSave unimplemented!\n\r"); fflush(stdout);
-
+ printf("[FIXME] HardwareInfo::setPowerSave unimplemented!\n"); fflush(stdout);
+
kdDebugFuncOut(trace);
return retval;
}
/*!
- * Function to call GetSchedPowerSavings() via HAL.
+ * Function to call GetSchedPowerSavings() via TDE hardware library.
* \return boolean with result of the operation
* \retval true if successful
* \retval false else, if a error occurs
@@ -1216,8 +1243,8 @@ bool HardwareInfo::getSchedPowerSavings() {
}
/*!
- * Function to call SetSchedPowerSavings() via HAL. Note: this would only work on
- * Multiprocessor/-core machines.
+ * Function to call SetSchedPowerSavings() via TDE hardware library.
+ * Note: this would only work on multiprocessor/-core machines.
* \return boolean with result of the operation
* \retval true if successful
* \retval false else, if a error occurs
@@ -1234,7 +1261,7 @@ bool HardwareInfo::setSchedPowerSavings( bool enable ) {
}
-// --> HAL method call (trigger actions) section -- END <---
+// --> TDE hardware library method call (trigger actions) section -- END <---
// --> private helper functions/slots to forward/handle events -- START <--
// need this functions to make events from HAL/D-Bus independent
@@ -1242,7 +1269,7 @@ bool HardwareInfo::setSchedPowerSavings( bool enable ) {
// blocked by normal KDE/QT (GUI) calls
/*!
* Function to emit the signal for the Power button.
- */
+ */
void HardwareInfo::emitPowerButtonPressed() {
if (sessionIsActive) {
emit powerButtonPressed();
@@ -1294,17 +1321,17 @@ void HardwareInfo::emitSessionActiveState() {
* Function to set the brightess a step up.
* \param percentageStep Integer of next step should get set
* \return result of the operation
- * \retval true if could get set
+ * \retval true if could get set
* \retval false else
*/
bool HardwareInfo::setBrightnessUp(int percentageStep) {
kdDebugFuncIn(trace);
-
+
bool retval = false;
-
+
checkCurrentBrightness();
- if (supportBrightness() && (getCurrentBrightnessLevel() >= 0) &&
+ if (supportBrightness() && (getCurrentBrightnessLevel() >= 0) &&
(getCurrentBrightnessLevel() != (getMaxBrightnessLevel()-1))) {
int setTo = 0;
int minPercStep = 10;
@@ -1312,7 +1339,7 @@ bool HardwareInfo::setBrightnessUp(int percentageStep) {
if (percentageStep > 0 && (percentageStep <= (100-currentPerc))) {
minPercStep = percentageStep;
- }
+ }
if ((currentPerc + minPercStep) > 100) {
// set to 100 %
@@ -1325,16 +1352,16 @@ bool HardwareInfo::setBrightnessUp(int percentageStep) {
}
if (trace) {
- kdDebug() << "Max: " << getMaxBrightnessLevel()
- << " Current: " << getCurrentBrightnessLevel()
+ kdDebug() << "Max: " << getMaxBrightnessLevel()
+ << " Current: " << getCurrentBrightnessLevel()
<< " minPercStep: " << minPercStep
<< " currentPerc: " << currentPerc
<< " setTo: " << setTo << endl;
}
-
+
retval = setBrightness(setTo, -1);
}
-
+
kdDebugFuncOut(trace);
return retval;
}
@@ -1343,7 +1370,7 @@ bool HardwareInfo::setBrightnessUp(int percentageStep) {
* Function to set the brightess a step up.
* \param percentageStep Integer of next step should get set
* \return result of the operation
- * \retval true if could get set
+ * \retval true if could get set
* \retval false else
*/
bool HardwareInfo::setBrightnessDown(int percentageStep) {
@@ -1372,8 +1399,8 @@ bool HardwareInfo::setBrightnessDown(int percentageStep) {
}
if (trace) {
- kdDebug() << "Max: " << getMaxBrightnessLevel()
- << " Current: " << getCurrentBrightnessLevel()
+ kdDebug() << "Max: " << getMaxBrightnessLevel()
+ << " Current: " << getCurrentBrightnessLevel()
<< " minPercStep: " << minPercStep
<< " currentPerc: " << currentPerc
<< " setTo: " << setTo << endl;
@@ -1391,7 +1418,7 @@ bool HardwareInfo::setBrightnessDown(int percentageStep) {
*/
void HardwareInfo::brightnessUpPressed() {
kdDebugFuncIn(trace);
-
+
if (brightness) {
if (!sessionIsActive) {
kdWarning() << "Session is not active, don't react on brightness up key event!" << endl;
@@ -1431,9 +1458,9 @@ void HardwareInfo::brightnessDownPressed() {
/*!
* The function return the current state of the ac adapter.
- * \return boolean with the current state
+ * \return boolean with the current state
* \retval true if adapter is present/connected or unknown
- * \retval false if not
+ * \retval false if not
*/
bool HardwareInfo::getAcAdapter() const {
return acadapter;
@@ -1441,7 +1468,7 @@ bool HardwareInfo::getAcAdapter() const {
/*!
* The function return the current state of the lidclose button.
- * \return boolean with the current state
+ * \return boolean with the current state
* \retval true if the lid is closed
* \retval false if the lid is opend
*/
@@ -1508,7 +1535,7 @@ TQPtrList<Battery> HardwareInfo::getAllBatteries() const {
/*!
* The function return the status of \ref laptop.
- * \return boolean with info if machine is a laptop
+ * \return boolean with info if machine is a laptop
* \retval true if a laptop
* \retval false else/if not a laptop
*/
@@ -1517,9 +1544,9 @@ bool HardwareInfo::isLaptop() const {
}
/*!
- * The function return info if there is a working connection to D-Bus and HAL.
+ * The function return info if there is a working connection to TDE hardware library.
* This mean if we get hardwareinformation
- * \return boolean with info if D-Bus and HAL work
+ * \return boolean with info if TDE hardware library work
* \retval true if connected
* \retval false if not connected
*/
@@ -1531,7 +1558,7 @@ bool HardwareInfo::isOnline() const {
/*!
* The function return the status of \ref has_ACPI.
- * \return boolean with info if machine support ACPI
+ * \return boolean with info if machine support ACPI
* \retval true if support ACPI
* \retval false else
*/
@@ -1551,7 +1578,7 @@ bool HardwareInfo::hasAPM() const {
/*!
* The function return the status of \ref has_PMU.
- * \return boolean with info if machine support PMU
+ * \return boolean with info if machine support PMU
* \retval true if support PMU
* \retval false else
*/
@@ -1561,7 +1588,7 @@ bool HardwareInfo::hasPMU() const {
/*!
* The function return the status of \ref brightness.
- * \return boolean with info if machine support brightness changes via HAL
+ * \return boolean with info if machine support brightness changes via TDE hardware library
* \retval true if support brightness changes
* \retval false else
*/
@@ -1571,7 +1598,7 @@ bool HardwareInfo::supportBrightness() const {
/*!
* The function return the status of \ref cpuFreq.
- * \return boolean with info if machine support change the CPU frequency via HAL
+ * \return boolean with info if machine support change the CPU frequency via TDE hardware library
* \retval true if support brightness changes
* \retval false else
*/
diff --git a/src/hardware.h b/src/hardware.h
index a5c7d5e..6d0c741 100644
--- a/src/hardware.h
+++ b/src/hardware.h
@@ -16,14 +16,14 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-
-/*!
+
+/*!
* \file hardware.h
* \brief Headerfile for hardwareinfo.cpp. This file collect/hold all
-* Hardware information as e.g. battery and ac state.
+* Hardware information as e.g. battery and ac state.
*/
-/*!
+/*!
* \class HardwareInfo
* \brief class for hardware information related funtionality
* \author Danny Kukawka, <[email protected]>, <[email protected]>
@@ -55,6 +55,7 @@
enum suspend_type {
SUSPEND2DISK,
SUSPEND2RAM,
+ FREEZE,
STANDBY
};
@@ -76,7 +77,7 @@ enum device_type {
};
enum ERROR_MSG {
- DBUS_NO_RIGHTS,
+ DBUS_NO_RIGHTS,
DBUS_NOT_RUNNING,
DBUS_RUNNING
};
@@ -84,7 +85,7 @@ enum ERROR_MSG {
//! hold information if suspend/standby/pm actions are supported and allowed
/*!
* This dictionary contains information about the available pm capabilities and
-* the related interfaces in HAL.
+* the related interfaces in TDE hardware library.
*/
typedef struct SuspendStates {
//! true if the machine support suspend2ram and the interface is available
@@ -99,6 +100,12 @@ typedef struct SuspendStates {
bool suspend2disk_can;
//! true if the machine support suspend2disk and PolicyKit allow to call the interface
int suspend2disk_allowed;
+ //! true if the machine support freeze and the interface is available
+ bool freeze;
+ //! true if the machine support freeze, but no interface available
+ bool freeze_can;
+ //! true if the machine support freeze and PolicyKit allow to call the interface
+ int freeze_allowed;
//! true if the machine support standby and the interface is available
bool standby;
//! true if the machine support standby, but no interface available
@@ -106,13 +113,16 @@ typedef struct SuspendStates {
//! true if the machine support standby and PolicyKit allow to call the interface
int standby_allowed;
- SuspendStates () {
+ SuspendStates () {
suspend2ram = false;
suspend2ram_can = false;
suspend2ram_allowed = -1;
suspend2disk = false;
suspend2disk_can = false;
suspend2disk_allowed = -1;
+ freeze = false;
+ freeze_can = false;
+ freeze_allowed = -1;
standby = false;
standby_can = false;
standby_allowed = -1;
@@ -122,9 +132,9 @@ typedef struct SuspendStates {
class HardwareInfo : public TQObject{
Q_OBJECT
-
-private:
+
+private:
TDEHardwareDevices *m_hwdevices;
//! pointer to the dbusInterface connection class
@@ -143,15 +153,15 @@ private:
//! hold the UDIs of all hardware we handle atm
/*!
* This TQStringList contains the list of UDIs we handle at the moment in this
- * class. This should be used to handle device events from HAL for devices we
- * want to monitor
+ * class. This should be used to handle device events from TDE hardware library
+ * for devices we want to monitor
*/
TQStringList allUDIs;
//! hold information if suspend/standby/pm actions are supported and allowed
/*!
* This dictionary contains information about the available pm capabilities and
- * the related interfaces in HAL.
+ * the related interfaces in TDE hardware library.
*/
SuspendStates suspend_states;
@@ -173,65 +183,65 @@ private:
cpufreq_type currentCPUFreqPolicy;
//! the state of the ac adapter
- /*!
+ /*!
* This boolean represent information about the AC adapter state.
* \li true: if AC adapter is present
* \li false: it AC adapter is not present
*/
bool acadapter;
//! the state of the lidclose button
- /*!
+ /*!
* This boolean represent information about the Lid button state.
- * \li true: if lid is closed
+ * \li true: if lid is closed
* \li false: else
*/
bool lidclose;
//! if the machine support APM
- /*!
+ /*!
* This boolean represent information if the machine support APM or not.
* \li true: if APM supported
* \li false: else
*/
bool has_APM;
//! if the machine support ACPI
- /*!
+ /*!
* This boolean represent information if the machine support ACPI or not.
* \li true: if ACPI supported
* \li false: else
*/
bool has_ACPI;
//! if the machine support PMU (ppc power management)
- /*!
+ /*!
* This boolean represent information if the machine support PMU or not.
* \li true: if PMU supported
* \li false: else
*/
bool has_PMU;
- //! if the machine support change CPU Freq via HAL interface
- /*!
- * This boolean represent information if the machine support change the
- * CPU freqency via HAL.
+ //! if the machine support change CPU Freq via TDE hardware library
+ /*!
+ * This boolean represent information if the machine support change the
+ * CPU freqency via TDE hardware library.
* \li true: if supported
* \li false: else
*/
bool cpuFreq;
- //! if the machine support change *SchedPowerSavings methodes via HAL interface
- /*!
- * This boolean represent information if the machine support change the
- * SchedPowerSavings methodes via HAL.
+ //! if the machine support change *SchedPowerSavings methodes via TDE hardware library
+ /*!
+ * This boolean represent information if the machine support change the
+ * SchedPowerSavings methodes via TDE hardware library.
* \li true: if supported
* \li false: else
*/
bool schedPowerSavings;
//! if the machine support change brightness
- /*!
+ /*!
* This boolean represent information if the machine support brightness changes.
* \li true: if supported
* \li false: else
*/
bool brightness;
//! if brightness get controled via keyevents in hardware
- /*!
+ /*!
* This boolean represent information if the machine handle brightness button
* and keyevents in hardware. If so TDEPowersave should ignore key events.
* \li true: if handled in hardware
@@ -239,7 +249,7 @@ private:
*/
bool brightness_in_hardware;
//! if the machine is a laptop
- /*!
+ /*!
* This boolean represent information if the machine is a laptop.
* \li true: if the machine is a laptop
* \li false: else
@@ -247,7 +257,7 @@ private:
bool laptop;
//! if the current desktop session is active
- /*!
+ /*!
* This boolean represent information if the current desktop session in
* Which TDEPowersave runs is marked in ConsoleKit as active or not.
* \li true: if active
@@ -256,18 +266,18 @@ private:
bool sessionIsActive;
//! if the current user can use the CPU Freq interface
- /*!
- * This integer tell if the current user is allowed to change the
- * CPU Frequency policy via the HAL interface
+ /*!
+ * This integer tell if the current user is allowed to change the
+ * CPU Frequency policy via the TDE hardware library
* \li 1: if allowed
* \li 0: if not allowed
* \li -1: if unknown (e.g. there is no policy/PolicyKit)
*/
int cpuFreqAllowed;
//! if the current user can use the brightness interface
- /*!
- * This integer tell if the current user is allowed to change the
- * brightness via the HAL interface
+ /*!
+ * This integer tell if the current user is allowed to change the
+ * brightness via the TDE hardware library
* \li 1: if allowed
* \li 0: if not allowed
* \li -1: if unknown (e.g. there is no policy/PolicyKit)
@@ -294,7 +304,7 @@ private:
void checkPowermanagement();
//! check the possible suspend/standby states
void checkSuspend();
- //! check if the machine support change CPU Freq via HAL
+ //! check if the machine support change CPU Freq via TDE hardware library
void checkCPUFreq();
//! check the current brightness level
void checkCurrentBrightness();
@@ -311,9 +321,9 @@ private:
bool checkIfHandleDevice ( TQString _udi, int *type );
//! to set the CPUFreq governor
bool setCPUFreqGovernor( const char *governor );
- //! to get the state of SchedPowerSave setting of kernel/HAL
+ //! to get the state of SchedPowerSave setting of kernel/TDE hardware library
bool getSchedPowerSavings();
- //! to set the state of SchedPowerSave setting of kernel/HAL
+ //! to set the state of SchedPowerSave setting of kernel/TDE hardware library
bool setSchedPowerSavings( bool enable );
//! find and update a battery information
@@ -340,7 +350,7 @@ private slots:
//! TQT_SLOT to forward signal about changed battery warning state
void emitBatteryWARNState (int type, int state);
-
+
//! TQT_SLOT to handle resume and forward a signal for resume
void handleResumeSignal (int result);
@@ -387,7 +397,7 @@ signals:
//! signal if the D-Bus daemon terminate and restart
void dbusRunning( int );
- //! signal if the IsActive state of
+ //! signal if the IsActive state of
void desktopSessionIsActive (bool);
//! signal if we are back from resume
@@ -397,21 +407,21 @@ public:
// update related info --> need to be reset if the data was read
//! tells if the CPUFreq Policy changed
- /*!
+ /*!
* This boolean represent information about CPUFreq Policy changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
*/
bool update_info_cpufreq_policy_changed;
//! tells if the AC status changed
- /*!
+ /*!
* This boolean represent information about AC status changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
*/
bool update_info_ac_changed;
//! tells if the primary battery collection changed some values
- /*!
+ /*!
* This boolean represent information about primary battery changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
@@ -433,14 +443,14 @@ public:
//! default destructor
~HardwareInfo();
- // to get private members
+ // to get private members
//! get info about support of suspend/standby
SuspendStates getSuspendSupport() const;
//! get a pointer to the primary batteries
BatteryCollection* getPrimaryBatteries() const;
//! get all batteries
TQPtrList<Battery> getAllBatteries() const;
-
+
//! check the currently set CPU Frequency Policy
cpufreq_type checkCurrentCPUFreqPolicy();
@@ -462,7 +472,7 @@ public:
bool getLidclose() const;
//! check if the machine is a latop
bool isLaptop() const;
- //! check if there is a connection to D-Bus _and_ HAL
+ //! check if there is a connection to TDE hardware library
bool isOnline() const;
//! check if the machine support ACPI
bool hasACPI() const;
@@ -477,10 +487,10 @@ public:
//! check if the current session is active
bool currentSessionIsActive() const;
- // --> functions to call a HAL interface and trigger an action
- //! execute/trigger a suspend via the HAL interface
+ // --> functions to call a TDE hardware library and trigger an action
+ //! execute/trigger a suspend via the TDE hardware library
bool suspend ( suspend_type suspend );
- //! set the brightness via HAL interface
+ //! set the brightness via TDE hardware library
bool setBrightness ( int level, int percent = -1);
//! to set the brightness down
bool setBrightnessDown(int percentageStep = -1);
@@ -488,7 +498,7 @@ public:
bool setBrightnessUp(int percentageStep = -1);
//! set the CPU frequency policy/speed
bool setCPUFreq ( cpufreq_type cpufreq, int limit = 51 );
- //! call SetPowerSave method on HAL.
+ //! call SetPowerSave method on TDE hardware library.
bool setPowerSave( bool on );
//! function to set warning states for the primary battery collection
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, <[email protected]>, <[email protected]>
* \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;
diff --git a/src/settings.h b/src/settings.h
index 6c8d777..ebe577d 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -16,8 +16,8 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-
-/*!
+
+/*!
* \file settings.h
* \brief Headerfile for settings.cpp and the class \ref Settings.
*/
@@ -42,6 +42,7 @@ enum action{
LOGOUT_DIALOG,
GO_SUSPEND2RAM,
GO_SUSPEND2DISK,
+ GO_FREEZE,
SWITCH_SCHEME,
BRIGHTNESS,
CPUFRETQ_POWERSAVE,
@@ -49,7 +50,7 @@ enum action{
CPUFRETQ_PERFORMANCE
};
-/*!
+/*!
* \class KDE_Settings
* \brief class/object for the KDE default settings
* \author Danny Kukawka, <[email protected]>, <[email protected]>
@@ -68,23 +69,23 @@ public:
bool displayEnergySaving;
//! time for DPMS standby
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should do to stand-by.
*/
int displayStandby;
- //! time for DPMS suspend
+ //! time for DPMS suspend
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should suspend.
*/
int displaySuspend;
//! time for DPMS power-off
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should power off.
*/
int displayPowerOff;
-
+
/* KDE settings [ScreenSaver] */
//! if the KDE screensaver is enabled
/*!
@@ -108,10 +109,10 @@ public:
* \li false: if else
*/
bool blanked;
-
+
};
-/*!
+/*!
* \class Settings
* \brief class for the Settings ( read ) related funtionality
* \author Danny Kukawka, <[email protected]>, <[email protected]>
@@ -125,10 +126,10 @@ public:
Settings();
//! default destructor
virtual ~Settings();
-
+
//! a instance of the KDE global settings.
KDE_Settings *kde;
-
+
/* START ************************** General settings *******************************/
//! name of the default "onAC" scheme
TQString ac_scheme;
@@ -136,7 +137,7 @@ public:
TQString battery_scheme;
//! a list with the names of the currently available schemes.
/*!
- * List with the names of the currently configured schemes. The name of the
+ * List with the names of the currently configured schemes. The name of the
* schemes are the same as we use for the related selection in the configure file.
* Note: Be sure that the name for the default schemes is not translated !!!
*/
@@ -155,16 +156,16 @@ public:
//! if the messages from powersave should popup as Kpassivepopup
/*!
* This boolean tells if the messages from powersave should be displayed
- * as KPassivePopup or as KMessageBox::error
+ * as KPassivePopup or as KMessageBox::error
* \li true: if use KPassivePopup
- * \li false: if not
+ * \li false: if not
*/
bool psMsgAsPassivePopup;
-
+
//! if the screen should be locked on suspend
/*!
* This boolean tells if the screen should be locked befor a suspend or standby.
- * \li true: if the screen should be locked
+ * \li true: if the screen should be locked
* \li false: if not lock the screen
*/
bool lockOnSuspend;
@@ -178,7 +179,7 @@ public:
//! if tdepowersave starts on login
/*!
* This boolean tells if tdepowersave should be start automatically on userlogin.
- * The value could be changed trough the configuration dialog and if the user
+ * The value could be changed trough the configuration dialog and if the user
* stop tdepowersave.
* \li true: if autostart
* \li false: if not start on login
@@ -188,12 +189,12 @@ public:
/*!
* This boolean tells if tdepowersave ask for autostart settings if user stop tdepowersave.
* \li true: if ask on stop
- * \li false: if never ask
+ * \li false: if never ask
*/
bool autostartNeverAsk;
//! if tdepowersave should force DPMS shutdown for display for lidclose
/*!
- * This boolean tells if tdepowersave should force dpms shutdown for the display if a
+ * This boolean tells if tdepowersave should force dpms shutdown for the display if a
* lidclose event was recieved
* \li true: if shutdown display
* \li false: if not
@@ -214,23 +215,23 @@ public:
* to show the login dialog if the desktop was locked on suspend. Value is in msec.
*/
int timeToFakeKeyAfterLock;
-
+
//! percentag value of battery level for warning state
/*!
- * This integer represent the remaining percentag of the battery
+ * This integer represent the remaining percentag of the battery
* where we reach the battery warning level. This is a value between 0 and 100.
*/
int batteryWarningLevel;
//! percentag value of battery level for low state
/*!
- * This integer represent the remaining percentag of the battery
+ * This integer represent the remaining percentag of the battery
* where we reach the battery low level. This is a value between 0 and 100 and
* should be lower than \ref batteryWarningLevel and higher than \ref batteryCriticalLevel
*/
int batteryLowLevel;
//! percentag value of battery level for critical state
/*!
- * This integer represent the remaining percentag of the battery
+ * This integer represent the remaining percentag of the battery
* where we reach the battery critical level. This is a value between 0 and 100 and
* should be lower than \ref batteryLowLevel and higher than 0
*/
@@ -268,7 +269,7 @@ public:
//! name of the scheme representing the current settings
TQString currentScheme;
-
+
// ---------- Screensaver/DPMS section ------------ //
//! if tdepowersave use own screensaver settings
/*!
@@ -296,7 +297,7 @@ public:
//! if tdepowersave use own DPMS settings
/*!
* This boolean tells if tdepowersave should use own userspecific settings for
- * Display PowerManagement Settings. If this value is true tdepowersave overwritte
+ * Display PowerManagement Settings. If this value is true tdepowersave overwritte
* the KDE or GNOME global settings.
* \li true: if tdepowersave use own DPMS settings
* \li false: if tdepowersave don't change DPMS settings
@@ -312,19 +313,19 @@ public:
bool disableDPMS;
//! time for DPMS standby
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should do to stand-by.
*/
int standbyAfter;
//! time for DPMS suspend
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should suspend.
*/
int suspendAfter;
//! time for DPMS power-off
/*!
- * This integer represent the time in minutes after which the
+ * This integer represent the time in minutes after which the
* display should power off.
*/
int powerOffAfter;
@@ -332,7 +333,7 @@ public:
// ------------ Brightness section ---------------- //
//! if brightness is enabled for the current scheme
/*!
- * This boolean tells if brightness is enabled for the
+ * This boolean tells if brightness is enabled for the
* current scheme
* \li true: if brightness is enabled
* \li false: if not
@@ -340,15 +341,15 @@ public:
bool brightness;
//! the value for the brighness
/*!
- * This integer represent the value to which the brigthness
+ * This integer represent the value to which the brigthness
* should be set. This value is in percentage.
*/
int brightnessValue;
-
+
// ------------ Autosuspend section ---------------- //
//! if autosuspend is enabled for the current scheme
/*!
- * This boolean tells if autosuspend is enabled for the
+ * This boolean tells if autosuspend is enabled for the
* current scheme
* \li true: if autosuspend is enabled
* \li false: if not
@@ -357,7 +358,7 @@ public:
//! if scheme specific blacklist is enabled
/*!
* This boolean tells if a scheme specific blacklist
- * ( autoInactiveSchemeBlacklist ) should be used.
+ * ( autoInactiveSchemeBlacklist ) should be used.
* \li true: if use scheme specific blacklist
* \li false: if not
*/
@@ -369,7 +370,7 @@ public:
* action.
*/
int autoInactiveActionAfter;
- //! action which execute after a defined time of inactivity
+ //! action which execute after a defined time of inactivity
/*!
* This TQString contains the action/command which should be execute
* after a trough \ref autoInactiveActionAfter defined time. If nothing
@@ -379,14 +380,14 @@ public:
//! general list with running programs which prevent the autosuspend
/*!
* This TQStringList contains names of programs which prevent, if one of
- * them is running/active the autossuspend.
- */
+ * them is running/active the autossuspend.
+ */
TQStringList autoInactiveGBlist;
//! scheme list with running programs which prevent the autosuspend
/*!
* This TQStringList contains names of programs which prevent, if one of
- * them is running/active the autossuspend.
- */
+ * them is running/active the autossuspend.
+ */
TQStringList autoInactiveSBlist;
// ------ Autosuspend countdown dialog section -------- //
@@ -401,12 +402,12 @@ public:
//! how long the autosuspend warn dialog should be shown
/*!
* This integer represent the time in seconds how long the autosuspend
- * warning dialog should be shown. This time get stripped from
+ * warning dialog should be shown. This time get stripped from
* \ref autoInactiveActionAfter to be sure the suspend get called within
* the expected time.
*/
int autoSuspendCountdownTimeout;
-
+
// -------------- Autodimm section ------------------- //
//! if autodimm is enabled for the current scheme
/*!
@@ -418,7 +419,7 @@ public:
//! if a scheme specific autodimm blacklist is enabled
/*!
* This boolean tells if a scheme specific autdimm blacklist
- * ( autoDimmSBlist ) should be used.
+ * ( autoDimmSBlist ) should be used.
* \li true: if use scheme specific blacklist
* \li false: if not
*/
@@ -431,7 +432,7 @@ public:
int autoDimmAfter;
//! percentage to which the display should dimmed to
/*!
- * This integer represent the brightness percentage to which the
+ * This integer represent the brightness percentage to which the
* display should get dimmed if the user is the via \ref autoDimmAfter
* defined time inactivit;
*/
@@ -439,17 +440,17 @@ public:
//! general list with running programs which prevent the autodimm
/*!
* This TQStringList contains names of programs which prevent, if one of
- * them is running/active the autodimm of the display panel.
- */
+ * them is running/active the autodimm of the display panel.
+ */
TQStringList autoDimmGBlist;
//! scheme specific list with running programs which prevent the autodimm
/*!
* This TQStringList contains names of programs which prevent, if one of
- * them is running/active the autodimm of the display panel. This list is
+ * them is running/active the autodimm of the display panel. This list is
* scheme specific.
- */
+ */
TQStringList autoDimmSBlist;
-
+
// ------------ CPU Frequency section ---------------- //
//! represent the CPU Frequency policy to set
@@ -476,17 +477,17 @@ public:
bool unmountExternalOnSuspend;
/* END ************************ Scheme settings and values ******************************/
-
- /******************* Functions ********************/
+
+ /******************* Functions ********************/
//! to load the general settings
bool load_general_settings();
//! to load the global KDE settings
void load_kde();
//! to load settings of a specific scheme
bool load_scheme_settings(TQString);
-
+
private:
-
+
//! configuration of tdepowersave
TDEConfig *tdeconfig;
diff --git a/src/suspenddialog.cpp b/src/suspenddialog.cpp
index ff3b04d..5431938 100644
--- a/src/suspenddialog.cpp
+++ b/src/suspenddialog.cpp
@@ -17,13 +17,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-/*!
+/*!
* \file suspenddialog.cpp
- * \brief In this file can be found the suspend dialog related code.
+ * \brief In this file can be found the suspend dialog related code.
* \author Danny Kukawka, <[email protected]>, <[email protected]>
* \date 2005
*/
-
+
// KDE - Headers
#include <tdelocale.h>
#include <kiconloader.h>
@@ -45,12 +45,12 @@ suspendDialog::suspendDialog(TQWidget *parent, const char *name)
}
/*! This is the default destructor of the class. */
-suspendDialog::~suspendDialog()
+suspendDialog::~suspendDialog()
{
}
-/*!
+/*!
* This used to set Icon/pixmap for the dialog.
* \param type TQString with the type of the current suspend
* to set the pixmap in the dialog
@@ -62,6 +62,8 @@ void suspendDialog::setPixmap( TQString type )
pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_disk", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else if (type.startsWith("suspend2ram")) {
pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_ram", TDEIcon::NoGroup, TDEIcon::SizeLarge);
+ } else if (type.startsWith("freeze")) {
+ pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_ram", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else if (type.startsWith("standby")) {
pixmap = TDEGlobal::iconLoader()->loadIcon("stand_by", TDEIcon::NoGroup, TDEIcon::SizeLarge);
} else {
@@ -71,7 +73,7 @@ void suspendDialog::setPixmap( TQString type )
iconPixmap->setPixmap( pixmap );
}
-/*!
+/*!
* This used to set the values of progressbar for the dialog.
* \param percent integer value with current progress stauts of suspend
*/
@@ -81,11 +83,11 @@ void suspendDialog::setProgressbar( int percent )
progressBar->setProgress(percent);
}
-/*!
+/*!
* This used to set the message of current suspend action to the the dialog.
* \param messageText TQString with the message of the current running suspend
* prepare action
- */
+ */
void suspendDialog::setTextLabel( TQString messageText )
{
message->show();
diff --git a/src/tdepowersave.cpp b/src/tdepowersave.cpp
index b54b990..73b569d 100644
--- a/src/tdepowersave.cpp
+++ b/src/tdepowersave.cpp
@@ -194,6 +194,8 @@ void tdepowersave::initMenu() {
TQIconSet::Automatic),
i18n("Suspend to RAM"), this,
TQT_SLOT(do_suspend2ram()));
+ FREEZE_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram", TQIconSet::Automatic),
+ i18n("Freeze"), this, TQT_SLOT(do_freeze()));
STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", TQIconSet::Automatic),
i18n("Standby"), this, TQT_SLOT(do_standby()));
@@ -685,9 +687,9 @@ void tdepowersave::slotConfigProcessExited(TDEProcess *proc){
}
/*!
- * \b TQT_SLOT to send the command for "suspend to disk" to HAL daemon.
+ * \b TQT_SLOT to send the command for "suspend to disk" to TDE hardware library.
* If there is a error while "suspend to disk" the user get e messagebox.
- * This function need a running HAL daemon for "suspend to disk".
+ * This function need a power management backend in TDE hardware library for "suspend to disk".
* \return boolean with the result of the operation
* \retval true if successful
* \retval false if command not supported or if powersaved not running
@@ -734,16 +736,16 @@ bool tdepowersave::do_suspend2disk(){
return false;
}
} else {
- kdWarning() << "This machine does not provide suspend2disk via HAL" << endl;
+ kdWarning() << "This machine does not provide suspend to disk state" << endl;
kdDebugFuncOut(trace);
return false;
}
}
/*!
- * \b TQT_SLOT to send the command for "suspend to RAM" to the HAL daemon.
+ * \b TQT_SLOT to send the command for "suspend to RAM" to the TDE hardware library.
* If there is a error while "suspend to RAM" the user get e messagebox.
- * This function need a running HAL daemon for "suspend to RAM".
+ * This function need a power management backend in TDE hardware library for "suspend to RAM".
* \return boolean with the result of the operation
* \retval true if successful
* \retval false if command not supported or if powersaved not running
@@ -790,16 +792,71 @@ bool tdepowersave::do_suspend2ram(){
return false;
}
} else {
- kdWarning() << "This machine does not provide suspend2ram via HAL" << endl;
+ kdWarning() << "This machine does not provide suspend to ram state" << endl;
kdDebugFuncOut(trace);
return false;
}
}
/*!
- * \b TQT_SLOT to send the command for "stand-by" to the HAL daemon.
+ * \b TQT_SLOT to send the command for "freeze" to the TDE hardware library.
+ * If there is a error while "freeze" the user get e messagebox.
+ * This function need a power management backend in TDE hardware library for "freeze".
+ * \return boolean with the result of the operation
+ * \retval true if successful
+ * \retval false if command not supported or if powersaved not running
+ */
+bool tdepowersave::do_freeze(){
+ kdDebugFuncIn(trace);
+
+ if (suspend.freeze) {
+ if (suspend.freeze_allowed || suspend.freeze_allowed == -1) {
+ calledSuspend = FREEZE;
+ if (!handleMounts(true)) {
+ kdWarning() << "Could not umount ..." << endl;
+ calledSuspend = -1;
+ kdDebugFuncOut(trace);
+ return false;
+ }
+
+ if(settings->lockOnSuspend) {
+ display->lockScreen( settings->lockmethod );
+ }
+
+ autoSuspend->stop();
+ autoDimm->stop();
+ notifySuspend(calledSuspend);
+ bool ret = hwinfo->suspend(FREEZE);
+
+ if (ret) {
+ kdDebugFuncOut(trace);
+ return true;
+ } else {
+ KPassivePopup::message( i18n("WARNING"),i18n("Freeze failed"),
+ SmallIcon("messagebox_warning", 20), this,
+ i18n("Warning").ascii(), 15000);
+ kdDebugFuncOut(trace);
+ return false;
+ }
+ } else {
+ KPassivePopup::message( i18n("WARNING"),i18n("Freeze disabled by administrator."),
+ SmallIcon("messagebox_warning", 20), this,
+ i18n("Warning").ascii(), 15000);
+ this->contextMenu()->setItemEnabled(FREEZE_MENU_ID, false);
+ kdDebugFuncOut(trace);
+ return false;
+ }
+ } else {
+ kdWarning() << "This machine does not provide freeze suspend state" << endl;
+ kdDebugFuncOut(trace);
+ return false;
+ }
+}
+
+/*!
+ * \b TQT_SLOT to send the command for "stand-by" to the TDE hardware library.
* If there is a error while "stand-by" the user get e messagebox.
- * This function need a running HAL daemon for "stand-by".
+ * This function need a power management backend in TDE hardware library for "stand-by".
* \return boolean with the result of the operation
* \retval true if successful
* \retval false if command not supported or if powersaved not running
@@ -845,7 +902,7 @@ bool tdepowersave::do_standby(){
return false;
}
} else {
- kdWarning() << "This machine does not provide suspend2ram via HAL" << endl;
+ kdWarning() << "This machine does not provide standby suspend state" << endl;
kdDebugFuncOut(trace);
return false;
}
@@ -872,6 +929,11 @@ void tdepowersave::do_autosuspendWarn() {
allowed = true;
}
}
+ else if (settings->autoInactiveAction == "Freeze") {
+ if ( suspend.freeze && (suspend.freeze_allowed || suspend.freeze_allowed == -1)) {
+ allowed = true;
+ }
+ }
else if (settings->autoInactiveAction == "Standby") {
if ( suspend.standby && (suspend.standby_allowed || suspend.standby_allowed == -1)) {
allowed = true;
@@ -890,6 +952,8 @@ void tdepowersave::do_autosuspendWarn() {
countdown->setPixmap("suspend2disk");
} else if (settings->autoInactiveAction == "Suspend to RAM") {
countdown->setPixmap("suspend2ram");
+ } else if (settings->autoInactiveAction == "Freeze") {
+ countdown->setPixmap("suspend2ram");
} else if (settings->autoInactiveAction == "Standby") {
countdown->setPixmap("standby");
} else {
@@ -943,6 +1007,8 @@ bool tdepowersave::do_autosuspend(bool chancel) {
return do_suspend2disk();
} else if (settings->autoInactiveAction == "Suspend to RAM") {
return do_suspend2ram();
+ } else if (settings->autoInactiveAction == "Freeze") {
+ return do_freeze();
} else if (settings->autoInactiveAction == "Standby") {
return do_standby();
} else {
@@ -1389,6 +1455,7 @@ void tdepowersave::update(){
if (!hwinfo->isOnline()){
this->contextMenu()->setItemVisible(SUSPEND2DISK_MENU_ID, false);
this->contextMenu()->setItemVisible(SUSPEND2RAM_MENU_ID, false);
+ this->contextMenu()->setItemVisible(FREEZE_MENU_ID, false);
this->contextMenu()->setItemVisible(STANDBY_MENU_ID, false);
this->contextMenu()->setItemVisible(SLEEP_SEPARATOR_MENU_ID, false);
this->contextMenu()->setItemVisible(SCHEME_SEPARATOR_MENU_ID, false);
@@ -1411,6 +1478,7 @@ void tdepowersave::update(){
}
this->contextMenu()->setItemVisible(SUSPEND2DISK_MENU_ID, true);
this->contextMenu()->setItemVisible(SUSPEND2RAM_MENU_ID, true);
+ this->contextMenu()->setItemVisible(FREEZE_MENU_ID, true);
this->contextMenu()->setItemVisible(STANDBY_MENU_ID, true);
this->contextMenu()->setItemVisible(SLEEP_SEPARATOR_MENU_ID, true);
this->contextMenu()->setItemVisible(SCHEME_SEPARATOR_MENU_ID, true);
@@ -1439,6 +1507,15 @@ void tdepowersave::update(){
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false);
}
+ if (suspend.freeze && (suspend.freeze_allowed || suspend.freeze_allowed == -1)) {
+ this->contextMenu()->setItemEnabled(FREEZE_MENU_ID, true);
+ } else {
+ if (!suspend.freeze)
+ this->contextMenu()->setItemVisible(FREEZE_MENU_ID, false);
+ else
+ this->contextMenu()->setItemEnabled(FREEZE_MENU_ID, false);
+ }
+
if (suspend.standby && (suspend.standby_allowed || suspend.standby_allowed == -1)) {
this->contextMenu()->setItemEnabled(STANDBY_MENU_ID, true);
} else {
@@ -1840,6 +1917,11 @@ void tdepowersave::setAutoSuspend( bool resumed ){
allowed = true;
}
}
+ else if (settings->autoInactiveAction == "Freeze") {
+ if ( suspend.freeze && (suspend.freeze_allowed || suspend.freeze_allowed == -1)) {
+ allowed = true;
+ }
+ }
else if (settings->autoInactiveAction == "Standby") {
if ( suspend.standby && (suspend.standby_allowed || suspend.standby_allowed == -1)) {
allowed = true;
@@ -2071,6 +2153,9 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
case GO_SUSPEND2DISK:
TQTimer::singleShot(100, this, TQT_SLOT(do_suspend2disk()));
break;
+ case GO_FREEZE:
+ TQTimer::singleShot(100, this, TQT_SLOT(do_freeze()));
+ break;
case BRIGHTNESS:
hwinfo->setBrightness( -1, value );
break;
@@ -2192,6 +2277,11 @@ void tdepowersave::notifySuspend( int suspendType ) {
i18n("System is going into %1 now.").
arg(i18n("Suspend to RAM")));
break;
+ case FREEZE:
+ KNotifyClient::event( this->winId(), "freeze_event",
+ i18n("System is going into %1 now.").
+ arg(i18n("Freeze")));
+ break;
case STANDBY:
KNotifyClient::event( this->winId(), "standby_event",
i18n("System is going into %1 now.").
@@ -2252,6 +2342,11 @@ void tdepowersave::handleResumeSignal() {
i18n("System is resumed from %1.").arg(
i18n("Suspend to RAM")));
break;
+ case FREEZE:
+ KNotifyClient::event( this->winId(), "resume_from_freeze_event",
+ i18n("System is resumed from %1.").arg(
+ i18n("Freeze")));
+ break;
case STANDBY:
KNotifyClient::event( this->winId(), "resume_from_standby_event",
i18n("System is resumed from %1.").arg(
@@ -2301,6 +2396,10 @@ void tdepowersave::handleResumeSignal() {
logview = new LogViewer ("/var/log/suspend2ram.log");
logview->show();
break;
+ case FREEZE:
+ logview = new LogViewer ("/var/log/freeze.log");
+ logview->show();
+ break;
case STANDBY:
logview = new LogViewer ("/var/log/standby.log");
logview->show();
@@ -2368,6 +2467,9 @@ TQString tdepowersave::getSuspendString (int type) {
case SUSPEND2RAM:
return i18n("Suspend to RAM");
break;
+ case FREEZE:
+ return i18n("Freeze");
+ break;
case STANDBY:
return i18n("Standby");
break;
@@ -2517,6 +2619,9 @@ TQStringList tdepowersave::allowed_sleepingStates(){
suspend.suspend2ram_allowed == -1)){
sleepList.append("suspendToRAM");
}
+ if (suspend.freeze && (suspend.freeze_allowed || suspend.freeze_allowed == -1)){
+ sleepList.append("freeze");
+ }
if (suspend.standby && (suspend.standby_allowed || suspend.standby_allowed == -1)){
sleepList.append("standBy");
}
@@ -2607,7 +2712,19 @@ bool tdepowersave::do_suspendToRAM(){
}
/*!
- * DCOP Interface funtion to send the suspend to disk command to powersave.
+ * DCOP Interface funtion to send the freeze command to powersave.
+ * \return boolean with the result of calling do_freeze()
+ * \retval true if successful
+ * \retval false if not supported or powersaved not running
+ */
+bool tdepowersave::do_suspendFreeze(){
+ kdDebugFuncIn(trace);
+ kdDebugFuncOut(trace);
+ return do_freeze();
+}
+
+/*!
+ * DCOP Interface funtion to send the standby command to powersave.
* \return boolean with the result of calling do_standby()
* \retval true if successful
* \retval false if not supported or powersaved not running
diff --git a/src/tdepowersave.h b/src/tdepowersave.h
index e7f198d..49f9bff 100644
--- a/src/tdepowersave.h
+++ b/src/tdepowersave.h
@@ -69,7 +69,7 @@ class TDEGlobalAccel;
class tdepowersave : public KSystemTray, public DCOPObject
{
Q_OBJECT
-//
+//
K_DCOP
private:
@@ -190,6 +190,9 @@ private:
/*! contains the ID of the menuentry for suspend-to-ram */
int SUSPEND2RAM_MENU_ID;
//! a menu entry ID
+ /*! contains the ID of the menuentry for freeze */
+ int FREEZE_MENU_ID;
+ //! a menu entry ID
/*! contains the ID of the menuentry for stand-by */
int STANDBY_MENU_ID;
//! a menu seperator ID
@@ -312,6 +315,8 @@ private slots:
//! send command for stand-by to the TDE hardware library
bool do_standby();
+ //! send command for freeze to the TDE hardware library
+ bool do_freeze();
//! send command for suspend_to_disk to the TDE hardware library
bool do_suspend2disk();
//! send command for suspend_to_RAM to the TDE hardware library
@@ -428,6 +433,8 @@ k_dcop:
bool do_suspendToDisk();
//! dcop function to send 'suspend to RAM' command to powersaved
bool do_suspendToRAM();
+ //! dcop function to send 'freeze' command to powersaved
+ bool do_suspendFreeze();
//! dcop function to send 'standby' command to powersaved
bool do_standBy();
//! dcop function to set the brightness down