2 * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3 * Copyright 2007-2008 Sebastian Kuegler <sebas@kde.org>
4 * Copyright 2008 Dario Freddi <drf54321@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Library General Public License version 2 as
8 * published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef POWERMANAGEMENTENGINE_H
22 #define POWERMANAGEMENTENGINE_H
24 #include <Plasma/DataEngine>
26 #include <solid/battery.h>
27 #include <solid/acadapter.h>
29 #include <QtDBus/QDBusConnection>
33 * This class provides runtime information about the battery and AC status
34 * for use in power management Plasma applets.
36 class PowermanagementEngine
: public Plasma::DataEngine
41 PowermanagementEngine( QObject
* parent
, const QVariantList
& args
);
42 ~PowermanagementEngine();
43 QStringList
sources() const;
46 bool sourceRequestEvent(const QString
&name
);
50 void updateBatteryChargeState(int newState
, const QString
& udi
);
51 void updateBatteryPlugState(bool newState
, const QString
& udi
);
52 void updateBatteryChargePercent(int newValue
, const QString
& udi
);
53 void updateAcPlugState(bool newState
);
54 void deviceRemoved(const QString
& udi
);
55 void deviceAdded(const QString
& udi
);
56 void profilesChanged(const QString
¤t
, const QStringList
&profiles
);
57 void batteryRemainingTimeChanged(int time
);
60 Solid::AcAdapter
* m_acadapter
;
61 QStringList m_sources
;
62 QDBusConnection m_dbus
;
64 QHash
<QString
, QString
> m_batterySources
;
68 K_EXPORT_PLASMA_DATAENGINE(powermanagement
, PowermanagementEngine
)