[packages/kde4-kdelibs] - more multibattery fixes

arekm arekm at pld-linux.org
Tue Jun 4 19:19:42 CEST 2013


commit f5bb7afbbcce905d8cb17e18c3ab3e3118b3a637
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Jun 4 19:19:39 2013 +0200

    - more multibattery fixes

 kde4-kdelibs-multibattery.patch | 483 +++++++++++++++-------------------------
 1 file changed, 177 insertions(+), 306 deletions(-)
---
diff --git a/kde4-kdelibs-multibattery.patch b/kde4-kdelibs-multibattery.patch
index dec1918..b313a06 100644
--- a/kde4-kdelibs-multibattery.patch
+++ b/kde4-kdelibs-multibattery.patch
@@ -1,22 +1,23 @@
-From: Kai Uwe Broulik <kde at privat.broulik.de>
-Date: Mon, 13 May 2013 15:34:27 +0000
-Subject: Add support for the Power Supply property of UPower which indicates if a battery
-X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=b86adffd69a972f612e0fb00f8c4e8154142c730
----
-Add support for the Power Supply property of UPower which indicates if a battery
-is actually powering the machine (ie. laptop battery) or just reported by one
-of your peripherals (eg. mouse, keyboard).
-This will eventually allow other parties such as the battery notifier to disregard
-them when calculating overall battery percentage or PowerDevil to notify about
-
-REVIEW: 110384
-CCBUG: 300787
----
-
-
+diff --git a/solid/solid/backends/fakehw/fakebattery.cpp b/solid/solid/backends/fakehw/fakebattery.cpp
+index 0afe765..147cea0 100644
 --- a/solid/solid/backends/fakehw/fakebattery.cpp
 +++ b/solid/solid/backends/fakehw/fakebattery.cpp
-@@ -90,6 +90,11 @@
+@@ -85,11 +85,26 @@ int FakeBattery::chargePercent() const
+     return percent;
+ }
+ 
++int FakeBattery::capacity() const
++{
++    int last_full = fakeDevice()->property("lastFullLevel").toInt();
++    int max = fakeDevice()->property("maxLevel").toInt();
++
++    int percent = (100 * last_full) / max;
++
++    return percent;
++}
++
+ bool FakeBattery::isRechargeable() const
+ {
      return fakeDevice()->property("isRechargeable").toBool();
  }
  
@@ -28,18 +29,23 @@ CCBUG: 300787
  Solid::Battery::ChargeState FakeBattery::chargeState() const
  {
      QString state = fakeDevice()->property("chargeState").toString();
-
+diff --git a/solid/solid/backends/fakehw/fakebattery.h b/solid/solid/backends/fakehw/fakebattery.h
+index c7e2791..f832a1a 100644
 --- a/solid/solid/backends/fakehw/fakebattery.h
 +++ b/solid/solid/backends/fakehw/fakebattery.h
-@@ -46,6 +46,7 @@
+@@ -44,8 +44,10 @@ public Q_SLOTS:
+     virtual Solid::Battery::BatteryType type() const;
+ 
      virtual int chargePercent() const;
++    virtual int capacity() const;
  
      virtual bool isRechargeable() const;
 +    virtual bool isPowerSupply() const;
      virtual Solid::Battery::ChargeState chargeState() const;
  
      void setChargeState(Solid::Battery::ChargeState newState);
-
+diff --git a/solid/solid/backends/fakehw/fakecomputer.xml b/solid/solid/backends/fakehw/fakecomputer.xml
+index fe7e323..f33a32b 100644
 --- a/solid/solid/backends/fakehw/fakecomputer.xml
 +++ b/solid/solid/backends/fakehw/fakecomputer.xml
 @@ -32,9 +32,22 @@
@@ -47,9 +53,8 @@ CCBUG: 300787
              <property key="voltage">11999</property>
              <property key="isRechargeable">true</property>
 +            <property key="isPowerSupply">true</property>
-             <property key="chargeState">discharging</property>
-         </device>
--
++            <property key="chargeState">discharging</property>
++        </device>
 +        <device udi="/org/kde/solid/fakehw/acpi_BAT1">
 +            <property key="name">Miraculous Mouse</property>
 +            <property key="vendor">Orange Inc.</property>
@@ -61,15 +66,30 @@ CCBUG: 300787
 +                 for primary batteries, not for other batteries like this mouse -->
 +            <property key="isRechargeable">true</property>
 +            <property key="isPowerSupply">true</property>
-+            <property key="chargeState">discharging</property>
-+        </device>
+             <property key="chargeState">discharging</property>
+         </device>
+-
  
  
          <!-- So that it looks like a laptop,
-
+diff --git a/solid/solid/backends/hal/halbattery.cpp b/solid/solid/backends/hal/halbattery.cpp
+index 4c530da..14de035 100644
 --- a/solid/solid/backends/hal/halbattery.cpp
 +++ b/solid/solid/backends/hal/halbattery.cpp
-@@ -88,6 +88,17 @@
+@@ -83,11 +83,30 @@ int Battery::chargePercent() const
+     return m_device->prop("battery.charge_level.percentage").toInt();
+ }
+ 
++int Battery::capacity() const
++{
++    const qreal lastFull = m_device->prop("battery.charge_level.last_full").toDouble();
++    const qreal designFull = m_device->prop("battery.charge_level.design").toDouble();
++
++    return lastFull / designFull;
++}
++
+ bool Battery::isRechargeable() const
+ {
      return m_device->prop("battery.is_rechargeable").toBool();
  }
  
@@ -87,11 +107,28 @@ CCBUG: 300787
  Solid::Battery::ChargeState Battery::chargeState() const
  {
      bool charging = m_device->prop("battery.rechargeable.is_charging").toBool();
-
+@@ -114,6 +133,12 @@ void Battery::slotPropertyChanged(const QMap<QString,int> &changes)
+         emit chargePercentChanged(chargePercent(), m_device->udi());
+     }
+ 
++    if (changes.contains("battery.charge_level.last_full")
++           || changes.contains("battery.charge_level.design"))
++    {
++        emit capacityChanged(capacity(), m_device->udi());
++    }
++
+     if (changes.contains("battery.rechargeable.is_charging")
+            || changes.contains("battery.rechargeable.is_discharging"))
+     {
+diff --git a/solid/solid/backends/hal/halbattery.h b/solid/solid/backends/hal/halbattery.h
+index e2f38a0..7160e3a 100644
 --- a/solid/solid/backends/hal/halbattery.h
 +++ b/solid/solid/backends/hal/halbattery.h
-@@ -45,12 +45,14 @@
+@@ -43,14 +43,18 @@ public:
+     virtual Solid::Battery::BatteryType type() const;
+ 
      virtual int chargePercent() const;
++    virtual int capacity() const;
  
      virtual bool isRechargeable() const;
 +    virtual bool isPowerSupply() const;
@@ -99,16 +136,28 @@ CCBUG: 300787
  
  Q_SIGNALS:
      void chargePercentChanged(int value, const QString &udi);
++    void capacityChanged(int value, const QString &udi);
      void chargeStateChanged(int newState, const QString &udi);
      void plugStateChanged(bool newState, const QString &udi);
 +    void powerSupplyStateChanged(bool newState, const QString &udi); // dummy
  
  private Q_SLOTS:
      void slotPropertyChanged(const QMap<QString,int> &changes);
-
+diff --git a/solid/solid/backends/upower/upowerbattery.cpp b/solid/solid/backends/upower/upowerbattery.cpp
+index 1a40a2a..7b5bdc4 100644
 --- a/solid/solid/backends/upower/upowerbattery.cpp
 +++ b/solid/solid/backends/upower/upowerbattery.cpp
-@@ -83,6 +83,11 @@
+@@ -78,11 +78,21 @@ int Battery::chargePercent() const
+     return qRound(m_device.data()->prop("Percentage").toDouble());
+ }
+ 
++int Battery::capacity() const
++{
++    return m_device.data()->prop("Capacity").toDouble();
++}
++
+ bool Battery::isRechargeable() const
+ {
      return m_device.data()->prop("IsRechargeable").toBool();
  }
  
@@ -120,15 +169,31 @@ CCBUG: 300787
  Solid::Battery::ChargeState Battery::chargeState() const
  {
      Solid::Battery::ChargeState result = Solid::Battery::NoCharge;
-@@ -116,6 +121,7 @@
-         const bool old_isPlugged = m_isPlugged;
+@@ -113,9 +123,11 @@ Solid::Battery::ChargeState Battery::chargeState() const
+ void Battery::slotChanged()
+ {
+     if (m_device) {
+-        const bool old_isPlugged = m_isPlugged;
          const int old_chargePercent = m_chargePercent;
++        const int old_capacity = m_capacity;
          const Solid::Battery::ChargeState old_chargeState = m_chargeState;
++        const bool old_isPlugged = m_isPlugged;
 +        const bool old_isPowerSupply = m_isPowerSupply;
          updateCache();
  
          if (old_chargePercent != m_chargePercent)
-@@ -132,6 +138,11 @@
+@@ -123,6 +135,10 @@ void Battery::slotChanged()
+             emit chargePercentChanged(m_chargePercent, m_device.data()->udi());
+         }
+ 
++        if (old_capacity != m_capacity) {
++            emit capacityChanged(m_capacity, m_device.data()->udi());
++        }
++
+         if (old_chargeState != m_chargeState)
+         {
+             emit chargeStateChanged(m_chargeState, m_device.data()->udi());
+@@ -132,6 +148,11 @@ void Battery::slotChanged()
          {
              emit plugStateChanged(m_isPlugged, m_device.data()->udi());
          }
@@ -140,45 +205,58 @@ CCBUG: 300787
      }
  }
  
-@@ -140,6 +151,7 @@
+@@ -139,7 +160,9 @@ void Battery::updateCache()
+ {
      m_isPlugged = isPlugged();
      m_chargePercent = chargePercent();
++    m_capacity = capacity();
      m_chargeState = chargeState();
 +    m_isPowerSupply = isPowerSupply();
  }
  
  #include "backends/upower/upowerbattery.moc"
-
+diff --git a/solid/solid/backends/upower/upowerbattery.h b/solid/solid/backends/upower/upowerbattery.h
+index 9d52f7b..3f589ce 100644
 --- a/solid/solid/backends/upower/upowerbattery.h
 +++ b/solid/solid/backends/upower/upowerbattery.h
-@@ -46,6 +46,7 @@
+@@ -44,16 +44,21 @@ public:
+     virtual Solid::Battery::BatteryType type() const;
+ 
      virtual int chargePercent() const;
++    virtual int capacity() const;
  
      virtual bool isRechargeable() const;
 +    virtual bool isPowerSupply() const;
++
      virtual Solid::Battery::ChargeState chargeState() const;
  
-     // TODO report stuff like capacity, technology, time-to-full, time-to-empty, energy rates, vendor, etc.
-@@ -54,6 +55,7 @@
+-    // TODO report stuff like capacity, technology, time-to-full, time-to-empty, energy rates, vendor, etc.
++    // TODO report stuff like technology, time-to-full, time-to-empty, energy rates, vendor, etc.
+ 
+ Q_SIGNALS:
      void chargePercentChanged(int value, const QString &udi);
++    void capacityChanged(int value, const QString &udi);
      void chargeStateChanged(int newState, const QString &udi);
      void plugStateChanged(bool newState, const QString &udi);
 +    void powerSupplyStateChanged(bool newState, const QString &udi);
  
  private Q_SLOTS:
      void slotChanged();
-@@ -64,6 +66,7 @@
+@@ -63,7 +68,9 @@ private:
+ 
      bool m_isPlugged;
      int m_chargePercent;
++    int m_capacity;
      Solid::Battery::ChargeState m_chargeState;
 +    bool m_isPowerSupply;
  };
  }
  }
-
+diff --git a/solid/solid/backends/upower/upowerdevice.cpp b/solid/solid/backends/upower/upowerdevice.cpp
+index 4930053..43e7060 100644
 --- a/solid/solid/backends/upower/upowerdevice.cpp
 +++ b/solid/solid/backends/upower/upowerdevice.cpp
-@@ -83,7 +83,7 @@
+@@ -83,7 +83,7 @@ bool UPowerDevice::queryDeviceInterface(const Solid::DeviceInterface::Type& type
          case Solid::DeviceInterface::GenericInterface:
              return true;
          case Solid::DeviceInterface::Battery:
@@ -187,90 +265,19 @@ CCBUG: 300787
          case Solid::DeviceInterface::AcAdapter:
              return (uptype == 1);
          default:
-
+diff --git a/solid/solid/battery.cpp b/solid/solid/battery.cpp
+index 37d7321..f8e2048 100644
 --- a/solid/solid/battery.cpp
 +++ b/solid/solid/battery.cpp
-@@ -48,6 +48,12 @@
-     return_SOLID_CALL(Ifaces::Battery *, d->backendObject(), false, isPlugged());
- }
- 
-+bool Solid::Battery::isPowerSupply() const
-+{
-+    Q_D(const Battery);
-+    return_SOLID_CALL(Ifaces::Battery *, d->backendObject(), true, isPowerSupply());
-+}
-+
- Solid::Battery::BatteryType Solid::Battery::type() const
- {
-     Q_D(const Battery);
-
---- a/solid/solid/battery.h
-+++ b/solid/solid/battery.h
-@@ -110,6 +110,14 @@
-         bool isPlugged() const;
- 
-         /**
-+         * Indicates if this battery is powering the machine or from an attached deviced.
-+         *
-+         * @since 4.11
-+         * @return true the battery is a powersupply, false otherwise
-+         */
-+        bool isPowerSupply() const;
-+
-+        /**
-          * Retrieves the type of device holding this battery.
-          *
-          * @return the type of device holding this battery
-
---- a/solid/solid/ifaces/battery.h
-+++ b/solid/solid/ifaces/battery.h
-@@ -75,6 +75,13 @@
-         virtual bool isRechargeable() const = 0;
+@@ -30,11 +30,17 @@ Solid::Battery::Battery(QObject *backendObject)
+     connect(backendObject, SIGNAL(chargePercentChanged(int,QString)),
+              this, SIGNAL(chargePercentChanged(int,QString)));
  
-         /**
-+         * Indicates if the battery is powering the machine.
-+         *
-+         * @return true if the battery is powersupply, false otherwise
-+         */
-+        virtual bool isPowerSupply() const = 0;
++    connect(backendObject, SIGNAL(capacityChanged(int,QString)),
++             this, SIGNAL(capacityChanged(int,QString)));
 +
-+        /**
-          * Retrieves the current charge state of the battery. It can be in a stable
-          * state (no charge), charging or discharging.
-          *
-
-From: Kai Uwe Broulik <kde at privat.broulik.de>
-Date: Tue, 04 Jun 2013 13:21:35 +0000
-Subject: Add missing Q_PROPERTY
-X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=0a53c75a44e2e7106490b37c2fff6ad247390f2a
----
-Add missing Q_PROPERTY
----
-
-
---- a/solid/solid/battery.h
-+++ b/solid/solid/battery.h
-@@ -38,6 +38,7 @@
-         Q_OBJECT
-         Q_ENUMS(BatteryType ChargeState)
-         Q_PROPERTY(bool plugged READ isPlugged)
-+        Q_PROPERTY(bool powerSupply READ isPowerSupply)
-         Q_PROPERTY(BatteryType type READ type)
-         Q_PROPERTY(int chargePercent READ chargePercent)
-         Q_PROPERTY(bool rechargeable READ isRechargeable)
-
-From: Kai Uwe Broulik <kde at privat.broulik.de>
-Date: Tue, 04 Jun 2013 13:25:43 +0000
-Subject: Add missing signal connection
-X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=076f57e7d38315bd965d139908b8b397d363fd18
----
-Add missing signal connection
----
-
-
---- a/solid/solid/battery.cpp
-+++ b/solid/solid/battery.cpp
-@@ -35,6 +35,9 @@
+     connect(backendObject, SIGNAL(chargeStateChanged(int,QString)),
+              this, SIGNAL(chargeStateChanged(int,QString)));
  
      connect(backendObject, SIGNAL(plugStateChanged(bool,QString)),
               this, SIGNAL(plugStateChanged(bool,QString)));
@@ -280,189 +287,20 @@ Add missing signal connection
  }
  
  Solid::Battery::~Battery()
-
-From: Kai Uwe Broulik <kde at privat.broulik.de>
-Date: Tue, 04 Jun 2013 13:40:16 +0000
-Subject: Add support for battery capacity
-X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=2f674db466ead221afc29da0022e2c7ccf59c36e
----
-Add support for battery capacity
-
-REVIEW: 110607
----
-
-
---- a/solid/solid/backends/fakehw/fakebattery.cpp
-+++ b/solid/solid/backends/fakehw/fakebattery.cpp
-@@ -85,6 +85,16 @@
-     return percent;
- }
- 
-+int FakeBattery::capacity() const
-+{
-+    int last_full = fakeDevice()->property("lastFullLevel").toInt();
-+    int max = fakeDevice()->property("maxLevel").toInt();
-+
-+    int percent = (100 * last_full) / max;
-+
-+    return percent;
-+}
-+
- bool FakeBattery::isRechargeable() const
- {
-     return fakeDevice()->property("isRechargeable").toBool();
-
---- a/solid/solid/backends/fakehw/fakebattery.h
-+++ b/solid/solid/backends/fakehw/fakebattery.h
-@@ -44,6 +44,7 @@
-     virtual Solid::Battery::BatteryType type() const;
- 
-     virtual int chargePercent() const;
-+    virtual int capacity() const;
- 
-     virtual bool isRechargeable() const;
-     virtual bool isPowerSupply() const;
-
---- a/solid/solid/backends/hal/halbattery.cpp
-+++ b/solid/solid/backends/hal/halbattery.cpp
-@@ -83,6 +83,14 @@
-     return m_device->prop("battery.charge_level.percentage").toInt();
- }
- 
-+int Battery::capacity() const
-+{
-+    const qreal lastFull = m_device->prop("battery.charge_level.last_full").toDouble();
-+    const qreal designFull = m_device->prop("battery.charge_level.design").toDouble();
-+
-+    return lastFull / designFull;
-+}
-+
- bool Battery::isRechargeable() const
- {
-     return m_device->prop("battery.is_rechargeable").toBool();
-@@ -125,6 +133,12 @@
-         emit chargePercentChanged(chargePercent(), m_device->udi());
-     }
- 
-+    if (changes.contains("battery.charge_level.last_full")
-+           || changes.contains("battery.charge_level.design"))
-+    {
-+        emit capacityChanged(capacity(), m_device->udi());
-+    }
-+
-     if (changes.contains("battery.rechargeable.is_charging")
-            || changes.contains("battery.rechargeable.is_discharging"))
-     {
-
---- a/solid/solid/backends/hal/halbattery.h
-+++ b/solid/solid/backends/hal/halbattery.h
-@@ -43,6 +43,7 @@
-     virtual Solid::Battery::BatteryType type() const;
- 
-     virtual int chargePercent() const;
-+    virtual int capacity() const;
- 
-     virtual bool isRechargeable() const;
-     virtual bool isPowerSupply() const;
-@@ -50,6 +51,7 @@
- 
- Q_SIGNALS:
-     void chargePercentChanged(int value, const QString &udi);
-+    void capacityChanged(int value, const QString &udi);
-     void chargeStateChanged(int newState, const QString &udi);
-     void plugStateChanged(bool newState, const QString &udi);
-     void powerSupplyStateChanged(bool newState, const QString &udi); // dummy
-
---- a/solid/solid/backends/upower/upowerbattery.cpp
-+++ b/solid/solid/backends/upower/upowerbattery.cpp
-@@ -78,6 +78,11 @@
-     return qRound(m_device.data()->prop("Percentage").toDouble());
+@@ -48,6 +54,12 @@ bool Solid::Battery::isPlugged() const
+     return_SOLID_CALL(Ifaces::Battery *, d->backendObject(), false, isPlugged());
  }
  
-+int Battery::capacity() const
++bool Solid::Battery::isPowerSupply() const
 +{
-+    return m_device.data()->prop("Capacity").toDouble();
++    Q_D(const Battery);
++    return_SOLID_CALL(Ifaces::Battery *, d->backendObject(), true, isPowerSupply());
 +}
 +
- bool Battery::isRechargeable() const
- {
-     return m_device.data()->prop("IsRechargeable").toBool();
-@@ -118,15 +123,20 @@
- void Battery::slotChanged()
- {
-     if (m_device) {
-+        const int old_chargePercent = m_chargePercent;
-+        const int old_capacity = m_capacity;
-+        const Solid::Battery::ChargeState old_chargeState = m_chargeState;
-         const bool old_isPlugged = m_isPlugged;
--        const int old_chargePercent = m_chargePercent;
--        const Solid::Battery::ChargeState old_chargeState = m_chargeState;
-         const bool old_isPowerSupply = m_isPowerSupply;
-         updateCache();
- 
-         if (old_chargePercent != m_chargePercent)
-         {
-             emit chargePercentChanged(m_chargePercent, m_device.data()->udi());
-+        }
-+
-+        if (old_capacity != m_capacity) {
-+            emit capacityChanged(m_capacity, m_device.data()->udi());
-         }
- 
-         if (old_chargeState != m_chargeState)
-@@ -150,6 +160,7 @@
- {
-     m_isPlugged = isPlugged();
-     m_chargePercent = chargePercent();
-+    m_capacity = capacity();
-     m_chargeState = chargeState();
-     m_isPowerSupply = isPowerSupply();
- }
-
---- a/solid/solid/backends/upower/upowerbattery.h
-+++ b/solid/solid/backends/upower/upowerbattery.h
-@@ -44,15 +44,18 @@
-     virtual Solid::Battery::BatteryType type() const;
- 
-     virtual int chargePercent() const;
-+    virtual int capacity() const;
- 
-     virtual bool isRechargeable() const;
-     virtual bool isPowerSupply() const;
-+
-     virtual Solid::Battery::ChargeState chargeState() const;
- 
--    // TODO report stuff like capacity, technology, time-to-full, time-to-empty, energy rates, vendor, etc.
-+    // TODO report stuff like technology, time-to-full, time-to-empty, energy rates, vendor, etc.
- 
- Q_SIGNALS:
-     void chargePercentChanged(int value, const QString &udi);
-+    void capacityChanged(int value, const QString &udi);
-     void chargeStateChanged(int newState, const QString &udi);
-     void plugStateChanged(bool newState, const QString &udi);
-     void powerSupplyStateChanged(bool newState, const QString &udi);
-@@ -65,6 +68,7 @@
- 
-     bool m_isPlugged;
-     int m_chargePercent;
-+    int m_capacity;
-     Solid::Battery::ChargeState m_chargeState;
-     bool m_isPowerSupply;
- };
-
---- a/solid/solid/battery.cpp
-+++ b/solid/solid/battery.cpp
-@@ -29,6 +29,9 @@
+ Solid::Battery::BatteryType Solid::Battery::type() const
  {
-     connect(backendObject, SIGNAL(chargePercentChanged(int,QString)),
-              this, SIGNAL(chargePercentChanged(int,QString)));
-+
-+    connect(backendObject, SIGNAL(capacityChanged(int,QString)),
-+             this, SIGNAL(capacityChanged(int,QString)));
- 
-     connect(backendObject, SIGNAL(chargeStateChanged(int,QString)),
-              this, SIGNAL(chargeStateChanged(int,QString)));
-@@ -69,6 +72,12 @@
+     Q_D(const Battery);
+@@ -60,6 +72,12 @@ int Solid::Battery::chargePercent() const
      return_SOLID_CALL(Ifaces::Battery *, d->backendObject(), 0, chargePercent());
  }
  
@@ -475,18 +313,37 @@ REVIEW: 110607
  bool Solid::Battery::isRechargeable() const
  {
      Q_D(const Battery);
-
+diff --git a/solid/solid/battery.h b/solid/solid/battery.h
+index 3afac6f..4ee7f69 100644
 --- a/solid/solid/battery.h
 +++ b/solid/solid/battery.h
-@@ -41,6 +41,7 @@
-         Q_PROPERTY(bool powerSupply READ isPowerSupply)
+@@ -38,8 +38,10 @@ namespace Solid
+         Q_OBJECT
+         Q_ENUMS(BatteryType ChargeState)
+         Q_PROPERTY(bool plugged READ isPlugged)
++        Q_PROPERTY(bool powerSupply READ isPowerSupply)
          Q_PROPERTY(BatteryType type READ type)
          Q_PROPERTY(int chargePercent READ chargePercent)
 +        Q_PROPERTY(int capacity READ capacity)
          Q_PROPERTY(bool rechargeable READ isRechargeable)
          Q_PROPERTY(ChargeState chargeState READ chargeState)
          Q_DECLARE_PRIVATE(Battery)
-@@ -136,6 +137,14 @@
+@@ -110,6 +112,14 @@ namespace Solid
+         bool isPlugged() const;
+ 
+         /**
++         * Indicates if this battery is powering the machine or from an attached deviced.
++         *
++         * @since 4.11
++         * @return true the battery is a powersupply, false otherwise
++         */
++        bool isPowerSupply() const;
++
++        /**
+          * Retrieves the type of device holding this battery.
+          *
+          * @return the type of device holding this battery
+@@ -127,6 +137,14 @@ namespace Solid
           */
          int chargePercent() const;
  
@@ -501,10 +358,11 @@ REVIEW: 110607
  
  
          /**
-
+diff --git a/solid/solid/ifaces/battery.h b/solid/solid/ifaces/battery.h
+index 9987d18..3158478 100644
 --- a/solid/solid/ifaces/battery.h
 +++ b/solid/solid/ifaces/battery.h
-@@ -66,6 +66,15 @@
+@@ -66,6 +66,15 @@ namespace Ifaces
           */
          virtual int chargePercent() const = 0;
  
@@ -520,4 +378,17 @@ REVIEW: 110607
  
          /**
           * Indicates if the battery is rechargeable.
-
+@@ -75,6 +84,13 @@ namespace Ifaces
+         virtual bool isRechargeable() const = 0;
+ 
+         /**
++         * Indicates if the battery is powering the machine.
++         *
++         * @return true if the battery is powersupply, false otherwise
++         */
++        virtual bool isPowerSupply() const = 0;
++
++        /**
+          * Retrieves the current charge state of the battery. It can be in a stable
+          * state (no charge), charging or discharging.
+          *
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kde4-kdelibs.git/commitdiff/f5bb7afbbcce905d8cb17e18c3ab3e3118b3a637



More information about the pld-cvs-commit mailing list