244 { |
240 { |
245 mDeviceInfo->disconnect(this); |
241 mDeviceInfo->disconnect(this); |
246 mChargingTimer->stop(); |
242 mChargingTimer->stop(); |
247 mChargingTimer->disconnect(this); |
243 mChargingTimer->disconnect(this); |
248 connect(mDeviceInfo, SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), SLOT(powerStateChanged(QSystemDeviceInfo::PowerState))); |
244 connect(mDeviceInfo, SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), SLOT(powerStateChanged(QSystemDeviceInfo::PowerState))); |
249 #ifdef OWN_TESTING |
|
250 connect(mChargingTimer, SIGNAL(timeout()), this, SLOT(updateChargingBatteryValue())); |
|
251 mChargingTimer->start(1000); |
|
252 #else |
|
253 if (mDeviceInfo->currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) { |
245 if (mDeviceInfo->currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) { |
254 connect(mChargingTimer, SIGNAL(timeout()), this, SLOT(updateChargingBatteryValue())); |
246 connect(mChargingTimer, SIGNAL(timeout()), this, SLOT(updateChargingBatteryValue())); |
255 mChargingTimer->start(500); |
247 mChargingTimer->start(500); |
256 } else { |
248 } else { |
257 connect(mDeviceInfo, SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)), SLOT(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus))); |
|
258 connect(mDeviceInfo, SIGNAL(batteryLevelChanged(int)), SLOT(batteryLevelChanged(int))); |
249 connect(mDeviceInfo, SIGNAL(batteryLevelChanged(int)), SLOT(batteryLevelChanged(int))); |
259 mBatteryValue = mDeviceInfo->batteryLevel(); |
250 mBatteryValue = mDeviceInfo->batteryLevel(); |
260 } |
251 } |
261 #endif |
|
262 drawBatteryImage(); |
252 drawBatteryImage(); |
263 update(); |
253 update(); |
264 } |
254 } |
265 |
255 |