From e4665a938a49e34aa427e885dc0d27a7bf8541c7 Mon Sep 17 00:00:00 2001 From: Riccardo Iaconelli Date: Fri, 21 Dec 2007 12:27:29 +0000 Subject: [PATCH] Implement Applet::shouldConserveResources(), a method to help plasmoid developers to know whether they should conserve resources. Peer reviewed by Chani and Richmoore. CCMAIL:aseigo@kde.org svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=751216 --- applet.cpp | 7 +++++++ applet.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/applet.cpp b/applet.cpp index c116aa18c..044923c28 100644 --- a/applet.cpp +++ b/applet.cpp @@ -44,6 +44,8 @@ #include #include +#include + #include "plasma/configxml.h" #include "plasma/containment.h" #include "plasma/corona.h" @@ -570,6 +572,11 @@ QString Applet::pluginName() const return d->appletDescription.pluginName(); } +bool Applet::shouldConserveResources() const +{ + return Solid::PowerManagement::appShouldConserveResources(); +} + QString Applet::category() const { if (!d->appletDescription.isValid()) { diff --git a/applet.h b/applet.h index bc9c00cc3..745abf42f 100644 --- a/applet.h +++ b/applet.h @@ -398,6 +398,14 @@ class PLASMA_EXPORT Applet : public Widget */ QString pluginName() const; + /** + * Whether the applet should conserve resources. If true, try to avoid doing stuff which + * is computationally heavy. Try to conserve power and resources. + * + * @return true if it should conserve resources, false if it does not. + */ + Q_PROPERTY bool shouldConserveResources() const; + /** * Returns the icon related to this applet **/