[SCM] KDE Development Platform Libraries module packaging branch, master, updated. debian/4.8.4-1-3-g4d01d6e

Matthias Klumpp ximion-guest at alioth.debian.org
Tue Jun 26 18:14:28 UTC 2012


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-sc/kde4libs.git;a=commitdiff;h=4d01d6e

The following commit has been merged in the master branch:
commit 4d01d6e57444b03116809c67fb3a63b850b2e3e1
Author: Matthias Klumpp <matthias at tenstral.net>
Date:   Tue Jun 26 19:48:29 2012 +0200

    Add patch 03_upstream_powermanager_fix
    
    Backport upstream commit 05f1a19291af5c16745b76c3e0944c5b80ef5870
    To fix powermanagement:
    Make sure we have valid values for powermanager, watch for
    unregistration to reset values
    KDE BUG: 300786
---
 ...x_05f1a19291af5c16745b76c3e0944c5b80ef5870.diff |  164 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 2 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/debian/patches/03_upstream_powermanager_fix_05f1a19291af5c16745b76c3e0944c5b80ef5870.diff b/debian/patches/03_upstream_powermanager_fix_05f1a19291af5c16745b76c3e0944c5b80ef5870.diff
new file mode 100644
index 0000000..0a28b4f
--- /dev/null
+++ b/debian/patches/03_upstream_powermanager_fix_05f1a19291af5c16745b76c3e0944c5b80ef5870.diff
@@ -0,0 +1,164 @@
+commit 05f1a19291af5c16745b76c3e0944c5b80ef5870
+Author: Daniel Nicoletti <dantt12 at gmail.com>
+Date:   Thu Jun 21 11:23:46 2012 -0300
+
+    Make sure we have valid values for powermanager, watch for unregistration to reset values
+    BUG: 300786
+
+diff --git a/solid/solid/powermanagement.cpp b/solid/solid/powermanagement.cpp
+index faadea4..b1fab65 100644
+--- a/solid/solid/powermanagement.cpp
++++ b/solid/solid/powermanagement.cpp
+@@ -39,14 +39,10 @@ Solid::PowerManagementPrivate::PowerManagementPrivate()
+                    QDBusConnection::sessionBus()),
+       serviceWatcher("org.kde.Solid.PowerManagement",
+                      QDBusConnection::sessionBus(),
+-                     QDBusServiceWatcher::WatchForRegistration)
++                     QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration),
++      powerSaveStatus(false)
+ {
+-    powerSaveStatus = managerIface.GetPowerSaveStatus();
+-
+-    if (managerIface.CanSuspend())
+-        supportedSleepStates+= Solid::PowerManagement::SuspendState;
+-    if (managerIface.CanHibernate())
+-        supportedSleepStates+= Solid::PowerManagement::HibernateState;
++    serviceWatcher.addWatchedService(QLatin1String("org.freedesktop.PowerManagement"));
+ 
+     connect(&managerIface, SIGNAL(CanSuspendChanged(bool)),
+             this, SLOT(slotCanSuspendChanged(bool)));
+@@ -56,11 +52,16 @@ Solid::PowerManagementPrivate::PowerManagementPrivate()
+             this, SLOT(slotPowerSaveStatusChanged(bool)));
+     connect(&serviceWatcher, SIGNAL(serviceRegistered(QString)),
+             this, SLOT(slotServiceRegistered(QString)));
++    connect(&serviceWatcher, SIGNAL(serviceUnregistered(QString)),
++            this, SLOT(slotServiceUnregistered(QString)));
+ 
+     // If the service is registered, trigger the connection immediately
+     if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
+         slotServiceRegistered("org.kde.Solid.PowerManagement");
+     }
++    if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.freedesktop.PowerManagement"))) {
++        slotServiceRegistered(QLatin1String("org.freedesktop.PowerManagement"));
++    }
+ }
+ 
+ Solid::PowerManagementPrivate::~PowerManagementPrivate()
+@@ -186,6 +187,10 @@ Solid::PowerManagement::Notifier *Solid::PowerManagement::notifier()
+ 
+ void Solid::PowerManagementPrivate::slotCanSuspendChanged(bool newState)
+ {
++    if (supportedSleepStates.contains(Solid::PowerManagement::SuspendState) == newState) {
++        return;
++    }
++
+     if (newState) {
+         supportedSleepStates+= Solid::PowerManagement::SuspendState;
+     } else {
+@@ -195,6 +200,10 @@ void Solid::PowerManagementPrivate::slotCanSuspendChanged(bool newState)
+ 
+ void Solid::PowerManagementPrivate::slotCanHibernateChanged(bool newState)
+ {
++    if (supportedSleepStates.contains(Solid::PowerManagement::HibernateState) == newState) {
++        return;
++    }
++
+     if (newState) {
+         supportedSleepStates+= Solid::PowerManagement::HibernateState;
+     } else {
+@@ -204,30 +213,65 @@ void Solid::PowerManagementPrivate::slotCanHibernateChanged(bool newState)
+ 
+ void Solid::PowerManagementPrivate::slotPowerSaveStatusChanged(bool newState)
+ {
++    if (powerSaveStatus == newState) {
++        return;
++    }
++
+     powerSaveStatus = newState;
+     emit appShouldConserveResourcesChanged(powerSaveStatus);
+ }
+ 
+ void Solid::PowerManagementPrivate::slotServiceRegistered(const QString &serviceName)
+ {
+-    Q_UNUSED(serviceName);
+-
+-    // Is the resume signal available?
+-    QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement",
+-                                                       "/org/kde/Solid/PowerManagement",
+-                                                       "org.kde.Solid.PowerManagement",
+-                                                       "backendCapabilities");
+-    QDBusPendingReply< uint > reply = QDBusConnection::sessionBus().asyncCall(call);
+-    reply.waitForFinished();
+-
+-    if (reply.isValid() && reply.value() > 0) {
+-        // Connect the signal
+-        QDBusConnection::sessionBus().connect("org.kde.Solid.PowerManagement",
+-                                              "/org/kde/Solid/PowerManagement",
+-                                              "org.kde.Solid.PowerManagement",
+-                                              "resumingFromSuspend",
+-                                              this,
+-                                              SIGNAL(resumingFromSuspend()));
++    if (serviceName == QLatin1String("org.freedesktop.PowerManagement")) {
++        // Load all the properties
++        QDBusPendingReply<bool> suspendReply = managerIface.CanSuspend();
++        suspendReply.waitForFinished();
++        slotCanSuspendChanged(suspendReply.isValid() ? suspendReply.value() : false);
++
++        QDBusPendingReply<bool> hibernateReply = managerIface.CanHibernate();
++        hibernateReply.waitForFinished();
++        slotCanHibernateChanged(hibernateReply.isValid() ? hibernateReply.value() : false);
++
++        QDBusPendingReply<bool> saveStatusReply = managerIface.GetPowerSaveStatus();
++        saveStatusReply.waitForFinished();
++        slotPowerSaveStatusChanged(saveStatusReply.isValid() ? saveStatusReply.value() : false);
++    } else {
++        // Is the resume signal available?
++        QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement",
++                                                           "/org/kde/Solid/PowerManagement",
++                                                           "org.kde.Solid.PowerManagement",
++                                                           "backendCapabilities");
++        QDBusPendingReply< uint > reply = QDBusConnection::sessionBus().asyncCall(call);
++        reply.waitForFinished();
++
++        if (reply.isValid() && reply.value() > 0) {
++                // Connect the signal
++                QDBusConnection::sessionBus().connect("org.kde.Solid.PowerManagement",
++                                                      "/org/kde/Solid/PowerManagement",
++                                                      "org.kde.Solid.PowerManagement",
++                                                      "resumingFromSuspend",
++                                                      this,
++                                                      SIGNAL(resumingFromSuspend()));
++        }
++    }
++}
++
++void Solid::PowerManagementPrivate::slotServiceUnregistered(const QString &serviceName)
++{
++    if (serviceName == QLatin1String("org.freedesktop.PowerManagement")) {
++        // Reset the values
++        slotCanSuspendChanged(false);
++        slotCanHibernateChanged(false);
++        slotPowerSaveStatusChanged(false);
++    } else {
++        // Disconnect the signal
++        QDBusConnection::sessionBus().disconnect(QLatin1String("org.kde.Solid.PowerManagement"),
++                                                 QLatin1String("/org/kde/Solid/PowerManagement"),
++                                                 QLatin1String("org.kde.Solid.PowerManagement"),
++                                                 QLatin1String("resumingFromSuspend"),
++                                                 this,
++                                                 SIGNAL(resumingFromSuspend()));
+     }
+ }
+ 
+diff --git a/solid/solid/powermanagement_p.h b/solid/solid/powermanagement_p.h
+index f39815d..02595db 100644
+--- a/solid/solid/powermanagement_p.h
++++ b/solid/solid/powermanagement_p.h
+@@ -50,6 +50,7 @@ namespace Solid
+         void slotCanHibernateChanged(bool newState);
+         void slotPowerSaveStatusChanged(bool newState);
+         void slotServiceRegistered(const QString &serviceName);
++        void slotServiceUnregistered(const QString &serviceName);
+ 
+     public:
+         OrgFreedesktopPowerManagementInterface managerIface;
diff --git a/debian/patches/series b/debian/patches/series
index 043d369..8d23b22 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,6 @@
 01_upstream_nepomuk_fix_76e0376d7582cfe5b898c56bf3779ca2279dace8.diff
 02_upstream_nepomuk_fix_bde5aad1e9f7bfb6f8d5c60197797de4a315158d.diff
+03_upstream_powermanager_fix_05f1a19291af5c16745b76c3e0944c5b80ef5870.diff
 kconf_update_migrate_from_kde3_icon_theme.diff
 add_debian_build_type.diff
 disable_usr_lib_install_rpath.diff

-- 
KDE Development Platform Libraries module packaging



More information about the pkg-kde-commits mailing list