|
|
|
@ -103,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 (handleSuspendButtonEvent()));
|
|
|
|
|
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( this );
|
|
|
|
|
m_globalAccel->insert( "Power button", i18n( "Execute configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86PowerOff")), TDEShortcut(TQString("XF86PowerOff")), this, TQT_SLOT( handlePowerButtonEvent() ) );
|
|
|
|
|
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, TQT_SLOT( handleSuspendButtonEvent() ) );
|
|
|
|
|
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")), this, TQT_SLOT( handleS2DiskButtonEvent() ) );
|
|
|
|
|
TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), this, TQ_SLOT( handleS2DiskButtonEvent() ) );
|
|
|
|
|
m_globalAccel->readSettings();
|
|
|
|
|
m_globalAccel->updateConnections();
|
|
|
|
|
|
|
|
|
@ -148,10 +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()));
|
|
|
|
|
|
|
|
|
|
m_autoDimmTimer = new TQTimer(this);
|
|
|
|
|
connect(m_autoDimmTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(do_dimm()));
|
|
|
|
|
connect(m_autoDimmTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(do_dimm()));
|
|
|
|
|
|
|
|
|
|
initMenu();
|
|
|
|
|
update();
|
|
|
|
@ -184,27 +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();
|
|
|
|
|
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, TQT_SLOT(do_suspend2ram()));
|
|
|
|
|
TQIconSet::Automatic), i18n("Suspend"), this, TQ_SLOT(do_suspend2ram()));
|
|
|
|
|
SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
|
TQIconSet::Automatic), i18n("Hibernate"), this, TQT_SLOT(do_suspend2disk()));
|
|
|
|
|
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, TQT_SLOT(do_suspend_hybrid()));
|
|
|
|
|
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);
|
|
|
|
@ -214,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);
|
|
|
|
|
|
|
|
|
@ -237,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);
|
|
|
|
|
}
|
|
|
|
@ -286,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."),
|
|
|
|
@ -520,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.
|
|
|
|
|
*/
|
|
|
|
@ -533,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;
|
|
|
|
@ -549,7 +549,7 @@ void tdepowersave::do_config(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \b TQT_SLOT to open the tdepowersave help
|
|
|
|
|
* \b Slot to open the tdepowersave help
|
|
|
|
|
*/
|
|
|
|
|
void tdepowersave::slotHelp()
|
|
|
|
|
{
|
|
|
|
@ -557,7 +557,7 @@ void tdepowersave::slotHelp()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \b TQT_SLOT to open the tdepowersave About dialog
|
|
|
|
|
* \b Slot to open the tdepowersave About dialog
|
|
|
|
|
*/
|
|
|
|
|
void tdepowersave::slotAbout()
|
|
|
|
|
{
|
|
|
|
@ -566,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
|
|
|
|
@ -582,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);
|
|
|
|
@ -607,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
|
|
|
|
|
*/
|
|
|
|
@ -633,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){
|
|
|
|
@ -664,7 +664,7 @@ void tdepowersave::slotConfigProcessExited(TDEProcess *proc){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \b TQT_SLOT to send the command for "suspend to disk" to TDE hardware library.
|
|
|
|
|
* \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
|
|
|
|
@ -720,7 +720,7 @@ bool tdepowersave::do_suspend2disk(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \b TQT_SLOT to send the command for "hybrid suspend" to 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
|
|
|
|
@ -776,7 +776,7 @@ bool tdepowersave::do_suspend_hybrid(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \b TQT_SLOT to send the command for "suspend to RAM" to the TDE hardware library.
|
|
|
|
|
* \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
|
|
|
|
@ -832,7 +832,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \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
|
|
|
|
@ -887,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
|
|
|
|
@ -942,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.
|
|
|
|
|
*/
|
|
|
|
@ -1008,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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1022,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
|
|
|
|
@ -1065,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
|
|
|
|
@ -1091,7 +1091,7 @@ void tdepowersave::do_downDimm() {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// wait until the timer is stopped, try later!
|
|
|
|
|
TQTimer::singleShot(2000, this, TQT_SLOT(do_downDimm()));
|
|
|
|
|
TQTimer::singleShot(2000, this, TQ_SLOT(do_downDimm()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1099,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
|
|
|
|
@ -1129,7 +1129,7 @@ void tdepowersave::do_upDimm() {
|
|
|
|
|
setAutoDimm(false);
|
|
|
|
|
} else {
|
|
|
|
|
// wait until the timer is stopped, try later!
|
|
|
|
|
TQTimer::singleShot(2000, this, TQT_SLOT(do_downDimm()));
|
|
|
|
|
TQTimer::singleShot(2000, this, TQ_SLOT(do_downDimm()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1138,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
|
|
|
|
@ -1304,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
|
|
|
|
|
*/
|
|
|
|
@ -1362,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);
|
|
|
|
@ -1372,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);
|
|
|
|
@ -1390,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.
|
|
|
|
|
*/
|
|
|
|
@ -1435,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;
|
|
|
|
@ -1453,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 ){
|
|
|
|
@ -1799,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() {
|
|
|
|
@ -1807,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 ){
|
|
|
|
@ -1942,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
|
|
|
|
|
*/
|
|
|
|
@ -1992,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)) {
|
|
|
|
@ -2025,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
|
|
|
|
|
*/
|
|
|
|
@ -2042,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) {
|
|
|
|
@ -2063,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
|
|
|
|
@ -2120,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",
|
|
|
|
@ -2198,16 +2198,16 @@ 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, TQT_SLOT(do_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->setBrightnessPercentage(value);
|
|
|
|
@ -2252,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 ...)
|
|
|
|
|
*/
|
|
|
|
@ -2290,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() {
|
|
|
|
@ -2314,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 ) {
|
|
|
|
@ -2356,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 ) {
|
|
|
|
@ -2364,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() {
|
|
|
|
@ -2493,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)
|
|
|
|
@ -2896,7 +2896,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);
|
|
|
|
|
}
|
|
|
|
|