add more spacing
[personal-kdebase.git] / workspace / plasma / dataengines / powermanagement / powermanagementengine.h
blobd6f5c4b8207f666f729540f819ba4799f3e8706d
1 /*
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>
30 #include <QHash>
32 /**
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
38 Q_OBJECT
40 public:
41 PowermanagementEngine( QObject* parent, const QVariantList& args );
42 ~PowermanagementEngine();
43 QStringList sources() const;
45 protected:
46 bool sourceRequestEvent(const QString &name);
47 void init();
49 private slots:
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 &current, const QStringList &profiles);
57 void batteryRemainingTimeChanged(int time);
59 private:
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)
70 #endif