|
|
@ -106,7 +106,7 @@ kpowersave::kpowersave( bool force_acpi_check, bool trace_func ) : KSystemTray(0
|
|
|
|
connect(hwinfo, TQT_SIGNAL(dbusRunning(int)), this, TQT_SLOT(showDBusErrorMsg(int)));
|
|
|
|
connect(hwinfo, TQT_SIGNAL(dbusRunning(int)), this, TQT_SLOT(showDBusErrorMsg(int)));
|
|
|
|
|
|
|
|
|
|
|
|
// connect to events
|
|
|
|
// connect to events
|
|
|
|
connect(hwinfo, TQT_SIGNAL(lidcloseStatus(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 (handleSleepButtonEvent()));
|
|
|
|
connect(hwinfo, TQT_SIGNAL(s2diskButtonPressed()), this, TQT_SLOT (handleS2DiskButtonEvent()));
|
|
|
|
connect(hwinfo, TQT_SIGNAL(s2diskButtonPressed()), this, TQT_SLOT (handleS2DiskButtonEvent()));
|
|
|
@ -474,26 +474,26 @@ void kpowersave::updateTooltip(){
|
|
|
|
else if (minutes > 0){
|
|
|
|
else if (minutes > 0){
|
|
|
|
if (charging_state == CHARGING)
|
|
|
|
if (charging_state == CHARGING)
|
|
|
|
tmp = i18n("Plugged in -- %1% charged (%2:%3 h until full "
|
|
|
|
tmp = i18n("Plugged in -- %1% charged (%2:%3 h until full "
|
|
|
|
"charged)").tqarg(percent).tqarg(minutes / 60).tqarg(num3);
|
|
|
|
"charged)").arg(percent).arg(minutes / 60).arg(num3);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
tmp = i18n("Plugged in -- %1% charged (%2:%3 remaining hours)")
|
|
|
|
tmp = i18n("Plugged in -- %1% charged (%2:%3 remaining hours)")
|
|
|
|
.tqarg(percent).tqarg(minutes / 60).tqarg(num3);
|
|
|
|
.arg(percent).arg(minutes / 60).arg(num3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (charging_state == CHARGING && hwinfo->hasAPM()) {
|
|
|
|
else if (charging_state == CHARGING && hwinfo->hasAPM()) {
|
|
|
|
tmp = i18n("Plugged in -- %1% charged").tqarg(percent);
|
|
|
|
tmp = i18n("Plugged in -- %1% charged").arg(percent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
if (percent == -1) tmp = i18n("Plugged in -- no battery");
|
|
|
|
if (percent == -1) tmp = i18n("Plugged in -- no battery");
|
|
|
|
else tmp = i18n("Plugged in -- %1% charged").tqarg(percent);
|
|
|
|
else tmp = i18n("Plugged in -- %1% charged").arg(percent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else{
|
|
|
|
} else{
|
|
|
|
if (minutes >= 0){
|
|
|
|
if (minutes >= 0){
|
|
|
|
tmp = i18n("Running on batteries -- %1% charged (%2:%3 hours remaining)")
|
|
|
|
tmp = i18n("Running on batteries -- %1% charged (%2:%3 hours remaining)")
|
|
|
|
.tqarg(percent).tqarg(minutes / 60).tqarg(num3);
|
|
|
|
.arg(percent).arg(minutes / 60).arg(num3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
tmp = i18n("Running on batteries -- %1% charged").tqarg(percent);
|
|
|
|
tmp = i18n("Running on batteries -- %1% charged").arg(percent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// add string whether battery is charging, but only if < 100% to avoid
|
|
|
|
// add string whether battery is charging, but only if < 100% to avoid
|
|
|
@ -873,7 +873,7 @@ void kpowersave::do_autosuspendWarn() {
|
|
|
|
// TODO: rework this after translation round for openSUSE 10.3 !
|
|
|
|
// TODO: rework this after translation round for openSUSE 10.3 !
|
|
|
|
message = i18n("Inactivity detected.") + " " +
|
|
|
|
message = i18n("Inactivity detected.") + " " +
|
|
|
|
i18n("To stop the %1 press the 'Cancel' button before the countdown "
|
|
|
|
i18n("To stop the %1 press the 'Cancel' button before the countdown "
|
|
|
|
"expire.").tqarg(i18n("Autosuspend")) + "\n\n" +
|
|
|
|
"expire.").arg(i18n("Autosuspend")) + "\n\n" +
|
|
|
|
i18n("The computer autosuspend in: ");
|
|
|
|
i18n("The computer autosuspend in: ");
|
|
|
|
|
|
|
|
|
|
|
|
countdown->setMessageText(message);
|
|
|
|
countdown->setMessageText(message);
|
|
|
@ -1104,13 +1104,13 @@ bool kpowersave::handleMounts( bool suspend ) {
|
|
|
|
_msg = "<qt>" +
|
|
|
|
_msg = "<qt>" +
|
|
|
|
i18n("Could not umount external media before suspend/standby. \n "
|
|
|
|
i18n("Could not umount external media before suspend/standby. \n "
|
|
|
|
"(Reason: %1)\n \n Would you like to continue suspend/standby "
|
|
|
|
"(Reason: %1)\n \n Would you like to continue suspend/standby "
|
|
|
|
"anyway? \n(Warning: Continue suspend can cause data loss!)").tqarg(_e_msg) +
|
|
|
|
"anyway? \n(Warning: Continue suspend can cause data loss!)").arg(_e_msg) +
|
|
|
|
"</qt>";
|
|
|
|
"</qt>";
|
|
|
|
|
|
|
|
|
|
|
|
_suspend = getSuspendString(calledSuspend);
|
|
|
|
_suspend = getSuspendString(calledSuspend);
|
|
|
|
|
|
|
|
|
|
|
|
int answer = KMessageBox::questionYesNo( 0, _msg,
|
|
|
|
int answer = KMessageBox::questionYesNo( 0, _msg,
|
|
|
|
i18n("Error while prepare %1").tqarg(_suspend),
|
|
|
|
i18n("Error while prepare %1").arg(_suspend),
|
|
|
|
i18n("Suspend anyway"), i18n("Cancel suspend"),
|
|
|
|
i18n("Suspend anyway"), i18n("Cancel suspend"),
|
|
|
|
"ignoreMountOnSuspend");
|
|
|
|
"ignoreMountOnSuspend");
|
|
|
|
|
|
|
|
|
|
|
@ -1306,7 +1306,7 @@ void kpowersave::do_setSpeedPolicy(int menu_id){
|
|
|
|
|
|
|
|
|
|
|
|
if(!hwinfo->setCPUFreq((cpufreq_type)menu_id, settings->cpuFreqDynamicPerformance)) {
|
|
|
|
if(!hwinfo->setCPUFreq((cpufreq_type)menu_id, settings->cpuFreqDynamicPerformance)) {
|
|
|
|
KPassivePopup::message(i18n("WARNING"),
|
|
|
|
KPassivePopup::message(i18n("WARNING"),
|
|
|
|
i18n("CPU Freq Policy %1 could not be set.").tqarg(speed_menu->text(menu_id)),
|
|
|
|
i18n("CPU Freq Policy %1 could not be set.").arg(speed_menu->text(menu_id)),
|
|
|
|
SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 10000);
|
|
|
|
SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 10000);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
hwinfo->checkCurrentCPUFreqPolicy();
|
|
|
|
hwinfo->checkCurrentCPUFreqPolicy();
|
|
|
@ -1335,7 +1335,7 @@ void kpowersave::do_setActiveScheme( int i ){
|
|
|
|
notifySchemeSwitch();
|
|
|
|
notifySchemeSwitch();
|
|
|
|
} else if (!settings->schemes[i]){
|
|
|
|
} else if (!settings->schemes[i]){
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
KPassivePopup::message( i18n("WARNING"),
|
|
|
|
i18n("Scheme %1 could not be activated.").tqarg(scheme_menu->text(i)),
|
|
|
|
i18n("Scheme %1 could not be activated.").arg(scheme_menu->text(i)),
|
|
|
|
SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 5000);
|
|
|
|
SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 5000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1990,7 +1990,7 @@ void kpowersave::notifyBatteryStatusChange ( int type, int state ) {
|
|
|
|
if (!settings->disableNotifications)
|
|
|
|
if (!settings->disableNotifications)
|
|
|
|
KNotifyClient::event(this->winId(), "battery_warning_event",
|
|
|
|
KNotifyClient::event(this->winId(), "battery_warning_event",
|
|
|
|
i18n("Battery state changed to WARNING -- remaining time: "
|
|
|
|
i18n("Battery state changed to WARNING -- remaining time: "
|
|
|
|
"%1 hours and %2 minutes.").tqarg(min/60).tqarg(min%60));
|
|
|
|
"%1 hours and %2 minutes.").arg(min/60).arg(min%60));
|
|
|
|
// set/call related actions
|
|
|
|
// set/call related actions
|
|
|
|
handleActionCall(settings->batteryWarningLevelAction,
|
|
|
|
handleActionCall(settings->batteryWarningLevelAction,
|
|
|
|
settings->batteryWarningLevelActionValue);
|
|
|
|
settings->batteryWarningLevelActionValue);
|
|
|
@ -1999,7 +1999,7 @@ void kpowersave::notifyBatteryStatusChange ( int type, int state ) {
|
|
|
|
if (!settings->disableNotifications)
|
|
|
|
if (!settings->disableNotifications)
|
|
|
|
KNotifyClient::event(this->winId(), "battery_low_event",
|
|
|
|
KNotifyClient::event(this->winId(), "battery_low_event",
|
|
|
|
i18n("Battery state changed to LOW -- remaining time: "
|
|
|
|
i18n("Battery state changed to LOW -- remaining time: "
|
|
|
|
"%1 hours and %2 minutes.").tqarg(min/60).tqarg(min%60));
|
|
|
|
"%1 hours and %2 minutes.").arg(min/60).arg(min%60));
|
|
|
|
// set/call related actions
|
|
|
|
// set/call related actions
|
|
|
|
handleActionCall(settings->batteryLowLevelAction,
|
|
|
|
handleActionCall(settings->batteryLowLevelAction,
|
|
|
|
settings->batteryLowLevelActionValue);
|
|
|
|
settings->batteryLowLevelActionValue);
|
|
|
@ -2014,7 +2014,7 @@ void kpowersave::notifyBatteryStatusChange ( int type, int state ) {
|
|
|
|
"Shut down your system or plug in the power "
|
|
|
|
"Shut down your system or plug in the power "
|
|
|
|
"cable immediately. Otherwise the machine\n"
|
|
|
|
"cable immediately. Otherwise the machine\n"
|
|
|
|
"will go shutdown in 30 seconds")
|
|
|
|
"will go shutdown in 30 seconds")
|
|
|
|
.tqarg(min/ 60).tqarg(min%60));
|
|
|
|
.arg(min/ 60).arg(min%60));
|
|
|
|
|
|
|
|
|
|
|
|
TQTimer::singleShot(30000, this, TQT_SLOT(handleCriticalBatteryActionCall()));
|
|
|
|
TQTimer::singleShot(30000, this, TQT_SLOT(handleCriticalBatteryActionCall()));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -2024,7 +2024,7 @@ void kpowersave::notifyBatteryStatusChange ( int type, int state ) {
|
|
|
|
"remaining time: %1 hours and %2 minutes.\n"
|
|
|
|
"remaining time: %1 hours and %2 minutes.\n"
|
|
|
|
"Shut down your system or plug in the power "
|
|
|
|
"Shut down your system or plug in the power "
|
|
|
|
"cable immediately.")
|
|
|
|
"cable immediately.")
|
|
|
|
.tqarg(min/ 60).tqarg(min%60));
|
|
|
|
.arg(min/ 60).arg(min%60));
|
|
|
|
|
|
|
|
|
|
|
|
handleActionCall(settings->batteryCriticalLevelAction,
|
|
|
|
handleActionCall(settings->batteryCriticalLevelAction,
|
|
|
|
settings->batteryCriticalLevelActionValue);
|
|
|
|
settings->batteryCriticalLevelActionValue);
|
|
|
@ -2181,7 +2181,7 @@ void kpowersave::notifySchemeSwitch() {
|
|
|
|
eventType = "scheme_" + _scheme;
|
|
|
|
eventType = "scheme_" + _scheme;
|
|
|
|
|
|
|
|
|
|
|
|
KNotifyClient::event( this->winId(), eventType,
|
|
|
|
KNotifyClient::event( this->winId(), eventType,
|
|
|
|
i18n("Switched to scheme: %1").tqarg(i18n(_scheme.ascii())).ascii());
|
|
|
|
i18n("Switched to scheme: %1").arg(i18n(_scheme.ascii())).ascii());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
|
kdDebugFuncOut(trace);
|
|
|
@ -2258,17 +2258,17 @@ void kpowersave::handleResumeSignal() {
|
|
|
|
switch (calledSuspend) {
|
|
|
|
switch (calledSuspend) {
|
|
|
|
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.").tqarg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Suspend to Disk")));
|
|
|
|
i18n("Suspend to Disk")));
|
|
|
|
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.").tqarg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Suspend to RAM")));
|
|
|
|
i18n("Suspend to RAM")));
|
|
|
|
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.").tqarg(
|
|
|
|
i18n("System is resumed from %1.").arg(
|
|
|
|
i18n("Standby")));
|
|
|
|
i18n("Standby")));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
@ -2297,7 +2297,7 @@ void kpowersave::handleResumeSignal() {
|
|
|
|
TQString msg;
|
|
|
|
TQString msg;
|
|
|
|
|
|
|
|
|
|
|
|
msg = i18n("An unknown error occurred while %1. The errorcode is: '%2'").
|
|
|
|
msg = i18n("An unknown error occurred while %1. The errorcode is: '%2'").
|
|
|
|
tqarg(getSuspendString(calledSuspend)).tqarg(resume_result);
|
|
|
|
arg(getSuspendString(calledSuspend)).arg(resume_result);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(DISTRO_IS_SUSE) || defined(DISTRO_IS_SLES_SLED) || defined(DISTRO_IS_PARDUS)
|
|
|
|
#if defined(DISTRO_IS_SUSE) || defined(DISTRO_IS_SLES_SLED) || defined(DISTRO_IS_PARDUS)
|
|
|
|
// okay we know this system use pm-utils and log is under /var/log/pm-suspend.log
|
|
|
|
// okay we know this system use pm-utils and log is under /var/log/pm-suspend.log
|
|
|
@ -2328,7 +2328,7 @@ void kpowersave::handleResumeSignal() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
KMessageBox::error(0, msg, i18n("Error while %1").tqarg(getSuspendString(calledSuspend)));
|
|
|
|
KMessageBox::error(0, msg, i18n("Error while %1").arg(getSuspendString(calledSuspend)));
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// set back ... suspend is handled
|
|
|
|
// set back ... suspend is handled
|
|
|
|