|
|
|
@ -108,7 +108,7 @@ kpowersave::kpowersave( bool force_acpi_check, bool trace_func ) : KSystemTray(0
|
|
|
|
|
// 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(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)));
|
|
|
|
@ -186,7 +186,7 @@ void kpowersave::initMenu() {
|
|
|
|
|
TQT_SLOT(do_suspend2disk()));
|
|
|
|
|
SUSPEND2RAM_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram",
|
|
|
|
|
TQIconSet::Automatic),
|
|
|
|
|
i18n("Sleep"), this,
|
|
|
|
|
i18n("Suspend"), this,
|
|
|
|
|
TQT_SLOT(do_suspend2ram()));
|
|
|
|
|
STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", TQIconSet::Automatic),
|
|
|
|
|
i18n("Standby"), this, TQT_SLOT(do_standby()));
|
|
|
|
@ -771,7 +771,7 @@ bool kpowersave::do_suspend2ram(){
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Sleep mode failed"),
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Suspend mode failed"),
|
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
@ -779,7 +779,7 @@ bool kpowersave::do_suspend2ram(){
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
|
i18n("Sleep mode disabled by administrator."),
|
|
|
|
|
i18n("Suspend mode disabled by administrator."),
|
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
|
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false);
|
|
|
|
@ -787,7 +787,7 @@ bool kpowersave::do_suspend2ram(){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
kdWarning() << "This machine does not provide Sleep state via HAL" << endl;
|
|
|
|
|
kdWarning() << "This machine does not provide Suspend state via HAL" << endl;
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -865,7 +865,7 @@ void kpowersave::do_autosuspendWarn() {
|
|
|
|
|
|
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
|
countdown->setPixmap("suspend2disk");
|
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
|
} else if (settings->autoInactiveAction == "Standby") {
|
|
|
|
|
countdown->setPixmap("standby");
|
|
|
|
@ -915,7 +915,7 @@ bool kpowersave::do_autosuspend(bool chancel) {
|
|
|
|
|
if(settings->autoSuspend && !contextMenu()->isItemChecked(AUTOSUSPEND_MENU_ID)) {
|
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
|
return do_suspend2disk();
|
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
return do_suspend2ram();
|
|
|
|
|
} else if (settings->autoInactiveAction == "Standby") {
|
|
|
|
|
return do_standby();
|
|
|
|
@ -1145,7 +1145,7 @@ void kpowersave::handlePowerButtonEvent( ) {
|
|
|
|
|
/*!
|
|
|
|
|
* Handle the event for the suspend2ram/sleep button and call the related action.
|
|
|
|
|
*/
|
|
|
|
|
void kpowersave::handleSleepButtonEvent() {
|
|
|
|
|
void kpowersave::handleSuspendButtonEvent() {
|
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
// Only go to suspend on button event if we already resumed successful.
|
|
|
|
@ -2383,7 +2383,7 @@ TQString kpowersave::getSuspendString (int type) {
|
|
|
|
|
return i18n("Hibernate");
|
|
|
|
|
break;
|
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
|
return i18n("Sleep");
|
|
|
|
|
return i18n("Suspend");
|
|
|
|
|
break;
|
|
|
|
|
case STANDBY:
|
|
|
|
|
return i18n("Standby");
|
|
|
|
|