[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-04-28 19:19:30
Message-ID: 1240946370.215204.13614.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 960645 by aseigo:

use powerdevil dbus calls consistently, and make them async calls while we're at it


 M  +7 -11     battery/battery.cpp  
 M  +10 -16    kickoff/core/itemhandlers.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/battery/battery.cpp #960644:960645
@@ -24,6 +24,7 @@
 #include <QApplication>
 #include <QDBusConnection>
 #include <QDBusInterface>
+#include <QDBusPendingCall>
 #include <QPainter>
 #include <QStyleOptionGraphicsItem>
 #include <QFont>
@@ -33,7 +34,6 @@
 
 #include <KDebug>
 #include <KIcon>
-#include <KJob>
 #include <KLocalizedString>
 #include <KSharedConfig>
 #include <KToolInvocation>
@@ -298,21 +298,17 @@
 void Battery::suspend()
 {
     hidePopup();
-    Solid::Control::PowerManager::SuspendMethod spdMethod = Solid::Control::PowerManager::ToRam;
-    KJob *job = Solid::Control::PowerManager::suspend(spdMethod);
-    if (job) {
-        job->start();
-    }
+    QDBusConnection dbus(QDBusConnection::sessionBus());
+    QDBusInterface iface("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", dbus);
+    iface.asyncCall("suspend", Solid::Control::PowerManager::ToRam);
 }
 
 void Battery::hibernate()
 {
     hidePopup();
-    Solid::Control::PowerManager::SuspendMethod spdMethod = Solid::Control::PowerManager::ToDisk;
-    KJob *job = Solid::Control::PowerManager::suspend(spdMethod);
-    if (job) {
-        job->start();
-    }
+    QDBusConnection dbus(QDBusConnection::sessionBus());
+    QDBusInterface iface("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", dbus);
+    iface.asyncCall("suspend", Solid::Control::PowerManager::ToDisk);
 }
 
 void Battery::brightnessChanged(const int brightness)
--- trunk/KDE/kdebase/workspace/plasma/applets/kickoff/core/itemhandlers.cpp #960644:960645
@@ -29,10 +29,10 @@
 #include <KService>
 #include <KToolInvocation>
 #include <KUrl>
-#include <solid/control/powermanager.h>
 
 // KDE Base
 #include <kworkspace/kworkspace.h>
+#include <solid/control/powermanager.h>
 
 // Local
 #include "core/recentapplications.h"
@@ -196,27 +196,21 @@
 
 void LeaveItemHandler::standby()
 {
-    Solid::Control::PowerManager::SuspendMethod spdMethod = Solid::Control::PowerManager::Standby;
-    KJob *job = Solid::Control::PowerManager::suspend(spdMethod);
-    if (job) {
-        job->start();
-    }
+    QDBusConnection dbus(QDBusConnection::sessionBus());
+    QDBusInterface iface("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", dbus);
+    iface.asyncCall("suspend", Solid::Control::PowerManager::Standby);
 }
 
 void LeaveItemHandler::suspendRAM()
 {
-    Solid::Control::PowerManager::SuspendMethod spdMethod = Solid::Control::PowerManager::ToRam;
-    KJob *job = Solid::Control::PowerManager::suspend(spdMethod);
-    if (job) {
-        job->start();
-    }
+    QDBusConnection dbus(QDBusConnection::sessionBus());
+    QDBusInterface iface("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", dbus);
+    iface.asyncCall("suspend", Solid::Control::PowerManager::ToRam);
 }
 
 void LeaveItemHandler::suspendDisk()
 {
-    Solid::Control::PowerManager::SuspendMethod spdMethod = Solid::Control::PowerManager::ToDisk;
-    KJob *job = Solid::Control::PowerManager::suspend(spdMethod);
-    if (job) {
-        job->start();
-    }
+    QDBusConnection dbus(QDBusConnection::sessionBus());
+    QDBusInterface iface("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", dbus);
+    iface.asyncCall("suspend", Solid::Control::PowerManager::ToDisk);
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic