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