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
This commit is contained in:
Riccardo Iaconelli 2007-12-21 12:27:29 +00:00
parent 2442ef8da9
commit e4665a938a
2 changed files with 15 additions and 0 deletions

View File

@ -44,6 +44,8 @@
#include <KServiceTypeTrader> #include <KServiceTypeTrader>
#include <KIconLoader> #include <KIconLoader>
#include <Solid/PowerManagement>
#include "plasma/configxml.h" #include "plasma/configxml.h"
#include "plasma/containment.h" #include "plasma/containment.h"
#include "plasma/corona.h" #include "plasma/corona.h"
@ -570,6 +572,11 @@ QString Applet::pluginName() const
return d->appletDescription.pluginName(); return d->appletDescription.pluginName();
} }
bool Applet::shouldConserveResources() const
{
return Solid::PowerManagement::appShouldConserveResources();
}
QString Applet::category() const QString Applet::category() const
{ {
if (!d->appletDescription.isValid()) { if (!d->appletDescription.isValid()) {

View File

@ -398,6 +398,14 @@ class PLASMA_EXPORT Applet : public Widget
*/ */
QString pluginName() const; 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 * Returns the icon related to this applet
**/ **/