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