|
|
@ -182,11 +182,11 @@ void kpowersave::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()));
|
|
|
|
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()));
|
|
|
@ -715,7 +715,7 @@ bool kpowersave::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);
|
|
|
@ -723,7 +723,7 @@ bool kpowersave::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);
|
|
|
@ -731,7 +731,7 @@ bool kpowersave::do_suspend2disk(){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
kdWarning() << "This machine does not provide suspend2disk via HAL" << endl;
|
|
|
|
kdWarning() << "This machine does not provide hibernation state" << endl;
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -771,7 +771,7 @@ bool kpowersave::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);
|
|
|
@ -779,7 +779,7 @@ bool kpowersave::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);
|
|
|
@ -787,7 +787,7 @@ bool kpowersave::do_suspend2ram(){
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
kdWarning() << "This machine does not provide suspend2ram via HAL" << endl;
|
|
|
|
kdWarning() << "This machine does not provide Sleep state via HAL" << endl;
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -863,9 +863,9 @@ void kpowersave::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 == "Standby") {
|
|
|
|
} else if (settings->autoInactiveAction == "Standby") {
|
|
|
|
countdown->setPixmap("standby");
|
|
|
|
countdown->setPixmap("standby");
|
|
|
@ -913,9 +913,9 @@ 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 == "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 == "Standby") {
|
|
|
|
} else if (settings->autoInactiveAction == "Standby") {
|
|
|
|
return do_standby();
|
|
|
|
return do_standby();
|
|
|
@ -2202,17 +2202,17 @@ void kpowersave::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 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;
|
|
|
@ -2262,17 +2262,17 @@ void kpowersave::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 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;
|
|
|
@ -2380,10 +2380,10 @@ TQString kpowersave::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 STANDBY:
|
|
|
|
case STANDBY:
|
|
|
|
return i18n("Standby");
|
|
|
|
return i18n("Standby");
|
|
|
|