summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeL10n.txt12
-rw-r--r--src/CMakeLists.txt20
-rw-r--r--src/Makefile.am102
-rw-r--r--src/autodimm.cpp8
-rw-r--r--src/autodimm.h2
-rw-r--r--src/autosuspend.cpp4
-rw-r--r--src/autosuspend.h2
-rw-r--r--src/blacklistedit_Dialog.ui13
-rw-r--r--src/blacklisteditdialog.cpp20
-rw-r--r--src/blacklisteditdialog.h2
-rw-r--r--src/config/tdepowersaverc_default6
-rw-r--r--src/configure.in.in9
-rw-r--r--src/configure_Dialog.ui29
-rw-r--r--src/configuredialog.cpp139
-rw-r--r--src/configuredialog.h2
-rw-r--r--src/countdown_Dialog.ui7
-rw-r--r--src/countdowndialog.cpp14
-rw-r--r--src/countdowndialog.h2
-rw-r--r--src/dbusInterface.cpp26
-rw-r--r--src/dbusInterface.h9
-rw-r--r--src/detailed_Dialog.ui3
-rw-r--r--src/detaileddialog.cpp48
-rw-r--r--src/detaileddialog.h4
-rw-r--r--src/dummy.cpp6
-rw-r--r--src/eventsrc260
-rw-r--r--src/hardware.cpp2214
-rw-r--r--src/hardware.h45
-rw-r--r--src/hardware_battery.cpp52
-rw-r--r--src/hardware_battery.h22
-rw-r--r--src/hardware_batteryCollection.cpp4
-rw-r--r--src/hardware_batteryCollection.h10
-rw-r--r--src/hardware_cpu.cpp6
-rw-r--r--src/hardware_cpu.h9
-rw-r--r--src/inactivity.cpp28
-rw-r--r--src/inactivity.h12
-rw-r--r--src/info_Dialog.ui10
-rw-r--r--src/infodialog.cpp8
-rw-r--r--src/infodialog.h2
-rw-r--r--src/log_viewer.ui4
-rw-r--r--src/logviewer.cpp10
-rw-r--r--src/logviewer.h2
-rw-r--r--src/main.cpp14
-rw-r--r--src/pics/Makefile.am3
-rw-r--r--src/screen.cpp46
-rw-r--r--src/screen.h13
-rw-r--r--src/settings.cpp16
-rw-r--r--src/settings.h5
-rw-r--r--src/suspenddialog.cpp10
-rw-r--r--src/suspenddialog.h2
-rw-r--r--src/tdepowersave-autostart.desktop72
-rw-r--r--src/tdepowersave.cpp493
-rw-r--r--src/tdepowersave.desktop71
-rw-r--r--src/tdepowersave.h46
-rw-r--r--src/tdepowersave_debug.h7
54 files changed, 1951 insertions, 2034 deletions
diff --git a/src/CMakeL10n.txt b/src/CMakeL10n.txt
index b401afd..5f00ced 100644
--- a/src/CMakeL10n.txt
+++ b/src/CMakeL10n.txt
@@ -1,3 +1,13 @@
##### create translation templates ##############
-tde_l10n_create_template( "tdepowersave" )
+tde_l10n_create_template( "messages/tdepowersave" )
+
+tde_l10n_create_template(
+ CATALOG "desktop_files/tdepowersave-desktops"
+ SOURCES *.desktop
+)
+
+tde_l10n_create_template(
+ CATALOG "desktop_files/eventsrc/"
+ SOURCES eventsrc
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5071df..0d3ff90 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,10 +30,20 @@ link_directories(
##### other data ################################
tde_install_icons( tdepowersave )
-install( FILES tdepowersave.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
-install( FILES tdepowersave-autostart.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} )
-install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/tdepowersave )
-install( FILES config/tdepowersaverc_default RENAME tdepowersaverc DESTINATION ${CONFIG_INSTALL_DIR} )
+tde_create_translated_desktop( tdepowersave.desktop )
+tde_create_translated_desktop(
+ SOURCE tdepowersave-autostart.desktop
+ DESTINATION ${AUTOSTART_INSTALL_DIR}
+)
+tde_create_translated_desktop(
+ SOURCE eventsrc
+ DESTINATION ${DATA_INSTALL_DIR}/tdepowersave
+)
+install(
+ FILES config/tdepowersaverc_default
+ RENAME tdepowersaverc
+ DESTINATION ${CONFIG_INSTALL_DIR}
+)
##### tdepowersave (tdeinit) ######################
@@ -50,6 +60,6 @@ tde_add_tdeinit_executable( tdepowersave AUTOMOC
tdepowersave.skel log_viewer.ui logviewer.cpp main.cpp
screen.cpp settings.cpp suspenddialog.cpp suspend_Dialog.ui
LINK
- ${DBUS_TQT_LIBRARIES} tdeio-shared
+ ${DBUS_TQT_LIBRARIES} tdeio-shared ${TDEHW_LIBRARIES}
${XEXT_LIBRARIES} ${XTST_LIBRARIES} ${XSCRNSAVER_LIBRARIES}
)
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 9c7b044..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,102 +0,0 @@
-# set the include path for X, qt and KDE
-INCLUDES = \
- -DPACKAGE_KDE_SOUND_DIR=\""$(prefix)/share/sounds/"\" \
- $(all_includes) \
- @PACKAGE_CFLAGS@
-
-# these are the headers for your project
-noinst_HEADERS = \
- autodimm.h \
- autosuspend.h \
- blacklisteditdialog.h \
- configuredialog.h \
- countdowndialog.h \
- dbusInterface.h \
- detaileddialog.h \
- hardware.h \
- hardware_battery.h \
- hardware_batteryCollection.h \
- hardware_cpu.h \
- inactivity.h \
- infodialog.h \
- tdepowersave.h \
- logviewer.h \
- screen.h \
- settings.h \
- suspenddialog.h
-
-
-# let automoc handle all of the meta source files (moc)
-METASOURCES = AUTO
-
-KDE_ICON = tdepowersave
-
-#########################################################################
-# APPLICATION SECTION
-#########################################################################
-# this is the program that gets installed. it's name is used for all
-# of the other Makefile.am variables
-
-bin_PROGRAMS =
-lib_LTLIBRARIES =
-tdeinit_LTLIBRARIES = tdepowersave.la
-
-# the application source, library search path, and link libraries
-tdepowersave_la_SOURCES = \
- dummy.cpp \
- autodimm.cpp \
- autosuspend.cpp \
- blacklistedit_Dialog.ui \
- blacklisteditdialog.cpp \
- configure_Dialog.ui \
- configuredialog.cpp \
- countdown_Dialog.ui \
- countdowndialog.cpp \
- dbusInterface.cpp \
- detailed_Dialog.ui \
- detaileddialog.cpp \
- hardware.cpp \
- hardware_battery.cpp \
- hardware_batteryCollection.cpp \
- hardware_cpu.cpp \
- inactivity.cpp \
- info_Dialog.ui \
- infodialog.cpp \
- tdepowersave.cpp \
- tdepowersave.skel \
- log_viewer.ui \
- logviewer.cpp \
- main.cpp \
- screen.cpp \
- settings.cpp \
- suspenddialog.cpp \
- suspend_Dialog.ui
-
-
-tdepowersave_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -module -avoid-version
-tdepowersave_la_LIBADD = $(LIB_TDEIO) @PACKAGE_LIBS@ -ldbus-tqt-1 -lXss -lXext -lXtst
-
-# this is where the desktop file will go
-xdg_apps_DATA = tdepowersave.desktop
-
-# and for autostart
-autostartdir = $(prefix)/share/autostart
-autostart_DATA = tdepowersave-autostart.desktop
-
-# this is where the shell's XML-GUI resource file goes
-shellrcdir = $(kde_datadir)/tdepowersave
-shellrc_DATA = eventsrc
-# shellrc_DATA = tdepowersaveui.rc
-
-# pics subdir
-SUBDIRS = pics
-messages:
- $(EXTRACTRC) *ui eventsrc >> rc.cpp
- $(XGETTEXT) `find . -name \*.h -o -name \*.H -o -name \*.cpp -o -name \*.C` -o $(podir)/tdepowersave.pot
- rm -f rc.cpp
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(kde_confdir)
- $(INSTALL_DATA) $(top_srcdir)/src/config/tdepowersaverc_default $(DESTDIR)$(kde_confdir)/tdepowersaverc
-
-
diff --git a/src/autodimm.cpp b/src/autodimm.cpp
index e797e61..5eb6f24 100644
--- a/src/autodimm.cpp
+++ b/src/autodimm.cpp
@@ -24,6 +24,10 @@
* \date 2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "autodimm.h"
/*! The default constructor of the class autodimm */
@@ -33,7 +37,7 @@ autodimm::autodimm(screen *disp) : inactivity(disp) {
lastIdleTime = 0;
checkActivity = new TQTimer( this );
- connect( checkActivity, TQT_SIGNAL(timeout()), this, TQT_SLOT(pollActivity()));
+ connect( checkActivity, TQ_SIGNAL(timeout()), this, TQ_SLOT(pollActivity()));
kdDebugFuncOut(trace);
}
@@ -61,7 +65,7 @@ void autodimm::startCheckForActivity() {
}
/*!
- * \b TQT_SLOT to call check if the user is active again.
+ * \b Slot to call check if the user is active again.
*/
void autodimm::pollActivity() {
kdDebugFuncIn(trace);
diff --git a/src/autodimm.h b/src/autodimm.h
index 81b1cf9..08557b4 100644
--- a/src/autodimm.h
+++ b/src/autodimm.h
@@ -37,7 +37,7 @@
class autodimm : public inactivity
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/autosuspend.cpp b/src/autosuspend.cpp
index 01372ba..ea6515c 100644
--- a/src/autosuspend.cpp
+++ b/src/autosuspend.cpp
@@ -23,6 +23,10 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "autosuspend.h"
/*! The default constructor of the class autosuspend */
diff --git a/src/autosuspend.h b/src/autosuspend.h
index 4fe5832..37a7216 100644
--- a/src/autosuspend.h
+++ b/src/autosuspend.h
@@ -36,7 +36,7 @@
class autosuspend : public inactivity
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/blacklistedit_Dialog.ui b/src/blacklistedit_Dialog.ui
index 375a450..45521e0 100644
--- a/src/blacklistedit_Dialog.ui
+++ b/src/blacklistedit_Dialog.ui
@@ -37,9 +37,6 @@
<property name="text">
<string>OK</string>
</property>
- <property name="accel">
- <string></string>
- </property>
<property name="autoDefault">
<bool>true</bool>
</property>
@@ -62,9 +59,6 @@
<property name="text">
<string>Cancel</string>
</property>
- <property name="accel">
- <string></string>
- </property>
<property name="autoDefault">
<bool>true</bool>
</property>
@@ -127,9 +121,6 @@
<property name="text">
<string>Remove</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
<widget class="TQListBox" row="0" column="3" rowspan="3" colspan="1">
<property name="name">
@@ -259,7 +250,7 @@
<tabstop>pB_remove</tabstop>
<tabstop>lB_blacklist</tabstop>
</tabstops>
-<Q_SLOTS>
+<slots>
<slot>buttonOk_released()</slot>
<slot>buttonCancel_released()</slot>
<slot>buttonApply_released()</slot>
@@ -270,6 +261,6 @@
<slot>lB_blacklist_selected()</slot>
<slot>lB_blacklist_currentChanged(TQListBoxItem*)</slot>
<slot>lB_blacklist_currentChanged()</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/src/blacklisteditdialog.cpp b/src/blacklisteditdialog.cpp
index 85526f5..f9638f8 100644
--- a/src/blacklisteditdialog.cpp
+++ b/src/blacklisteditdialog.cpp
@@ -24,6 +24,10 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// own header
#include "blacklisteditdialog.h"
@@ -31,7 +35,7 @@
#include <tdelocale.h>
#include <kiconloader.h>
-// QT headers:
+// TQt headers:
#include <tqbuttongroup.h>
#include <tqdialog.h>
#include <tqlabel.h>
@@ -76,7 +80,7 @@ blacklistEditDialog::~blacklistEditDialog()
}
/*!
- * SLOT: called if the 'ok' button clicked. This TQT_SLOT emit
+ * Slot called if the 'ok' button clicked. This slot emit
* \ref config_finished() and close the dialog.
*/
void blacklistEditDialog::buttonOk_released() {
@@ -90,7 +94,7 @@ void blacklistEditDialog::buttonOk_released() {
/*!
- * SLOT: called if the 'cancel' button clicked. This TQT_SLOT close
+ * Slot called if the 'cancel' button clicked. This slot close
* the dialog.
*/
void blacklistEditDialog::buttonCancel_released(){
@@ -100,7 +104,7 @@ void blacklistEditDialog::buttonCancel_released(){
/*!
- * SLOT: called if the 'remove' button clicked. The TQT_SLOT try to remove
+ * Slot called if the 'remove' button clicked. The slot try to remove
* the selected item from the TQListBox and the TQStringList \ref blacklist .
*/
void blacklistEditDialog::pB_remove_released(){
@@ -120,8 +124,8 @@ void blacklistEditDialog::pB_remove_released(){
/*!
- * SLOT: called if the 'add' button clicked. The TQT_SLOT try to add the string from
- * the TQLineEdit lE_blacklist to the TQListBox and the TQStringList \ref blacklist .
+ * Slot called if the 'add' button clicked. The slot try to add the string from
+ * the TQLineEdit lE_blacklist to the TQListBox and the TQStringList \ref blacklist.
*/
void blacklistEditDialog::pB_add_released(){
@@ -151,7 +155,7 @@ void blacklistEditDialog::pB_add_released(){
/*!
- * SLOT: called if a item in the TQListBox lB_blacklist is selected.
+ * Slot called if a item in the TQListBox lB_blacklist is selected.
* Here we enable the remove button pB_remove .
*/
void blacklistEditDialog::lB_blacklist_currentChanged(){
@@ -161,7 +165,7 @@ void blacklistEditDialog::lB_blacklist_currentChanged(){
/*!
- * SLOT: called if the input-line in the dialog is modified. Here we enable
+ * Slot called if the input-line in the dialog is modified. Here we enable
* the add button pB_add .
*/
void blacklistEditDialog::lE_blacklist_textChanged(){
diff --git a/src/blacklisteditdialog.h b/src/blacklisteditdialog.h
index 8ae17db..fc1c775 100644
--- a/src/blacklisteditdialog.h
+++ b/src/blacklisteditdialog.h
@@ -36,7 +36,7 @@
class blacklistEditDialog: public blacklistedit_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/config/tdepowersaverc_default b/src/config/tdepowersaverc_default
index 7f230af..a2e701a 100644
--- a/src/config/tdepowersaverc_default
+++ b/src/config/tdepowersaverc_default
@@ -5,9 +5,9 @@ ActionOnLidClose=
ActionOnLidCloseValue=
ActionOnPowerButton=SHUTDOWN
ActionOnPowerButtonValue=
-ActionOnSleepButton=SUSPEND2RAM
+ActionOnSuspendButton=SUSPEND2RAM
ActionOnS2DiskButton=SUSPEND2DISK
-buttonsAllowedActions=SHUTDOWN,LOGOUT_DIALOG,SUSPEND2DISK,SUSPEND2RAM,FREEZE
+buttonsAllowedActions=LOGOUT_DIALOG,FREEZE,SUSPEND2RAM,SUSPEND2DISK,SUSPEND_HYBRID,SHUTDOWN
AutoSuspendCountdown=true
AutoSuspendCountdownTimeOut=30
Autostart=true
@@ -32,7 +32,7 @@ batteryLowActionValue=1
batteryCritical=2
batteryCriticalAction=SHUTDOWN
batteryCriticalActionValue=
-batteryAllowedActions=SHUTDOWN,SUSPEND2DISK,SUSPEND2RAM,FREEZE,CPUFREQ_POWERSAVE,CPUFREQ_PERFORMANCE,CPUFREQ_DYNAMIC,BRIGHTNESS
+batteryAllowedActions=FREEZE,SUSPEND2RAM,SUSPEND2DISK,SUSPEND_HYBRID,SHUTDOWN,CPUFREQ_POWERSAVE,CPUFREQ_PERFORMANCE,CPUFREQ_DYNAMIC,BRIGHTNESS
[default-scheme]
specSsSettings=false
diff --git a/src/configure.in.in b/src/configure.in.in
deleted file mode 100644
index dfcd1b3..0000000
--- a/src/configure.in.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#MIN_CONFIG(3.0.0)
-
-AM_INIT_AUTOMAKE(tdepowersave, 0.1)
-AC_C_BIGENDIAN
-AC_CHECK_KDEMAXPATHLEN
-
-AC_PATH_QT
-# AC_PATH_QT_TQMOC_UIC
-
diff --git a/src/configure_Dialog.ui b/src/configure_Dialog.ui
index 956721a..b1c0416 100644
--- a/src/configure_Dialog.ui
+++ b/src/configure_Dialog.ui
@@ -48,9 +48,6 @@
<property name="text">
<string>Apply</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
<widget class="TQPushButton" row="0" column="0">
<property name="name">
@@ -59,9 +56,6 @@
<property name="text">
<string>Help</string>
</property>
- <property name="accel">
- <string></string>
- </property>
<property name="autoDefault">
<bool>true</bool>
</property>
@@ -84,9 +78,6 @@
<property name="text">
<string>Cancel</string>
</property>
- <property name="accel">
- <string></string>
- </property>
<property name="autoDefault">
<bool>true</bool>
</property>
@@ -115,9 +106,6 @@
<property name="text">
<string>OK</string>
</property>
- <property name="accel">
- <string></string>
- </property>
<property name="autoDefault">
<bool>true</bool>
</property>
@@ -522,9 +510,6 @@
<property name="text">
<string>Enable scheme specific Brightness settings</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
@@ -1524,10 +1509,10 @@
<cstring>textLabel3_4_3</cstring>
</property>
<property name="text">
- <string>Sleep button:</string>
+ <string>Suspend button:</string>
</property>
<property name="buddy" stdset="0">
- <cstring>cB_SleepButton</cstring>
+ <cstring>cB_SuspendButton</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
@@ -1622,7 +1607,7 @@
</spacer>
<widget class="TQComboBox" row="3" column="2">
<property name="name">
- <cstring>cB_SleepButton</cstring>
+ <cstring>cB_SuspendButton</cstring>
</property>
<property name="minimumSize">
<size>
@@ -2315,7 +2300,7 @@
<slot>general_valueChanged()</slot>
</connection>
<connection>
- <sender>cB_SleepButton</sender>
+ <sender>cB_SuspendButton</sender>
<signal>activated(int)</signal>
<receiver>configure_Dialog</receiver>
<slot>general_valueChanged()</slot>
@@ -2556,7 +2541,7 @@
<tabstop>sB_batCritAction_value</tabstop>
<tabstop>cB_PowerButton</tabstop>
<tabstop>cB_LidcloseButton</tabstop>
- <tabstop>cB_SleepButton</tabstop>
+ <tabstop>cB_SuspendButton</tabstop>
<tabstop>cB_S2DiskButton</tabstop>
<tabstop>cB_acScheme</tabstop>
<tabstop>cB_batteryScheme</tabstop>
@@ -2569,7 +2554,7 @@
<tabstop>cB_autostart_neverAsk</tabstop>
<tabstop>buttonHelp</tabstop>
</tabstops>
-<Q_SLOTS>
+<slots>
<slot>buttonApply_clicked()</slot>
<slot>cB_specificSettings_toggled( bool )</slot>
<slot>cB_SpecificPM_toggled( bool )</slot>
@@ -2636,6 +2621,6 @@
<slot>pB_editAutosuspendGBlacklist_clicked()</slot>
<slot>pB_editAutodimmGBlacklist_clicked()</slot>
<slot>sB_autoDimmTime_valueChanged( int )</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
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"))) {
diff --git a/src/configuredialog.h b/src/configuredialog.h
index d9e3307..5979f18 100644
--- a/src/configuredialog.h
+++ b/src/configuredialog.h
@@ -41,7 +41,7 @@
class ConfigureDialog: public configure_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/countdown_Dialog.ui b/src/countdown_Dialog.ui
index 1a978a3..fd8c25e 100644
--- a/src/countdown_Dialog.ui
+++ b/src/countdown_Dialog.ui
@@ -54,9 +54,6 @@
<property name="text">
<string>&amp;Cancel</string>
</property>
- <property name="accel">
- <string>Alt+C</string>
- </property>
</widget>
<spacer row="1" column="0">
<property name="name">
@@ -197,9 +194,9 @@
<slot>pB_cancel_pressed()</slot>
</connection>
</connections>
-<Q_SLOTS>
+<slots>
<slot>pB_cancel_pressed()</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
<includes>
<include location="global" impldecl="in implementation">kprogress.h</include>
diff --git a/src/countdowndialog.cpp b/src/countdowndialog.cpp
index 0037100..1e028ef 100644
--- a/src/countdowndialog.cpp
+++ b/src/countdowndialog.cpp
@@ -23,6 +23,10 @@
* \date 2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// own header
#include "countdowndialog.h"
#include "tdepowersave_debug.h"
@@ -32,7 +36,7 @@
#include <kiconloader.h>
#include <kprogress.h>
-// QT headers:
+// TQt headers:
#include <tqdialog.h>
#include <tqlabel.h>
#include <tqprogressbar.h>
@@ -49,7 +53,7 @@ countDownDialog::countDownDialog( int timeout, TQWidget *parent, const char *nam
timeOut = timeout;
PROGRESS = new TQTimer(this);
- connect(PROGRESS, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateProgress()));
+ connect(PROGRESS, TQ_SIGNAL(timeout()), this, TQ_SLOT(updateProgress()));
this->setCaption(i18n("TDEPowersave"));
@@ -76,6 +80,8 @@ void countDownDialog::setPixmap( TQString type )
if(type.startsWith("suspend2disk")){
pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_disk", TDEIcon::NoGroup, TDEIcon::SizeLarge);
+ } else if(type.startsWith("suspend_hybrid")){
+ 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")) {
@@ -131,7 +137,7 @@ bool countDownDialog::showDialog() {
}
/*!
- * \b TQT_SLOT to get the event if the 'Cancel' button was pressed.
+ * \b Slot to get the event if the 'Cancel' button was pressed.
*/
void countDownDialog::pB_cancel_pressed() {
kdDebugFuncIn(trace);
@@ -156,7 +162,7 @@ void countDownDialog::reject() {
}
/*!
- * \b TQT_SLOT to handle the change of the progressbar.
+ * \b Slot to handle the change of the progressbar.
*/
void countDownDialog::updateProgress() {
kdDebugFuncIn(trace);
diff --git a/src/countdowndialog.h b/src/countdowndialog.h
index c50b511..b103c4c 100644
--- a/src/countdowndialog.h
+++ b/src/countdowndialog.h
@@ -35,7 +35,7 @@
class countDownDialog: public countdown_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/dbusInterface.cpp b/src/dbusInterface.cpp
index 8ad5552..5180448 100644
--- a/src/dbusInterface.cpp
+++ b/src/dbusInterface.cpp
@@ -24,8 +24,12 @@
* \author Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de>
* \date 2006-2007
*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
-// QT - Header
+// TQt - Header
#include <tqtimer.h>
// KDE Header
@@ -140,19 +144,19 @@ bool dbusInterface::initDBUS(){
if( !dBusConn.isConnected() ) {
kdError() << "Failed to open connection to system message bus: " << dBusConn.lastError().message() << endl;
- TQTimer::singleShot(4000, this, TQT_SLOT(reconnect()));
+ TQTimer::singleShot(4000, this, TQ_SLOT(reconnect()));
return false;
}
// watcher for NameOwnerChanged signals
dBusWatch = new TQT_DBusProxy(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, dBusConn);
- TQObject::connect(dBusWatch, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
- this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
+ TQObject::connect(dBusWatch, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
+ this, TQ_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
// watcher for Disconnect signal
dBusLocal = new TQT_DBusProxy(DBUS_SERVICE_DBUS, DBUS_PATH_LOCAL, DBUS_INTERFACE_LOCAL, dBusConn);
- TQObject::connect(dBusLocal, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
- this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
+ TQObject::connect(dBusLocal, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
+ this, TQ_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
// find already running SystemD
TQT_DBusProxy checkSystemD(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, dBusConn);
@@ -189,7 +193,7 @@ void dbusInterface::handleDBusSignal(const TQT_DBusMessage& msg) {
&& msg.interface() == DBUS_INTERFACE_LOCAL
&& msg.member() == "Disconnected" ) {
close();
- TQTimer::singleShot(1000, this, TQT_SLOT(reconnect()));
+ TQTimer::singleShot(1000, this, TQ_SLOT(reconnect()));
return;
}
@@ -286,8 +290,8 @@ void dbusInterface::onServiceRegistered(const TQString& service) {
// watch session changes
systemdSeat = new TQT_DBusProxy(SYSTEMD_LOGIN1_SERVICE, seat, DBUS_INTERFACE_PROPERTIES, dBusConn);
- TQObject::connect(systemdSeat, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
- this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
+ TQObject::connect(systemdSeat, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
+ this, TQ_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
// inhibit systemd handling of power/sleep/hibernate/lid buttons
// http://www.freedesktop.org/wiki/Software/systemd/inhibit
@@ -338,8 +342,8 @@ void dbusInterface::onServiceRegistered(const TQString& service) {
// watch session changes
consolekitSeat = new TQT_DBusProxy(CK_SERVICE, seat, CK_SEAT_IFACE, dBusConn);
- TQObject::connect(consolekitSeat, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
- this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
+ TQObject::connect(consolekitSeat, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
+ this, TQ_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
return;
}
}
diff --git a/src/dbusInterface.h b/src/dbusInterface.h
index 3fa8071..c700057 100644
--- a/src/dbusInterface.h
+++ b/src/dbusInterface.h
@@ -35,12 +35,7 @@
#define DBUS_API_SUBJECT_TO_CHANGE
#endif
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// QT - Header
+// TQt - Header
#include <tqobject.h>
#include <tqstring.h>
@@ -66,7 +61,7 @@
#define SYSTEMD_LOGIN1_SEAT_IFACE "org.freedesktop.login1.Seat"
class dbusInterface : public TQObject{
- Q_OBJECT
+ TQ_OBJECT
private:
diff --git a/src/detailed_Dialog.ui b/src/detailed_Dialog.ui
index dd9dc6a..a9e5bc3 100644
--- a/src/detailed_Dialog.ui
+++ b/src/detailed_Dialog.ui
@@ -630,9 +630,6 @@
<property name="text">
<string>OK</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
</grid>
</widget>
diff --git a/src/detaileddialog.cpp b/src/detaileddialog.cpp
index 851d844..8390f29 100644
--- a/src/detaileddialog.cpp
+++ b/src/detaileddialog.cpp
@@ -27,12 +27,16 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// KDE headers:
#include <kled.h>
#include <kiconloader.h>
#include <tdelocale.h>
-// QT headers:
+// TQt headers:
#include <tqpushbutton.h>
#include <tqlayout.h>
#include <tqlabel.h>
@@ -93,12 +97,12 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, TQPixmap *_pixmap, Settin
BatteryFrame->adjustSize();
tl_powerConsDesc->hide();
tl_powerConsValue->hide();
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setBattery()));
- connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this, TQT_SLOT(setBattery()));
- connect(primaryBatteries, TQT_SIGNAL(batteryChargingStateChanged(int)), this,
- TQT_SLOT(setPowerConsumption()));
- connect(primaryBatteries, TQT_SIGNAL(batteryRateChanged()), this,
- TQT_SLOT(setPowerConsumption()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setBattery()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryChanged()), this, TQ_SLOT(setBattery()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryChargingStateChanged(int)), this,
+ TQ_SLOT(setPowerConsumption()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryRateChanged()), this,
+ TQ_SLOT(setPowerConsumption()));
setBattery();
setPowerConsumption();
} else {
@@ -122,21 +126,21 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, TQPixmap *_pixmap, Settin
}
ProcessorFrame->adjustSize();
- connect(OkButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(closeDetailedDlg()));
- connect(hwinfo, TQT_SIGNAL(ACStatus(bool)), this, TQT_SLOT(setAC()));
+ connect(OkButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(closeDetailedDlg()));
+ connect(hwinfo, TQ_SIGNAL(ACStatus(bool)), this, TQ_SLOT(setAC()));
// TODO: replace event
- //connect(pd, TQT_SIGNAL(schemeDataChanged()), this, TQT_SLOT(setInfos()));
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setInfos()));
+ //connect(pd, TQ_SIGNAL(schemeDataChanged()), this, TQ_SLOT(setInfos()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setInfos()));
if (hwinfo->supportCPUFreq() || cpuInfo->cpuFreqHW) {
// Check if cpufreq is available
cpuInfo->getCPUMaxSpeed();
setProcessor();
- connect(hwinfo, TQT_SIGNAL(currentCPUFreqPolicyChanged()), this, TQT_SLOT(setInfos()));
+ connect(hwinfo, TQ_SIGNAL(currentCPUFreqPolicyChanged()), this, TQ_SLOT(setInfos()));
} else {
// .. if not, use cpu throttling
if (!cpuInfo->getCPUThrottlingState() || numOfCPUs <= 1) {
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setProcessorThrottling()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setProcessorThrottling()));
}
setProcessorThrottling();
}
@@ -154,7 +158,7 @@ detaileddialog::~detaileddialog() {
}
/*!
- * \b TQT_SLOT called if the dialog is closed by the user.
+ * \b Slot called if the dialog is closed by the user.
* We do some cleanups here.
*/
void detaileddialog::closeDetailedDlg() {
@@ -165,7 +169,7 @@ void detaileddialog::closeDetailedDlg() {
}
/*!
- * \b TQT_SLOT to set up the battery progress widgets.
+ * \b Slot to set up the battery progress widgets.
*/
void detaileddialog::setBattery() {
kdDebugFuncIn(trace);
@@ -266,7 +270,7 @@ void detaileddialog::setBattery() {
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU progress bar widgets.
+ * \b Slot to set up the Processor/CPU progress bar widgets.
*/
void detaileddialog::setPowerConsumption() {
kdDebugFuncIn(trace);
@@ -303,7 +307,7 @@ void detaileddialog::setPowerConsumption() {
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU progress bar widgets.
+ * \b Slot to set up the Processor/CPU progress bar widgets.
*/
void detaileddialog::setProcessor() {
kdDebugFuncIn(trace);
@@ -337,12 +341,12 @@ void detaileddialog::setProcessor() {
ProcessorPBar[i]->setEnabled(false);
}
}
- TQTimer::singleShot(333, this, TQT_SLOT(setProcessor()));
+ TQTimer::singleShot(333, this, TQ_SLOT(setProcessor()));
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU bar widgets for cpu throttling machines.
+ * \b Slot to set up the Processor/CPU bar widgets for cpu throttling machines.
*/
void detaileddialog::setProcessorThrottling() {
kdDebugFuncOut(trace);
@@ -380,14 +384,14 @@ void detaileddialog::setProcessorThrottling() {
// currently there are no events we can use to get actual data
// so we recheck data ever 2 secs to register changes in the
// throttling state and if a CPU/core online state change
- TQTimer::singleShot(2000, this, TQT_SLOT(setProcessorThrottling()));
+ TQTimer::singleShot(2000, this, TQ_SLOT(setProcessorThrottling()));
}
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT to set up the AC status within the Led widget.
+ * \b Slot to set up the AC status within the Led widget.
*/
void detaileddialog::setAC() {
kdDebugFuncIn(trace);
@@ -405,7 +409,7 @@ void detaileddialog::setAC() {
}
/*!
- * \b TQT_SLOT to set all additional informtation as e.g. CPUFrequency policy
+ * \b Slot to set all additional informtation as e.g. CPUFrequency policy
* or current scheme
*/
void detaileddialog::setInfos() {
diff --git a/src/detaileddialog.h b/src/detaileddialog.h
index 5cc6d4e..b7d40b3 100644
--- a/src/detaileddialog.h
+++ b/src/detaileddialog.h
@@ -28,7 +28,7 @@
// KDE headers:
#include <kprogress.h>
-// other QT headers:
+// other TQt headers:
#include <tqpixmap.h>
// own headers:
@@ -50,7 +50,7 @@
*/
class detaileddialog: public detailed_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/dummy.cpp b/src/dummy.cpp
index b1381e5..8e842d8 100644
--- a/src/dummy.cpp
+++ b/src/dummy.cpp
@@ -24,6 +24,10 @@
* \date 2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <tqstring.h>
#include <tdelocale.h>
@@ -95,7 +99,7 @@ class dummy {
dummy = i18n("Scheme switched to %1. \n Deactivate following devices: %2").arg("").arg("");
dummy = i18n("Scheme switched to %1. \n Activate following devices: %2").arg("").arg("");
dummy = i18n("Report ...");
- dummy = i18n("Suspend to RAM is not supported on your machine.");
+ dummy = i18n("Suspend mode is not supported on your machine.");
dummy = i18n("Additionally, please mail the output of %1 to %2 . Thanks!").arg("").arg("");
dummy = i18n("Power consumption");
diff --git a/src/eventsrc b/src/eventsrc
index f379275..b189921 100644
--- a/src/eventsrc
+++ b/src/eventsrc
@@ -1,124 +1,40 @@
[!Global!]
IconName=tdepowersave
Comment=TDEPowersave
-Comment[cs]=TDEPowersave
-Comment[de]=TDEPowersave
-Comment[es]=TDEPowersave
-Comment[fr]=TDEPowersave
-Comment[it]=TDEPowersave
-Comment[ja]=TDEPowersave
-Comment[pl]=TDEPowersave
-Comment[pt]=TDEPowersave
-Comment[pt_BR]=TDEPowersave
-Comment[ru]=TDEPowersave
-Comment[zh_CN]=TDEPowersave
-Comment[zh_TW]=TDEPowersave
[plug_event]
Name=PlugEvent
Comment=AC adapter plugged in
-Comment[cs]=Připojen do sítě
-Comment[de]=Netzstecker angeschlossen
-Comment[es]=Adaptador de CA conectado
-Comment[fr]=Adaptateur CA branché
-Comment[it]=Adattatore CA collegato
-Comment[ja]=ACアダプタプラグ接続
-Comment[pl]=Zasilacz sieciowy podłączony
-Comment[pt]=Foi ligado o Adaptador CA
-Comment[pt_BR]=Adaptador de CA conectado
-Comment[ru]=Питание подключено
-Comment[zh_CN]=AC 适配器已插入
-Comment[zh_TW]=已插入 AC 介面卡
default_sound=KDE_Dialog_Appear.ogg
default_presentation=17
[unplug_event]
Name=UnplugEvent
Comment=AC adpater unplugged
-Comment[cs]=Odpojen ze sítě
-Comment[de]=Netzstecker entfernt
-Comment[es]=Adaptador de CA desconectado
-Comment[fr]=Adaptateur CA non branché
-Comment[it]=Adattatore CA scollegato
-Comment[ja]=ACアダプタプラグ非接続
-Comment[pl]=Zasilacz sieciowy odłączony
-Comment[pt]=O Adaptador CA foi desligado
-Comment[pt_BR]=Adaptador de CA desconectado
-Comment[ru]=Питание отключено
-Comment[zh_CN]=AC 适配器已拔出
-Comment[zh_TW]=未插入 AC 介面卡
default_sound=KDE_Dialog_Disappear.ogg
default_presentation=17
[battery_warning_event]
Name=BatteryWarningEvent
Comment=Battery charge dropped to level WARNING
-Comment[cs]=Stav baterie dosáhl úrovně POPLACH
-Comment[de]=Batteriestand erreicht Level WARNUNG
-Comment[es]=El nivel de carga de la batería es ADVERTENCIA
-Comment[fr]=Le niveau de charge de la batterie est tombé au niveau AVERTISSEMENT
-Comment[it]=La carica della batteria è sul livello AVVERTENZA
-Comment[ja]=充電量が警告レベルまで下がりました
-Comment[pl]=Naładowanie baterii spadło do poziomu OSTRZEŻENIE
-Comment[pt]=Estado da bateria baixou para o nível de AVISO
-Comment[pt_BR]=A carga da bateria caiu para o nível AVISO
-Comment[ru]=Уровень заряда батареи сменился на ПРЕДУПРЕЖДЕНИ
-Comment[zh_CN]=电池电量降至"警告"级别
-Comment[zh_TW]=電池充電量已降至「警告」層級
default_sound=KDE_Event_1.ogg
default_presentation=17
[battery_low_event]
Name=BatteryLowEvent
Comment=Battery charge dropped to level LOW
-Comment[cs]=Stav baterie dosáhl NÍZKĚ úrovně
-Comment[de]=Batteriestand erreicht Level NIEDRIG
-Comment[es]=El nivel de carga de la batería es BAJO
-Comment[fr]=Le niveau de charge de la batterie est tombé au niveau FAIBLE
-Comment[it]=La carica della batteria è sul livello BASSA
-Comment[ja]=充電量が低レベルまで下がりました
-Comment[pl]=Naładowanie baterii spadło do poziomu NISKI
-Comment[pt]=Estado da bateria baixou para o nível de BAIXO
-Comment[pt_BR]=A carga da bateria caiu para o nível BAIXO
-Comment[ru]=Состояние батареи изменилось к НИЗКОМУ
-Comment[zh_CN]=电池电量降至"低电量"级别
-Comment[zh_TW]=電池充電量已降至「低」層級
default_sound=KDE_Event_1.ogg
default_presentation=17
[battery_critical_event]
Name=BatteryCriticalEvent
Comment=Battery charge dropped to level CRITICAL
-Comment[cs]=Stav baterie dosáhl KRITICKÉ úrovně
-Comment[de]=Batteriestand erreicht Level KRITISCH
-Comment[es]=El nivel de carga de la batería es CRÍTICO
-Comment[fr]=Le niveau de charge de la batterie est tombé au niveau CRITIQUE
-Comment[it]=La carica della batteria è sul livello CRITICA
-Comment[ja]=充電量が致命的レベルまで下がりました
-Comment[pl]=Naładowanie baterii spadło do poziomu OSTRZEŻENIE
-Comment[pt]=Estado da bateria baixou para o nível CRÍTICO
-Comment[pt_BR]=A carga da bateria caiu para o nível CRÍTICO
-Comment[ru]=Состояние батареи изменилось к КРИТИЧЕСКОМУ
-Comment[zh_CN]=电池电量降至"电量严重不足"级别
-Comment[zh_TW]=電池充電量已降至「危急」層級
default_sound=KDE_Event_1.ogg
default_presentation=17
[autosuspend_event]
Name=AutosupendEvent
Comment=Autosuspend is going to be executed
-Comment[cs]=Vykonává se automatické uspání
-Comment[de]=Autosuspend wird ausgeführt
-Comment[es]=Se ejecutará la suspensión automática
-Comment[fr]=La mise en veille automatique va être exécutée
-Comment[it]=Attivazione in corso della sospensione automatica
-Comment[ja]=自動サスペンドが実行されます。
-Comment[pl]=Zostanie wykonane automatyczne uśpienie
-Comment[pt]=Será executada a sustensão automática
-Comment[pt_BR]=A suspensão automática será executada
-Comment[ru]=Запускается автозасыпание
-Comment[zh_CN]=将执行自动暂停
-Comment[zh_TW]=即將執行自動暫停
default_sound=KDE_Event_2.ogg
default_presentation=17
@@ -135,234 +51,86 @@ default_presentation=0
[scheme_Performance]
Name=SchemeSwitchToPerformanceEvent
Comment=Switched to scheme Performance
-Comment[cs]=Powersave přepnut do schématu Výkon
-Comment[de]=Zu Schema Leistung gewechselt.
-Comment[es]=Powersave ha pasado al esquema de rendimiento
-Comment[fr]=La fonction d'économie d'énergie a été basculée sur le profil Performance
-Comment[it]=Powersave attivato nello schema Prestazioni
-Comment[ja]=省電力がスキーム「パフォーマンス」に切り替わりました
-Comment[pl]=Schemat oszczędzania przełączono na Wydajność
-Comment[pt]=Powersave alterou para o esquema de Desempenho
-Comment[pt_BR]=O Powersave mudou para o esquema Desempenhodefault_presentation=0
-Comment[ru]=Управление питанием переключено на схему Производительность
-Comment[zh_CN]=Powersave 切换为"执行"方案
-Comment[zh_TW]=Powersave 已切換至「效能」規劃
default_presentation=0
[scheme_Powersave]
Name=SchemeSwitchToPowersaveEvent
Comment=Switched to scheme Powersave
-Comment[cs]=Powersave přepnut do schématu Úspora energie
-Comment[de]=Zu Schema Energiesparen gewechselt
-Comment[es]=Powersave ha pasado al esquema de ahorro de energía
-Comment[fr]=La fonction d'économie d'énergie a été basculée sur le profil Économie d'énergie
-Comment[it]=Powersave attivato nello schema Risparmio energetico
-Comment[ja]=省電力がスキーム「省電力」に切り替わりました
-Comment[pl]=Schemat oszczędzania przełączono na Oszczędzanie
-Comment[pt]=Powersave alterou para o esquema de Economia
-Comment[pt_BR]=O Powersave mudou para o esquema Powersave
-Comment[ru]=Управление питанием переключено на схему Энергосбережение
-Comment[zh_CN]=Powersave 切换为"省电"方案
-Comment[zh_TW]=Powersave 已切換至 Powersave 規劃
default_presentation=0
[scheme_Acoustic]
Name=SchemeSwitchToAcousticEvent
Comment=Switched to scheme Acoustic
-Comment[cs]=Powersave přepnut do schématu Tichý
-Comment[de]=Zu Schema Akustik gewechselt
-Comment[es]=Powersave ha pasado al esquema acústico
-Comment[fr]=La fonction d'économie d'énergie a été basculée sur le profil Acoustique
-Comment[it]=Powersave attivato nello schema Acustica
-Comment[ja]=省電力がスキーム「アコースティック」に切り替わりました
-Comment[pl]=Schemat oszczędzania przełączono na Hałas
-Comment[pt]=Powersave alterou para o esquema Silencioso
-Comment[pt_BR]=O Powersave mudou para o esquema Acústica
-Comment[ru]=Управление питанием переключилено на схему Шумоподавление
-Comment[zh_CN]=Powersave 切换为"声音"方案
-Comment[zh_TW]=Powersave 已切換至「音效」規劃
default_presentation=0
[scheme_Presentation]
Name=SchemeSwitchToPresentationEvent
Comment=Switched to scheme Presentation
-Comment[cs]=Powersave přepnut do schématu Prezentace
-Comment[de]=Zu Schema Präsentation gewechselt
-Comment[es]=Powersave ha pasado al esquema de presentación
-Comment[fr]=La fonction d'économie d'énergie a été basculée sur le profil Présentation
-Comment[it]=Powersave attivato nello schema Presentazione
-Comment[ja]=省電力がスキーム「プレゼンテーション」に切り替わりました:
-Comment[pl]=Schemat oszczędzania przełączono na Prezentacja
-Comment[pt]=Powersave alterou para o esquema de Apresentação
-Comment[pt_BR]=O Powersave mudou para o esquema Apresentação
-Comment[ru]=Управление питанием переключено на схему Презентация
-Comment[zh_CN]=Powersave 切换为"演示"方案
-Comment[zh_TW]=Powersave 已切換至「簡報」規劃
default_presentation=0
[scheme_Unknown]
Name=SchemeSwitchToUnknownEvent
Comment=Switched to unknown/user defined scheme
-Comment[cs]=Powersave přepnut do neznámého/uživatelem definovaného schématu
-Comment[de]=Zu unbekanntem/benutzerdefiniertem Schema gewechselt
-Comment[es]=Powersave ha pasado a un esquema desconocido o definido por el usuario
-Comment[fr]=La fonction d'économie d'énergie a été basculée sur un profil inconnu/défini par un utilisateur
-Comment[it]=Powersave attivato nello schema sconosciuto/definito dall'utente
-Comment[ja]=省電力が不明/ユーザ定義スキームに切り替わりました:
-Comment[pl]=Schemat oszczędzania przełączono na schemat nieznany lub użytkownika
-Comment[pt]=Powersave alterou para um esquema desconhecido ou definido pelo utilizador
-Comment[pt_BR]=O Powersave mudou para um esquema desconhecido/definido pelo usuário
-Comment[ru]=Управление питанием переключилось на определяемую пользователем схему
-Comment[zh_CN]=Powersave 切换为未知/用户定义的方案。
-Comment[zh_TW]=Powersave 已切換至未知的/使用者定義的規劃
default_presentation=0
[suspend2disk_event]
Name=SuspendToDiskEvent
-Comment=Suspend to Disk is started
-Comment[cs]=Uspávání na disk
-Comment[de]='Suspend to Disk' wurde gestartet
-Comment[es]=Se ha iniciado la suspensión en disco
-Comment[fr]=La mise en veille sur disque a été lancée
-Comment[it]=Sospendi su disco avviata
-Comment[ja]=サスペンド(ディスク)を開始しました
-Comment[pl]=Rozpoczęto Usypianie na Dysk
-Comment[pt]=Iniciou-se a Suspensão para o Disco
-Comment[pt_BR]=Suspender para Disco foi iniciado
-Comment[ru]=Запуск Уснуть на диск
-Comment[zh_CN]=启动暂挂到磁盘
-Comment[zh_TW]=已啟動「暫停寫入到磁碟」
+Comment=Hibernation is started
+default_presentation=0
+
+[suspend_hybrid_event]
+Name=HybridSuspendEvent
+Comment=Hybrid Suspend is started
default_presentation=0
[suspend2ram_event]
Name=SuspendToRamEvent
-Comment=Suspend to RAM is started
-Comment[cs]=Uspávání do RAM
-Comment[de]='Suspend to RAM' wurde gestartet
-Comment[es]=Se ha iniciado la suspensión en RAM
-Comment[fr]=La mise en veille sur RAM a été lancée
-Comment[it]=Sospensione su RAM avviata
-Comment[ja]=サスペンド(RAM)を開始しました
-Comment[pl]=Rozpoczęto Usypianie do pamięci RAM
-Comment[pt]=Iniciou-se a Suspensão para a Memória
-Comment[pt_BR]=Suspender para RAM foi iniciado
-Comment[ru]=Запуск Уснуть в память
-Comment[zh_CN]=启动暂挂到 RAM
-Comment[zh_TW]=已啟動「暫停寫入到 RAM」
+Comment=Suspend mode is started
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
-Comment[cs]=Přepínání do pohotovosti
-Comment[de]=Stand-by wurde gestartet
-Comment[es]=Se ha iniciado el modo de stand-by
-Comment[fr]=La mise en attente a été lancée
-Comment[it]=Standby avviato
-Comment[ja]=スタンバイを開始しました
-Comment[pl]=Przechodzenie w Stan Uśpienia
-Comment[pt]=Iniciou-se o StandBy
-Comment[pt_BR]=O Standby foi iniciado
-Comment[ru]=Запуск ждущего режима
-Comment[zh_CN]=启动待机
-Comment[zh_TW]=已啟動「待機」
default_presentation=0
[resume_from_suspend2disk_event]
Name=ResumeFromSuspendToDiskEvent
-Comment=Resumed from Suspend to Disk
-Comment[cs]=Probouzení z uspání na disk
-Comment[de]=Wiederaufnahme nach 'Suspend to Disk'
-Comment[es]=Reanudación desde suspensión en disco
-Comment[fr]=Reprise après la mise en veille sur disque
-Comment[it]=Ripristinato da Sospendi su disco
-Comment[ja]=サスペンド(ディスク)から再開しました
-Comment[pl]=Wznowiono po Uśpieniu na Dysk
-Comment[pt]=O Sistema acordou da Suspensão para Disco
-Comment[pt_BR]=Continuação a partir da Suspensão para Disco
-Comment[ru]=Возврат из режима 'Уснуть на диск'
-Comment[zh_CN]=已从暂挂到磁盘恢复
-Comment[zh_TW]=從「暫停寫入到磁碟」繼續
+Comment=Resumed from Hibernate
+default_presentation=0
+
+[resume_from_suspend_hybrid_event]
+Name=ResumeFromHybridSuspendEvent
+Comment=Resumed from Hybrid Suspend
default_presentation=0
[resume_from_suspend2ram_event]
Name=ResumeFromSuspendToRamEvent
-Comment=Resumed from Suspend to RAM
-Comment[cs]=Probouzení z uspání do RAM
-Comment[de]=Wiederaufnahme nach 'Suspend to RAM'
-Comment[es]=Reanudación desde suspensión en RAM
-Comment[fr]=Reprise après la mise en veille sur RAM
-Comment[it]=Ripristinato da Sospendi su RAM
-Comment[ja]=サスペンド(RAM)から再開しました
-Comment[pl]=Wznowiono po Uśpieniu do pamięci RAM
-Comment[pt]=O Sistema acordou da Suspensão para Memória
-Comment[pt_BR]=Continuação a partir da Suspensão para a Memória
-Comment[ru]=Возврат из режима 'уснуть в память'
-Comment[zh_CN]=从“暂挂到 RAM”继续执行
-Comment[zh_TW]=從「暫停寫入到 RAM」繼續執行
+Comment=Resumed from Suspend mode
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
-Comment[cs]=Probouzení z pohotovosti
-Comment[de]=Wiederaufnahme nach Stand-by
-Comment[es]=Reanudación desde stand-by
-Comment[fr]=Reprise après la mise en attente
-Comment[it]=Ripristinato da Standby
-Comment[ja]=スタンバイから再開しました
-Comment[pl]=Wznowiono ze Stanu Uśpienia
-Comment[pt]=O Sistema acordou do StandBy
-Comment[pt_BR]=Continuação a partir do Standby
-Comment[ru]=Возврат из ждущего режима
-Comment[zh_CN]=已从待机恢复
-Comment[zh_TW]=從「待機」繼續
default_presentation=0
[lid_closed_event]
Name=LidCloseEvent
Comment=The lid was closed
-Comment[cs]=Víko zavřeno
-Comment[de]=Der Laptop wurde geschlossen
-Comment[es]=Tapa cerrada
-Comment[fr]=L'écran était fermé
-Comment[it]=Lo schermo è stato chiuso
-Comment[ja]=Lidがクローズしました
-Comment[pl]=Pokrywa została zamknięta
-Comment[pt]=A tampa foi fechada
-Comment[pt_BR]=A tampa foi fechada
-Comment[ru]=Дисплей ноутбука закрыт
-Comment[zh_CN]=此盖已关闭
-Comment[zh_TW]=蓋子已關閉
default_presentation=0
[lid_opened_event]
Name=LidOpenedEvent
Comment=The lid was opened
-Comment[cs]=Víko otevřeno
-Comment[de]=Der Laptop wurde geöffnet
-Comment[es]=Tapa abierta
-Comment[fr]=L'écran était ouvert
-Comment[it]=Lo schermo è stato aperto
-Comment[ja]=Lidがオープンしました
-Comment[pl]=Pokrywa została otwarta
-Comment[pt]=A tampa foi aberta
-Comment[pt_BR]=A tampa foi aberta
-Comment[ru]=Дисплей ноутбука открыт
-Comment[zh_CN]=此盖已打开
-Comment[zh_TW]=蓋子已開啟
default_presentation=0
[brightness_up_event]
diff --git a/src/hardware.cpp b/src/hardware.cpp
index 92d2b36..6c29de3 100644
--- a/src/hardware.cpp
+++ b/src/hardware.cpp
@@ -1,4 +1,4 @@
- /**************************************************************************
+/**************************************************************************
* Copyright (C) 2006-2007 by Danny Kukawka *
* <dkukawka@suse.de>, <danny.kukawka@web.de> *
* *
@@ -24,10 +24,15 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// include global header
#include <fcntl.h>
+#include <math.h>
-// include QT header
+// include TQt header
#include <tqtimer.h>
#include <tqdir.h>
@@ -41,64 +46,69 @@
// #define USE_EVENT_DEVICES_DIRECTLY 1
/*! The default constructor of the class HardwareInfo */
-HardwareInfo::HardwareInfo() {
- kdDebugFuncIn(trace);
-
- // init members
- acadapter = true;
- lidclose = false;
- laptop = false;
- brightness = false;
- brightness_in_hardware = false;
- sessionIsActive = true; // assume as first we are active
-
- // initialize connection to the TDE hardware library
- m_hwdevices = TDEGlobal::hardwareDevices();
- connect(m_hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(processHardwareChangedEvent(TDEGenericDevice*)));
+HardwareInfo::HardwareInfo()
+{
+ kdDebugFuncIn(trace);
+
+ // init members
+ acadapter = true;
+ lidclose = false;
+ laptop = false;
+ brightness = false;
+ brightness_in_hardware = false;
+ sessionIsActive = true; // assume as first we are active
+
+ // initialize connection to the TDE hardware library
+ m_hwdevices = TDEGlobal::hardwareDevices();
+ connect(m_hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)),
+ this, TQ_SLOT(processHardwareChangedEvent(TDEGenericDevice*)));
#ifdef USE_EVENT_DEVICES_DIRECTLY
- connect(m_hwdevices, TQT_SIGNAL(eventDeviceKeyPressed(unsigned int, TDEEventDevice*)), this, TQT_SLOT(processKeyPressEvent(unsigned int, TDEEventDevice*)));
+ connect(m_hwdevices, TQ_SIGNAL(eventDeviceKeyPressed(unsigned int, TDEEventDevice*)),
+ this, TQ_SLOT(processKeyPressEvent(unsigned int, TDEEventDevice*)));
#endif
- // update everything the first time
- update_info_ac_changed = true;
- update_info_cpufreq_policy_changed = true;
- update_info_primBattery_changed = true;
+ // update everything the first time
+ update_info_ac_changed = true;
+ update_info_cpufreq_policy_changed = true;
+ update_info_primBattery_changed = true;
- currentCPUFreqPolicy = UNKNOWN_CPUFREQ;
- primaryBatteriesWarnLevel = 12;
- primaryBatteriesLowLevel = 7;
- primaryBatteriesCriticalLevel = 2;
+ currentCPUFreqPolicy = UNKNOWN_CPUFREQ;
+ primaryBatteriesWarnLevel = 12;
+ primaryBatteriesLowLevel = 7;
+ primaryBatteriesCriticalLevel = 2;
- allUDIs = TQStringList();
- consoleKitSession = TQString();
- BatteryList.setAutoDelete( true ); // the list owns the objects
+ allUDIs = TQStringList();
+ unknownUDIs = TQStringList();
+ consoleKitSession = TQString();
+ BatteryList.setAutoDelete(true); // the list owns the objects
- primaryBatteries = new BatteryCollection(BAT_PRIMARY);
- setPrimaryBatteriesWarningLevel(); // force default settings
+ primaryBatteries = new BatteryCollection(BAT_PRIMARY);
+ setPrimaryBatteriesWarningLevel(); // force default settings
- // connect to D-Bus
- dbus_iface = new dbusInterface();
- sessionIsActive = dbus_iface->checkActiveSession();
- connect(dbus_iface, TQT_SIGNAL(activeSessionChanged(bool)), this, TQT_SLOT(handleSessionState(bool)));
+ // connect to D-Bus
+ dbus_iface = new dbusInterface();
+ sessionIsActive = dbus_iface->checkActiveSession();
+ connect(dbus_iface, TQ_SIGNAL(activeSessionChanged(bool)), this, TQ_SLOT(handleSessionState(bool)));
- checkPowermanagement();
- checkIsLaptop();
- checkBrightness();
- checkCPUFreq();
- checkSuspend();
- intialiseHWInfo();
+ checkPowermanagement();
+ checkIsLaptop();
+ checkBrightness();
+ checkCPUFreq();
+ checkSuspend();
+ intialiseHWInfo();
- updatePrimaryBatteries();
+ updatePrimaryBatteries();
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
/*! The default desctuctor of the class HardwareInfo */
-HardwareInfo::~HardwareInfo() {
- kdDebugFuncIn(trace);
+HardwareInfo::~HardwareInfo()
+{
+ kdDebugFuncIn(trace);
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
/*!
@@ -107,48 +117,51 @@ HardwareInfo::~HardwareInfo() {
* \retval true if reinit HW infos correct
* \retval false if not
*/
-bool HardwareInfo::reinitHardwareInfos () {
- kdDebugFuncIn(trace);
-
- /* first cleanup */
- acadapter = true;
- lidclose = false;
- laptop = false;
- brightness = false;
- has_APM = false;
- has_ACPI = false;
-
- update_info_ac_changed = true;
- update_info_cpufreq_policy_changed = true;
- update_info_primBattery_changed = true;
-
- allUDIs = TQStringList();
-
- BatteryList.clear();
- primaryBatteries = new BatteryCollection(BAT_PRIMARY);
-
- /* reinit hardware data */
- checkPowermanagement();
- checkIsLaptop();
- checkBrightness();
- checkCPUFreq();
- checkSuspend();
- intialiseHWInfo();
- updatePrimaryBatteries();
-
- kdDebugFuncOut(trace);
- return true;
+bool HardwareInfo::reinitHardwareInfos()
+{
+ kdDebugFuncIn(trace);
+
+ /* first cleanup */
+ acadapter = true;
+ lidclose = false;
+ laptop = false;
+ brightness = false;
+ has_APM = false;
+ has_ACPI = false;
+
+ update_info_ac_changed = true;
+ update_info_cpufreq_policy_changed = true;
+ update_info_primBattery_changed = true;
+
+ allUDIs = TQStringList();
+ unknownUDIs = TQStringList();
+
+ BatteryList.clear();
+ primaryBatteries = new BatteryCollection(BAT_PRIMARY);
+
+ /* reinit hardware data */
+ checkPowermanagement();
+ checkIsLaptop();
+ checkBrightness();
+ checkCPUFreq();
+ checkSuspend();
+ intialiseHWInfo();
+ updatePrimaryBatteries();
+
+ kdDebugFuncOut(trace);
+ return true;
}
-
/*!
- * \b TQT_SLOT called if the state of the current session change
+ * \b Slot called if the state of the current session change
* \param state boolean represent the state of the session
*/
-void HardwareInfo::handleSessionState( bool state ) {
- if( state != sessionIsActive ) {
- sessionIsActive = state;
- TQTimer::singleShot(50, this, TQT_SLOT(emitSessionActiveState()));
+void HardwareInfo::handleSessionState(bool state)
+{
+ if (state != sessionIsActive)
+ {
+ sessionIsActive = state;
+ TQTimer::singleShot(50, this, TQ_SLOT(emitSessionActiveState()));
}
}
@@ -156,31 +169,49 @@ void HardwareInfo::handleSessionState( bool state ) {
* This function is used to parse changed hardware nofifications from the TDE hardware library
* \param device a \ref TDEGenericDevice* which should be processed
*/
-void HardwareInfo::processHardwareChangedEvent (TDEGenericDevice* device) {
- kdDebugFuncIn(trace);
-
- if (allUDIs.contains( device->uniqueID() )) {
- if (device->type() == TDEGenericDeviceType::PowerSupply) {
- TQTimer::singleShot(50, this, TQT_SLOT(checkACAdapterState()));
- } else if (device->type() == TDEGenericDeviceType::Battery) {
- // this is a battery event
- updateBatteryValues(device);
- } else if (device->type() == TDEGenericDeviceType::Event) {
- TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(device);
- if (edevice) {
- if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch) {
- TQTimer::singleShot(50, this, TQT_SLOT(checkLidcloseState()));
- }
- }
- } else if (device->type() == TDEGenericDeviceType::Backlight) {
- TQTimer::singleShot(50, this, TQT_SLOT(checkBrightness()));
- }
- // TODO: add needed code
- } else {
- kdDebug() << "unmonitored device changed: " << device->uniqueID() << endl;
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::processHardwareChangedEvent(TDEGenericDevice *device)
+{
+ kdDebugFuncIn(trace);
+
+ if (allUDIs.contains(device->uniqueID()))
+ {
+ if (device->type() == TDEGenericDeviceType::PowerSupply)
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(checkACAdapterState()));
+ }
+ else if (device->type() == TDEGenericDeviceType::Battery)
+ {
+ // this is a battery event
+ updateBatteryValues(device);
+ }
+ else if (device->type() == TDEGenericDeviceType::Event)
+ {
+ TDEEventDevice *edevice = dynamic_cast<TDEEventDevice*>(device);
+ if (edevice)
+ {
+ if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch)
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(checkLidcloseState()));
+ }
+ }
+ }
+ else if (device->type() == TDEGenericDeviceType::Backlight)
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(checkBrightness()));
+ }
+ // TODO: add needed code
+ }
+ else
+ {
+ TQString duid = device->uniqueID();
+ if (!unknownUDIs.contains(duid))
+ {
+ kdDebug() << "unmonitored device changed: " << duid << endl;
+ unknownUDIs.append(duid);
+ }
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
@@ -188,57 +219,55 @@ void HardwareInfo::processHardwareChangedEvent (TDEGenericDevice* device) {
* \param keycode a keycode which should be processed
* \param edevice the \ref TDEEventDevice* from whence the keypress originated
*/
-void HardwareInfo::processKeyPressEvent(unsigned int keycode, TDEEventDevice* edevice) {
- kdDebugFuncIn(trace);
-
- // 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
- // HAL_PROPERTY_CHANGED event for the key
-// if (message.startsWith("ButtonPressed")) {
- kdDebug() << "ButtonPressed event from TDE HW library " << endl;
- if (((edevice->eventType() == TDEEventDeviceType::ACPIPowerButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput))
- && (keycode == KEY_POWER)) {
- TQTimer::singleShot(50, this, TQT_SLOT(emitPowerButtonPressed()));
- } else if (((edevice->eventType() == TDEEventDeviceType::ACPISleepButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput))
- && (keycode == KEY_SLEEP)) {
- TQTimer::singleShot(50, this, TQT_SLOT(emitSleepButtonPressed()));
- } else if (((edevice->eventType() == TDEEventDeviceType::ACPISuspendButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput))
- && (keycode == KEY_SUSPEND)) {
- TQTimer::singleShot(50, this, TQT_SLOT(emitS2diskButtonPressed()));
-// } else if (value.startsWith("brightness-")) {
-// if (!brightness_in_hardware && value.endsWith("-up"))
-// TQTimer::singleShot(50, this, TQT_SLOT(brightnessUpPressed()));
-// else if (!brightness_in_hardware && value.endsWith("-down"))
-// TQTimer::singleShot(50, this, TQT_SLOT(brightnessDownPressed()));
- }
-// } else {
-// kdDebug() << "Unmonitored HAL_CONDITION: " << message << " : " << value << endl;
-// }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::processKeyPressEvent(unsigned int keycode, TDEEventDevice *edevice)
+{
+ kdDebugFuncIn(trace);
+
+ // FIXME
+ // How can I get specific button press/release information (instead of just "something happened to the button") from the TDE hardware library?
+ kdDebug() << "ButtonPressed event from TDE HW library " << endl;
+ if (((edevice->eventType() == TDEEventDeviceType::ACPIPowerButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) && (keycode == KEY_POWER))
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(emitPowerButtonPressed()));
+ }
+ else if (((edevice->eventType() == TDEEventDeviceType::ACPISuspendButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) && (keycode == KEY_SLEEP))
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(emitSuspendButtonPressed()));
+ }
+ else if (((edevice->eventType() == TDEEventDeviceType::ACPISuspendButton) || (edevice->eventType() == TDEEventDeviceType::ACPIOtherInput)) && (keycode == KEY_SUSPEND))
+ {
+ TQTimer::singleShot(50, this, TQ_SLOT(emitS2diskButtonPressed()));
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
- * This TQT_SLOT is used to fetch the resume signal and multiplex. If needed some
+ * This slot is used to fetch the resume signal and multiplex. If needed some
* actions after resume, do this here.
* \param result integer with the result of the resume/suspend
*/
-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,
- // the magic D-Bus timeout for pending calls
- if (calledSuspend.elapsed() > 21600000) {
- emit resumed(INT_MAX);
- }
- } else {
- emit resumed(result);
- }
-
- calledSuspend = TQTime();
- kdDebugFuncOut(trace);
+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,
+ // the magic D-Bus timeout for pending calls
+ if (calledSuspend.elapsed() > 21600000)
+ {
+ emit resumed(INT_MAX);
+ }
+ }
+ else
+ {
+ emit resumed(result);
+ }
+
+ calledSuspend = TQTime();
+ kdDebugFuncOut(trace);
}
/*!
@@ -249,49 +278,73 @@ void HardwareInfo::handleResumeSignal (int result) {
* \retval true if we should handle
* \retval false if not
*/
-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) {
- *type = BATTERY;
- } else if (devtype == TDEGenericDeviceType::Event) {
- TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(hwdevice);
- if (edevice) {
- if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch) {
- *type = LID;
- } else if (edevice->eventType() == TDEEventDeviceType::ACPIPowerButton) {
- *type = BUTTON_POWER;
- } else if (edevice->eventType() == TDEEventDeviceType::ACPISleepButton) {
- *type = BUTTON_SLEEP;
- } else {
- ret = false;
- }
- } else {
- ret = false;
- }
- } else if (devtype == TDEGenericDeviceType::Battery) {
- *type = BATTERY;
- } else if (devtype == TDEGenericDeviceType::Backlight) {
- *type = LAPTOP_PANEL;
- } else {
- ret = false;
- kdDebug() << "Device with type " << devtype << " unhandled" << endl;
- }
- } else {
- ret = false;
- }
-
- if (!ret) *type = UNKNOWN_DEVICE;
-
- kdDebugFuncOut(trace);
- return ret;
+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)
+ {
+ *type = BATTERY;
+ }
+ else if (devtype == TDEGenericDeviceType::Event)
+ {
+ TDEEventDevice *edevice = dynamic_cast<TDEEventDevice*>(hwdevice);
+ if (edevice)
+ {
+ if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch)
+ {
+ *type = LID;
+ }
+ else if (edevice->eventType() == TDEEventDeviceType::ACPIPowerButton)
+ {
+ *type = BUTTON_POWER;
+ }
+ else if (edevice->eventType() == TDEEventDeviceType::ACPISuspendButton)
+ {
+ *type = BUTTON_SLEEP;
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+ else if (devtype == TDEGenericDeviceType::Battery)
+ {
+ *type = BATTERY;
+ }
+ else if (devtype == TDEGenericDeviceType::Backlight)
+ {
+ *type = LAPTOP_PANEL;
+ }
+ else
+ {
+ ret = false;
+ kdDebug() << "Device with type " << devtype << " unhandled" << endl;
+ }
+ }
+ else
+ {
+ ret = false;
+ }
+
+ if (!ret)
+ *type = UNKNOWN_DEVICE;
+
+ kdDebugFuncOut(trace);
+ return ret;
}
// --> set some values for devices
@@ -303,25 +356,30 @@ bool HardwareInfo::checkIfHandleDevice ( TQString _udi, int *type) {
* \param _low value for the state BAT_LOW or -1
* \param _crit value for the state BAT_CRIT or -1
*/
-void HardwareInfo::setPrimaryBatteriesWarningLevel (int _warn, int _low, int _crit ) {
- if (trace) kdDebug() << funcinfo << "IN: " << "warn: " << _warn << " low: " << _low << " crit: " << _crit << endl;
-
- if (_warn > -1 && _low > -1 && _crit > -1 ){
- primaryBatteriesWarnLevel = _warn;
- primaryBatteriesLowLevel = _low;
- primaryBatteriesCriticalLevel = _crit;
- }
-
- if (primaryBatteries) {
- primaryBatteries->setWarnLevel( primaryBatteriesWarnLevel );
- primaryBatteries->setLowLevel( primaryBatteriesLowLevel );
- primaryBatteries->setCritLevel( primaryBatteriesCriticalLevel );
- if (!BatteryList.isEmpty()) {
- primaryBatteries->refreshInfo( BatteryList, true );
- }
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::setPrimaryBatteriesWarningLevel(int _warn, int _low, int _crit)
+{
+ if (trace)
+ kdDebug() << funcinfo << "IN: " << "warn: " << _warn << " low: " << _low << " crit: " << _crit << endl;
+
+ if (_warn > -1 && _low > -1 && _crit > -1)
+ {
+ primaryBatteriesWarnLevel = _warn;
+ primaryBatteriesLowLevel = _low;
+ primaryBatteriesCriticalLevel = _crit;
+ }
+
+ if (primaryBatteries)
+ {
+ primaryBatteries->setWarnLevel(primaryBatteriesWarnLevel);
+ primaryBatteries->setLowLevel(primaryBatteriesLowLevel);
+ primaryBatteries->setCritLevel(primaryBatteriesCriticalLevel);
+ if (!BatteryList.isEmpty())
+ {
+ primaryBatteries->refreshInfo(BatteryList, true);
+ }
+ }
+
+ kdDebugFuncOut(trace);
}
// --> init HW information section -- START <---
@@ -329,249 +387,298 @@ void HardwareInfo::setPrimaryBatteriesWarningLevel (int _warn, int _low, int _cr
/*!
* The function checks if the machine is a laptop.
*/
-void HardwareInfo::checkIsLaptop () {
- kdDebugFuncIn(trace);
+void HardwareInfo::checkIsLaptop()
+{
+ kdDebugFuncIn(trace);
- TQString ret;
+ TQString ret;
- TDERootSystemDevice* rdevice = m_hwdevices->rootSystemDevice();
+ TDERootSystemDevice *rdevice = m_hwdevices->rootSystemDevice();
- if (rdevice->formFactor() == TDESystemFormFactor::Laptop) {
- laptop = true;
- }
- else {
- laptop = false;
- }
+ if (rdevice->formFactor() == TDESystemFormFactor::Laptop)
+ {
+ laptop = true;
+ }
+ else
+ {
+ laptop = false;
+ }
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
/*!
* The function checks whether the machine support ACPI/APM/PMU or not.
*/
-void HardwareInfo::checkPowermanagement() {
- kdDebugFuncIn(trace);
+void HardwareInfo::checkPowermanagement()
+{
+ kdDebugFuncIn(trace);
- TQString ret;
+ TQString ret;
- has_APM = false;
- has_ACPI = false;
- has_PMU = false;
+ has_APM = false;
+ has_ACPI = false;
+ has_PMU = false;
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::OtherACPI);
- if (hwlist.count() > 0) {
- has_ACPI = true;
- }
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::OtherACPI);
+ if (hwlist.count() > 0)
+ {
+ has_ACPI = true;
+ }
- // FIXME
- // Do we even need to detect APM and PMU devices in the year 2012?!?
+ // FIXME
+ // Do we even need to detect APM and PMU devices in the year 2012?!?
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
-
/*!
* The function checks whether the machine can suspend/standby.
*/
-void HardwareInfo::checkSuspend() {
- kdDebugFuncIn(trace);
-
- suspend_states = SuspendStates();
-
- suspend_states.suspend2ram = false;
- suspend_states.suspend2ram_can = false;
- suspend_states.suspend2ram_allowed = -1;
- 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;
-
- TDERootSystemDevice* rdevice = m_hwdevices->rootSystemDevice();
- TDESystemPowerStateList powerStates = rdevice->powerStates();
- if (powerStates.count() > 0) {
- TDESystemPowerStateList::iterator it;
- for (it = powerStates.begin(); it != powerStates.end(); ++it) {
- if ((*it) == TDESystemPowerState::Active) {
- //
- }
- if ((*it) == TDESystemPowerState::Standby) {
- suspend_states.standby = true;
- 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();
- suspend_states.suspend2ram_can = suspend_states.suspend2ram_allowed & suspend_states.suspend2ram;
- }
- if ((*it) == TDESystemPowerState::Hibernate) {
- suspend_states.suspend2disk = true;
- suspend_states.suspend2disk_allowed = rdevice->canHibernate();
- suspend_states.suspend2disk_can = suspend_states.suspend2disk_allowed & suspend_states.suspend2disk;
- }
- if ((*it) == TDESystemPowerState::PowerOff) {
- //
- }
- }
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::checkSuspend()
+{
+ kdDebugFuncIn(trace);
+
+ suspend_states = SuspendStates();
+
+ suspend_states.suspend2ram = false;
+ suspend_states.suspend2ram_can = false;
+ suspend_states.suspend2ram_allowed = -1;
+ 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;
+ suspend_states.suspend_hybrid = false;
+ suspend_states.suspend_hybrid_can = false;
+ suspend_states.suspend_hybrid_allowed = -1;
+
+ TDERootSystemDevice *rdevice = m_hwdevices->rootSystemDevice();
+ TDESystemPowerStateList powerStates = rdevice->powerStates();
+ if (powerStates.count() > 0)
+ {
+ TDESystemPowerStateList::iterator it;
+ for (it = powerStates.begin(); it != powerStates.end(); ++it)
+ {
+ if ((*it) == TDESystemPowerState::Active)
+ {
+ //
+ }
+ else if ((*it) == TDESystemPowerState::Standby)
+ {
+ suspend_states.standby = true;
+ suspend_states.standby_allowed = rdevice->canStandby();
+ suspend_states.standby_can = suspend_states.standby_allowed && suspend_states.standby;
+ }
+ else 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;
+ }
+ else if ((*it) == TDESystemPowerState::Suspend)
+ {
+ suspend_states.suspend2ram = true;
+ suspend_states.suspend2ram_allowed = rdevice->canSuspend();
+ suspend_states.suspend2ram_can = suspend_states.suspend2ram_allowed && suspend_states.suspend2ram;
+ }
+ else if ((*it) == TDESystemPowerState::Hibernate)
+ {
+ suspend_states.suspend2disk = true;
+ suspend_states.suspend2disk_allowed = rdevice->canHibernate();
+ suspend_states.suspend2disk_can = suspend_states.suspend2disk_allowed && suspend_states.suspend2disk;
+ }
+ else if ((*it) == TDESystemPowerState::HybridSuspend)
+ {
+ suspend_states.suspend_hybrid = true;
+ suspend_states.suspend_hybrid_allowed = rdevice->canHybridSuspend();
+ suspend_states.suspend_hybrid_can = suspend_states.suspend_hybrid_allowed && suspend_states.suspend_hybrid;
+ }
+ else if ((*it) == TDESystemPowerState::PowerOff)
+ {
+ //
+ }
+ }
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
* The function checks whether the machine support CPU frequency changes
*/
-void HardwareInfo::checkCPUFreq() {
- kdDebugFuncIn(trace);
-
- // Use the first CPU in the list; permissions are probably the same across all CPUs
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
-
- if (!cpudevice->scalingDriver().isNull()) {
- cpuFreq = true;
- cpuFreqAllowed = cpudevice->canSetGovernor();
-
- checkCurrentCPUFreqPolicy();
- } else {
- cpuFreq = false;
- }
+void HardwareInfo::checkCPUFreq()
+{
+ kdDebugFuncIn(trace);
+
+ // Use the first CPU in the list; permissions are probably the same across all CPUs
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+
+ if (!cpudevice->scalingDriver().isNull())
+ {
+ cpuFreq = true;
+ cpuFreqAllowed = cpudevice->canSetGovernor();
+
+ checkCurrentCPUFreqPolicy();
+ }
+ else
+ {
+ cpuFreq = false;
+ }
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
/*!
* The function check the currently selected CPU Frequency policy
* \return the current policy
*/
-cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy() {
- kdDebugFuncIn(trace);
-
- // Use the first CPU in the list; permissions are probably the same across all CPUs
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
-
- TQString gov = cpudevice->governor();
-
- cpufreq_type _current = UNKNOWN_CPUFREQ;
-
- if (cpuFreq) {
- if (!gov.isNull()) {
- kdDebug() << "got CPU Freq gov: " << gov << endl;
- if ((gov == "ondemand") || (gov == "userspace") || (gov == "conservative")) {
- _current = DYNAMIC;
- } else if (gov == "powersave") {
- _current = POWERSAVE;
- } else if (gov =="performance") {
- _current = PERFORMANCE;
- } else {
- kdError() << "Got unknown CPUFreq Policy back: " << gov << endl;
- }
- cpuFreqGovernor = gov;
- } else {
- kdWarning() << "Could not get information about current governor" << endl;
- }
- } else {
- kdWarning() << "CPU Frequency interface not supported by machine or TDE hardware library" << endl;
- }
-
- if (_current != currentCPUFreqPolicy) {
- currentCPUFreqPolicy = _current;
- update_info_cpufreq_policy_changed = true;
- emit currentCPUFreqPolicyChanged();
- } else {
- update_info_cpufreq_policy_changed = false;
- }
-
- kdDebugFuncOut(trace);
- return currentCPUFreqPolicy;
-}
+cpufreq_type HardwareInfo::checkCurrentCPUFreqPolicy()
+{
+ kdDebugFuncIn(trace);
+
+ // Use the first CPU in the list; permissions are probably the same across all CPUs
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+
+ TQString gov = cpudevice->governor();
+
+ cpufreq_type _current = UNKNOWN_CPUFREQ;
+
+ if (cpuFreq)
+ {
+ if (!gov.isNull())
+ {
+ kdDebug() << "got CPU Freq gov: " << gov << endl;
+ if ((gov == "ondemand") || (gov == "userspace") || (gov == "conservative"))
+ {
+ _current = DYNAMIC;
+ }
+ else if (gov == "powersave")
+ {
+ _current = POWERSAVE;
+ }
+ else if (gov == "performance")
+ {
+ _current = PERFORMANCE;
+ }
+ else
+ {
+ kdError() << "Got unknown CPUFreq Policy back: " << gov << endl;
+ }
+ cpuFreqGovernor = gov;
+ }
+ else
+ {
+ kdWarning() << "Could not get information about current governor" << endl;
+ }
+ }
+ else
+ {
+ kdWarning() << "CPU Frequency interface not supported by machine or TDE hardware library" << endl;
+ }
+ if (_current != currentCPUFreqPolicy)
+ {
+ currentCPUFreqPolicy = _current;
+ update_info_cpufreq_policy_changed = true;
+ emit currentCPUFreqPolicyChanged();
+ }
+ else
+ {
+ update_info_cpufreq_policy_changed = false;
+ }
+
+ kdDebugFuncOut(trace);
+ return currentCPUFreqPolicy;
+}
/*!
* The function checks whether the machine provide a brightness interface and init
* (if needed) brightness information.
*/
-void HardwareInfo::checkBrightness() {
- kdDebugFuncIn(trace);
-
- TQStringList devices;
-
- brightness = false;
- currentBrightnessLevel = -1;
- availableBrightnessLevels = -1;
-
- // Use the first backlight in the list
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
-
- if (backlightdevice) {
- udis.insert("laptop_panel", new TQString( hwdevice->uniqueID() ));
- if (!allUDIs.contains( hwdevice->uniqueID() )) {
- allUDIs.append( hwdevice->uniqueID() );
- }
-
- availableBrightnessLevels = backlightdevice->brightnessSteps();
-
- if (availableBrightnessLevels > 1) {
- brightnessAllowed = backlightdevice->canSetBrightness();
-
- brightness = true;
- // get the current level via GetBrightness
- checkCurrentBrightness();
- }
- else {
- availableBrightnessLevels = -1;
- }
- }
- else {
- udis.remove("laptop_panel");
- kdDebug() << "no device with category laptop_panel found" << endl;
- kdDebugFuncOut(trace);
- return;
- }
-
- kdDebugFuncOut(trace);
-}
+void HardwareInfo::checkBrightness()
+{
+ kdDebugFuncIn(trace);
+
+ TQStringList devices;
+
+ brightness = false;
+ currentBrightnessLevel = -1;
+ availableBrightnessLevels = -1;
+
+ // Use the first backlight in the list
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
+
+ if (backlightdevice)
+ {
+ udis.insert("laptop_panel", new TQString(hwdevice->uniqueID()));
+ if (!allUDIs.contains(hwdevice->uniqueID()))
+ {
+ allUDIs.append(hwdevice->uniqueID());
+ }
+
+ availableBrightnessLevels = backlightdevice->brightnessSteps();
+
+ if (availableBrightnessLevels > 1)
+ {
+ brightnessAllowed = backlightdevice->canSetBrightness();
+
+ brightness = true;
+ // get the current level via GetBrightness
+ checkCurrentBrightness();
+ }
+ else
+ {
+ availableBrightnessLevels = -1;
+ }
+ }
+ else
+ {
+ udis.remove("laptop_panel");
+ kdDebug() << "no device with category laptop_panel found" << endl;
+ kdDebugFuncOut(trace);
+ return;
+ }
+ kdDebugFuncOut(trace);
+}
/*!
* The function check the current brigthness
*/
-void HardwareInfo::checkCurrentBrightness() {
- kdDebugFuncIn(trace);
-
- if (brightness) {
- // Use the first backlight in the list
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
-
- if (backlightdevice) {
- currentBrightnessLevel = backlightdevice->rawBrightness();
- }
- }
-
- kdDebugFuncOut(trace);
-}
+void HardwareInfo::checkCurrentBrightness()
+{
+ kdDebugFuncIn(trace);
+
+ if (brightness)
+ {
+ // Use the first backlight in the list
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
+ 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
@@ -580,105 +687,128 @@ void HardwareInfo::checkCurrentBrightness() {
* \retval true if successful
* \retval false else, if a error occurs
*/
-bool HardwareInfo::intialiseHWInfo() {
- kdDebugFuncIn(trace);
-
- TDEGenericDevice *hwdevice;
- TDEGenericHardwareList hwlist;
-
- hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::PowerSupply);
- for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- udis.insert("acadapter", new TQString( hwdevice->uniqueID() ));
- if (!allUDIs.contains( hwdevice->uniqueID() )) {
- allUDIs.append( hwdevice->uniqueID() );
- }
- checkACAdapterState();
- }
-
- hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Event);
- for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(hwdevice);
- if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch) {
- udis.insert("lidclose", new TQString( hwdevice->uniqueID() ));
- if (!allUDIs.contains( hwdevice->uniqueID() )) {
- allUDIs.append( hwdevice->uniqueID() );
- }
- connect(edevice, TQT_SIGNAL(switchChanged()), this, TQT_SLOT(checkLidcloseState()));
- checkLidcloseState();
- }
- }
-
- // find batteries and fill battery information
- hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Battery);
- for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- if (!allUDIs.contains( hwdevice->uniqueID() )) {
- allUDIs.append( hwdevice->uniqueID() );
- }
- BatteryList.append( new Battery( hwdevice->uniqueID() ) );
- }
- // connect to signals for primary batteries:
- Battery *bat;
- for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
- if (bat->getType() == BAT_PRIMARY) {
- connect(bat, TQT_SIGNAL(changedBattery()),this, TQT_SLOT(updatePrimaryBatteries()));
- }
- }
-
- kdDebugFuncOut(trace);
- return true;
+bool HardwareInfo::intialiseHWInfo()
+{
+ kdDebugFuncIn(trace);
+
+ TDEGenericDevice *hwdevice;
+ TDEGenericHardwareList hwlist;
+
+ hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::PowerSupply);
+ for (hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next())
+ {
+ udis.insert("acadapter", new TQString(hwdevice->uniqueID()));
+ if (!allUDIs.contains(hwdevice->uniqueID()))
+ {
+ allUDIs.append(hwdevice->uniqueID());
+ }
+ checkACAdapterState();
+ }
+
+ hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Event);
+ for (hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next())
+ {
+ TDEEventDevice *edevice = dynamic_cast<TDEEventDevice*>(hwdevice);
+ if (edevice->eventType() == TDEEventDeviceType::ACPILidSwitch)
+ {
+ udis.insert("lidclose", new TQString(hwdevice->uniqueID()));
+ if (!allUDIs.contains(hwdevice->uniqueID()))
+ {
+ allUDIs.append(hwdevice->uniqueID());
+ }
+ connect(edevice, TQ_SIGNAL(switchChanged()), this, TQ_SLOT(checkLidcloseState()));
+ checkLidcloseState();
+ }
+ }
+
+ // find batteries and fill battery information
+ hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Battery);
+ for (hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next())
+ {
+ if (!allUDIs.contains(hwdevice->uniqueID()))
+ {
+ allUDIs.append(hwdevice->uniqueID());
+ }
+ BatteryList.append(new Battery(hwdevice->uniqueID()));
+ }
+ // connect to signals for primary batteries:
+ Battery *bat;
+ for (bat = BatteryList.first(); bat; bat = BatteryList.next())
+ {
+ if (bat->getType() == BAT_PRIMARY)
+ {
+ connect(bat, TQ_SIGNAL(changedBattery()), this, TQ_SLOT(updatePrimaryBatteries()));
+ }
+ }
+
+ kdDebugFuncOut(trace);
+ return true;
}
/*!
- * The function/TQT_SLOT checks the state of the AC adapter.
+ * The function/slot checks the state of the AC adapter.
*/
-void HardwareInfo::checkACAdapterState() {
- kdDebugFuncIn(trace);
-
- if ( udis["acadapter"] ) {
- bool _state;
-
- TDEMainsPowerDevice* mdevice = dynamic_cast<TDEMainsPowerDevice*>(m_hwdevices->findByUniqueID(*udis["acadapter"]));
- if (mdevice) {
- _state = mdevice->online();
- if (_state != acadapter) {
- acadapter = _state;
- update_info_ac_changed = true;
- emit ACStatus( acadapter );
- } else {
- update_info_ac_changed = false;
- }
- }
- else {
- // we use true as default e.g. for workstations
- acadapter = true;
- }
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::checkACAdapterState()
+{
+ kdDebugFuncIn(trace);
+
+ if (udis["acadapter"])
+ {
+ bool _state;
+
+ TDEMainsPowerDevice *mdevice = dynamic_cast<TDEMainsPowerDevice*>(m_hwdevices->findByUniqueID(*udis["acadapter"]));
+ if (mdevice)
+ {
+ _state = mdevice->online();
+ if (_state != acadapter)
+ {
+ acadapter = _state;
+ update_info_ac_changed = true;
+ emit ACStatus(acadapter);
+ }
+ else
+ {
+ update_info_ac_changed = false;
+ }
+ }
+ else
+ {
+ // we use true as default e.g. for workstations
+ acadapter = true;
+ }
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
* The function checks the state of the Lidclose button.
*/
-void HardwareInfo::checkLidcloseState() {
- kdDebugFuncIn(trace);
-
- if ( udis["lidclose"] ) {
- bool _state;
-
- TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(m_hwdevices->findByUniqueID(*udis["lidclose"]));
- if (edevice) {
- _state = (edevice->activeSwitches() & TDESwitchType::Lid);
- if (_state != lidclose) {
- lidclose = _state;
- emit lidclosetStatus( lidclose );
- }
- } else {
- lidclose = false;
- }
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::checkLidcloseState()
+{
+ kdDebugFuncIn(trace);
+
+ if (udis["lidclose"])
+ {
+ bool _state;
+
+ TDEEventDevice *edevice = dynamic_cast<TDEEventDevice*>(m_hwdevices->findByUniqueID(*udis["lidclose"]));
+ if (edevice)
+ {
+ _state = (edevice->activeSwitches() & TDESwitchType::Lid);
+ if (_state != lidclose)
+ {
+ lidclose = _state;
+ emit lidclosetStatus(lidclose);
+ }
+ }
+ else
+ {
+ lidclose = false;
+ }
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
@@ -687,80 +817,94 @@ void HardwareInfo::checkLidcloseState() {
* \param udi TQString with the UDI of the battery
* \param property TQString with the changed property
*/
-void HardwareInfo::updateBatteryValues (TDEGenericDevice* device) {
- kdDebugFuncIn(trace);
-
- if (device && allUDIs.contains( device->uniqueID() )) {
- // find effected battery object
- Battery *bat;
- for (bat = BatteryList.first(); bat; bat = BatteryList.next() ) {
- if (device->uniqueID().startsWith( bat->getUdi())) {
- TDEBatteryDevice* bdevice = dynamic_cast<TDEBatteryDevice*>(device);
- if (bdevice) {
- // found a battery with udi
- bat->updateProperty(bdevice);
- }
- }
- }
- } else {
- kdDebug() << "UDI is empty or not in the list of monitored devices " << endl;
- }
-
- kdDebugFuncOut(trace);
- return;
+void HardwareInfo::updateBatteryValues(TDEGenericDevice *device)
+{
+ kdDebugFuncIn(trace);
+
+ if (device && allUDIs.contains(device->uniqueID()))
+ {
+ // find effected battery object
+ Battery *bat;
+ for (bat = BatteryList.first(); bat; bat = BatteryList.next())
+ {
+ if (device->uniqueID().startsWith(bat->getUdi()))
+ {
+ TDEBatteryDevice *bdevice = dynamic_cast<TDEBatteryDevice*>(device);
+ if (bdevice)
+ {
+ // found a battery with udi
+ bat->updateProperty(bdevice);
+ }
+ }
+ }
+ }
+ else
+ {
+ kdDebug() << "UDI is empty or not in the list of monitored devices " << endl;
+ }
+
+ kdDebugFuncOut(trace);
+ return;
}
/*!
* This function refresh the information for the primary battery collection.
*/
-void HardwareInfo::updatePrimaryBatteries () {
- kdDebugFuncIn(trace);
-
- if (!BatteryList.isEmpty()) {
- if (primaryBatteries->getNumBatteries() < 1) {
- setPrimaryBatteriesWarningLevel();
- primaryBatteries->refreshInfo( BatteryList );
- connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this,
- TQT_SLOT(setPrimaryBatteriesChanges()));
- connect(primaryBatteries, TQT_SIGNAL(batteryWarnState(int,int)), this,
- TQT_SLOT(emitBatteryWARNState(int,int)));
- } else {
- setPrimaryBatteriesWarningLevel();
- primaryBatteries->refreshInfo( BatteryList );
- }
- } else {
- primaryBatteries = new BatteryCollection(BAT_PRIMARY);
- }
-
- kdDebugFuncOut(trace);
+void HardwareInfo::updatePrimaryBatteries()
+{
+ kdDebugFuncIn(trace);
+
+ if (!BatteryList.isEmpty())
+ {
+ if (primaryBatteries->getNumBatteries() < 1)
+ {
+ setPrimaryBatteriesWarningLevel();
+ primaryBatteries->refreshInfo(BatteryList);
+ connect(primaryBatteries, TQ_SIGNAL(batteryChanged()), this, TQ_SLOT(setPrimaryBatteriesChanges()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryWarnState(int,int)), this, TQ_SLOT(emitBatteryWARNState(int,int)));
+ }
+ else
+ {
+ setPrimaryBatteriesWarningLevel();
+ primaryBatteries->refreshInfo(BatteryList);
+ }
+ }
+ else
+ {
+ primaryBatteries = new BatteryCollection(BAT_PRIMARY);
+ }
+
+ kdDebugFuncOut(trace);
}
/*!
* This function set the change status for the primary battery collection
*/
-void HardwareInfo::setPrimaryBatteriesChanges () {
- kdDebugFuncIn(trace);
+void HardwareInfo::setPrimaryBatteriesChanges()
+{
+ kdDebugFuncIn(trace);
- update_info_primBattery_changed = true;
- emit primaryBatteryChanged();
+ update_info_primBattery_changed = true;
+ emit primaryBatteryChanged();
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
/*!
* This slot emit a signal if a warning state of a battery reached
*/
-void HardwareInfo::emitBatteryWARNState (int type, int state) {
- kdDebugFuncIn(trace);
+void HardwareInfo::emitBatteryWARNState(int type, int state)
+{
+ kdDebugFuncIn(trace);
- if (type == BAT_PRIMARY)
- emit primaryBatteryChanged();
- else
- emit generalDataChanged();
+ if (type == BAT_PRIMARY)
+ emit primaryBatteryChanged();
+ else
+ emit generalDataChanged();
- emit batteryWARNState(type, state);
+ emit batteryWARNState(type, state);
- kdDebugFuncOut(trace);
+ kdDebugFuncOut(trace);
}
// --> init HW information section -- END <---
@@ -773,154 +917,281 @@ void HardwareInfo::emitBatteryWARNState (int type, int state) {
* \retval true if successful
* \retval false else, if a error occurs
*/
-bool HardwareInfo::suspend( suspend_type suspend ) {
- kdDebugFuncIn(trace);
-
- calledSuspend = TQTime();
-
- TDERootSystemDevice* rdevice = m_hwdevices->rootSystemDevice();
-
- if (rdevice) {
- switch (suspend) {
- case SUSPEND2DISK:
- if (suspend_states.suspend2disk && (suspend_states.suspend2disk_allowed != 0)) {
- if (rdevice->setPowerState(TDESystemPowerState::Hibernate)) {
- calledSuspend.start();
- handleResumeSignal(0);
- return true;
- } else {
- handleResumeSignal(-1);
- return false;
- }
- } else {
- 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;
-
- return false;
- }
- break;
- case SUSPEND2RAM:
- if (suspend_states.suspend2ram && (suspend_states.suspend2ram_allowed != 0)) {
- if (rdevice->setPowerState(TDESystemPowerState::Suspend)) {
- calledSuspend.start();
- handleResumeSignal(0);
- return true;
- } else {
- handleResumeSignal(-1);
- return false;
- }
- } else {
- 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;
- case STANDBY:
- if (suspend_states.standby && (suspend_states.standby_allowed != 0)) {
- if (rdevice->setPowerState(TDESystemPowerState::Standby)) {
- calledSuspend.start();
- handleResumeSignal(0);
- return true;
- } else {
- handleResumeSignal(-1);
- return false;
- }
- } else {
- if ( !suspend_states.standby )
- kdDebug() << "The machine does not support standby." << endl;
- else
- kdWarning() << "Policy forbid user to trigger standby" << endl;
-
- return false;
- }
- break;
- default:
- return false;
- }
- }
-
- kdDebugFuncOut(trace);
- return false;
+bool HardwareInfo::suspend(suspend_type suspend)
+{
+ kdDebugFuncIn(trace);
+
+ calledSuspend = TQTime();
+
+ TDERootSystemDevice *rdevice = m_hwdevices->rootSystemDevice();
+
+ if (rdevice)
+ {
+ switch (suspend)
+ {
+ case SUSPEND2DISK:
+ if (suspend_states.suspend2disk && (suspend_states.suspend2disk_allowed != 0))
+ {
+ if (rdevice->setPowerState(TDESystemPowerState::Hibernate))
+ {
+ calledSuspend.start();
+ handleResumeSignal(0);
+ return true;
+ }
+ else
+ {
+ handleResumeSignal(-1);
+ return false;
+ }
+ }
+ else
+ {
+ if (!suspend_states.suspend2disk)
+ kdDebug() << "The machine does not support hibernation." << endl;
+ else
+ kdWarning() << "Policy forbid user to trigger hibernation" << endl;
+
+ return false;
+ }
+ break;
+
+ case SUSPEND_HYBRID:
+ if (suspend_states.suspend_hybrid && (suspend_states.suspend_hybrid_allowed != 0))
+ {
+ if (rdevice->setPowerState(TDESystemPowerState::HybridSuspend))
+ {
+ calledSuspend.start();
+ handleResumeSignal(0);
+ return true;
+ }
+ else
+ {
+ handleResumeSignal(-1);
+ return false;
+ }
+ }
+ else
+ {
+ if (!suspend_states.suspend_hybrid)
+ kdDebug() << "The machine does not support hybrid suspension." << endl;
+ else
+ kdWarning() << "Policy forbid user to trigger hybrid suspension" << endl;
+
+ return false;
+ }
+ break;
+
+ case SUSPEND2RAM:
+ if (suspend_states.suspend2ram && (suspend_states.suspend2ram_allowed != 0))
+ {
+ if (rdevice->setPowerState(TDESystemPowerState::Suspend))
+ {
+ calledSuspend.start();
+ handleResumeSignal(0);
+ return true;
+ }
+ else
+ {
+ handleResumeSignal(-1);
+ return false;
+ }
+ }
+ else
+ {
+ if (!suspend_states.suspend2ram)
+ kdDebug() << "The machine does not support Suspend mode." << endl;
+ else
+ kdWarning() << "Policy forbid user to trigger Suspend mode" << 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;
+
+ case STANDBY:
+ if (suspend_states.standby && (suspend_states.standby_allowed != 0))
+ {
+ if (rdevice->setPowerState(TDESystemPowerState::Standby))
+ {
+ calledSuspend.start();
+ handleResumeSignal(0);
+ return true;
+ }
+ else
+ {
+ handleResumeSignal(-1);
+ return false;
+ }
+ }
+ else
+ {
+ if (!suspend_states.standby)
+ kdDebug() << "The machine does not support standby." << endl;
+ else
+ kdWarning() << "Policy forbid user to trigger standby" << endl;
+
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
+
+ kdDebugFuncOut(trace);
+ return false;
}
/*!
- * Function to set brightness via TDE hardware library (if supported by hardware)
+ * Function to set brightness level via TDE hardware library (if supported by hardware)
* \param level Integer with the level to set, (range: 0 - \ref availableBrightnessLevels )
+ * \return boolean with result of the operation
+ * \retval true if successful
+ * \retval false else, if a error occurs
+ */
+bool HardwareInfo::setBrightnessLevel(int level)
+{
+ if (trace)
+ kdDebug() << funcinfo << "IN: " << "level: " << level << endl;
+
+ bool retval = false;
+ int maxBrightness = getMaxBrightnessLevel();
+
+ // Use the first backlight in the list
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
+
+ if (backlightdevice)
+ {
+ if (!brightness)
+ {
+ checkBrightness();
+ }
+
+ // Make sure level is within valid range
+ if (level < 0)
+ {
+ level = 0;
+ }
+ else if (level > maxBrightness)
+ {
+ level = maxBrightness;
+ }
+
+ if (!brightness)
+ {
+ kdError() << "Change brightness not supported " << endl;
+ }
+ else
+ {
+ if (currentBrightnessLevel == level)
+ {
+ kdDebug() << "Brightness level not changed, requested level == current level" << endl;
+ retval = true;
+ }
+ else
+ {
+ backlightdevice->setRawBrightness(level);
+ retval = true;
+ }
+ }
+ }
+
+ // check for actual brightness level to be sure everything was set correct
+ checkCurrentBrightness();
+ kdDebugFuncOut(trace);
+ return retval;
+}
+
+/*!
+ * Function to set brightness percentage via TDE hardware library (if supported by hardware)
* \param percent Integer with the brightness percentage to set
* \return boolean with result of the operation
* \retval true if successful
* \retval false else, if a error occurs
*/
-bool HardwareInfo::setBrightness ( int level, int percent ){
- if (trace) kdDebug() << funcinfo << "IN: " << "level: " << level << " percent: " << percent << endl;
-
- bool retval = false;
-
- if ((level == -1) && (percent >= 0)) {
- if (percent == 0) {
- level = 0;
- } else if (percent >= 98) {
- level = (availableBrightnessLevels - 1);
- } else {
- level = (int)((float)availableBrightnessLevels * ((float)percent/100.0));
- if (level > (availableBrightnessLevels -1))
- level = availableBrightnessLevels -1;
- kdDebug() << "percentage mapped to new level: " << level << endl;
- }
- }
-
- // Use the first backlight in the list
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
-
- if (backlightdevice) {
- if (!brightness) {
- checkBrightness();
- }
-
- if (!brightness || (level < 0 ) || (level >= availableBrightnessLevels)) {
- kdError() << "Change brightness or requested level not supported " << endl;
- } else {
- if (currentBrightnessLevel == level) {
- kdDebug() << "Brightness level not changed, requested level == current level" << endl;
- retval = true;
- } else {
- backlightdevice->setRawBrightness(level);
- retval = true;
- }
- }
- }
-
- // check for actual brightness level to be sure everything was set correct
- checkCurrentBrightness();
- kdDebugFuncOut(trace);
- return retval;
+bool HardwareInfo::setBrightnessPercentage(int percent)
+{
+ if (trace)
+ kdDebug() << funcinfo << "IN: " << " percent: " << percent << endl;
+
+ bool retval = false;
+
+ // Use the first backlight in the list
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::Backlight);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDEBacklightDevice *backlightdevice = static_cast<TDEBacklightDevice*>(hwdevice);
+
+ if (backlightdevice)
+ {
+ if (!brightness)
+ {
+ checkBrightness();
+ }
+
+ if (!brightness)
+ {
+ kdError() << "Change brightness not supported " << endl;
+ }
+ else
+ {
+ // Make sure percentage is within valid range
+ if (percent < 0)
+ {
+ percent = 0;
+ }
+ else if (percent > 100)
+ {
+ percent = 100;
+ }
+
+ int level = (int) round(getMaxBrightnessLevel() * percent / 100.0);
+ if (currentBrightnessLevel == level)
+ {
+ kdDebug() << "Brightness level not changed, requested level == current level" << endl;
+ retval = true;
+ }
+ else
+ {
+ backlightdevice->setRawBrightness(level);
+ retval = true;
+ }
+ }
+ }
+
+ // check for actual brightness level to be sure everything was set correct
+ checkCurrentBrightness();
+ kdDebugFuncOut(trace);
+ return retval;
}
/*!
@@ -931,90 +1202,110 @@ bool HardwareInfo::setBrightness ( int level, int percent ){
* \retval true if successful
* \retval false else, if a error occurs
*/
-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 TDE hardware library" << endl;
- return false;
- }
-
- if (cpuFreqAllowed == 0) {
- kdError() << "Could not set CPU Freq - insufficient privileges." << endl;
- return false;
- }
-
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
-
- if (hwlist.count() > 0) {
- TQStringList dynamic;
-
- if (checkCurrentCPUFreqPolicy() == cpufreq) {
- if (cpufreq == DYNAMIC && !cpuFreqGovernor.startsWith("ondemand")) {
- kdDebug() << "CPU Freq Policy is already DYNAMIC, but not governor is currently "
- << "not 'ondemand'. Try to set ondemand governor." << endl;
- } else {
- kdDebug() << "Didn't change Policy, was already set." << endl;
- return true;
- }
- }
-
- switch (cpufreq) {
- case PERFORMANCE:
- if (!setCPUFreqGovernor("performance")) {
- kdError() << "Could not set CPU Freq to performance policy" << endl;
- return false;
- }
- break;
- case DYNAMIC:
- dynamic << "ondemand" << "userspace" << "conservative";
-
- 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;
- }
- }
-
- // Set performance limits on all CPUs
- TDEGenericDevice *hwdevice;
- TDECPUDevice *cpudevice;
- for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- cpudevice = static_cast<TDECPUDevice*>(hwdevice);
- // set dynamic performance limit
- // scale the desired limit so that when limit==0 the minFrequency() is used, and when limit==100 the maxFrequency() is used
- double cpuLimit = cpudevice->maxFrequency() - cpudevice->minFrequency();
- cpuLimit = (cpuLimit * limit) / 100.0;
- cpuLimit = cpudevice->maxFrequency() + cpuLimit;
- cpudevice->setMaximumScalingFrequency(cpuLimit);
-
- }
-
- break;
- case POWERSAVE:
- if (!setCPUFreqGovernor("powersave")) {
- kdError() << "Could not set CPU Freq to powersave policy" << endl;
- return false;
- }
- break;
- default:
- kdWarning() << "Unknown cpufreq_type: " << cpufreq << endl;
- return false;
- }
-
- // check if the policy was really set (and emit signal)
- if (checkCurrentCPUFreqPolicy() == cpufreq) {
+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 TDE hardware library" << endl;
+ return false;
+ }
+
+ if (cpuFreqAllowed == 0)
+ {
+ kdError() << "Could not set CPU Freq - insufficient privileges." << endl;
+ return false;
+ }
+
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+
+ if (hwlist.count() > 0)
+ {
+ TQStringList dynamic;
+
+ if (checkCurrentCPUFreqPolicy() == cpufreq)
+ {
+ if (cpufreq == DYNAMIC && !cpuFreqGovernor.startsWith("ondemand"))
+ {
+ kdDebug() << "CPU Freq Policy is already DYNAMIC, but not governor is currently " << "not 'ondemand'. Try to set ondemand governor." << endl;
+ }
+ else
+ {
+ kdDebug() << "Didn't change Policy, was already set." << endl;
+ return true;
+ }
+ }
+
+ switch (cpufreq)
+ {
+ case PERFORMANCE:
+ if (!setCPUFreqGovernor("performance"))
+ {
+ kdError() << "Could not set CPU Freq to performance policy" << endl;
+ return false;
+ }
+ break;
+ case DYNAMIC:
+ dynamic << "ondemand" << "userspace" << "conservative";
+
+ 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;
+ }
+ }
+
+ // Set performance limits on all CPUs
+ TDEGenericDevice *hwdevice;
+ TDECPUDevice *cpudevice;
+ for (hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next())
+ {
+ cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+ // set dynamic performance limit
+ // scale the desired limit so that when limit==0 the minFrequency() is used, and when limit==100 the maxFrequency() is used
+ double cpuLimit = cpudevice->maxFrequency() - cpudevice->minFrequency();
+ cpuLimit = (cpuLimit * limit) / 100.0;
+ cpuLimit = cpudevice->maxFrequency() + cpuLimit;
+ cpudevice->setMaximumScalingFrequency(cpuLimit);
+
+ }
+
+ break;
+ case POWERSAVE:
+ if (!setCPUFreqGovernor("powersave"))
+ {
+ kdError() << "Could not set CPU Freq to powersave policy" << endl;
+ return false;
+ }
+ break;
+ default:
+ 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;
// emit currentCPUFreqPolicyChanged();
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
}
/*!
@@ -1024,73 +1315,87 @@ bool HardwareInfo::setCPUFreq ( cpufreq_type cpufreq, int limit ) {
* \retval true if successful
* \retval false else, if a error occurs
*/
-bool HardwareInfo::setCPUFreqGovernor( const char *governor ) {
- kdDebugFuncIn(trace);
-
- bool ret = true;
-
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
- TDEGenericDevice *hwdevice;
- TDECPUDevice *cpudevice;
- // Set governor on all CPUs
- for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
- cpudevice = static_cast<TDECPUDevice*>(hwdevice);
- cpudevice->setGovernor(governor);
- if (cpudevice->governor() != governor) {
- ret = false;
- }
- }
-
- kdDebugFuncOut(trace);
- return ret;
-}
-
+bool HardwareInfo::setCPUFreqGovernor(const char *governor)
+{
+ kdDebugFuncIn(trace);
+
+ bool ret = true;
+
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+ TDEGenericDevice *hwdevice;
+ TDECPUDevice *cpudevice;
+ // Set governor on all CPUs
+ for (hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next())
+ {
+ cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+ cpudevice->setGovernor(governor);
+ if (cpudevice->governor() != governor)
+ {
+ ret = false;
+ }
+ }
+ kdDebugFuncOut(trace);
+ return ret;
+}
// --> 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
-// from QT event loop and to allow QT3 D-Bus bindings to get not
-// blocked by normal KDE/QT (GUI) calls
+// need this functions to make events independent
+// from TQt event loop and to allow TQt3 D-Bus bindings to get not
+// blocked by normal TDE/TQt (GUI) calls
/*!
* Function to emit the signal for the Power button.
*/
-void HardwareInfo::emitPowerButtonPressed() {
- if (sessionIsActive) {
- emit powerButtonPressed();
- } else {
- kdWarning() << "Session is not active, don't react on power button event!" << endl;
- }
+void HardwareInfo::emitPowerButtonPressed()
+{
+ if (sessionIsActive)
+ {
+ emit powerButtonPressed();
+ }
+ else
+ {
+ kdWarning() << "Session is not active, don't react on power button event!" << endl;
+ }
}
/*!
- * Function to emit the signal for the Sleep button.
+ * Function to emit the signal for the Suspend button.
*/
-void HardwareInfo::emitSleepButtonPressed() {
- if (sessionIsActive) {
- emit sleepButtonPressed();
- } else {
- kdWarning() << "Session is not active, don't react on sleep button event!" << endl;
- }
+void HardwareInfo::emitSuspendButtonPressed()
+{
+ if (sessionIsActive)
+ {
+ emit sleepButtonPressed();
+ }
+ else
+ {
+ kdWarning() << "Session is not active, don't react on sleep button event!" << endl;
+ }
}
/*!
* Function to emit the signal for the s2disk button.
*/
-void HardwareInfo::emitS2diskButtonPressed() {
- if (sessionIsActive) {
- emit s2diskButtonPressed();
- } else {
- kdWarning() << "Session is not active, don't react on suspend2disk button event!" << endl;
- }
+void HardwareInfo::emitS2diskButtonPressed()
+{
+ if (sessionIsActive)
+ {
+ emit s2diskButtonPressed();
+ }
+ else
+ {
+ kdWarning() << "Session is not active, don't react on suspend2disk button event!" << endl;
+ }
}
/*!
* Function to emit the signal about changes in the session state
*/
-void HardwareInfo::emitSessionActiveState() {
- emit desktopSessionIsActive(sessionIsActive);
+void HardwareInfo::emitSessionActiveState()
+{
+ emit desktopSessionIsActive(sessionIsActive);
}
/*!
@@ -1100,46 +1405,22 @@ void HardwareInfo::emitSessionActiveState() {
* \retval true if could get set
* \retval false else
*/
-bool HardwareInfo::setBrightnessUp(int percentageStep) {
- kdDebugFuncIn(trace);
-
- bool retval = false;
-
- checkCurrentBrightness();
-
- if (supportBrightness() && (getCurrentBrightnessLevel() >= 0) &&
- (getCurrentBrightnessLevel() != (getMaxBrightnessLevel()-1))) {
- int setTo = 0;
- int minPercStep = 10;
- int currentPerc = (int)(((float)getCurrentBrightnessLevel()/(float)(getMaxBrightnessLevel()-1))*100.0);
-
- if (percentageStep > 0 && (percentageStep <= (100-currentPerc))) {
- minPercStep = percentageStep;
- }
-
- if ((currentPerc + minPercStep) > 100) {
- // set to 100 %
- setTo = getMaxBrightnessLevel() -1;
- } else {
- setTo = (int)(((float)(getMaxBrightnessLevel()-1))*(((float)(currentPerc + minPercStep))/100.0));
- if ((setTo == getCurrentBrightnessLevel()) && (setTo < (getMaxBrightnessLevel() -1))) {
- setTo++;
- }
- }
-
- if (trace) {
- kdDebug() << "Max: " << getMaxBrightnessLevel()
- << " Current: " << getCurrentBrightnessLevel()
- << " minPercStep: " << minPercStep
- << " currentPerc: " << currentPerc
- << " setTo: " << setTo << endl;
- }
-
- retval = setBrightness(setTo, -1);
- }
-
- kdDebugFuncOut(trace);
- return retval;
+bool HardwareInfo::setBrightnessUp(int percentageStep)
+{
+ kdDebugFuncIn(trace);
+
+ bool retval = false;
+
+ checkCurrentBrightness();
+
+ if (supportBrightness() && percentageStep > 0)
+ {
+ int currentPerc = (int) round(100.0 * getCurrentBrightnessLevel() / getMaxBrightnessLevel());
+ retval = setBrightnessPercentage(currentPerc + percentageStep);
+ }
+
+ kdDebugFuncOut(trace);
+ return retval;
}
/*!
@@ -1149,83 +1430,22 @@ bool HardwareInfo::setBrightnessUp(int percentageStep) {
* \retval true if could get set
* \retval false else
*/
-bool HardwareInfo::setBrightnessDown(int percentageStep) {
- kdDebugFuncIn(trace);
-
- bool retval = false;
-
- checkCurrentBrightness();
-
- if (supportBrightness() && (getCurrentBrightnessLevel() > 0)) {
- int setTo = 0;
- int minPercStep = 10;
- int currentPerc = (int)(((float)getCurrentBrightnessLevel()/(float)(getMaxBrightnessLevel()-1))*100.0);
-
- if (percentageStep > 0 && (percentageStep < currentPerc)) {
- minPercStep = percentageStep;
- }
-
- if ((currentPerc - minPercStep) < 0) {
- setTo = 0;
- } else {
- setTo = (int)(((float)(getMaxBrightnessLevel()-1))*(((float)(currentPerc - minPercStep))/100.0));
- if ((setTo == getCurrentBrightnessLevel()) && (setTo > 0)) {
- setTo--;
- }
- }
-
- if (trace) {
- kdDebug() << "Max: " << getMaxBrightnessLevel()
- << " Current: " << getCurrentBrightnessLevel()
- << " minPercStep: " << minPercStep
- << " currentPerc: " << currentPerc
- << " setTo: " << setTo << endl;
- }
-
- retval = setBrightness(setTo, -1);
- }
-
- kdDebugFuncOut(trace);
- return retval;
-}
+bool HardwareInfo::setBrightnessDown(int percentageStep)
+{
+ kdDebugFuncIn(trace);
-/*!
- * Function to handle the signal for the brightness up button/key
- */
-void HardwareInfo::brightnessUpPressed() {
- kdDebugFuncIn(trace);
-
- if (brightness) {
- if (!sessionIsActive) {
- kdWarning() << "Session is not active, don't react on brightness up key event!" << endl;
- } else {
- if (currentBrightnessLevel < availableBrightnessLevels) {
- setBrightnessUp();
- } else {
- kdWarning() << "Could not set brightness to higher level, it's already set to max." << endl;
- }
- }
- }
- kdDebugFuncOut(trace);
-}
+ bool retval = false;
-/*!
- * Function to handle the signal for the brightness down button/key
- */
-void HardwareInfo::brightnessDownPressed() {
- kdDebugFuncIn(trace);
-
- if (brightness) {
- if (!sessionIsActive) {
- kdWarning() << "Session is not active, don't react on brightness down key event!" << endl;
- } else {
- if (currentBrightnessLevel > 0) {
- setBrightnessDown();
- } else {
- kdWarning() << "Could not set brightness to lower level, it's already set to min." << endl;
- }
- }
- }
+ checkCurrentBrightness();
+
+ if (supportBrightness() && percentageStep > 0)
+ {
+ int currentPerc = (int) round(100.0 * getCurrentBrightnessLevel() / getMaxBrightnessLevel());
+ retval = setBrightnessPercentage(currentPerc - percentageStep);
+ }
+
+ kdDebugFuncOut(trace);
+ return retval;
}
// --> private helper slots to forward/handle events -- END <--
@@ -1238,8 +1458,9 @@ void HardwareInfo::brightnessDownPressed() {
* \retval true if adapter is present/connected or unknown
* \retval false if not
*/
-bool HardwareInfo::getAcAdapter() const {
- return acadapter;
+bool HardwareInfo::getAcAdapter() const
+{
+ return acadapter;
}
/*!
@@ -1248,38 +1469,42 @@ bool HardwareInfo::getAcAdapter() const {
* \retval true if the lid is closed
* \retval false if the lid is opend
*/
-bool HardwareInfo::getLidclose() const {
- return lidclose;
+bool HardwareInfo::getLidclose() const
+{
+ return lidclose;
}
/*!
* The function return the maximal available brightness level
* \return Integer with max level or -1 if not supported
*/
-int HardwareInfo::getMaxBrightnessLevel() const {
- if (brightness)
- return availableBrightnessLevels;
- else
- return -1;
+int HardwareInfo::getMaxBrightnessLevel() const
+{
+ if (brightness)
+ return availableBrightnessLevels - 1;
+ else
+ return -1;
}
/*!
* The function return the current brightness level
* \return Integer with max level or -1 if not supported or unkown
*/
-int HardwareInfo::getCurrentBrightnessLevel() const {
- if (brightness)
- return currentBrightnessLevel;
- else
- return -1;
+int HardwareInfo::getCurrentBrightnessLevel() const
+{
+ if (brightness)
+ return currentBrightnessLevel;
+ else
+ return -1;
}
/*!
* The function return the current set CPU Frequency Policy
* \return Integer with currently set Policy or -1 if not supported or unkown
*/
-int HardwareInfo::getCurrentCPUFreqPolicy() const {
- return currentCPUFreqPolicy;
+int HardwareInfo::getCurrentCPUFreqPolicy() const
+{
+ return currentCPUFreqPolicy;
}
/*!
@@ -1288,35 +1513,38 @@ int HardwareInfo::getCurrentCPUFreqPolicy() const {
* \return struct with information from \ref suspend_states
* TODO: check if we maybe should replace this by more different functions
*/
-SuspendStates HardwareInfo::getSuspendSupport() const {
- return suspend_states;
+SuspendStates HardwareInfo::getSuspendSupport() const
+{
+ return suspend_states;
}
/*!
* The function return a pointer to the battery collection of primary batteries.
* \return BatteryCollection with type == PRIMARY
*/
-BatteryCollection* HardwareInfo::getPrimaryBatteries() const {
- return primaryBatteries;
+BatteryCollection* HardwareInfo::getPrimaryBatteries() const
+{
+ return primaryBatteries;
}
/*!
* The function return all batteries
* \return TQPtrList<Battery>
*/
-TQPtrList<Battery> HardwareInfo::getAllBatteries() const {
- return BatteryList;
+TQPtrList<Battery> HardwareInfo::getAllBatteries() const
+{
+ return BatteryList;
}
-
/*!
* The function return the status of \ref laptop.
* \return boolean with info if machine is a laptop
* \retval true if a laptop
* \retval false else/if not a laptop
*/
-bool HardwareInfo::isLaptop() const {
- return laptop;
+bool HardwareInfo::isLaptop() const
+{
+ return laptop;
}
/*!
@@ -1326,10 +1554,11 @@ bool HardwareInfo::isLaptop() const {
* \retval true if connected
* \retval false if not connected
*/
-bool HardwareInfo::isOnline() const {
- // FIXME
- // Is there ANY case where the TDE hardware library would not function?
- return true;
+bool HardwareInfo::isOnline() const
+{
+ // FIXME
+ // Is there ANY case where the TDE hardware library would not function?
+ return true;
}
/*!
@@ -1338,8 +1567,9 @@ bool HardwareInfo::isOnline() const {
* \retval true if support ACPI
* \retval false else
*/
-bool HardwareInfo::hasACPI() const {
- return has_ACPI;
+bool HardwareInfo::hasACPI() const
+{
+ return has_ACPI;
}
/*!
@@ -1348,8 +1578,9 @@ bool HardwareInfo::hasACPI() const {
* \retval true if support APM
* \retval false else
*/
-bool HardwareInfo::hasAPM() const {
- return has_APM;
+bool HardwareInfo::hasAPM() const
+{
+ return has_APM;
}
/*!
@@ -1358,8 +1589,9 @@ bool HardwareInfo::hasAPM() const {
* \retval true if support PMU
* \retval false else
*/
-bool HardwareInfo::hasPMU() const {
- return has_PMU;
+bool HardwareInfo::hasPMU() const
+{
+ return has_PMU;
}
/*!
@@ -1368,8 +1600,9 @@ bool HardwareInfo::hasPMU() const {
* \retval true if support brightness changes
* \retval false else
*/
-bool HardwareInfo::supportBrightness() const {
- return brightness;
+bool HardwareInfo::supportBrightness() const
+{
+ return brightness;
}
/*!
@@ -1378,8 +1611,9 @@ bool HardwareInfo::supportBrightness() const {
* \retval true if support brightness changes
* \retval false else
*/
-bool HardwareInfo::supportCPUFreq() const {
- return cpuFreq;
+bool HardwareInfo::supportCPUFreq() const
+{
+ return cpuFreq;
}
/*!
@@ -1388,8 +1622,9 @@ bool HardwareInfo::supportCPUFreq() const {
* \retval true if the current session is active
* \retval false else
*/
-bool HardwareInfo::currentSessionIsActive() const {
- return sessionIsActive;
+bool HardwareInfo::currentSessionIsActive() const
+{
+ return sessionIsActive;
}
/*!
@@ -1400,15 +1635,16 @@ bool HardwareInfo::currentSessionIsActive() const {
* \retval 1 not allowed
* \retval -1 unknown
*/
-int HardwareInfo::isCpuFreqAllowed () {
- // Use the first CPU in the list; permissions are probably the same across all CPUs
- TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
- TDEGenericDevice *hwdevice;
- hwdevice = hwlist.first();
- TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
-
- cpuFreqAllowed = cpudevice->canSetGovernor();
- return cpuFreqAllowed;
+int HardwareInfo::isCpuFreqAllowed()
+{
+ // Use the first CPU in the list; permissions are probably the same across all CPUs
+ TDEGenericHardwareList hwlist = m_hwdevices->listByDeviceClass(TDEGenericDeviceType::CPU);
+ TDEGenericDevice *hwdevice;
+ hwdevice = hwlist.first();
+ TDECPUDevice *cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+
+ cpuFreqAllowed = cpudevice->canSetGovernor();
+ return cpuFreqAllowed;
}
// --> get private members section -- END <---
diff --git a/src/hardware.h b/src/hardware.h
index b173aa5..4d64314 100644
--- a/src/hardware.h
+++ b/src/hardware.h
@@ -33,12 +33,7 @@
#ifndef _HARDWARE_H_
#define _HARDWARE_H_
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// QT - Header
+// TQt - Header
#include <tqstring.h>
#include <tqobject.h>
#include <tqvaluelist.h>
@@ -56,7 +51,8 @@ enum suspend_type {
SUSPEND2DISK,
SUSPEND2RAM,
FREEZE,
- STANDBY
+ STANDBY,
+ SUSPEND_HYBRID,
};
enum cpufreq_type {
@@ -106,6 +102,12 @@ typedef struct SuspendStates {
bool standby_can;
//! true if the machine support standby and PolicyKit allow to call the interface
int standby_allowed;
+ //! true if the machine support hybrid suspend and the interface is available
+ bool suspend_hybrid;
+ //! true if the machine support hybrid suspend, but no interface available
+ bool suspend_hybrid_can;
+ //! true if the machine support hybrid suspend and PolicyKit allow to call the interface
+ int suspend_hybrid_allowed;
SuspendStates () {
suspend2ram = false;
@@ -120,12 +122,15 @@ typedef struct SuspendStates {
standby = false;
standby_can = false;
standby_allowed = -1;
+ suspend_hybrid = false;
+ suspend_hybrid_can = false;
+ suspend_hybrid_allowed = -1;
}
} SuspendStates;
class HardwareInfo : public TQObject{
- Q_OBJECT
+ TQ_OBJECT
private:
@@ -134,7 +139,7 @@ private:
//! pointer to the dbusInterface connection class
dbusInterface *dbus_iface;
- //! hold udis of special hardware execpt batteries represented by a TQString pairs (name,udi)
+ //! hold udis of special hardware except batteries represented by a TQString pairs (name,udi)
/*!
* This directory handle udis for known fixed devices as e.g ac adapter. This devices are
* currently available:
@@ -152,6 +157,11 @@ private:
*/
TQStringList allUDIs;
+ /*!
+ * This TQStringList contains the unmonitored UDIs we alread know
+ */
+ TQStringList unknownUDIs;
+
//! hold information if suspend/standby/pm actions are supported and allowed
/*!
* This dictionary contains information about the available pm capabilities and
@@ -328,26 +338,21 @@ private slots:
//! check if brightness change is possible
void checkBrightness();
- //! TQT_SLOT to forward signal about changed battery warning state
+ //! TQ_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
+ //! TQ_SLOT to handle resume and forward a signal for resume
void handleResumeSignal (int result);
//! to emit signal for power button
void emitPowerButtonPressed();
//! to emit signal for sleep button
- void emitSleepButtonPressed();
+ void emitSuspendButtonPressed();
//! to emit signal for s2disk button
void emitS2diskButtonPressed();
//! to emit signal for session state
void emitSessionActiveState();
- //! to handle signal for brightness Up buttons/keys
- void brightnessUpPressed();
- //! to handle signal for brightness Down buttons/keys
- void brightnessDownPressed();
-
signals:
//! signal for larger data changes
void generalDataChanged();
@@ -454,8 +459,10 @@ public:
// --> 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 TDE hardware library
- bool setBrightness ( int level, int percent = -1);
+ //! set the brightness level via TDE hardware library
+ bool setBrightnessLevel(int level);
+ //! set the brightness percentage via TDE hardware library
+ bool setBrightnessPercentage(int percent);
//! to set the brightness down
bool setBrightnessDown(int percentageStep = -1);
//! to set the brightness up
diff --git a/src/hardware_battery.cpp b/src/hardware_battery.cpp
index 2e60fb7..d68dfd4 100644
--- a/src/hardware_battery.cpp
+++ b/src/hardware_battery.cpp
@@ -24,6 +24,10 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "hardware_battery.h"
// FOR REFERENCE
@@ -69,7 +73,7 @@ Battery::Battery( TQString _udi ) {
udi = _udi;
- connect(m_hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(updateProperty(TDEGenericDevice*)));
+ connect(m_hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(updateProperty(TDEGenericDevice*)));
initialized = false;
@@ -110,20 +114,12 @@ void Battery::initDefault() {
kdDebugFuncOut(trace);
}
-//! initialize this battery object with values from HAL
+//! initialize this battery object
void Battery::init() {
kdDebugFuncIn(trace);
- // read battery information from HAL
- if (resetUdi(udi)) {
- //udi is valid
- recheck(); //fills all values
- //ready here for now
- } else {
- //udi is invalid or is no battery
- state=BAT_HAL_ERROR;
- kdWarning() << "Warning: Battery::init cannot make use of udi " << udi << endl;
- }
+ // read battery information
+ recheck(); //fills all values
initialized = true;
kdDebugFuncOut(trace);
@@ -201,7 +197,7 @@ void Battery::recheck() {
kdDebugFuncOut(trace);
}
-// ---> query HAL for properties SECTION : START <----
+// ---> query for properties SECTION : START <----
//! to check battery.present
/*!
@@ -729,11 +725,11 @@ bool Battery::checkChargingState () {
return _ret;
}
-// ---> query HAL for properties SECTION : END <----
+// ---> query for properties SECTION : END <----
-//! to recheck a special value for a HAL event
+//! to recheck a special value for an event
/*!
- * Check for the given property new values from HAL and set them to
+ * Check for the given property new values and set them to
* the battery variables.
* \param device TDEGenericDevice
*/
@@ -747,26 +743,6 @@ void Battery::updateProperty(TDEGenericDevice* device) {
kdDebugFuncOut(trace);
}
-//! Resets the current HAL udi used by the one given
-/*!
-* The given TQString will be (checked and) used as new HAL udi for the battery.
-* But don't forget to do a recheck of the battery afterwards.
-* \param _udi TQString with the UDI to reset
-* \return boolean with the result of the operation
-* \retval true if reset was successfull
-* \retval false if reset couldn't be applied
-*/
-bool Battery::resetUdi(TQString _udi) {
- kdDebugFuncIn(trace);
-
- // FIXME
- // What does this function do outside of HAL!?!? Should it even exist any more?
- bool tmp_result=true;
-
- kdDebugFuncOut(trace);
- return tmp_result;
-}
-
// ---> write private members SECTION : START <----
//! sets the chargelevel in percent when battery should go into state warning
@@ -815,7 +791,7 @@ void Battery::setCritLevel(int _crit_level) {
// ---> write private members SECTION : END <----
// ---> get private members SECTION : START <----
-//! reports the HAL udi of this battery
+//! reports the udi of this battery
TQString Battery::getUdi() const {
return TQString(udi);
}
@@ -880,7 +856,7 @@ int Battery::getCurrentLevel() const {
return charge_level_current;
}
-//! reports HAL capacity_state value
+//! reports capacity_state value
TQString Battery::getCapacityState() const {
return TQString(capacity_state);
}
diff --git a/src/hardware_battery.h b/src/hardware_battery.h
index 36bf68c..25557f4 100644
--- a/src/hardware_battery.h
+++ b/src/hardware_battery.h
@@ -32,12 +32,7 @@
#ifndef _BATTERY_H_
#define _BATTERY_H_
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// QT - Header
+// TQt - Header
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqobject.h>
@@ -49,7 +44,7 @@
class Battery : public TQObject {
- Q_OBJECT
+ TQ_OBJECT
private:
@@ -282,16 +277,6 @@ public:
//! reports the chargelevel in percent when battery goes to state critical
int getCritLevel() const;
- //writeable access to internals
- //! Resets the current TDE hardware library udi used by the one given
- /*!
- * The given TQString will be (checked and) used as new TDE hardware library udi for the battery.
- * But don't forget to do a recheck of the battery afterwards.
- * \li returns TRUE: if reset was successfull
- * \li returns FALSE: if reset couldn't be applied
- */
- bool resetUdi(TQString);
-
//! sets the chargelevel in percent when battery should go into state warning
void setWarnLevel(int _warn_level);
//! sets the chargelevel in percent when battery should go into state low
@@ -336,8 +321,7 @@ enum BAT_STATE {
BAT_WARN,
BAT_LOW,
BAT_CRIT,
- BAT_NORM,
- BAT_HAL_ERROR
+ BAT_NORM
};
#endif
diff --git a/src/hardware_batteryCollection.cpp b/src/hardware_batteryCollection.cpp
index e331492..0d4f4dd 100644
--- a/src/hardware_batteryCollection.cpp
+++ b/src/hardware_batteryCollection.cpp
@@ -24,6 +24,10 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// own headers
#include "hardware_batteryCollection.h"
diff --git a/src/hardware_batteryCollection.h b/src/hardware_batteryCollection.h
index c30717d..8c977db 100644
--- a/src/hardware_batteryCollection.h
+++ b/src/hardware_batteryCollection.h
@@ -31,12 +31,7 @@
#ifndef _BATTERYCOLLECTION_H_
#define _BATTERYCOLLECTION_H_
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// QT - Header
+// TQt - Header
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqobject.h>
@@ -46,7 +41,7 @@
class BatteryCollection : public TQObject {
- Q_OBJECT
+ TQ_OBJECT
private:
@@ -85,7 +80,6 @@ private:
* \li BAT_LOW: batterylevel is already low
* \li BAT_CRIT: batterylevel has become really critical
* \li BAT_NONE: battery state not available
- * \li BAT_HAL_ERROR: battery state couldn't be retrieved because of a HAL error
*/
int state;
diff --git a/src/hardware_cpu.cpp b/src/hardware_cpu.cpp
index e87de1a..ef4fe55 100644
--- a/src/hardware_cpu.cpp
+++ b/src/hardware_cpu.cpp
@@ -28,11 +28,15 @@
* \date 2006
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// include own header
#include "hardware_cpu.h"
#include "hardware_cpu.moc"
-// QT Header
+// TQt Header
#include <tqdir.h>
#include <tqtimer.h>
diff --git a/src/hardware_cpu.h b/src/hardware_cpu.h
index 62069ac..f47a267 100644
--- a/src/hardware_cpu.h
+++ b/src/hardware_cpu.h
@@ -33,12 +33,7 @@
#ifndef _HARDWARE_CPU_H_
#define _HARDWARE_CPU_H_
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// QT Headers
+// TQt Headers
#include <tqstring.h>
#include <tqobject.h>
#include <tqvaluelist.h>
@@ -51,7 +46,7 @@
class CPUInfo : public TQObject{
- Q_OBJECT
+ TQ_OBJECT
private:
diff --git a/src/inactivity.cpp b/src/inactivity.cpp
index 977161e..6ce04d8 100644
--- a/src/inactivity.cpp
+++ b/src/inactivity.cpp
@@ -23,6 +23,10 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// own header
#include "inactivity.h"
@@ -55,7 +59,7 @@ inactivity::inactivity(screen *disp) : display(disp),
has_XSC_Extension = XScreenSaverQueryExtension( tqt_xdisplay(), &dummy, &dummy );
checkInactivity = new TQTimer( this );
- connect( checkInactivity, TQT_SIGNAL(timeout()), this, TQT_SLOT(check()));
+ connect( checkInactivity, TQ_SIGNAL(timeout()), this, TQ_SLOT(check()));
kdDebugFuncOut(trace);
}
@@ -97,7 +101,7 @@ void inactivity::start( int timeToExpire, TQStringList blacked ) {
}
/*!
- * \b TQT_SLOT to call check as recheck inactivity if before a running PID
+ * \b Slot to call check as recheck inactivity if before a running PID
* request was detected.
*/
void inactivity::recheck() {
@@ -109,14 +113,14 @@ void inactivity::recheck() {
}
/*!
- * \b TQT_SLOT to call check without a recheck.
+ * \b Slot to call check without a recheck.
*/
void inactivity::check() {
check(false);
}
/*!
- * \b TQT_SLOT to check the current idle-time of the X-Server and if there
+ * \b Slot to check the current idle-time of the X-Server and if there
* are blacklisted programs are running. If the through \ref timeToInactivity
* defined time is expired, this function emit signal \ref inactivityTimeExpired() .
* \param recheck boolean which define if this is a recheck or not.
@@ -147,7 +151,7 @@ void inactivity::check( bool recheck ) {
}
else {
//called if there is a getPIDs() is running
- TQTimer::singleShot(500, this, TQT_SLOT(recheck()));
+ TQTimer::singleShot(500, this, TQ_SLOT(recheck()));
}
}
else checkInactivity->start(CHECK_for_INACTIVITY, true);
@@ -318,10 +322,10 @@ void inactivity::checkBlacklisted(){
proc = new TDEProcess;
*proc << "pidof" << blacklist;
- connect( proc, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)),this,
- TQT_SLOT(getPIDs(TDEProcess *, char *, int)));
- connect( proc, TQT_SIGNAL(processExited(TDEProcess *)),
- TQT_SLOT(getPIDsExited(TDEProcess *)));
+ connect( proc, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)),this,
+ TQ_SLOT(getPIDs(TDEProcess *, char *, int)));
+ connect( proc, TQ_SIGNAL(processExited(TDEProcess *)),
+ TQ_SLOT(getPIDsExited(TDEProcess *)));
if (!proc->start(TDEProcess::NotifyOnExit, TDEProcess::AllOutput))
{
@@ -339,7 +343,7 @@ void inactivity::checkBlacklisted(){
/*!
- * \b TQT_SLOT to get the return of the command pidof and parse this to set
+ * \b Slot to get the return of the command pidof and parse this to set
* \ref blacklisted_running .
* \param *proc pointer to the sending TDEProcess
* \param *buffer the char pointer to the output of the process to stdout
@@ -372,8 +376,8 @@ void inactivity::getPIDs(TDEProcess */*proc*/, char *buffer, int /*length*/) {
/*!
- * \b TQT_SLOT which called if the call of pidof is exited
- * \param proc the KPocess which called this SLOT
+ * \b Slot which called if the call of pidof is exited
+ * \param proc the TDEProcess which called this slot
*/
void inactivity::getPIDsExited(TDEProcess *proc){
kdDebugFuncIn(trace);
diff --git a/src/inactivity.h b/src/inactivity.h
index 7fafab9..0ecd740 100644
--- a/src/inactivity.h
+++ b/src/inactivity.h
@@ -20,16 +20,10 @@
#ifndef _INACTIVITY_H_
#define _INACTIVITY_H_
-/* this is needed to avoid typedef clash with X11
- */
-#ifndef TQT_CLEAN_NAMESPACE
-#define TQT_CLEAN_NAMESPACE
-#endif
-
// KDE Header
-#include <kprocess.h>
+#include <tdeprocess.h>
-// QT Header
+// TQt Header
#include <tqregexp.h>
#include <tqstring.h>
#include <tqwidget.h>
@@ -64,7 +58,7 @@ extern "C" {
class inactivity : public TQWidget
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/info_Dialog.ui b/src/info_Dialog.ui
index 1b95e5e..61d9a9b 100644
--- a/src/info_Dialog.ui
+++ b/src/info_Dialog.ui
@@ -32,9 +32,6 @@
<property name="text">
<string>OK</string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
<spacer row="3" column="5" rowspan="1" colspan="2">
<property name="name">
@@ -174,9 +171,6 @@
<property name="text">
<string></string>
</property>
- <property name="accel">
- <string></string>
- </property>
</widget>
<spacer row="2" column="6">
<property name="name">
@@ -210,8 +204,8 @@
<slot>ButtonOK_clicked()</slot>
</connection>
</connections>
-<Q_SLOTS>
+<slots>
<slot>ButtonOK_clicked()</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/src/infodialog.cpp b/src/infodialog.cpp
index 9837acb..9205a5a 100644
--- a/src/infodialog.cpp
+++ b/src/infodialog.cpp
@@ -25,6 +25,10 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// own headers
#include "infodialog.h"
@@ -32,7 +36,7 @@
#include <kiconloader.h>
#include <tdelocale.h>
-// QT headers:
+// TQt headers:
#include <tqcheckbox.h>
#include <tqdialog.h>
#include <tqlabel.h>
@@ -104,7 +108,7 @@ bool infoDialog::dialogIsDisabled() {
}
/*!
- * SLOT: called if the 'ok' button clicked. This TQT_SLOT sync the settings
+ * Slot called if the 'ok' button clicked. This slot sync the settings
* and close the dialog.
*/
void infoDialog::ButtonOK_clicked() {
diff --git a/src/infodialog.h b/src/infodialog.h
index 85d13dc..384a3bb 100644
--- a/src/infodialog.h
+++ b/src/infodialog.h
@@ -37,7 +37,7 @@
class infoDialog: public info_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/log_viewer.ui b/src/log_viewer.ui
index cf99f42..b28572d 100644
--- a/src/log_viewer.ui
+++ b/src/log_viewer.ui
@@ -96,10 +96,10 @@
<slot>pB_save_clicked()</slot>
</connection>
</connections>
-<Q_SLOTS>
+<slots>
<slot>pB_close_clicked()</slot>
<slot>pB_save_clicked()</slot>
-</Q_SLOTS>
+</slots>
<layoutdefaults spacing="6" margin="11"/>
<includes>
<include location="global" impldecl="in implementation">ktextedit.h</include>
diff --git a/src/logviewer.cpp b/src/logviewer.cpp
index bd2207a..a5336f4 100644
--- a/src/logviewer.cpp
+++ b/src/logviewer.cpp
@@ -23,8 +23,12 @@
* \version 0.0.1
* \date 2007
*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
-// QT header
+// TQt header
#include <tqfile.h>
#include <tqtextstream.h>
@@ -63,7 +67,7 @@ LogViewer::~LogViewer(){
}
/*!
- * SLOT: Called if the user click on 'Close' Button
+ * Slot called if the user click on 'Close' Button
*/
void LogViewer::pB_close_clicked() {
@@ -71,7 +75,7 @@ void LogViewer::pB_close_clicked() {
}
/*!
- * SLOT: Called if the user click on 'Save As ...' Button
+ * Slot called if the user click on 'Save As ...' Button
*/
void LogViewer::pB_save_clicked() {
diff --git a/src/logviewer.h b/src/logviewer.h
index 9bb6274..6c17e6a 100644
--- a/src/logviewer.h
+++ b/src/logviewer.h
@@ -37,7 +37,7 @@
class LogViewer: public log_viewer {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/main.cpp b/src/main.cpp
index 9a7339d..a2693d2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,8 +19,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "tdepowersave.h"
-#include <kuniqueapplication.h>
+#include <tdeuniqueapplication.h>
#include <tdeaboutdata.h>
#include <tdecmdlineargs.h>
#include <tdelocale.h>
@@ -49,7 +53,7 @@ TDECmdLineOptions options[] = { { "force-acpi-check", I18N_NOOP("Force a new che
static const char version[] = "0.7.x (0.7.3)";
bool trace = false;
-extern "C" KDE_EXPORT
+extern "C" TDE_EXPORT
int kdemain(int argc, char **argv)
{
TDEAboutData about("tdepowersave", I18N_NOOP("TDEPowersave"), version, description,
@@ -70,16 +74,16 @@ int kdemain(int argc, char **argv)
TDECmdLineArgs::init(argc, argv, &about);
TDECmdLineArgs::addCmdLineOptions (options);
- KUniqueApplication::addCmdLineOptions();
+ TDEUniqueApplication::addCmdLineOptions();
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
- if (!KUniqueApplication::start()) {
+ if (!TDEUniqueApplication::start()) {
fprintf(stderr, "TDEPowersave is already running!\n");
exit(0);
}
- KUniqueApplication app;
+ TDEUniqueApplication app;
app.disableSessionManagement();
tdepowersave *mainWin = 0;
diff --git a/src/pics/Makefile.am b/src/pics/Makefile.am
deleted file mode 100644
index 213fe82..0000000
--- a/src/pics/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-tdepowersaveiconsdir = $(kde_datadir)/tdepowersave/icons
-tdepowersaveicons_ICON = AUTO
-
diff --git a/src/screen.cpp b/src/screen.cpp
index ef68a26..f2c05f4 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -26,6 +26,10 @@
* \author Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de>
* \date 2004 - 2006
*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
// own headers
#include "screen.h"
@@ -39,7 +43,7 @@ extern "C" {
}
// KDE Headers
-#include <kprocess.h>
+#include <tdeprocess.h>
/*! The default constructor of the class screen */
screen::screen() {
@@ -59,7 +63,7 @@ screen::screen() {
screen_save_dcop_ref = DCOPRef( "kdesktop", "KScreensaverIface" );
check_xscreensaver_timer = new TQTimer( this );
- connect( check_xscreensaver_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(xscreensaver_ping() ));
+ connect( check_xscreensaver_timer, TQ_SIGNAL(timeout()), this, TQ_SLOT(xscreensaver_ping() ));
SCREENSAVER_STATUS = checkScreenSaverStatus();
kdDebugFuncOut(trace);
@@ -284,7 +288,7 @@ int screen::checkScreenSaverStatus() {
gnomeScreensaverCheck = new TDEProcess;
*gnomeScreensaverCheck << "gnome-screensaver-command" << "--query";
- connect( gnomeScreensaverCheck , TQT_SIGNAL(processExited(TDEProcess *)),TQT_SLOT(getGSExited(TDEProcess *)));
+ connect( gnomeScreensaverCheck , TQ_SIGNAL(processExited(TDEProcess *)),TQ_SLOT(getGSExited(TDEProcess *)));
if(!gnomeScreensaverCheck->start(TDEProcess::NotifyOnExit))
{
@@ -329,8 +333,8 @@ bool screen::checkScreenSaverActive()
}
/*!
- * \b TQT_SLOT which called if the call of gnomescreensaver-command exited
- * \param gnomecheckcommand the KPocess which called this SLOT
+ * \b Slot which called if the call of gnomescreensaver-command exited
+ * \param gnomecheckcommand the TDEProcess which called this slot
*/
void screen::getGSExited (TDEProcess *gnomecheckcommand) {
kdDebugFuncIn(trace);
@@ -481,8 +485,8 @@ xscreensaver:
xscreensaver_lock = new TDEProcess;
*xscreensaver_lock << "xscreensaver-command" << "-lock";
- connect(xscreensaver_lock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xscreensaver_lock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = xscreensaver_lock->start(TDEProcess::DontCare);
if(!status)
@@ -499,8 +503,8 @@ xscreensaver:
gnomescreensaver_lock = new TDEProcess;
*gnomescreensaver_lock << "gnome-screensaver-command" << "--lock";
- connect(gnomescreensaver_lock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(gnomescreensaver_lock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = gnomescreensaver_lock->start(TDEProcess::DontCare);
if(!status)
{
@@ -517,8 +521,8 @@ xscreensaver:
xlock = new TDEProcess;
*xlock << "xlock"; //<< "-mode" << "blank";
- connect(xlock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xlock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = xlock->start(TDEProcess::DontCare);
if(!status)
{
@@ -551,8 +555,8 @@ bool screen::lockScreen( TQString lock_withMethod ) {
xlock = new TDEProcess;
*xlock << "xlock";
- connect(xlock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xlock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = xlock->start(TDEProcess::DontCare);
if(!status)
@@ -566,8 +570,8 @@ bool screen::lockScreen( TQString lock_withMethod ) {
else if (lock_withMethod == "gnomescreensaver") {
gnomescreensaver_lock = new TDEProcess;
*gnomescreensaver_lock << "gnome-screensaver-command" << "--lock";
- connect(gnomescreensaver_lock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(gnomescreensaver_lock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = gnomescreensaver_lock->start(TDEProcess::DontCare);
if(!status)
@@ -601,8 +605,8 @@ xscreensaver:
xscreensaver_lock = new TDEProcess;
*xscreensaver_lock << "xscreensaver-command" << "-lock";
- connect(xscreensaver_lock, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xscreensaver_lock, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = xscreensaver_lock->start(TDEProcess::DontCare);
if(!status)
@@ -684,8 +688,8 @@ bool screen::resetXScreensaver(){
xscreensaver_reset = new TDEProcess;
*xscreensaver_reset << "xscreensaver-command" << "-restart";
- connect(xscreensaver_reset, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xscreensaver_reset, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
bool status = xscreensaver_reset->start(TDEProcess::DontCare);
if(!status)
@@ -709,8 +713,8 @@ void screen::forceDPMSOff() {
TDEProcess *xset = new TDEProcess;
*xset << "xset" << "dpms" << "force" << "off";
- connect(xset, TQT_SIGNAL(processExited(TDEProcess*)),
- this, TQT_SLOT(cleanProcess(TDEProcess*)));
+ connect(xset, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(cleanProcess(TDEProcess*)));
if(!xset->start())
{
delete xset;
diff --git a/src/screen.h b/src/screen.h
index eb45fb4..9bd23b0 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -20,21 +20,14 @@
#ifndef SCREEN_H
#define SCREEN_H
-/* this is needed to avoid typedef clash with X11/Xmd.h (X11/Xproto.h)
- */
-#ifndef TQT_CLEAN_NAMESPACE
-#define TQT_CLEAN_NAMESPACE
-#endif
-
// KDE Header
#include <dcopref.h>
-#include <kprocess.h>
+#include <tdeprocess.h>
#include <tdelocale.h>
-// QT Header
+// TQt Header
#include <tqstring.h>
#include <tqwidget.h>
-//#include <tqvector.h>
#include <tqtimer.h>
#include <tqevent.h>
@@ -55,7 +48,7 @@
*/
class screen : public TQWidget
{
- Q_OBJECT
+ TQ_OBJECT
private:
diff --git a/src/settings.cpp b/src/settings.cpp
index 4fc92a1..c1a04d0 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -24,10 +24,14 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// KDE Header
#include <tdelocale.h>
-// QT Header
+// TQt Header
// own headers
#include "settings.h"
@@ -296,13 +300,15 @@ bool Settings::load_general_settings(){
powerButtonActionValue = tdeconfig->readNumEntry("ActionOnPowerButtonValue", -1);
}
- sleepButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnSleepButton",""));
- if ((sleepButtonAction != GO_SUSPEND2RAM) && (sleepButtonAction != GO_SUSPEND2DISK) && (sleepButtonAction != GO_FREEZE)) {
+ sleepButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnSuspendButton",""));
+ if ((sleepButtonAction != GO_SUSPEND2RAM) && (sleepButtonAction != GO_SUSPEND2DISK) &&
+ (sleepButtonAction != GO_FREEZE) && (sleepButtonAction != GO_SUSPEND_HYBRID)) {
sleepButtonAction = NONE;
}
s2diskButtonAction = mapActionToType(tdeconfig->readEntry("ActionOnS2DiskButton",""));
- if ((s2diskButtonAction != GO_SUSPEND2RAM) && (s2diskButtonAction != GO_SUSPEND2DISK) && (s2diskButtonAction != GO_FREEZE)) {
+ if ((s2diskButtonAction != GO_SUSPEND2RAM) && (s2diskButtonAction != GO_SUSPEND2DISK) &&
+ (s2diskButtonAction != GO_FREEZE) && (s2diskButtonAction != GO_SUSPEND_HYBRID)) {
s2diskButtonAction = NONE;
}
@@ -327,6 +333,8 @@ action Settings::mapActionToType (TQString _action) {
return LOGOUT_DIALOG;
} else if (_action.startsWith("SUSPEND2DISK")) {
return GO_SUSPEND2DISK;
+ } else if (_action.startsWith("SUSPEND_HYBRID")) {
+ return GO_SUSPEND_HYBRID;
} else if (_action.startsWith("SUSPEND2RAM")) {
return GO_SUSPEND2RAM;
} else if (_action.startsWith("FREEZE")) {
diff --git a/src/settings.h b/src/settings.h
index b38cb2a..c860f17 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -28,7 +28,7 @@
// KDE - Header
#include <tdeconfig.h>
-// QT - Header
+// TQt - Header
#include <tqstring.h>
#include <tqstringlist.h>
@@ -47,7 +47,8 @@ enum action{
BRIGHTNESS,
CPUFREQ_POWERSAVE,
CPUFREQ_DYNAMIC,
- CPUFREQ_PERFORMANCE
+ CPUFREQ_PERFORMANCE,
+ GO_SUSPEND_HYBRID
};
/*!
diff --git a/src/suspenddialog.cpp b/src/suspenddialog.cpp
index 5431938..69d6683 100644
--- a/src/suspenddialog.cpp
+++ b/src/suspenddialog.cpp
@@ -24,11 +24,15 @@
* \date 2005
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// KDE - Headers
#include <tdelocale.h>
#include <kiconloader.h>
- // QT - Headers
+ // TQt - Headers
#include <tqdialog.h>
#include <tqlabel.h>
#include <tqstring.h>
@@ -58,7 +62,9 @@ suspendDialog::~suspendDialog()
void suspendDialog::setPixmap( TQString type )
{
TQPixmap pixmap = 0;
- if(type.startsWith("suspend2disk")){// || type.startsWith("NULL")) {
+ if(type.startsWith("suspend2disk")){
+ pixmap = TDEGlobal::iconLoader()->loadIcon("suspend_to_disk", TDEIcon::NoGroup, TDEIcon::SizeLarge);
+ } else if(type.startsWith("suspend_hybrid")){
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);
diff --git a/src/suspenddialog.h b/src/suspenddialog.h
index 096c9c6..cd80d0b 100644
--- a/src/suspenddialog.h
+++ b/src/suspenddialog.h
@@ -35,7 +35,7 @@
class suspendDialog: public suspend_Dialog {
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/src/tdepowersave-autostart.desktop b/src/tdepowersave-autostart.desktop
index 20cf6e0..3e4bb75 100644
--- a/src/tdepowersave-autostart.desktop
+++ b/src/tdepowersave-autostart.desktop
@@ -1,68 +1,16 @@
[Desktop Entry]
-Encoding=UTF-8
-Name=tdepowersave
-Name[xx]=xxtdepowersavexx
-Name[de]=TDEPowersave
-Name[es]=TDEPowersave
-Name[fr]=TDEPowersave
-Name[it]=TDEPowersave
-Name[ja]=TDEPowersave
-Name[pt_BR]=TDEPowersave
-Name[ru]=TDEPowersave
-Name[sv]=TDEPowersave
-Name[zh_CN]=TDEPowersave
-Name[zh_TW]=TDEPowersave
+Name=TDEPowersave
+
GenericName=Battery Monitor
-Exec=tdepowersave
-Icon=tdepowersave
-Type=Application
+
Comment=Battery monitor and general power management
-Comment[bg]=Монитор за батерията и основно управление на енергията
-GenericName[bg]=Монитор за батерията
-Comment[cs]=Sledování stavu baterií a správa napájení
-GenericName[cs]=Monitor baterie
-GenericName[de]=Akkuüberwachung
-Comment[de]=Akkuüberwachung und allgemeine Energieverwaltung
-GenericName[el]=Παρακολούθηση Μπαταρίας
-GenericName[es]=Monitor de carga de la batería
-Comment[es]=Monitor de batería y gestión general de la energía
-Comment[fi]=Akkumonitori ja yleinen virranhallinta
-GenericName[fi]=Akkumonitori
-Comment[fr]=Moniteur de batterie et gestion de l'alimentation
-GenericName[fr]=Moniteur de batterie
-GenericName[hu]=Akkumulátorfigyelő
-Comment[it]=Monitor della batteria e gestione generale dell'alimentazione
-GenericName[it]=Monitor della batteria
-Comment[km]=កមមវធ<200b>តរតពនតយ<200b>ថម នង គរបគរង<200b>ថាមពល<200b>ទទៅ
-GenericName[km]=កមមវធ<200b>តរតពនតយ<200b>ថម
-Comment[nb]=Batteriovervåking og generell strømstyring
-GenericName[nb]=Batteriovervåker
-GenericName[nl]=Batterijmonitor
-GenericName[ja]=バッテリモニタ
-Comment[ja]=バッテリモニタと一般電源管理
-Name[pa]=ਕ-ਊਰਜਾ ਸਭਾਲ
-GenericName[pa]=ਬਟਰੀ ਦਰਸ਼ਕ
-Comment[pl]=Monitor stanu baterii i ogólne zarządzanie energią
-GenericName[pl]=Monitor baterii
-Comment[pt]=Monitor de bateria e gestor global de energia
-GenericName[pt]=Monitor de Bateria
-Comment[pt_BR]=Monitor de Bateria e Gerenciamento de Energia Geral
-GenericName[pt_BR]=Monitor de Bateria
-GenericName[ru]=Монитор Батареи
-Comment[ru]=Монитор батареи и управление энергосбережением
-GenericName[sv]=Batteriövervakare
-GenericName[tr]=Pil durumu izleme ve güç yönetimi arayüzü
-Comment[tr]=Pil durumu izleme ve güç yönetimi arayüzü
-Comment[uk]=Монітор стану батареї і загальне керування живленням
-GenericName[uk]=Монітор батарей
-Comment[xx]=xxBattery monitor and general power managementxx
-GenericName[zh_CN]=电池监视器
-Comment[zh_CN]=电池监视器和常规电源管理
-GenericName[zh_TW]=電池監視器
-Comment[zh_TW]=電池監視器和一般電源管理
+
+Type=Application
+Icon=tdepowersave
+Exec=tdepowersave
+Encoding=UTF-8
+Categories=System;Applet;
X-TDE-autostart-after=panel
+X-TDE-autostart-condition=tdepowersaverc:General:Autostart:true
X-TDE-StartupNotify=false
X-TDE-UniqueApplet=true
-X-TDE-autostart-condition=tdepowersaverc:General:Autostart:true
-Categories=System;Applet;
-
diff --git a/src/tdepowersave.cpp b/src/tdepowersave.cpp
index e3f6ce5..a08e8de 100644
--- a/src/tdepowersave.cpp
+++ b/src/tdepowersave.cpp
@@ -19,6 +19,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <math.h>
+
// KDE headers:
#include <tdeaboutapplication.h>
#include <tdeapplication.h>
@@ -30,7 +36,7 @@
#include <knotifydialog.h>
#include <kpassivepopup.h>
#include <tdepopupmenu.h>
-#include <kglobalaccel.h>
+#include <tdeglobalaccel.h>
#include <khelpmenu.h>
// other TQt headers:
@@ -75,12 +81,12 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
config->writeEntry("AlreadyStarted", true);
// check whether APM, ACPI, PMU, CPUFreq or Suspend2Disk/ram supported, otherwise end up
// and don't start tdepowersave ever again until force_acpi_check == true.
- if (!hwinfo->hasACPI() && !hwinfo->hasAPM() && !hwinfo->hasPMU() &&
- !hwinfo->supportCPUFreq() && !suspend.suspend2disk && !suspend.suspend2ram){
+ if (!hwinfo->hasACPI() && !hwinfo->hasAPM() && !hwinfo->hasPMU() && !hwinfo->supportCPUFreq() &&
+ !suspend.suspend2disk && !suspend.suspend2ram && !suspend.suspend_hybrid) {
config->writeEntry("Autostart", false);
config->sync();
- kdError() << "This machine does not support ACPI, APM, PMU, CPUFreq, Suspend2Disk nor "
- << "Suspend2RAM. Please close tdepowersave now." << endl;
+ kdError() << "This machine does not support ACPI, APM, PMU, CPUFreq, Suspend2Disk, "
+ << "Suspend2RAM nor Hybrid Suspend. Please close tdepowersave now." << endl;
exit(-1);
}
}
@@ -97,33 +103,33 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
settings->batteryCriticalLevel);
// connect to signals for changes
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(update()));
- connect(hwinfo, TQT_SIGNAL(primaryBatteryChanged()), this, TQT_SLOT(update()));
- connect(hwinfo, TQT_SIGNAL(ACStatus(bool)), this, TQT_SLOT(handleACStatusChange (bool)));
- connect(hwinfo, TQT_SIGNAL(resumed(int)), this, TQT_SLOT(forwardResumeSignal(int)));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(update()));
+ connect(hwinfo, TQ_SIGNAL(primaryBatteryChanged()), this, TQ_SLOT(update()));
+ connect(hwinfo, TQ_SIGNAL(ACStatus(bool)), this, TQ_SLOT(handleACStatusChange (bool)));
+ connect(hwinfo, TQ_SIGNAL(resumed(int)), this, TQ_SLOT(forwardResumeSignal(int)));
// connect to error messages
- connect(autoSuspend, TQT_SIGNAL(displayErrorMsg(TQString)), this, TQT_SLOT(showErrorMessage(TQString)));
+ connect(autoSuspend, TQ_SIGNAL(displayErrorMsg(TQString)), this, TQ_SLOT(showErrorMessage(TQString)));
// connect to events
- connect(hwinfo, TQT_SIGNAL(lidclosetStatus(bool)), this, TQT_SLOT(handleLidEvent(bool)));
- connect(hwinfo, TQT_SIGNAL(powerButtonPressed()), this, TQT_SLOT (handlePowerButtonEvent()));
- connect(hwinfo, TQT_SIGNAL(sleepButtonPressed()), this, TQT_SLOT (handleSleepButtonEvent()));
- connect(hwinfo, TQT_SIGNAL(s2diskButtonPressed()), this, TQT_SLOT (handleS2DiskButtonEvent()));
- connect(hwinfo, TQT_SIGNAL(batteryWARNState(int,int)), this, TQT_SLOT(notifyBatteryStatusChange (int,int)));
- connect(hwinfo, TQT_SIGNAL(desktopSessionIsActive(bool)), this, TQT_SLOT (handleSessionState(bool)));
- connect(autoSuspend, TQT_SIGNAL(inactivityTimeExpired()), this, TQT_SLOT(do_autosuspendWarn()));
- connect(autoDimm, TQT_SIGNAL(inactivityTimeExpired()), this, TQT_SLOT(do_downDimm()));
- connect(autoDimm, TQT_SIGNAL(UserIsActiveAgain()), this, TQT_SLOT(do_upDimm()));
+ connect(hwinfo, TQ_SIGNAL(lidclosetStatus(bool)), this, TQ_SLOT(handleLidEvent(bool)));
+ connect(hwinfo, TQ_SIGNAL(powerButtonPressed()), this, TQ_SLOT (handlePowerButtonEvent()));
+ connect(hwinfo, TQ_SIGNAL(sleepButtonPressed()), this, TQ_SLOT (handleSuspendButtonEvent()));
+ connect(hwinfo, TQ_SIGNAL(s2diskButtonPressed()), this, TQ_SLOT (handleS2DiskButtonEvent()));
+ connect(hwinfo, TQ_SIGNAL(batteryWARNState(int,int)), this, TQ_SLOT(notifyBatteryStatusChange (int,int)));
+ connect(hwinfo, TQ_SIGNAL(desktopSessionIsActive(bool)), this, TQ_SLOT (handleSessionState(bool)));
+ connect(autoSuspend, TQ_SIGNAL(inactivityTimeExpired()), this, TQ_SLOT(do_autosuspendWarn()));
+ connect(autoDimm, TQ_SIGNAL(inactivityTimeExpired()), this, TQ_SLOT(do_downDimm()));
+ connect(autoDimm, TQ_SIGNAL(UserIsActiveAgain()), this, TQ_SLOT(do_upDimm()));
// connect to hotkeys
- m_globalAccel = new TDEGlobalAccel( TQT_TQOBJECT(this) );
+ m_globalAccel = new TDEGlobalAccel( this );
m_globalAccel->insert( "Power button", i18n( "Execute configured power button action"), TQString(),
- TDEShortcut(TQString("XF86PowerOff")), TDEShortcut(TQString("XF86PowerOff")), TQT_TQOBJECT(this), TQT_SLOT( handlePowerButtonEvent() ) );
- m_globalAccel->insert( "Sleep button", i18n( "Sleep configured power button action"), TQString(),
- TDEShortcut(TQString("XF86Sleep")), TDEShortcut(TQString("XF86Sleep")), TQT_TQOBJECT(this), TQT_SLOT( handleSleepButtonEvent() ) );
+ TDEShortcut(TQString("XF86PowerOff")), TDEShortcut(TQString("XF86PowerOff")), this, TQ_SLOT( handlePowerButtonEvent() ) );
+ m_globalAccel->insert( "Suspend button", i18n( "Suspend configured power button action"), TQString(),
+ TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), this, TQ_SLOT( handleSuspendButtonEvent() ) );
m_globalAccel->insert( "Hibernate button", i18n( "Hibernate configured power button action"), TQString(),
- TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), TQT_TQOBJECT(this), TQT_SLOT( handleS2DiskButtonEvent() ) );
+ TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), this, TQ_SLOT( handleS2DiskButtonEvent() ) );
m_globalAccel->readSettings();
m_globalAccel->updateConnections();
@@ -142,9 +148,10 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
suspendType = "NULL";
BAT_WARN_ICON_Timer = new TQTimer(this);
- connect(BAT_WARN_ICON_Timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(do_setIconBG()));
+ connect(BAT_WARN_ICON_Timer, TQ_SIGNAL(timeout()), this, TQ_SLOT(do_setIconBG()));
- AUTODIMM_Timer = new TQTimer(this);
+ m_autoDimmTimer = new TQTimer(this);
+ connect(m_autoDimmTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(do_dimm()));
initMenu();
update();
@@ -163,6 +170,7 @@ tdepowersave::~tdepowersave(){
delete display;
delete settings;
delete autoSuspend;
+ delete m_autoDimmTimer;
#ifdef ENABLE_YAST_ENTRY
delete yast2;
#endif
@@ -176,29 +184,27 @@ void tdepowersave::initMenu() {
CONFIGURE_ID = this->contextMenu()->insertItem(SmallIcon("configure", TQIconSet::Automatic),
i18n("Configure TDEPowersave..."),
- this, TQT_SLOT(showConfigureDialog()));
+ this, TQ_SLOT(showConfigureDialog()));
CONFIGURE_EVENTS_ID = this->contextMenu()->insertItem(SmallIcon("knotify", TQIconSet::Automatic),
i18n("Configure Notifications..."),
- this, TQT_SLOT(showConfigureNotificationsDialog()));
+ this, TQ_SLOT(showConfigureNotificationsDialog()));
#ifdef ENABLE_YAST_ENTRY
YAST_MODULE_MENU_ID = this->contextMenu()->insertItem(SmallIcon("yast", TQIconSet::Automatic),
i18n("Start YaST2 Power Management Module..."),
- this, TQT_SLOT(do_config()));
+ this, TQ_SLOT(do_config()));
#endif
SLEEP_SEPARATOR_MENU_ID = this->contextMenu()->insertSeparator();
- SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
- TQIconSet::Automatic),
- i18n("Suspend to Disk"), this,
- TQT_SLOT(do_suspend2disk()));
- SUSPEND2RAM_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram",
- 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()));
+ i18n("Freeze"), this, TQ_SLOT(do_freeze()));
STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", TQIconSet::Automatic),
- i18n("Standby"), this, TQT_SLOT(do_standby()));
+ i18n("Standby"), this, TQ_SLOT(do_standby()));
+ SUSPEND2RAM_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram",
+ TQIconSet::Automatic), i18n("Suspend"), this, TQ_SLOT(do_suspend2ram()));
+ SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
+ TQIconSet::Automatic), i18n("Hibernate"), this, TQ_SLOT(do_suspend2disk()));
+ SUSPEND_HYBRID_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
+ TQIconSet::Automatic), i18n("Hybrid Suspend"), this, TQ_SLOT(do_suspend_hybrid()));
speed_menu = new TQPopupMenu(this, i18n("Set CPU Frequency Policy").utf8());
speed_menu->insertItem(i18n("Performance"), PERFORMANCE);
@@ -208,21 +214,21 @@ void tdepowersave::initMenu() {
CPUFREQ_SEPARATOR_MENU_ID = contextMenu()->insertSeparator();
CPUFREQ_MENU_ID = contextMenu()->insertItem(i18n("Set CPU Frequency Policy"), speed_menu);
- connect(speed_menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(do_setSpeedPolicy(int)));
- connect(hwinfo, TQT_SIGNAL(currentCPUFreqPolicyChanged()), this, TQT_SLOT(updateCPUFreqMenu()));
+ connect(speed_menu, TQ_SIGNAL(activated(int)), this, TQ_SLOT(do_setSpeedPolicy(int)));
+ connect(hwinfo, TQ_SIGNAL(currentCPUFreqPolicyChanged()), this, TQ_SLOT(updateCPUFreqMenu()));
SCHEME_SEPARATOR_MENU_ID = contextMenu()->insertSeparator();
scheme_menu = new TQPopupMenu(this, i18n("Set Active Scheme").utf8());
SCHEME_MENU_ID = contextMenu()->insertItem(i18n("Set Active Scheme"), scheme_menu);
- connect(scheme_menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(do_setActiveScheme(int)));
+ connect(scheme_menu, TQ_SIGNAL(activated(int)), this, TQ_SLOT(do_setActiveScheme(int)));
// menu entry for the autosuspend disable checkbox, disabled by default, only
// displayed if autosuspend for the current scheme is activated
AUTOSUSPEND_SEPARATOR_MENU_ID = contextMenu()->insertSeparator();
AUTOSUSPEND_MENU_ID = this->contextMenu()->insertItem( i18n("Disable Actions on Inactivity"),
- this,TQT_SLOT(do_setAutosuspend()));
+ this,TQ_SLOT(do_setAutosuspend()));
this->contextMenu()->setItemVisible(AUTOSUSPEND_SEPARATOR_MENU_ID, false);
this->contextMenu()->setItemVisible(AUTOSUSPEND_MENU_ID, false);
@@ -231,10 +237,10 @@ void tdepowersave::initMenu() {
// Create help submenu
KHelpMenu *m_help = new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection());
TDEPopupMenu *help = m_help->menu();
- help->connectItem(KHelpMenu::menuHelpContents, this, TQT_SLOT(slotHelpContents()));
+ help->connectItem(KHelpMenu::menuHelpContents, this, TQ_SLOT(slotHelpContents()));
this->contextMenu()->insertItem(SmallIcon("help"), KStdGuiItem::help().text(), help);
- connect(this, TQT_SIGNAL(quitSelected()), this, TQT_SLOT(_quit()));
+ connect(this, TQ_SIGNAL(quitSelected()), this, TQ_SLOT(_quit()));
kdDebugFuncOut(trace);
}
@@ -280,9 +286,9 @@ void tdepowersave::showConfigureDialog() {
configDlg = new ConfigureDialog(config, hwinfo, settings);
configDlg->show();
config_dialog_shown = true;
- connect(configDlg, TQT_SIGNAL(destroyed()), this, TQT_SLOT(observeConfigDlg()));
- connect(configDlg, TQT_SIGNAL(openHelp()), this, TQT_SLOT(slotHelp()));
- connect(configDlg, TQT_SIGNAL(openKNotify()), this, TQT_SLOT(showConfigureNotificationsDialog()));
+ connect(configDlg, TQ_SIGNAL(destroyed()), this, TQ_SLOT(observeConfigDlg()));
+ connect(configDlg, TQ_SIGNAL(openHelp()), this, TQ_SLOT(slotHelp()));
+ connect(configDlg, TQ_SIGNAL(openKNotify()), this, TQ_SLOT(showConfigureNotificationsDialog()));
}
else {
KPassivePopup::message(i18n("WARNING"), i18n("Cannot find any schemes."),
@@ -290,7 +296,7 @@ void tdepowersave::showConfigureDialog() {
i18n("Warning").utf8(), 15000);
}
} else {
- configDlg->setWindowState((configDlg->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
+ configDlg->setWindowState((configDlg->windowState() & ~TQt::WindowMinimized) | TQt::WindowActive);
configDlg->setActiveWindow();
}
@@ -514,7 +520,7 @@ void tdepowersave::updateTooltip(){
}
/*!
- * \b TQT_SLOT to starts the Yast2-power-management module. This called by the menuentry
+ * \b Slot to starts the Yast2-power-management module. This called by the menuentry
* with ID \ref YAST_MODULE_MENU_ID, named "Start YaST2 Power Management Module".
* It create a new TDEProcess and execute "/sbin/yast2 power-management" with tdesu.
*/
@@ -527,8 +533,8 @@ void tdepowersave::do_config(){
yast2 = new TDEProcess;
*yast2 << "tdesu" << "--nonewdcop" << "/sbin/yast2" << "power-management";
- connect(yast2, TQT_SIGNAL(processExited(TDEProcess *)),
- TQT_SLOT(slotConfigProcessExited(TDEProcess *)));
+ connect(yast2, TQ_SIGNAL(processExited(TDEProcess *)),
+ TQ_SLOT(slotConfigProcessExited(TDEProcess *)));
if(!yast2->start(TDEProcess::NotifyOnExit))
{
delete yast2;
@@ -543,15 +549,15 @@ void tdepowersave::do_config(){
}
/*!
- * \b TQT_SLOT to open the tdepowersave help
+ * \b Slot to open the tdepowersave help
*/
void tdepowersave::slotHelp()
{
- kapp->invokeHelp( "", "tdepowersave" );
+ tdeApp->invokeHelp( "", "tdepowersave" );
}
/*!
- * \b TQT_SLOT to open the tdepowersave About dialog
+ * \b Slot to open the tdepowersave About dialog
*/
void tdepowersave::slotAbout()
{
@@ -560,7 +566,7 @@ void tdepowersave::slotAbout()
}
/*!
- * \b TQT_SLOT to set the icon background on/off if battery is in critical, low or warning-state. Within
+ * \b Slot to set the icon background on/off if battery is in critical, low or warning-state. Within
* this function we set \ref icon_state_changed to true and call \ref redrawPixmap() to redraw the
* kickerapplet icon and create a icon with blinking background. \n \n
* The slot called by the TQTimer \ref BAT_WARN_ICON_Timer . The interval of the timer is defined
@@ -576,7 +582,7 @@ void tdepowersave::do_setIconBG(){
}
/*!
- * \b TQT_SLOT to enable/disable the autosuspend.
+ * \b Slot to enable/disable the autosuspend.
*/
void tdepowersave::do_setAutosuspend(){
kdDebugFuncIn(trace);
@@ -601,7 +607,7 @@ void tdepowersave::do_setAutosuspend(){
}
/*!
- * \b TQT_SLOT which called if the \ref configDlg is destroyed. We set within this SLOT
+ * \b Slot which called if the \ref configDlg is destroyed. We set within this slot
* \ref config_dialog_shown to false.
* TODO: check if we maybe should force here the current default scheme depending on the AC/battery state
*/
@@ -627,7 +633,7 @@ void tdepowersave::observeConfigDlg(){
}
/*!
- * \b TQT_SLOT which called from \ref do_config() if the 'tdesu yast2' TDEProcess exited.
+ * \b Slot which called from \ref do_config() if the 'tdesu yast2' TDEProcess exited.
* This function control the return value and display if needed a errormessage on failure.
*/
void tdepowersave::slotConfigProcessExited(TDEProcess *proc){
@@ -658,8 +664,8 @@ void tdepowersave::slotConfigProcessExited(TDEProcess *proc){
}
/*!
- * \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.
+ * \b 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 a messagebox.
* 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
@@ -691,7 +697,7 @@ bool tdepowersave::do_suspend2disk(){
kdDebugFuncOut(trace);
return true;
} else {
- KPassivePopup::message( i18n("WARNING"),i18n("Suspend to disk failed"),
+ KPassivePopup::message( i18n("WARNING"),i18n("Hibernation failed"),
SmallIcon("messagebox_warning", 20), this,
i18n("Warning").utf8(), 15000);
kdDebugFuncOut(trace);
@@ -699,7 +705,7 @@ bool tdepowersave::do_suspend2disk(){
}
} else {
KPassivePopup::message( i18n("WARNING"),
- i18n("Suspend to disk disabled by administrator."),
+ i18n("Hibernation disabled by administrator."),
SmallIcon("messagebox_warning", 20),
this, i18n("Warning").utf8(), 15000);
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
@@ -707,14 +713,70 @@ bool tdepowersave::do_suspend2disk(){
return false;
}
} else {
- kdWarning() << "This machine does not provide suspend to disk state" << endl;
+ kdWarning() << "This machine does not provide hibernation state" << endl;
kdDebugFuncOut(trace);
return false;
}
}
/*!
- * \b TQT_SLOT to send the command for "suspend to RAM" to the TDE hardware library.
+ * \b Slot to send the command for "hybrid suspend" to TDE hardware library.
+ * If there is a error while "hybrid suspend" the user get a messagebox.
+ * This function need a power management backend in TDE hardware library for "hybrid suspend".
+ * \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_suspend_hybrid(){
+ kdDebugFuncIn(trace);
+
+ if (suspend.suspend_hybrid) {
+ if (suspend.suspend_hybrid_allowed || suspend.suspend_hybrid_allowed == -1) {
+ calledSuspend = SUSPEND_HYBRID;
+ 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(SUSPEND_HYBRID);
+
+ if (ret) {
+ kdDebugFuncOut(trace);
+ return true;
+ } else {
+ KPassivePopup::message( i18n("WARNING"),i18n("Hybrid Suspend failed"),
+ SmallIcon("messagebox_warning", 20), this,
+ i18n("Warning").utf8(), 15000);
+ kdDebugFuncOut(trace);
+ return false;
+ }
+ } else {
+ KPassivePopup::message( i18n("WARNING"),
+ i18n("Hybrid Suspend disabled by administrator."),
+ SmallIcon("messagebox_warning", 20),
+ this, i18n("Warning").utf8(), 15000);
+ this->contextMenu()->setItemEnabled(SUSPEND_HYBRID_MENU_ID, false);
+ kdDebugFuncOut(trace);
+ return false;
+ }
+ } else {
+ kdWarning() << "This machine does not provide hybrid suspend state" << endl;
+ kdDebugFuncOut(trace);
+ return false;
+ }
+}
+
+/*!
+ * \b 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 a messagebox.
* This function need a power management backend in TDE hardware library for "suspend to RAM".
* \return boolean with the result of the operation
@@ -747,7 +809,7 @@ bool tdepowersave::do_suspend2ram(){
kdDebugFuncOut(trace);
return true;
} else {
- KPassivePopup::message( i18n("WARNING"),i18n("Suspend to RAM failed"),
+ KPassivePopup::message( i18n("WARNING"),i18n("Suspend mode failed"),
SmallIcon("messagebox_warning", 20), this,
i18n("Warning").utf8(), 15000);
kdDebugFuncOut(trace);
@@ -755,7 +817,7 @@ bool tdepowersave::do_suspend2ram(){
}
} else {
KPassivePopup::message( i18n("WARNING"),
- i18n("Suspend to RAM disabled by administrator."),
+ i18n("Suspend mode disabled by administrator."),
SmallIcon("messagebox_warning", 20), this,
i18n("Warning").utf8(), 15000);
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false);
@@ -763,14 +825,14 @@ bool tdepowersave::do_suspend2ram(){
return false;
}
} else {
- kdWarning() << "This machine does not provide suspend to ram state" << endl;
+ kdWarning() << "This machine does not provide Suspend state" << endl;
kdDebugFuncOut(trace);
return false;
}
}
/*!
- * \b TQT_SLOT to send the command for "freeze" to the TDE hardware library.
+ * \b 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
@@ -825,7 +887,7 @@ bool tdepowersave::do_freeze(){
}
/*!
- * \b TQT_SLOT to send the command for "stand-by" to the TDE hardware library.
+ * \b 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 power management backend in TDE hardware library for "stand-by".
* \return boolean with the result of the operation
@@ -880,7 +942,7 @@ bool tdepowersave::do_standby(){
}
/*!
- * \b TQT_SLOT to send check if we should display the warning dialog and display
+ * \b Slot to send check if we should display the warning dialog and display
* the dialog if needed or call directly autosuspend after the signal
* \ref autosuspend::inactivityTimeExpired was recieved.
*/
@@ -890,12 +952,17 @@ void tdepowersave::do_autosuspendWarn() {
// Verify that the desired suspend action is allowed before displaying the dialog
SuspendStates suspend = hwinfo->getSuspendSupport();
bool allowed = false;
- if(settings->autoInactiveAction == "Suspend to Disk") {
+ if(settings->autoInactiveAction == "Hibernate") {
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
allowed = true;
}
}
- else if (settings->autoInactiveAction == "Suspend to RAM") {
+ else if(settings->autoInactiveAction == "Hybrid Suspend") {
+ if ( suspend.suspend_hybrid && (suspend.suspend_hybrid_allowed || suspend.suspend_hybrid_allowed == -1)) {
+ allowed = true;
+ }
+ }
+ else if (settings->autoInactiveAction == "Suspend") {
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
allowed = true;
}
@@ -919,9 +986,11 @@ void tdepowersave::do_autosuspendWarn() {
countdown = new countDownDialog(settings->autoSuspendCountdownTimeout);
- if(settings->autoInactiveAction == "Suspend to Disk") {
+ if(settings->autoInactiveAction == "Hibernate") {
+ countdown->setPixmap("suspend2disk");
+ } else if(settings->autoInactiveAction == "Hybrid Suspend") {
countdown->setPixmap("suspend2disk");
- } else if (settings->autoInactiveAction == "Suspend to RAM") {
+ } else if (settings->autoInactiveAction == "Suspend") {
countdown->setPixmap("suspend2ram");
} else if (settings->autoInactiveAction == "Freeze") {
countdown->setPixmap("suspend2ram");
@@ -939,7 +1008,7 @@ void tdepowersave::do_autosuspendWarn() {
countdown->setMessageText(message);
- connect(countdown, TQT_SIGNAL(dialogClosed(bool)), this, TQT_SLOT(do_autosuspend(bool)));
+ connect(countdown, TQ_SIGNAL(dialogClosed(bool)), this, TQ_SLOT(do_autosuspend(bool)));
countdown->showDialog();
}
}
@@ -953,7 +1022,7 @@ void tdepowersave::do_autosuspendWarn() {
}
/*!
- * \b TQT_SLOT to send the related suspend command for autosuspend
+ * \b Slot to send the related suspend command for autosuspend
* \param cancel boolean with info if the autosuspend should get canceled
* \return boolean with the result of the operation
* \retval true if successful
@@ -963,8 +1032,6 @@ void tdepowersave::do_autosuspendWarn() {
*/
bool tdepowersave::do_autosuspend(bool cancel) {
kdDebugFuncIn(trace);
-
- // TODO: check if this is really needed, it get called also on the suspend methodes
autoSuspend->stop();
if (!cancel) {
@@ -974,9 +1041,11 @@ bool tdepowersave::do_autosuspend(bool cancel) {
}
if(settings->autoSuspend && !contextMenu()->isItemChecked(AUTOSUSPEND_MENU_ID)) {
- if(settings->autoInactiveAction == "Suspend to Disk") {
+ if(settings->autoInactiveAction == "Hibernate") {
return do_suspend2disk();
- } else if (settings->autoInactiveAction == "Suspend to RAM") {
+ } else if(settings->autoInactiveAction == "Hybrid Suspend") {
+ return do_suspend_hybrid();
+ } else if (settings->autoInactiveAction == "Suspend") {
return do_suspend2ram();
} else if (settings->autoInactiveAction == "Freeze") {
return do_freeze();
@@ -996,7 +1065,7 @@ bool tdepowersave::do_autosuspend(bool cancel) {
}
/*!
- * \b TQT_SLOT to dimm the display down to the configured level if the signal
+ * \b Slot to dimm the display down to the configured level if the signal
* \ref autodimm::inactivityTimeExpired was recieved.
* \param
* \return boolean with the result of the operation
@@ -1007,25 +1076,22 @@ void tdepowersave::do_downDimm() {
kdDebugFuncIn(trace);
if (hwinfo->supportBrightness()) {
- if (!AUTODIMM_Timer->isActive()) {
- int dimmToLevel = (int)((float)hwinfo->getMaxBrightnessLevel()*((float)settings->autoDimmTo/100.0));
+ if (!m_autoDimmTimer->isActive()) {
+ int dimmToLevel = (int)round(hwinfo->getMaxBrightnessLevel() * settings->autoDimmTo / 100.0);
// check if we really need to dimm down
if (dimmToLevel < hwinfo->getCurrentBrightnessLevel()) {
- int steps = hwinfo->getCurrentBrightnessLevel() - dimmToLevel;
- int timePerStep = (1500 / steps);
-
+ m_dimmRequestedLevel = dimmToLevel;
+ m_dimmStep = (hwinfo->getCurrentBrightnessLevel() - dimmToLevel) / 10 + 1;
+ m_dimmTimeoutCounter = 0;
autoDimmDown = true;
-
- AUTODIMM_Timer = new TQTimer(this);
- connect(AUTODIMM_Timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(do_dimm()));
- AUTODIMM_Timer->start(timePerStep, false);
+ m_autoDimmTimer->start(100, false);
} else {
kdWarning() << "Don't dimm down, current level is already lower than requested Level" << endl;
}
} else {
// wait until the timer is stopped, try later!
- TQTimer::singleShot(1500, this, TQT_SLOT(do_downDimm()));
+ TQTimer::singleShot(2000, this, TQ_SLOT(do_downDimm()));
}
}
@@ -1033,7 +1099,7 @@ void tdepowersave::do_downDimm() {
}
/*!
- * \b TQT_SLOT to dimm the display up to the configured level if the signal
+ * \b Slot to dimm the display up to the configured level if the signal
* \ref autodimm::UserIsActiveAgain was recieved.
* \param
* \return boolean with the result of the operation
@@ -1046,28 +1112,24 @@ void tdepowersave::do_upDimm() {
//NOTE we go back to the value of the scheme and not the last on, to reduce trouble with the scheme
if (hwinfo->supportBrightness()) {
- if (!AUTODIMM_Timer->isActive()) {
- int dimmToLevel = (int)((float)hwinfo->getMaxBrightnessLevel()*((float)settings->brightnessValue/100.0));
+ if (!m_autoDimmTimer->isActive()) {
+ int dimmToLevel = (int)round(hwinfo->getMaxBrightnessLevel() * settings->brightnessValue / 100.0);
// check if we really need to dimm up
if (dimmToLevel > hwinfo->getCurrentBrightnessLevel()) {
- int steps = dimmToLevel - hwinfo->getCurrentBrightnessLevel();
- int timePerStep = (750 / steps);
-
+ m_dimmRequestedLevel = dimmToLevel;
+ m_dimmStep = (dimmToLevel - hwinfo->getCurrentBrightnessLevel()) / 10 + 1;
+ m_dimmTimeoutCounter = 0;
autoDimmDown = false;
-
- AUTODIMM_Timer = new TQTimer(this);
- connect(AUTODIMM_Timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(do_dimm()));
- AUTODIMM_Timer->start(timePerStep, false);
-
- // start autodimm again
- setAutoDimm(false);
+ m_autoDimmTimer->start(100, false);
} else {
kdWarning() << "Don't dimm up, current level is already above requested Level" << endl;
}
+ // start autodimm again
+ setAutoDimm(false);
} else {
// wait until the timer is stopped, try later!
- TQTimer::singleShot(750, this, TQT_SLOT(do_downDimm()));
+ TQTimer::singleShot(2000, this, TQ_SLOT(do_downDimm()));
}
}
@@ -1076,7 +1138,7 @@ void tdepowersave::do_upDimm() {
/*!
- * \b TQT_SLOT to dimm the display down
+ * \b Slot to dimm the display down
* \return boolean with the result of the operation
* \retval true if successful
* \retval false else
@@ -1084,15 +1146,22 @@ void tdepowersave::do_upDimm() {
void tdepowersave::do_dimm() {
kdDebugFuncIn(trace);
+ if (m_dimmStep <= 0 || m_dimmTimeoutCounter > 30)
+ {
+ m_autoDimmTimer->stop();
+ return;
+ }
+
+ ++m_dimmTimeoutCounter;
int current = hwinfo->getCurrentBrightnessLevel();
if (autoDimmDown) {
// dimm the display down
- if (current > 0 &&
- current > ((int)((float)hwinfo->getMaxBrightnessLevel()*((float)settings->autoDimmTo/100.0))-1)) {
- hwinfo->setBrightness((current -1) , -1);
+ if (current > 0 && current > (m_dimmRequestedLevel * 1.005)) {
+ hwinfo->setBrightnessLevel(current - m_dimmStep);
} else {
- AUTODIMM_Timer->stop();
+ m_autoDimmTimer->stop();
+ m_dimmStep = 0;
// start checking if the user get active again
// NOTE: we start this here because the X-Server detect brightness changes as
@@ -1101,10 +1170,11 @@ void tdepowersave::do_dimm() {
}
} else {
// dimm the display up
- if (current < ((int)((float)hwinfo->getMaxBrightnessLevel()*((float)settings->brightnessValue/100.0))-1)) {
- hwinfo->setBrightness((current +1) , -1);
+ if (current < (m_dimmRequestedLevel * 0.995)) {
+ hwinfo->setBrightnessLevel(current + m_dimmStep);
} else {
- AUTODIMM_Timer->stop();
+ m_autoDimmTimer->stop();
+ m_dimmStep = 0;
}
}
@@ -1208,7 +1278,7 @@ void tdepowersave::handlePowerButtonEvent( ) {
/*!
* Handle the event for the suspend2ram/sleep button and call the related action.
*/
-void tdepowersave::handleSleepButtonEvent() {
+void tdepowersave::handleSuspendButtonEvent() {
kdDebugFuncIn(trace);
// Only go to suspend on button event if we already resumed successful.
@@ -1234,7 +1304,7 @@ void tdepowersave::handleS2DiskButtonEvent() {
}
/*!
- * \b TQT_SLOT to handle the lidclose event. If the screen get locked
+ * \b Slot to handle the lidclose event. If the screen get locked
* depends on the user specific settings.
* \param closed boolean with info if the lid is closed or not
*/
@@ -1292,7 +1362,7 @@ void tdepowersave::handleLidEvent( bool closed ){
}
/*!
- * \b TQT_SLOT to show the login dialog if the desktop was locked before the suspend.
+ * \b Slot to show the login dialog if the desktop was locked before the suspend.
*/
void tdepowersave::activateLoginScreen(){
kdDebugFuncIn(trace);
@@ -1302,14 +1372,14 @@ void tdepowersave::activateLoginScreen(){
settings->load_general_settings();
if(settings->timeToFakeKeyAfterLock >= 0) {
- TQTimer::singleShot(settings->timeToFakeKeyAfterLock, display, TQT_SLOT(fakeShiftKeyEvent()));
+ TQTimer::singleShot(settings->timeToFakeKeyAfterLock, display, TQ_SLOT(fakeShiftKeyEvent()));
}
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT to set the current suspend type for later use.
+ * \b Slot to set the current suspend type for later use.
*/
void tdepowersave::setSuspendType( TQString suspendtype){
kdDebugFuncIn(trace);
@@ -1320,7 +1390,7 @@ void tdepowersave::setSuspendType( TQString suspendtype){
}
/*!
- * \b TQT_SLOT which called if tdepowersave is exited by the user. In this case the user
+ * \b Slot which called if tdepowersave is exited by the user. In this case the user
* is asked through a yes/no box if "tdepowersave start automatically on log in" and the
* result is written to the KDE configfile.
*/
@@ -1365,7 +1435,7 @@ void tdepowersave::_quit (){
}
/*!
- * \b TQT_SLOT called if the user select a 'CPU Frequency Policy' from the menu ( \ref CPUFREQ_MENU_ID ).
+ * \b Slot called if the user select a 'CPU Frequency Policy' from the menu ( \ref CPUFREQ_MENU_ID ).
*/
void tdepowersave::do_setSpeedPolicy(int menu_id){
if (trace) kdDebug() << funcinfo << "IN: " << "menu_id/set policy to: " << menu_id << endl;
@@ -1383,7 +1453,7 @@ void tdepowersave::do_setSpeedPolicy(int menu_id){
}
/*!
- * \b TQT_SLOT called if the user select a scheme from the menu. If there is any errormessage
+ * \b Slot called if the user select a scheme from the menu. If there is any errormessage
* while try to set the selected scheme, the user get a messagebox with info.
*/
void tdepowersave::do_setActiveScheme( int i ){
@@ -1424,10 +1494,11 @@ void tdepowersave::update(){
redraw_pixmap = 1;
}
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(SUSPEND2RAM_MENU_ID, false);
+ this->contextMenu()->setItemVisible(SUSPEND2DISK_MENU_ID, false);
+ this->contextMenu()->setItemVisible(SUSPEND_HYBRID_MENU_ID, false);
this->contextMenu()->setItemVisible(SLEEP_SEPARATOR_MENU_ID, false);
this->contextMenu()->setItemVisible(SCHEME_SEPARATOR_MENU_ID, false);
this->contextMenu()->setItemVisible(SCHEME_MENU_ID, false);
@@ -1447,10 +1518,11 @@ void tdepowersave::update(){
hwinfo->update_info_cpufreq_policy_changed = true;
suspend = hwinfo->getSuspendSupport();
}
- 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(SUSPEND2RAM_MENU_ID, true);
+ this->contextMenu()->setItemVisible(SUSPEND2DISK_MENU_ID, true);
+ this->contextMenu()->setItemVisible(SUSPEND_HYBRID_MENU_ID, true);
this->contextMenu()->setItemVisible(SLEEP_SEPARATOR_MENU_ID, true);
this->contextMenu()->setItemVisible(SCHEME_SEPARATOR_MENU_ID, true);
this->contextMenu()->setItemVisible(SCHEME_MENU_ID, true);
@@ -1468,6 +1540,16 @@ void tdepowersave::update(){
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
}
+ if (suspend.suspend_hybrid && (suspend.suspend_hybrid_allowed ||
+ suspend.suspend_hybrid_allowed == -1)) {
+ this->contextMenu()->setItemEnabled(SUSPEND_HYBRID_MENU_ID, true);
+ } else {
+ if (!suspend.suspend_hybrid)
+ this->contextMenu()->setItemVisible(SUSPEND_HYBRID_MENU_ID, false);
+ else
+ this->contextMenu()->setItemEnabled(SUSPEND_HYBRID_MENU_ID, false);
+ }
+
if (suspend.suspend2ram && (suspend.suspend2ram_allowed ||
suspend.suspend2ram_allowed == -1)) {
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, true);
@@ -1683,7 +1765,7 @@ void tdepowersave::wheelEvent (TQWheelEvent *qwe)
if (!hwinfo->supportBrightness() && settings->brightness)
return;
- if (qwe->orientation () == Qt::Vertical) {
+ if (qwe->orientation () == TQt::Vertical) {
if (qwe->delta() > 0) {
do_brightnessUp(5);
} else {
@@ -1705,10 +1787,10 @@ void tdepowersave::mousePressEvent(TQMouseEvent *qme){
KSystemTray::mousePressEvent(qme);
if (hwinfo->isOnline()) {
- if (qme->button() == Qt::RightButton){
+ if (qme->button() == TQt::RightButton){
// TODO check if maybe some rechecks needed
this->contextMenu()->exec(TQCursor::pos());
- } else if (qme->button() == Qt::LeftButton) {
+ } else if (qme->button() == TQt::LeftButton) {
showDetailedDialog();
}
}
@@ -1717,7 +1799,7 @@ void tdepowersave::mousePressEvent(TQMouseEvent *qme){
}
/*!
- * \b TQT_SLOT called if the detaileddialog is closed. With this we prevent open
+ * \b Slot called if the detaileddialog is closed. With this we prevent open
* the dialog twice, use this function to reset the used variables.
*/
void tdepowersave::closedetaileddialog() {
@@ -1725,7 +1807,7 @@ void tdepowersave::closedetaileddialog() {
}
/*!
- * \b TQT_SLOT used to display messeges in tdepowersave. This function
+ * \b Slot used to display messeges in tdepowersave. This function
* block all messeges which we have in tdepowersave!
*/
void tdepowersave::showErrorMessage( TQString msg ){
@@ -1735,7 +1817,7 @@ void tdepowersave::showErrorMessage( TQString msg ){
KPassivePopup::message("tdepowersave", msg, SmallIcon("messagebox_warning", 20),
this, i18n("Warning").utf8(), 10000);
} else {
- kapp->updateUserTimestamp();
+ tdeApp->updateUserTimestamp();
// KMessageBox::error( 0, msg);
KMessageBox::queuedMessageBox(0, KMessageBox::Error, msg);
}
@@ -1848,7 +1930,7 @@ void tdepowersave::setSchemeSettings(){
// --> set brightness settings
if(settings->brightness && hwinfo->supportBrightness()) {
// set to given values
- hwinfo->setBrightness (-1, settings->brightnessValue);
+ hwinfo->setBrightnessPercentage(settings->brightnessValue);
}
// --> set CPU Freq settings
@@ -1860,7 +1942,7 @@ void tdepowersave::setSchemeSettings(){
}
/*!
- * \b TQT_SLOT which called to set and start the autosuspend monitoring.
+ * \b Slot which called to set and start the autosuspend monitoring.
* \param resumed boolean value which represent information if machine
* currently back from suspend/standby
*/
@@ -1870,12 +1952,17 @@ void tdepowersave::setAutoSuspend( bool resumed ){
// Verify that the desired suspend action is allowed before enabling autosuspend
SuspendStates suspend = hwinfo->getSuspendSupport();
bool allowed = false;
- if(settings->autoInactiveAction == "Suspend to Disk") {
+ if(settings->autoInactiveAction == "Hibernate") {
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
allowed = true;
}
}
- else if (settings->autoInactiveAction == "Suspend to RAM") {
+ else if(settings->autoInactiveAction == "Hybrid Suspend") {
+ if ( suspend.suspend_hybrid && (suspend.suspend_hybrid_allowed || suspend.suspend_hybrid_allowed == -1)) {
+ allowed = true;
+ }
+ }
+ else if (settings->autoInactiveAction == "Suspend") {
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
allowed = true;
}
@@ -1905,7 +1992,7 @@ void tdepowersave::setAutoSuspend( bool resumed ){
autoSuspend->stop();
delete autoSuspend;
autoSuspend = new autosuspend(display);
- connect(autoSuspend, TQT_SIGNAL(inactivityTimeExpired()), this, TQT_SLOT(do_autosuspendWarn()));
+ connect(autoSuspend, TQ_SIGNAL(inactivityTimeExpired()), this, TQ_SLOT(do_autosuspendWarn()));
}
if (settings->autoSuspendCountdown && (settings->autoSuspendCountdownTimeout > 0)) {
@@ -1938,7 +2025,7 @@ void tdepowersave::setAutoSuspend( bool resumed ){
}
/*!
- * \b TQT_SLOT which called to set and start the autodimm monitoring.
+ * \b Slot which called to set and start the autodimm monitoring.
* \param resumed boolean value which represent information if machine
* currently back from suspend/standby
*/
@@ -1955,8 +2042,8 @@ void tdepowersave::setAutoDimm( bool resumed ){
autoDimm->stop();
delete autoDimm;
autoDimm = new autodimm(display);
- connect(autoDimm, TQT_SIGNAL(inactivityTimeExpired()), this, TQT_SLOT(do_downDimm()));
- connect(autoDimm, TQT_SIGNAL(UserIsActiveAgain()), this, TQT_SLOT(do_upDimm()));
+ connect(autoDimm, TQ_SIGNAL(inactivityTimeExpired()), this, TQ_SLOT(do_downDimm()));
+ connect(autoDimm, TQ_SIGNAL(UserIsActiveAgain()), this, TQ_SLOT(do_upDimm()));
}
if (settings->autoDimmSBlistEnabled) {
@@ -1976,7 +2063,7 @@ void tdepowersave::setAutoDimm( bool resumed ){
// -------- start KNotify functions ------------- //
/*!
- * \b TQT_SLOT called if a battery warning state reached and related signal recieved.
+ * \b Slot called if a battery warning state reached and related signal recieved.
* Here we emit the related KNotify event, if not disabled.
* \param type integer with the type of the battery
* \param state integer represent the reached battery state
@@ -2033,7 +2120,7 @@ void tdepowersave::notifyBatteryStatusChange ( int type, int state ) {
"will go shutdown in 30 seconds")
.arg(min/ 60).arg(min%60));
- TQTimer::singleShot(30000, this, TQT_SLOT(handleCriticalBatteryActionCall()));
+ TQTimer::singleShot(30000, this, TQ_SLOT(handleCriticalBatteryActionCall()));
} else {
if (!settings->disableNotifications)
KNotifyClient::event(this->winId(), "battery_critical_event",
@@ -2111,16 +2198,19 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
}
break;
case GO_SUSPEND2RAM:
- TQTimer::singleShot(100, this, TQT_SLOT(do_suspend2ram()));
+ TQTimer::singleShot(100, this, TQ_SLOT(do_suspend2ram()));
break;
case GO_SUSPEND2DISK:
- TQTimer::singleShot(100, this, TQT_SLOT(do_suspend2disk()));
+ TQTimer::singleShot(100, this, TQ_SLOT(do_suspend2disk()));
+ break;
+ case GO_SUSPEND_HYBRID:
+ TQTimer::singleShot(100, this, TQ_SLOT(do_suspend_hybrid()));
break;
case GO_FREEZE:
- TQTimer::singleShot(100, this, TQT_SLOT(do_freeze()));
+ TQTimer::singleShot(100, this, TQ_SLOT(do_freeze()));
break;
case BRIGHTNESS:
- hwinfo->setBrightness( -1, value );
+ hwinfo->setBrightnessPercentage(value);
break;
case CPUFREQ_POWERSAVE:
hwinfo->setCPUFreq( POWERSAVE );
@@ -2162,7 +2252,7 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
}
/*!
- * \b TQT_SLOT called if ac stated changed. Here we emit the related KNotify event.
+ * \b Slot called if ac stated changed. Here we emit the related KNotify event.
* and switch to the AC/battery scheme depending on the state of AC
* \param acstate boolean represent the state of AC (true == AC plugged in ...)
*/
@@ -2200,7 +2290,7 @@ void tdepowersave::handleACStatusChange ( bool acstate , bool notifyEvent ) {
}
/*!
- * \b TQT_SLOT called if scheme switched. Here we emit the related KNotify events
+ * \b Slot called if scheme switched. Here we emit the related KNotify events
* if they are not disabled.
*/
void tdepowersave::notifySchemeSwitch() {
@@ -2224,7 +2314,7 @@ void tdepowersave::notifySchemeSwitch() {
}
/*!
- * \b TQT_SLOT called if the machine suspend. Here we emit the related KNotify events
+ * \b Slot called if the machine suspend. Here we emit the related KNotify events
* if they are not disabled.
*/
void tdepowersave::notifySuspend( int suspendType ) {
@@ -2235,22 +2325,27 @@ void tdepowersave::notifySuspend( int suspendType ) {
case SUSPEND2DISK:
KNotifyClient::event( this->winId(), "suspend2disk_event",
i18n("System is going into %1 now.").
- arg(i18n("Suspend to Disk")));
+ arg(i18n("hibernation")));
+ break;
+ case SUSPEND_HYBRID:
+ KNotifyClient::event( this->winId(), "suspend_hybrid_event",
+ i18n("System is going into %1 now.").
+ arg(i18n("hybrid suspension")));
break;
case SUSPEND2RAM:
KNotifyClient::event( this->winId(), "suspend2ram_event",
i18n("System is going into %1 now.").
- arg(i18n("Suspend to RAM")));
+ arg(i18n("sleep")));
break;
case FREEZE:
KNotifyClient::event( this->winId(), "freeze_event",
i18n("System is going into %1 now.").
- arg(i18n("Freeze")));
+ arg(i18n("freeze")));
break;
case STANDBY:
KNotifyClient::event( this->winId(), "standby_event",
i18n("System is going into %1 now.").
- arg(i18n("Standby")));
+ arg(i18n("standby")));
break;
default:
break;
@@ -2261,7 +2356,7 @@ void tdepowersave::notifySuspend( int suspendType ) {
}
/*!
- * \b TQT_SLOT called to independent handleResumeSignal() from event loop and
+ * \b Slot called to independent handleResumeSignal() from event loop and
* to avoid problems with the QT3 D-Bus bindings
*/
void tdepowersave::forwardResumeSignal( int result ) {
@@ -2269,13 +2364,13 @@ void tdepowersave::forwardResumeSignal( int result ) {
resume_result = result;
- TQTimer::singleShot(100, this, TQT_SLOT(handleResumeSignal()));
+ TQTimer::singleShot(100, this, TQ_SLOT(handleResumeSignal()));
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT called if the machine suspend. Here we emit the related KNotify events
+ * \b Slot called if the machine suspend. Here we emit the related KNotify events
* if they are not disabled.
*/
void tdepowersave::handleResumeSignal() {
@@ -2300,22 +2395,27 @@ void tdepowersave::handleResumeSignal() {
case SUSPEND2DISK:
KNotifyClient::event( this->winId(), "resume_from_suspend2disk_event",
i18n("System is resumed from %1.").arg(
- i18n("Suspend to Disk")));
+ i18n("hibernation")));
+ break;
+ case SUSPEND_HYBRID:
+ KNotifyClient::event( this->winId(), "resume_from_suspend_hybrid_event",
+ i18n("System is resumed from %1.").arg(
+ i18n("hybrid suspension")));
break;
case SUSPEND2RAM:
KNotifyClient::event( this->winId(), "resume_from_suspend2ram_event",
i18n("System is resumed from %1.").arg(
- i18n("Suspend to RAM")));
+ i18n("sleep")));
break;
case FREEZE:
KNotifyClient::event( this->winId(), "resume_from_freeze_event",
i18n("System is resumed from %1.").arg(
- i18n("Freeze")));
+ i18n("freeze")));
break;
case STANDBY:
KNotifyClient::event( this->winId(), "resume_from_standby_event",
i18n("System is resumed from %1.").arg(
- i18n("Standby")));
+ i18n("standby")));
break;
default:
kdError() << "called suspend type unknown" << endl;
@@ -2357,6 +2457,10 @@ void tdepowersave::handleResumeSignal() {
logview = new LogViewer ("/var/log/suspend2disk.log");
logview->show();
break;
+ case SUSPEND_HYBRID:
+ logview = new LogViewer ("/var/log/suspend_hybrid.log");
+ logview->show();
+ break;
case SUSPEND2RAM:
logview = new LogViewer ("/var/log/suspend2ram.log");
logview->show();
@@ -2389,7 +2493,7 @@ void tdepowersave::handleResumeSignal() {
}
/*!
- * \b TQT_SLOT called if the state of the current session change
+ * \b Slot called if the state of the current session change
* \param state boolean represent the state of the session
* TODO: fix scheme handling
* TODO: fix critical battery situations (see the todo file in the source)
@@ -2427,10 +2531,13 @@ TQString tdepowersave::getSuspendString (int type) {
switch (type) {
case SUSPEND2DISK:
- return i18n("Suspend to Disk");
+ return i18n("Hibernate");
+ break;
+ case SUSPEND_HYBRID:
+ return i18n("Hybrid Suspend");
break;
case SUSPEND2RAM:
- return i18n("Suspend to RAM");
+ return i18n("Suspend");
break;
case FREEZE:
return i18n("Freeze");
@@ -2544,24 +2651,20 @@ TQStringList tdepowersave::listCPUFreqPolicies() {
bool tdepowersave::do_setCPUFreqPolicy( TQString policy ) {
if (trace) kdDebug() << funcinfo << "IN: " << "policy: " << policy << endl;
-
- bool ret = true;
- /*
+ bool ret = false;
if (hwinfo->isCpuFreqAllowed() && hwinfo->isOnline()) {
if (policy == "PERFORMANCE") {
hwinfo->setCPUFreq(PERFORMANCE);
+ ret = true;
} else if (policy == "DYNAMIC") {
hwinfo->setCPUFreq(DYNAMIC, settings->cpuFreqDynamicPerformance);
+ ret = true;
} else if (policy == "POWERSAVE") {
hwinfo->setCPUFreq(POWERSAVE);
- } else {
- kdDebugFuncOut(trace);
- ret = false;
+ ret = true;
}
- } else {
- ret = false;
}
- */
+
kdDebugFuncOut(trace);
return ret;
}
@@ -2580,6 +2683,10 @@ TQStringList tdepowersave::allowed_sleepingStates(){
suspend.suspend2disk_allowed == -1)){
sleepList.append("suspendToDisk");
}
+ if (suspend.suspend_hybrid && (suspend.suspend_hybrid_allowed ||
+ suspend.suspend_hybrid_allowed == -1)){
+ sleepList.append("suspendHybrid");
+ }
if (suspend.suspend2ram && (suspend.suspend2ram_allowed ||
suspend.suspend2ram_allowed == -1)){
sleepList.append("suspendToRAM");
@@ -2632,22 +2739,17 @@ TQStringList tdepowersave::listSchemes(){
* \param _scheme TQString with the scheme to set, scheme should be
* named as list from list_schemes()
*/
-bool tdepowersave::do_setScheme( TQString /*_scheme*/ ) {
- kdDebugFuncIn(trace);
-
-/* int index;
- index = settings->schemes.findIndex(_scheme);
+bool tdepowersave::do_setScheme( TQString _scheme ) {
+ if (trace) kdDebug() << funcinfo << "IN: scheme: " << _scheme << endl;
+ int index = settings->schemes.findIndex(_scheme);
+ if (trace) kdDebug() << funcinfo << " index: " << index << endl;
if (index != -1) {
do_setActiveScheme(index);
kdDebugFuncOut(trace);
return true;
}
- else {
- kdDebugFuncOut(trace);
- return false;
- }
-*/
+
kdDebugFuncOut(trace);
return false;
}
@@ -2665,6 +2767,18 @@ bool tdepowersave::do_suspendToDisk(){
}
/*!
+ * DCOP Interface funtion to send the hybrid suspend command to powersave.
+ * \return boolean with the result of calling do_suspend_hybrid()
+ * \retval true if successful
+ * \retval false if not supported or powersaved not running
+ */
+bool tdepowersave::do_suspendHybrid(){
+ kdDebugFuncIn(trace);
+ kdDebugFuncOut(trace);
+ return do_suspend_hybrid();
+}
+
+/*!
* DCOP Interface funtion to send the suspend to disk command to powersave.
* \return boolean with the result of calling do_suspend2ram()
* \retval true if successful
@@ -2773,7 +2887,7 @@ void tdepowersave::showDetailedDialog( ){
detailedIsShown = true;
}
- connect(detailedDlg, TQT_SIGNAL(destroyed()), this, TQT_SLOT(closedetaileddialog()));
+ connect(detailedDlg, TQ_SIGNAL(destroyed()), this, TQ_SLOT(closedetaileddialog()));
kdDebugFuncOut(trace);
}
@@ -2781,7 +2895,7 @@ void tdepowersave::showDetailedDialog( ){
/*!
* DCOP Interface funtion to open the configure dialog.
* \return boolean with the result of open the dialog
- * \retval false if failed (e.g. D-Bus or HAL is not running)
+ * \retval false if failed
* \retval true if correct opend
*/
bool tdepowersave::openConfigureDialog (){
@@ -2820,7 +2934,7 @@ int tdepowersave::brightnessGet() {
int retval = -1;
if (hwinfo->supportBrightness()) {
- retval = (int)(((float)hwinfo->getCurrentBrightnessLevel() / (float)hwinfo->getMaxBrightnessLevel()-1) * 100.0);
+ retval = (int)round(100.0 * hwinfo->getCurrentBrightnessLevel() / hwinfo->getMaxBrightnessLevel());
}
kdDebugFuncOut(trace);
@@ -2828,4 +2942,13 @@ int tdepowersave::brightnessGet() {
return retval;
}
+//! dcop funtion to set the brightness level
+void tdepowersave::brightnessSet(int percentage)
+{
+ kdDebugFuncIn(trace);
+
+ hwinfo->setBrightnessPercentage(percentage);
+
+ kdDebugFuncOut(trace);
+}
#include "tdepowersave.moc"
diff --git a/src/tdepowersave.desktop b/src/tdepowersave.desktop
index 0388c36..4385410 100644
--- a/src/tdepowersave.desktop
+++ b/src/tdepowersave.desktop
@@ -1,68 +1,17 @@
[Desktop Entry]
-Encoding=UTF-8
Name=TDEPowersave
-Name[xx]=xxTDEPowersavexx
-Name[de]=TDEPowersave
-Name[es]=TDEPowersave
-Name[fr]=TDEPowersave
-Name[it]=TDEPowersave
-Name[ja]=TDEPowersave
-Name[pt_BR]=TDEPowersave
-Name[ru]=TDEPowersave
-Name[sv]=TDEPowersave
-Name[zh_CN]=TDEPowersave
-Name[zh_TW]=TDEPowersave
+
GenericName=Battery Monitor
-Exec=tdepowersave --force-acpi-check
-Icon=tdepowersave
-Type=Application
+
Comment=Battery monitor and general power management
-Comment[bg]=Монитор за батерията и основно управление на енергията
-GenericName[bg]=Монитор за батерията
-Comment[cs]=Sledování stavu baterií a správa napájení
-GenericName[cs]=Monitor baterie
-GenericName[de]=Akkuüberwachung
-Comment[de]=Akkuüberwachung und allgemeine Energieverwaltung
-GenericName[el]=Παρακολούθηση Μπαταρίας
-GenericName[es]=Monitor de carga de la batería
-Comment[es]=Monitor de batería y gestión general de la energía
-Comment[fi]=Akkumonitori ja yleinen virranhallinta
-GenericName[fi]=Akkumonitori
-Comment[fr]=Moniteur de batterie et gestion de l'alimentation
-GenericName[fr]=Moniteur de batterie
-GenericName[hu]=Akkumulátorfigyelő
-Comment[it]=Monitor della batteria e gestione generale dell'alimentazione
-GenericName[it]=Monitor della batteria
-Comment[km]=កមមវធ<200b>តរតពនតយ<200b>ថម នង គរបគរង<200b>ថាមពល<200b>ទទៅ
-GenericName[km]=កមមវធ<200b>តរតពនតយ<200b>ថម
-Comment[nb]=Batteriovervåking og generell strømstyring
-GenericName[nb]=Batteriovervåker
-GenericName[nl]=Batterijmonitor
-GenericName[ja]=バッテリモニタ
-Comment[ja]=バッテリモニタと一般電源管理
-Name[pa]=ਕ-ਊਰਜਾ ਸਭਾਲ
-GenericName[pa]=ਬਟਰੀ ਦਰਸ਼ਕ
-Comment[pl]=Monitor stanu baterii i ogólne zarządzanie energią
-GenericName[pl]=Monitor baterii
-Comment[pt]=Monitor de bateria e gestor global de energia
-GenericName[pt]=Monitor de Bateria
-Comment[pt_BR]=Monitor de Bateria e Gerenciamento de Energia Geral
-GenericName[pt_BR]=Monitor de Bateria
-GenericName[ru]=Монитор Батареи
-Comment[ru]=Монитор батареи и управление энергосбережением
-GenericName[sv]=Batteriövervakare
-GenericName[tr]=Pil durumu izleme ve güç yönetimi arayüzü
-Comment[tr]=Pil durumu izleme ve güç yönetimi arayüzü
-Comment[uk]=Монітор стану батареї і загальне керування живленням
-GenericName[uk]=Монітор батарей
-Comment[xx]=xxBattery monitor and general power managementxx
-GenericName[zh_CN]=电池监视器
-Comment[zh_CN]=电池监视器和常规电源管理
-GenericName[zh_TW]=電池監視器
-Comment[zh_TW]=電池監視器和一般電源管理
+
+Type=Application
+Icon=tdepowersave
+Exec=tdepowersave --force-acpi-check
+Encoding=UTF-8
+Categories=System;Applet;
+X-DocPath=tdepowersave/index.html
X-TDE-autostart-after=panel
+X-TDE-autostart-condition=tdepowersaverc:General:Autostart:true
X-TDE-StartupNotify=false
X-TDE-UniqueApplet=true
-X-TDE-autostart-condition=tdepowersaverc:General:Autostart:true
-Categories=System;Applet;
-X-DocPath=tdepowersave/index.html
diff --git a/src/tdepowersave.h b/src/tdepowersave.h
index 41e0d9f..67fc6f7 100644
--- a/src/tdepowersave.h
+++ b/src/tdepowersave.h
@@ -22,23 +22,13 @@
#ifndef _TDEPOWERSAVE_H_
#define _TDEPOWERSAVE_H_
-// this is needed to avoid typedef clash with X11/Xmd.h (X11/Xproto.h)
-#ifndef TQT_CLEAN_NAMESPACE
-#define TQT_CLEAN_NAMESPACE
-#endif
-
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
// KDE - Header
-#include <kprocess.h>
+#include <tdeprocess.h>
#include <ksystemtray.h>
#include <dcopobject.h>
#include <tdehardwaredevices.h>
-// QT - Header
+// TQt - Header
#include <tqpopupmenu.h>
// tdepowersave - Header
@@ -69,7 +59,7 @@ class TDEGlobalAccel;
class tdepowersave : public KSystemTray, public DCOPObject
{
- Q_OBJECT
+ TQ_OBJECT
//
K_DCOP
@@ -169,6 +159,11 @@ private:
*/
bool autoDimmDown;
+ // used during dimm down/up transitions
+ int m_dimmRequestedLevel;
+ int m_dimmStep;
+ int m_dimmTimeoutCounter;
+
//! to temporary hold the resume result
int resume_result;
@@ -188,6 +183,9 @@ private:
/*! contains the ID of the menuentry for suspend-to-disk */
int SUSPEND2DISK_MENU_ID;
//! a menu entry ID
+ /*! contains the ID of the menuentry for hybrid suspend */
+ int SUSPEND_HYBRID_MENU_ID;
+ //! a menu entry ID
/*! contains the ID of the menuentry for suspend-to-ram */
int SUSPEND2RAM_MENU_ID;
//! a menu entry ID
@@ -273,12 +271,12 @@ private:
* The timerinterval is defined in \ref BAT_icon_BG_intervall .
*/
TQTimer *BAT_WARN_ICON_Timer;
+
//! Timer to dimm down/up the brightness
/*!
- * This timer is used dimm the display up and down. The timerinterval
- * depends on calculated timePerStep in the calling function.
+ * This timer is used to dimm the display up and down.
*/
- TQTimer *AUTODIMM_Timer;
+ TQTimer *m_autoDimmTimer;
//! draw all icon related things for \ref redrawPixmap()
void drawIcon();
@@ -316,6 +314,8 @@ private slots:
bool do_suspend2disk();
//! send command for suspend_to_RAM to the TDE hardware library
bool do_suspend2ram();
+ //! send command for hybrid suspend to the TDE hardware library
+ bool do_suspend_hybrid();
//! show warning dialog or call autosuspend if signal \ref inactivity::inactivityTimeExpired() recieved
void do_autosuspendWarn();
@@ -346,9 +346,9 @@ private slots:
void do_downDimm();
//! called if the user get active again and the display should get dimmed up
void do_upDimm();
- //! TQT_SLOT do do the dimmining for autodimm feature
+ //! TQ_SLOT do do the dimmining for autodimm feature
void do_dimm();
- //! TQT_SLOT to set autodimm related stuff and start autodimm monitoring
+ //! TQ_SLOT to set autodimm related stuff and start autodimm monitoring
void setAutoDimm( bool resumed );
//! to update the main menu of the kickerapplet
@@ -377,7 +377,7 @@ private slots:
//! handle event for press power button and call action
void handlePowerButtonEvent();
//! handle event for press s2ram/sleep button and call action
- void handleSleepButtonEvent();
+ void handleSuspendButtonEvent();
//! handle event for press s2disk button and call action
void handleS2DiskButtonEvent();
@@ -424,6 +424,8 @@ k_dcop:
bool do_setCPUFreqPolicy( TQString );
//! dcop function to send 'suspend to disk' command to powersaved
bool do_suspendToDisk();
+ //! dcop function to send 'hybrid suspend' command to powersaved
+ bool do_suspendHybrid();
//! dcop function to send 'suspend to RAM' command to powersaved
bool do_suspendToRAM();
//! dcop function to send 'freeze' command to powersaved
@@ -443,10 +445,12 @@ k_dcop:
//! dcop function to open the configure dialog
bool openConfigureDialog();
- //! dcop function to find out if tdepowersave manages DPMS
- bool currentSchemeManagesDPMS();
+ //! dcop function to find out if tdepowersave manages DPMS
+ bool currentSchemeManagesDPMS();
//! dcop funtion to get the current brightness level
int brightnessGet();
+ //! dcop funtion to set the brightness level
+ void brightnessSet(int percentage);
//! dcop function to return the name of the current scheme
TQString currentScheme ();
diff --git a/src/tdepowersave_debug.h b/src/tdepowersave_debug.h
index e97ade6..7be95d5 100644
--- a/src/tdepowersave_debug.h
+++ b/src/tdepowersave_debug.h
@@ -21,16 +21,11 @@
#ifndef _TDEPOWERSAVE_DEBUG_H
#define _TDEPOWERSAVE_DEBUG_H
-// Global Header
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
// Default Header
#include <stdio.h>
#include <stdlib.h>
-// QT - Header
+// TQt - Header
#include <tqdatetime.h>
// KDE Header