|
|
|
@ -188,11 +188,11 @@ void tdepowersave::initMenu() {
|
|
|
|
|
SLEEP_SEPARATOR_MENU_ID = this->contextMenu()->insertSeparator();
|
|
|
|
|
SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
|
TQIconSet::Automatic),
|
|
|
|
|
i18n("Suspend to Disk"), this,
|
|
|
|
|
i18n("Hibernate"), this,
|
|
|
|
|
TQT_SLOT(do_suspend2disk()));
|
|
|
|
|
SUSPEND2RAM_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram",
|
|
|
|
|
TQIconSet::Automatic),
|
|
|
|
|
i18n("Suspend to RAM"), this,
|
|
|
|
|
i18n("Sleep"), this,
|
|
|
|
|
TQT_SLOT(do_suspend2ram()));
|
|
|
|
|
FREEZE_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram", TQIconSet::Automatic),
|
|
|
|
|
i18n("Freeze"), this, TQT_SLOT(do_freeze()));
|
|
|
|
@ -723,7 +723,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").ascii(), 15000);
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
@ -731,7 +731,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").ascii(), 15000);
|
|
|
|
|
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
|
|
|
|
@ -739,7 +739,7 @@ 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;
|
|
|
|
|
}
|
|
|
|
@ -779,7 +779,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Suspend to RAM failed"),
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Sleep mode failed"),
|
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
@ -787,7 +787,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
|
i18n("Suspend to RAM disabled by administrator."),
|
|
|
|
|
i18n("Sleep mode disabled by administrator."),
|
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
|
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false);
|
|
|
|
@ -795,7 +795,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
kdWarning() << "This machine does not provide suspend to ram state" << endl;
|
|
|
|
|
kdWarning() << "This machine does not provide Sleep state" << endl;
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -922,12 +922,12 @@ 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 == "Sleep") {
|
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
@ -951,9 +951,9 @@ 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 == "Suspend to RAM") {
|
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
@ -1006,9 +1006,9 @@ bool tdepowersave::do_autosuspend(bool chancel) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 == "Sleep") {
|
|
|
|
|
return do_suspend2ram();
|
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
|
return do_freeze();
|
|
|
|
@ -1902,12 +1902,12 @@ 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 == "Sleep") {
|
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
@ -2267,22 +2267,22 @@ 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 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;
|
|
|
|
@ -2332,22 +2332,22 @@ 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 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;
|
|
|
|
@ -2459,10 +2459,10 @@ TQString tdepowersave::getSuspendString (int type) {
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
|
return i18n("Suspend to Disk");
|
|
|
|
|
return i18n("Hibernate");
|
|
|
|
|
break;
|
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
|
return i18n("Suspend to RAM");
|
|
|
|
|
return i18n("Sleep");
|
|
|
|
|
break;
|
|
|
|
|
case FREEZE:
|
|
|
|
|
return i18n("Freeze");
|
|
|
|
|