summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 14:12:28 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-15 14:12:28 -0500
commitc8c3b71ed2853200ea94bd14e1035b703025f03d (patch)
treefd1b06687db9eb6643ae4f3e819e1081f78bc290
parent7ac2a6533d3df1f083f48115bc67edd23080bb95 (diff)
downloadtdebase-c8c3b71ed2853200ea94bd14e1035b703025f03d.tar.gz
tdebase-c8c3b71ed2853200ea94bd14e1035b703025f03d.zip
Expose battery time remaining
-rw-r--r--kcontrol/hwmanager/devicepropsdlg.cpp14
-rw-r--r--kcontrol/hwmanager/devicepropsdlgbase.ui13
2 files changed, 26 insertions, 1 deletions
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp
index 8622dc978..459d72662 100644
--- a/kcontrol/hwmanager/devicepropsdlg.cpp
+++ b/kcontrol/hwmanager/devicepropsdlg.cpp
@@ -503,10 +503,22 @@ void DevicePropertiesDialog::populateDeviceInformation() {
base->labelMinimumBatteryVoltage->setText((bdevice->minimumVoltage()<0)?i18n("<unknown>"):TQString("%1 V").arg(bdevice->minimumVoltage()));
base->labelCurrentBatteryVoltage->setText((bdevice->voltage()<0)?i18n("<unknown>"):TQString("%1 V").arg(bdevice->voltage()));
base->labelCurrentBatteryDischargeRate->setText((bdevice->dischargeRate()<0)?i18n("<unknown>"):TQString("%1 Vh").arg(bdevice->dischargeRate()));
- base->labelCurrentBatteryStatus->setText((bdevice->status().isNull())?i18n("<unknown>"):bdevice->status());
+ TQString batteryStatusString = i18n("Unknown");
+ TDEBatteryStatus::TDEBatteryStatus batteryStatus = bdevice->status();
+ if (batteryStatus == TDEBatteryStatus::Charging) {
+ batteryStatusString = i18n("Charging");
+ }
+ if (batteryStatus == TDEBatteryStatus::Discharging) {
+ batteryStatusString = i18n("Discharging");
+ }
+ if (batteryStatus == TDEBatteryStatus::Full) {
+ batteryStatusString = i18n("Full");
+ }
+ base->labelCurrentBatteryStatus->setText(batteryStatusString);
base->labelBatteryTechnology->setText((bdevice->technology().isNull())?i18n("<unknown>"):bdevice->technology());
base->labelBatteryInstalled->setText((bdevice->installed()==0)?i18n("No"):i18n("Yes"));
base->labelBatteryCharge->setText((bdevice->chargePercent()<0)?i18n("<unknown>"):TQString("%1 %").arg(bdevice->chargePercent()));
+ base->labelBatteryTimeRemaining->setText((bdevice->timeRemaining()<0)?i18n("<unknown>"):TQString("%1 seconds").arg(bdevice->timeRemaining()));
}
if (m_device->type() == TDEGenericDeviceType::PowerSupply) {
diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui
index bd80b3900..ff5af2031 100644
--- a/kcontrol/hwmanager/devicepropsdlgbase.ui
+++ b/kcontrol/hwmanager/devicepropsdlgbase.ui
@@ -662,6 +662,19 @@
<cstring>labelBatteryCharge</cstring>
</property>
</widget>
+ <widget class="TQLabel" row="10" column="0" colspan="1">
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="text">
+ <string>Time To Charge / Discharge</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="10" column="1" colspan="1">
+ <property name="name">
+ <cstring>labelBatteryTimeRemaining</cstring>
+ </property>
+ </widget>
</grid>
</widget>
<spacer row="8" column="0">