|
|
@ -188,11 +188,11 @@ void tdepowersave::initMenu() {
|
|
|
|
SLEEP_SEPARATOR_MENU_ID = this->contextMenu()->insertSeparator();
|
|
|
|
SLEEP_SEPARATOR_MENU_ID = this->contextMenu()->insertSeparator();
|
|
|
|
SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
TQIconSet::Automatic),
|
|
|
|
TQIconSet::Automatic),
|
|
|
|
i18n("Suspend to Disk"), this,
|
|
|
|
i18n("Hibernate"), this,
|
|
|
|
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("Suspend to RAM"), this,
|
|
|
|
i18n("Sleep"), this,
|
|
|
|
TQT_SLOT(do_suspend2ram()));
|
|
|
|
TQT_SLOT(do_suspend2ram()));
|
|
|
|
FREEZE_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram", TQIconSet::Automatic),
|
|
|
|
FREEZE_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram", TQIconSet::Automatic),
|
|
|
|
i18n("Freeze"), this, TQT_SLOT(do_freeze()));
|
|
|
|
i18n("Freeze"), this, TQT_SLOT(do_freeze()));
|
|
|
@ -723,7 +723,7 @@ bool tdepowersave::do_suspend2disk(){
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Suspend to disk failed"),
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Hibernation failed"),
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
@ -731,7 +731,7 @@ bool tdepowersave::do_suspend2disk(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
i18n("Suspend to disk disabled by administrator."),
|
|
|
|
i18n("Hibernation disabled by administrator."),
|
|
|
|
SmallIcon("messagebox_warning", 20),
|
|
|
|
SmallIcon("messagebox_warning", 20),
|
|
|
|
this, i18n("Warning").ascii(), 15000);
|
|
|
|
this, i18n("Warning").ascii(), 15000);
|
|
|
|
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
|
|
|
|
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
|
|
|
@ -739,7 +739,7 @@ bool tdepowersave::do_suspend2disk(){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
kdWarning() << "This machine does not provide suspend to disk state" << endl;
|
|
|
|
kdWarning() << "This machine does not provide hibernation state" << endl;
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -779,7 +779,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Suspend to RAM failed"),
|
|
|
|
KPassivePopup::message( i18n("WARNING"),i18n("Sleep mode failed"),
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
SmallIcon("messagebox_warning", 20), this,
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
i18n("Warning").ascii(), 15000);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
@ -787,7 +787,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
i18n("Suspend to RAM disabled by administrator."),
|
|
|
|
i18n("Sleep 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);
|
|
|
@ -795,7 +795,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
kdWarning() << "This machine does not provide suspend to ram state" << endl;
|
|
|
|
kdWarning() << "This machine does not provide Sleep state" << endl;
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -922,12 +922,12 @@ void tdepowersave::do_autosuspendWarn() {
|
|
|
|
// Verify that the desired suspend action is allowed before displaying the dialog
|
|
|
|
// Verify that the desired suspend action is allowed before displaying the dialog
|
|
|
|
SuspendStates suspend = hwinfo->getSuspendSupport();
|
|
|
|
SuspendStates suspend = hwinfo->getSuspendSupport();
|
|
|
|
bool allowed = false;
|
|
|
|
bool allowed = false;
|
|
|
|
if(settings->autoInactiveAction == "Suspend to Disk") {
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
|
|
|
|
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
|
|
|
|
allowed = true;
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (settings->autoInactiveAction == "Suspend to RAM") {
|
|
|
|
else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
allowed = true;
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -951,9 +951,9 @@ void tdepowersave::do_autosuspendWarn() {
|
|
|
|
|
|
|
|
|
|
|
|
countdown = new countDownDialog(settings->autoSuspendCountdownTimeout);
|
|
|
|
countdown = new countDownDialog(settings->autoSuspendCountdownTimeout);
|
|
|
|
|
|
|
|
|
|
|
|
if(settings->autoInactiveAction == "Suspend to Disk") {
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
countdown->setPixmap("suspend2disk");
|
|
|
|
countdown->setPixmap("suspend2disk");
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend to RAM") {
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
@ -1006,9 +1006,9 @@ bool tdepowersave::do_autosuspend(bool chancel) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(settings->autoSuspend && !contextMenu()->isItemChecked(AUTOSUSPEND_MENU_ID)) {
|
|
|
|
if(settings->autoSuspend && !contextMenu()->isItemChecked(AUTOSUSPEND_MENU_ID)) {
|
|
|
|
if(settings->autoInactiveAction == "Suspend to Disk") {
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
return do_suspend2disk();
|
|
|
|
return do_suspend2disk();
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend to RAM") {
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
return do_suspend2ram();
|
|
|
|
return do_suspend2ram();
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
return do_freeze();
|
|
|
|
return do_freeze();
|
|
|
@ -1902,12 +1902,12 @@ void tdepowersave::setAutoSuspend( bool resumed ){
|
|
|
|
// Verify that the desired suspend action is allowed before enabling autosuspend
|
|
|
|
// Verify that the desired suspend action is allowed before enabling autosuspend
|
|
|
|
SuspendStates suspend = hwinfo->getSuspendSupport();
|
|
|
|
SuspendStates suspend = hwinfo->getSuspendSupport();
|
|
|
|
bool allowed = false;
|
|
|
|
bool allowed = false;
|
|
|
|
if(settings->autoInactiveAction == "Suspend to Disk") {
|
|
|
|
if(settings->autoInactiveAction == "Hibernate") {
|
|
|
|
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
|
|
|
|
if ( suspend.suspend2disk && (suspend.suspend2disk_allowed || suspend.suspend2disk_allowed == -1)) {
|
|
|
|
allowed = true;
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (settings->autoInactiveAction == "Suspend to RAM") {
|
|
|
|
else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
allowed = true;
|
|
|
|
allowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2267,22 +2267,22 @@ void tdepowersave::notifySuspend( int suspendType ) {
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
KNotifyClient::event( this->winId(), "suspend2disk_event",
|
|
|
|
KNotifyClient::event( this->winId(), "suspend2disk_event",
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
arg(i18n("Suspend to Disk")));
|
|
|
|
arg(i18n("hibernation")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
KNotifyClient::event( this->winId(), "suspend2ram_event",
|
|
|
|
KNotifyClient::event( this->winId(), "suspend2ram_event",
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
arg(i18n("Suspend to RAM")));
|
|
|
|
arg(i18n("sleep")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case FREEZE:
|
|
|
|
case FREEZE:
|
|
|
|
KNotifyClient::event( this->winId(), "freeze_event",
|
|
|
|
KNotifyClient::event( this->winId(), "freeze_event",
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
arg(i18n("Freeze")));
|
|
|
|
arg(i18n("freeze")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case STANDBY:
|
|
|
|
case STANDBY:
|
|
|
|
KNotifyClient::event( this->winId(), "standby_event",
|
|
|
|
KNotifyClient::event( this->winId(), "standby_event",
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
i18n("System is going into %1 now.").
|
|
|
|
arg(i18n("Standby")));
|
|
|
|
arg(i18n("standby")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -2332,22 +2332,22 @@ void tdepowersave::handleResumeSignal() {
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_suspend2disk_event",
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_suspend2disk_event",
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Suspend to Disk")));
|
|
|
|
i18n("hibernation")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_suspend2ram_event",
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_suspend2ram_event",
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Suspend to RAM")));
|
|
|
|
i18n("sleep")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case FREEZE:
|
|
|
|
case FREEZE:
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_freeze_event",
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_freeze_event",
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Freeze")));
|
|
|
|
i18n("freeze")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case STANDBY:
|
|
|
|
case STANDBY:
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_standby_event",
|
|
|
|
KNotifyClient::event( this->winId(), "resume_from_standby_event",
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Standby")));
|
|
|
|
i18n("standby")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
kdError() << "called suspend type unknown" << endl;
|
|
|
|
kdError() << "called suspend type unknown" << endl;
|
|
|
@ -2459,10 +2459,10 @@ TQString tdepowersave::getSuspendString (int type) {
|
|
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
switch (type) {
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
case SUSPEND2DISK:
|
|
|
|
return i18n("Suspend to Disk");
|
|
|
|
return i18n("Hibernate");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
return i18n("Suspend to RAM");
|
|
|
|
return i18n("Sleep");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case FREEZE:
|
|
|
|
case FREEZE:
|
|
|
|
return i18n("Freeze");
|
|
|
|
return i18n("Freeze");
|
|
|
|