summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamarque V. Souza <lamarque@gmail.com>2011-02-05 19:40:42 (GMT)
committerLamarque V. Souza <lamarque@gmail.com>2011-02-05 19:45:16 (GMT)
commitc5721519a0ccf8a528bdb31f051509db00e98e0c (patch)
treea562cf1eef62e89ed949d286f13adb187c4f14bb
parentd12cdfc89da1bfc847d55e286cd74c2aae4c1c2a (diff)
Add UpsBatteries to batterySources so that the Battery plasmoid can
monitors them when using UPower backend. CCBUG: 197627
-rw-r--r--plasma/generic/dataengines/powermanagement/powermanagementengine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/plasma/generic/dataengines/powermanagement/powermanagementengine.cpp b/plasma/generic/dataengines/powermanagement/powermanagementengine.cpp
index c5644b5..f54d609 100644
--- a/plasma/generic/dataengines/powermanagement/powermanagementengine.cpp
+++ b/plasma/generic/dataengines/powermanagement/powermanagementengine.cpp
@@ -120,7 +120,8 @@ bool PowermanagementEngine::sourceRequestEvent(const QString &name)
foreach (const Solid::Device &deviceBattery, listBattery) {
const Solid::Battery* battery = deviceBattery.as<Solid::Battery>();
- if (battery && battery->type() == Solid::Battery::PrimaryBattery) {
+ if (battery && battery->type() == Solid::Battery::PrimaryBattery ||
+ battery->type() == Solid::Battery::UpsBattery) {
const QString source = QString("Battery%1").arg(index++);
batterySources << source;
@@ -247,7 +248,8 @@ void PowermanagementEngine::deviceAdded(const QString& udi)
if (device.isValid()) {
const Solid::Battery* battery = device.as<Solid::Battery>();
- if (battery && battery->type() == Solid::Battery::PrimaryBattery) {
+ if (battery && battery->type() == Solid::Battery::PrimaryBattery ||
+ battery->type() == Solid::Battery::UpsBattery) {
int index = 0;
QStringList sourceNames(m_batterySources.values());
while (sourceNames.contains(QString("Battery%1").arg(index))) {