From kde-commits Tue Apr 28 19:19:30 2009 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Tue, 28 Apr 2009 19:19:30 +0000 To: kde-commits Subject: KDE/kdebase/workspace/plasma/applets Message-Id: <1240946370.215204.13614.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124094933304783 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 #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include -#include #include #include #include @@ -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 #include #include -#include // KDE Base #include +#include // 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); }