|
|
|
@ -107,7 +107,7 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
|
|
|
|
|
// 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)));
|
|
|
|
@ -119,8 +119,8 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
|
|
|
|
|
m_globalAccel = new TDEGlobalAccel( TQT_TQOBJECT(this) );
|
|
|
|
|
m_globalAccel->insert( "Power button", i18n( "Execute configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86PowerOff")), TDEShortcut(TQString("XF86PowerOff")), TQT_TQOBJECT(this), TQT_SLOT( handlePowerButtonEvent() ) );
|
|
|
|
|
m_globalAccel->insert( "Sleep button", i18n( "Sleep configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86Sleep")), TDEShortcut(TQString("XF86Sleep")), TQT_TQOBJECT(this), TQT_SLOT( handleSleepButtonEvent() ) );
|
|
|
|
|
m_globalAccel->insert( "Suspend button", i18n( "Suspend configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), TQT_TQOBJECT(this), TQT_SLOT( handleSuspendButtonEvent() ) );
|
|
|
|
|
m_globalAccel->insert( "Hibernate button", i18n( "Hibernate configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), TQT_TQOBJECT(this), TQT_SLOT( handleS2DiskButtonEvent() ) );
|
|
|
|
|
m_globalAccel->readSettings();
|
|
|
|
@ -191,7 +191,7 @@ void tdepowersave::initMenu() {
|
|
|
|
|
STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", TQIconSet::Automatic),
|
|
|
|
|
i18n("Standby"), this, TQT_SLOT(do_standby()));
|
|
|
|
|
SUSPEND2RAM_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_ram",
|
|
|
|
|
TQIconSet::Automatic), i18n("Sleep"), this, TQT_SLOT(do_suspend2ram()));
|
|
|
|
|
TQIconSet::Automatic), i18n("Suspend"), this, TQT_SLOT(do_suspend2ram()));
|
|
|
|
|
SUSPEND2DISK_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
|
TQIconSet::Automatic), i18n("Hibernate"), this, TQT_SLOT(do_suspend2disk()));
|
|
|
|
|
SUSPEND_HYBRID_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("suspend_to_disk",
|
|
|
|
@ -833,7 +833,7 @@ bool tdepowersave::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);
|
|
|
|
@ -841,7 +841,7 @@ bool tdepowersave::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);
|
|
|
|
@ -849,7 +849,7 @@ bool tdepowersave::do_suspend2ram(){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
kdWarning() << "This machine does not provide Sleep state" << endl;
|
|
|
|
|
kdWarning() << "This machine does not provide Suspend state" << endl;
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -986,7 +986,7 @@ void tdepowersave::do_autosuspendWarn() {
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
@ -1014,7 +1014,7 @@ void tdepowersave::do_autosuspendWarn() {
|
|
|
|
|
countdown->setPixmap("suspend2disk");
|
|
|
|
|
} else if(settings->autoInactiveAction == "Hybrid Suspend") {
|
|
|
|
|
countdown->setPixmap("suspend2disk");
|
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
|
countdown->setPixmap("suspend2ram");
|
|
|
|
@ -1069,7 +1069,7 @@ bool tdepowersave::do_autosuspend(bool cancel) {
|
|
|
|
|
return do_suspend2disk();
|
|
|
|
|
} else if(settings->autoInactiveAction == "Hybrid Suspend") {
|
|
|
|
|
return do_suspend_hybrid();
|
|
|
|
|
} else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
} else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
return do_suspend2ram();
|
|
|
|
|
} else if (settings->autoInactiveAction == "Freeze") {
|
|
|
|
|
return do_freeze();
|
|
|
|
@ -1301,7 +1301,7 @@ void tdepowersave::handlePowerButtonEvent( ) {
|
|
|
|
|
/*!
|
|
|
|
|
* Handle the event for the suspend2ram/sleep button and call the related action.
|
|
|
|
|
*/
|
|
|
|
|
void tdepowersave::handleSleepButtonEvent() {
|
|
|
|
|
void tdepowersave::handleSuspendButtonEvent() {
|
|
|
|
|
kdDebugFuncIn(trace);
|
|
|
|
|
|
|
|
|
|
// Only go to suspend on button event if we already resumed successful.
|
|
|
|
@ -1985,7 +1985,7 @@ void tdepowersave::setAutoSuspend( bool resumed ){
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (settings->autoInactiveAction == "Sleep") {
|
|
|
|
|
else if (settings->autoInactiveAction == "Suspend") {
|
|
|
|
|
if( suspend.suspend2ram && (suspend.suspend2ram_allowed || suspend.suspend2ram_allowed == -1)) {
|
|
|
|
|
allowed = true;
|
|
|
|
|
}
|
|
|
|
@ -2560,7 +2560,7 @@ TQString tdepowersave::getSuspendString (int type) {
|
|
|
|
|
return i18n("Hybrid Suspend");
|
|
|
|
|
break;
|
|
|
|
|
case SUSPEND2RAM:
|
|
|
|
|
return i18n("Sleep");
|
|
|
|
|
return i18n("Suspend");
|
|
|
|
|
break;
|
|
|
|
|
case FREEZE:
|
|
|
|
|
return i18n("Freeze");
|
|
|
|
|