summaryrefslogtreecommitdiffstats
path: root/src/configuredialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configuredialog.cpp')
-rw-r--r--src/configuredialog.cpp139
1 files changed, 76 insertions, 63 deletions
diff --git a/src/configuredialog.cpp b/src/configuredialog.cpp
index c4273da..5e933c6 100644
--- a/src/configuredialog.cpp
+++ b/src/configuredialog.cpp
@@ -25,6 +25,10 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// KDE - Headers
#include <kaudioplayer.h>
#include <tdeconfig.h>
@@ -34,7 +38,7 @@
#include <kinputdialog.h>
#include <tdeaccelmanager.h>
- // QT - Headers
+ // TQt - Headers
#include <tqcheckbox.h>
#include <tqcombobox.h>
#include <tqdialog.h>
@@ -74,9 +78,9 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
scheme_changed = false;
displayed_WARN_autosuspend = false;
- // check if brightness is supporte
+ // check if brightness is supported
if(hwinfo->supportBrightness()) {
- brightnessLevels = hwinfo->getMaxBrightnessLevel() -1;
+ brightnessLevels = hwinfo->getMaxBrightnessLevel();
brightness_last = hwinfo->getCurrentBrightnessLevel();
} else {
brightnessLevels = -1;
@@ -88,18 +92,21 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
// get the correct available suspend types
SuspendStates suspend = hwinfo->getSuspendSupport();
- if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
- actions.append("Suspend to RAM");
- }
- 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");
}
+ if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
+ actions.append("Suspend");
+ }
+ if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
+ actions.append("Hibernate");
+ }
+ if ( suspend.suspend_hybrid && (suspend.suspend_hybrid_allowed || suspend.suspend_hybrid_allowed == -1)) {
+ actions.append("Hybrid Suspend");
+ }
setIcons();
setTooltips();
@@ -112,7 +119,7 @@ ConfigureDialog::ConfigureDialog( TDEConfig *_config, HardwareInfo *_hwinfo, Set
tL_valueBrightness->setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
tL_valueBrightness->setBackgroundMode(TQt::PaletteBase);
tL_valueBrightness->setAlignment(TQt::AlignCenter);
- tL_valueBrightness->setFocusPolicy(TQ_NoFocus);
+ tL_valueBrightness->setFocusPolicy(TQWidget::NoFocus);
// hide Lid item if this is not a laptop
if (!hwinfo->isLaptop())
@@ -246,10 +253,10 @@ 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") {
+ if(actions[0] == "Hibernate") {
tB_scheme->setItemIconSet( 2 ,SmallIcon("suspend_to_disk", TQIconSet::Automatic));
}
- else if(actions[0] == "Suspend to RAM") {
+ else if(actions[0] == "Suspend") {
tB_scheme->setItemIconSet( 2 ,SmallIcon("suspend_to_ram", TQIconSet::Automatic));
}
else if(actions[0] == "Freeze") {
@@ -562,7 +569,7 @@ void ConfigureDialog::setConfigToDialog( int schemeID ){
else {
cB_Brightness->setEnabled(false);
gB_Brightness->setEnabled(false);
- tL_brightness->setText(i18n("Your Hardware currently not support changing the brightness "
+ tL_brightness->setText(i18n("Your hardware does not currently support changing the brightness "
"of your display."));
}
@@ -742,7 +749,7 @@ void ConfigureDialog::setGeneralSettings() {
// buttons tab:
TQStringList _actions = tdeconfig->readListEntry("buttonsAllowedActions", TQString());
fillActionComboBox(cB_PowerButton, _actions, tdeconfig->readEntry("ActionOnPowerButton", TQString()));
- fillActionComboBox(cB_SleepButton, _actions, tdeconfig->readEntry("ActionOnSleepButton", TQString()));
+ fillActionComboBox(cB_SuspendButton, _actions, tdeconfig->readEntry("ActionOnSuspendButton", TQString()));
fillActionComboBox(cB_S2DiskButton, _actions, tdeconfig->readEntry("ActionOnS2DiskButton", TQString()));
// avoid logout dialog for lidclose - this make no sense
_actions.remove("LOGOUT_DIALOG");
@@ -879,7 +886,7 @@ void ConfigureDialog::saveGeneralSettings() {
// button tab
tdeconfig->writeEntry("ActionOnPowerButton", mapDescriptionToAction(cB_PowerButton->currentText()));
tdeconfig->writeEntry("ActionOnLidClose", mapDescriptionToAction(cB_LidcloseButton->currentText()));
- tdeconfig->writeEntry("ActionOnSleepButton", mapDescriptionToAction(cB_SleepButton->currentText()));
+ tdeconfig->writeEntry("ActionOnSuspendButton", mapDescriptionToAction(cB_SuspendButton->currentText()));
tdeconfig->writeEntry("ActionOnS2DiskButton", mapDescriptionToAction(cB_S2DiskButton->currentText()));
// schemes tab
@@ -898,7 +905,7 @@ void ConfigureDialog::saveGeneralSettings() {
/* ---- START monitor changes SECTION ---- */
/*!
- * SLOT: Called if a value within the Tab 'General Settings' is changed.
+ * Slot called if a value within the Tab 'General Settings' is changed.
*/
void ConfigureDialog::general_valueChanged(){
kdDebugFuncIn(trace);
@@ -921,7 +928,7 @@ void ConfigureDialog::general_valueChanged(){
}
/*!
- * SLOT: Called if a value within the Tab 'Scheme Settings' is changed.
+ * Slot called if a value within the Tab 'Scheme Settings' is changed.
*/
void ConfigureDialog::scheme_valueChanged(){
kdDebugFuncIn(trace);
@@ -935,7 +942,7 @@ void ConfigureDialog::scheme_valueChanged(){
}
/*!
- * SLOT: called if the current scheme in the TQListBox listBox_schemes is
+ * Slot called if the current scheme in the TQListBox listBox_schemes is
* changed/ a other scheme was selected.
*/
void ConfigureDialog::listBox_schemes_currentChanged(){
@@ -970,7 +977,7 @@ void ConfigureDialog::listBox_schemes_currentChanged(){
/* ---- START BUTTON SECTION ---- */
/*!
- * SLOT: called if the 'Apply' button is clicked.
+ * Slot called if the 'Apply' button is clicked.
*/
void ConfigureDialog::buttonApply_clicked(){
kdDebugFuncIn(trace);
@@ -988,7 +995,7 @@ void ConfigureDialog::buttonApply_clicked(){
}
/*!
- * SLOT: called if the 'Cancel' button is clicked.
+ * Slot called if the 'Cancel' button is clicked.
*/
void ConfigureDialog::buttonCancel_clicked(){
kdDebugFuncOut(trace);
@@ -1010,7 +1017,7 @@ void ConfigureDialog::buttonCancel_clicked(){
}
/*!
- * SLOT: called if the 'OK' button is clicked.
+ * Slot called if the 'OK' button is clicked.
*/
void ConfigureDialog::buttonOk_clicked(){
kdDebugFuncIn(trace);
@@ -1023,7 +1030,7 @@ void ConfigureDialog::buttonOk_clicked(){
}
/*!
- * SLOT: called if the 'Help' button is clicked.
+ * Slot called if the 'Help' button is clicked.
*/
void ConfigureDialog::buttonHelp_clicked(){
kdDebugFuncIn(trace);
@@ -1038,7 +1045,7 @@ void ConfigureDialog::buttonHelp_clicked(){
/* ---- START SCHEME ADD/DELETE SECTION ---- */
/*!
- * SLOT: called if the 'New' scheme button is clicked.
+ * Slot called if the 'New' scheme button is clicked.
*/
void ConfigureDialog::pB_newScheme_clicked(){
kdDebugFuncIn(trace);
@@ -1084,7 +1091,7 @@ void ConfigureDialog::pB_newScheme_clicked(){
}
/*!
- * SLOT: called if the 'Delete' scheme button is clicked.
+ * Slot called if the 'Delete' scheme button is clicked.
*/
void ConfigureDialog::pB_deleteScheme_clicked(){
kdDebugFuncIn(trace);
@@ -1122,7 +1129,7 @@ void ConfigureDialog::pB_deleteScheme_clicked(){
/* ---- START SCREENSAVER SECTION ---- */
/*!
- * SLOT: called if TQCheckBox cB_specificSettings is toggled.
+ * Slot called if TQCheckBox cB_specificSettings is toggled.
* \param state boolean, true if toggled on
* false if toggled off
*/
@@ -1150,7 +1157,7 @@ void ConfigureDialog::cB_specificSettings_toggled(bool state){
}
/*!
- * SLOT: called if TQCheckBox cB_disable_Ss is toggled.
+ * Slot called if TQCheckBox cB_disable_Ss is toggled.
* \param state boolean, true if toggled on
* false if toggled off
*/
@@ -1170,7 +1177,7 @@ void ConfigureDialog::cB_disable_Ss_toggled(bool state){
/* ---- START DPMS SECTION ---- */
/*!
- * SLOT: called if TQCheckBox cB_SpecificPM is toggled.
+ * Slot called if TQCheckBox cB_SpecificPM is toggled.
* \param state boolean, true if toggled on
* false if toggled offtrue
*/
@@ -1195,7 +1202,7 @@ void ConfigureDialog::cB_SpecificPM_toggled(bool state){
}
/*!
- * SLOT: called if TQCheckBox cB_disablePM is toggled.
+ * Slot called if TQCheckBox cB_disablePM is toggled.
* \param state boolean, true if toggled on
* false if toggled off
*/
@@ -1216,7 +1223,7 @@ void ConfigureDialog::cB_disablePM_toggled(bool state){
}
/*!
- * SLOT: called if the standby TQSpinBoxes for DPMS timout is changed.
+ * Slot called if the standby TQSpinBoxes for DPMS timout is changed.
*/
void ConfigureDialog::sB_standby_valueChanged() {
kdDebugFuncIn(trace);
@@ -1233,7 +1240,7 @@ void ConfigureDialog::sB_standby_valueChanged() {
}
/*!
- * SLOT: called if the suspend TQSpinBoxes for DPMS timout is changed.
+ * Slot called if the suspend TQSpinBoxes for DPMS timout is changed.
*/
void ConfigureDialog::sB_suspend_valueChanged() {
kdDebugFuncIn(trace);
@@ -1254,7 +1261,7 @@ void ConfigureDialog::sB_suspend_valueChanged() {
}
/*!
- * SLOT: called if the powerOff TQSpinBoxes for DPMS timout is changed.
+ * Slot called if the powerOff TQSpinBoxes for DPMS timout is changed.
*/
void ConfigureDialog::sB_powerOff_valueChanged() {
kdDebugFuncIn(trace);
@@ -1330,7 +1337,7 @@ void ConfigureDialog::cB_autoSuspend_toggled( bool toggled ) {
}
/*!
- * SLOT: called if a new item in cB_autoInactivity is selected.
+ * Slot called if a new item in cB_autoInactivity is selected.
* \param selectedItem Integer, contains the ID of the new item in the
* comboBox.
*/
@@ -1381,7 +1388,7 @@ void ConfigureDialog::cB_autoInactivity_activated( int selectedItem ) {
}
/*!
- * SLOT: Called if the 'Enable scheme specific blacklist' is toggled.
+ * Slot called if the 'Enable scheme specific blacklist' is toggled.
* \param toggled boolean, true if toggled on
* false if toggled off
*/
@@ -1401,7 +1408,7 @@ void ConfigureDialog::cB_Blacklist_toggled( bool toggled ){
}
/*!
- * SLOT: Called if the 'edit blacklist' button is toggled.
+ * Slot called if the 'edit blacklist' button is toggled.
*/
void ConfigureDialog::pB_editBlacklistSuspend_clicked(){
kdDebugFuncIn(trace);
@@ -1438,15 +1445,15 @@ void ConfigureDialog::pB_editBlacklistSuspend_clicked(){
}
blacklistEDlgAS = new blacklistEditDialog(blacklist, _top_text, initialiseImport, this);
- connect( blacklistEDlgAS, TQT_SIGNAL(config_finished(TQStringList)), this,
- TQT_SLOT(saveSchemeSuspendBlacklist(TQStringList)));
+ connect( blacklistEDlgAS, TQ_SIGNAL(config_finished(TQStringList)), this,
+ TQ_SLOT(saveSchemeSuspendBlacklist(TQStringList)));
blacklistEDlgAS->exec();
kdDebugFuncOut(trace);
}
/*!
- * SLOT: Called if the signal config_finished(TQStringList) recieved
+ * Slot called if the signal config_finished(TQStringList) recieved
* and the autosuspend blacklist is edited.
* \param new_blacklist TQStringlist with the edited blacklisted processes
*/
@@ -1511,7 +1518,7 @@ void ConfigureDialog::cB_autoDimm_toggled( bool toggled ) {
}
/*!
- * SLOT: Called if the 'Enable scheme specific blacklist' is toggled.
+ * Slot called if the 'Enable scheme specific blacklist' is toggled.
* \param toggled boolean, true if toggled on
* false if toggled off
*/
@@ -1531,7 +1538,7 @@ void ConfigureDialog::cB_BlacklistDimm_toggled( bool toggled ){
}
/*!
- * SLOT: Called if the 'edit blacklist' button for autodimm is toggled.
+ * Slot called if the 'edit blacklist' button for autodimm is toggled.
*/
void ConfigureDialog::pB_editBlacklistDimm_clicked(){
kdDebugFuncIn(trace);
@@ -1568,15 +1575,15 @@ void ConfigureDialog::pB_editBlacklistDimm_clicked(){
}
blacklistEDlgAD = new blacklistEditDialog(blacklist, _top_text, initialiseImport, this);
- connect( blacklistEDlgAD, TQT_SIGNAL(config_finished(TQStringList)), this,
- TQT_SLOT(saveSchemeDimmBlacklist(TQStringList)));
+ connect( blacklistEDlgAD, TQ_SIGNAL(config_finished(TQStringList)), this,
+ TQ_SLOT(saveSchemeDimmBlacklist(TQStringList)));
blacklistEDlgAD->exec();
kdDebugFuncOut(trace);
}
/*!
- * SLOT: Called if the signal config_finished(TQStringList) recieved
+ * Slot called if the signal config_finished(TQStringList) recieved
* and the autdimm blacklist is edited.
* \param new_blacklist TQStringlist with the edited blacklisted processes
*/
@@ -1598,7 +1605,7 @@ void ConfigureDialog::saveSchemeDimmBlacklist( TQStringList new_blacklist){
}
/*!
- * SLOT: Called if there \ref sB_autoDimmTime get changed
+ * Slot called if there \ref sB_autoDimmTime get changed
* \param value Integer with the new value
*/
void ConfigureDialog::sB_autoDimmTime_valueChanged( int value ) {
@@ -1627,25 +1634,25 @@ void ConfigureDialog::sB_autoDimmTime_valueChanged( int value ) {
/* ---- END Autodimm SECTION ---- */
/* ---- START Brightness SECTION ---- */
-/*! \b SLOT: to enable the brigthness related widgets */
+/*! \b Slot: to enable the brigthness related widgets */
void ConfigureDialog::cB_Brightness_toggled( bool toggled ) {
kdDebugFuncIn(trace);
gB_Brightness->setEnabled(toggled);
cB_Brightness->setChecked(toggled);
- connect(brightnessSlider, TQT_SIGNAL(valueChanged (int)), this, TQT_SLOT(brightnessSlider_sliderMoved(int)));
+ connect(brightnessSlider, TQ_SIGNAL(valueChanged (int)), this, TQ_SLOT(brightnessSlider_sliderMoved(int)));
kdDebugFuncOut(trace);
}
-/*! \b SLOT: to change the brightness if the slider is changed */
+/*! \b Slot: to change the brightness if the slider is changed */
void ConfigureDialog::brightnessSlider_sliderMoved( int new_value ) {
kdDebugFuncIn(trace);
if (cB_Brightness->isEnabled() && cB_Brightness->isChecked()) {
scheme_valueChanged();
tL_valueBrightness->setText(TQString::number(new_value) + " %");
- hwinfo->setBrightness(-1, new_value);
+ hwinfo->setBrightnessPercentage(new_value);
pB_resetBrightness->setEnabled(true);
brightness_changed = true;
}
@@ -1653,11 +1660,11 @@ void ConfigureDialog::brightnessSlider_sliderMoved( int new_value ) {
kdDebugFuncOut(trace);
}
-/*! \b SLOT: to reset the brightness if the reset button clicked */
+/*! \b Slot: to reset the brightness if the reset button clicked */
void ConfigureDialog::pB_resetBrightness_clicked( ) {
kdDebugFuncIn(trace);
- hwinfo->setBrightness(brightness_last, -1);
+ hwinfo->setBrightnessLevel(brightness_last);
brightnessSlider->setValue(brightness_last);
pB_resetBrightness->setEnabled(false);
brightness_changed = false;
@@ -1669,7 +1676,7 @@ void ConfigureDialog::pB_resetBrightness_clicked( ) {
/* ---- START battery level SECTION ---- */
/*!
- * SLOT: called if the warning TQSpinBoxes for battery level is changed.
+ * Slot called if the warning TQSpinBoxes for battery level is changed.
*/
void ConfigureDialog::sB_batWarning_valueChanged() {
kdDebugFuncIn(trace);
@@ -1686,7 +1693,7 @@ void ConfigureDialog::sB_batWarning_valueChanged() {
}
/*!
- * SLOT: called if the low TQSpinBoxes for battery level is changed.
+ * Slot called if the low TQSpinBoxes for battery level is changed.
*/
void ConfigureDialog::sB_batLow_valueChanged() {
kdDebugFuncIn(trace);
@@ -1707,7 +1714,7 @@ void ConfigureDialog::sB_batLow_valueChanged() {
}
/*!
- * SLOT: called if the critical TQSpinBoxes for battery level is changed.
+ * Slot called if the critical TQSpinBoxes for battery level is changed.
*/
void ConfigureDialog::sB_batCritical_valueChanged() {
kdDebugFuncIn(trace);
@@ -1724,7 +1731,7 @@ void ConfigureDialog::sB_batCritical_valueChanged() {
}
/*!
- * SLOT: called if the TQComboBox for the battery warning level action changed,
+ * Slot called if the TQComboBox for the battery warning level action changed,
* used to hide/show the related TQSpinboxes if needed.
*/
void ConfigureDialog::cB_batWarning_activated() {
@@ -1756,7 +1763,7 @@ void ConfigureDialog::cB_batLow_activated() {
}
/*!
- * SLOT: called if the TQComboBox for the battery critical level action changed,
+ * Slot called if the TQComboBox for the battery critical level action changed,
* used to hide/show the related TQSpinboxes if needed.
*/
void ConfigureDialog::cB_batCritical_activated() {
@@ -1773,7 +1780,7 @@ void ConfigureDialog::cB_batCritical_activated() {
/* ---- END battery level SECTION ---- */
-/*! \b SLOT: to open the KNotify config dialog */
+/*! \b Slot: to open the KNotify config dialog */
void ConfigureDialog::pB_configNotify_released( ) {
kdDebugFuncIn(trace);
@@ -1798,11 +1805,14 @@ TQString ConfigureDialog::mapActionToDescription( TQString action ) {
} else if (action.startsWith("LOGOUT_DIALOG")) {
ret = i18n("Logout Dialog");
} else if (action.startsWith("SUSPEND2DISK")) {
- if (actions.contains("Suspend to Disk"))
- ret = i18n("Suspend to Disk");
+ if (actions.contains("Hibernate"))
+ ret = i18n("Hibernate");
+ } else if (action.startsWith("SUSPEND_HYBRID")) {
+ if (actions.contains("Hybrid Suspend"))
+ ret = i18n("Hybrid Suspend");
} else if (action.startsWith("SUSPEND2RAM")) {
- if (actions.contains("Suspend to RAM"))
- ret = i18n("Suspend to RAM");
+ if (actions.contains("Suspend"))
+ ret = i18n("Suspend");
} else if (action.startsWith("FREEZE")) {
if (actions.contains("Freeze"))
ret = i18n("Freeze");
@@ -1839,11 +1849,14 @@ TQString ConfigureDialog::mapDescriptionToAction( TQString description ) {
} else if (description.startsWith("Logout Dialog") ||
description.startsWith(i18n("Logout Dialog"))) {
ret = "LOGOUT_DIALOG";
- } else if (description.startsWith("Suspend to Disk") ||
- description.startsWith(i18n("Suspend to Disk"))) {
+ } else if (description.startsWith("Hibernate") ||
+ description.startsWith(i18n("Hibernate"))) {
ret = "SUSPEND2DISK";
- } else if (description.startsWith("Suspend to RAM") ||
- description.startsWith(i18n("Suspend to RAM"))) {
+ } else if (description.startsWith("Hybrid Suspend") ||
+ description.startsWith(i18n("Hybrid Suspend"))) {
+ ret = "SUSPEND_HYBRID";
+ } else if (description.startsWith("Suspend") ||
+ description.startsWith(i18n("Suspend"))) {
ret = "SUSPEND2RAM";
} else if (description.startsWith("Freeze") ||
description.startsWith(i18n("Freeze"))) {