File 0001-Fix-battery-remaining-time-update-with-upower-0.99.patch of Package powerdevil5.openSUSE_13.2_Update

From e6a51ee22d43a659dde1cf1e2acab9bfb0000619 Mon Sep 17 00:00:00 2001
From: Weng Xuetian <wengxt@gmail.com>
Date: Fri, 5 Dec 2014 10:56:17 -0500
Subject: [PATCH 1/1] Fix battery remaining time update with upower >= 0.99

Existing device is not connected to PropertiesChanged signal, so it
never recevies update.

REVIEW: 121343
BUG: 339957
FIXED-IN: 5.1.2
(cherry picked from commit 23ad576c3fdbd1498b88907f6c9ee0cd693fa834)
---
 daemon/backends/upower/powerdevilupowerbackend.cpp | 10 ++++++----
 daemon/backends/upower/powerdevilupowerbackend.h   |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/daemon/backends/upower/powerdevilupowerbackend.cpp b/daemon/backends/upower/powerdevilupowerbackend.cpp
index ea1741f43ce220e0d7bb232f2c899fd30049d3c2..be7824cf4e0eff396ac767acbc8c4ab2fe147bd3 100644
--- a/daemon/backends/upower/powerdevilupowerbackend.cpp
+++ b/daemon/backends/upower/powerdevilupowerbackend.cpp
@@ -448,9 +448,7 @@ void PowerDevilUPowerBackend::enumerateDevices()
 
     QList<QDBusObjectPath> deviceList = m_upowerInterface->EnumerateDevices();
     foreach (const QDBusObjectPath & device, deviceList) {
-        OrgFreedesktopUPowerDeviceInterface * upowerDevice =
-                new OrgFreedesktopUPowerDeviceInterface(UPOWER_SERVICE, device.path(), QDBusConnection::systemBus(), this);
-        m_devices.insert(device.path(), upowerDevice);
+        addDevice(device.path());
     }
 
     updateDeviceProps();
@@ -461,7 +459,7 @@ void PowerDevilUPowerBackend::enumerateDevices()
         setAcAdapterState(Plugged);
 }
 
-void PowerDevilUPowerBackend::slotDeviceAdded(const QString & device)
+void PowerDevilUPowerBackend::addDevice(const QString & device)
 {
     OrgFreedesktopUPowerDeviceInterface * upowerDevice =
             new OrgFreedesktopUPowerDeviceInterface(UPOWER_SERVICE, device, QDBusConnection::systemBus(), this);
@@ -470,7 +468,11 @@ void PowerDevilUPowerBackend::slotDeviceAdded(const QString & device)
     // for UPower >= 0.99.0 which doesn't emit the DeviceChanged(QString) signal
     QDBusConnection::systemBus().connect(UPOWER_SERVICE, device, "org.freedesktop.DBus.Properties", "PropertiesChanged", this,
                                          SLOT(onDevicePropertiesChanged(QString,QVariantMap,QStringList)));
+}
 
+void PowerDevilUPowerBackend::slotDeviceAdded(const QString & device)
+{
+    addDevice(device);
     updateDeviceProps();
 }
 
diff --git a/daemon/backends/upower/powerdevilupowerbackend.h b/daemon/backends/upower/powerdevilupowerbackend.h
index 46817bcc9ba29aa26a15ded6b1432844c5307866..35459f6431f5554f56cc30f11b0e5bc4860c026d 100644
--- a/daemon/backends/upower/powerdevilupowerbackend.h
+++ b/daemon/backends/upower/powerdevilupowerbackend.h
@@ -64,6 +64,7 @@ public:
 
 private:
     void enumerateDevices();
+    void addDevice(const QString &);
 
 private slots:
     void updateDeviceProps();
-- 
2.1.3