summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamarque V. Souza <lamarque@gmail.com>2011-02-05 19:50:39 (GMT)
committerLamarque V. Souza <lamarque@gmail.com>2011-02-05 19:50:39 (GMT)
commit09492b4dd8c83056125275cf558e00ad7c4a1e0f (patch)
treed96281c65b56b08fac67e7d5da888f835ad72868
parent84384efb52367e720ad82ace04ac8da668afc5ec (diff)
Backport c5721519a0ccf8a528bdb31f051509db00e98e0c by lvsouza from master
to the 4.6 branch: Add UpsBatteries to batterySources so that the Battery plasmoid can monitors them when using UPower backend.
-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))) {