Engines
powermanagementengine.h
Go to the documentation of this file.00001 /* 00002 * Copyright (C) 2007 Aaron Seigo <aseigo@kde.org> 00003 * Copyright (C) 2007 Sebastian Kuegler <sebas@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License version 2 as 00007 * published by the Free Software Foundation 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef POWERMANAGEMENTENGINE_H 00021 #define POWERMANAGEMENTENGINE_H 00022 00023 #include "plasma/dataengine.h" 00024 00025 #include <solid/battery.h> 00026 #include <solid/acadapter.h> 00027 00028 #include <QHash> 00029 00034 class PowermanagementEngine : public Plasma::DataEngine 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 PowermanagementEngine( QObject* parent, const QVariantList& args ); 00040 ~PowermanagementEngine(); 00041 QStringList sources() const; 00042 00043 protected: 00044 bool sourceRequestEvent(const QString &name); 00045 void init(); 00046 00047 protected slots: 00048 void updateBatteryChargeState(int newState, const QString& udi); 00049 void updateBatteryPlugState(bool newState, const QString& udi); 00050 void updateBatteryChargePercent(int newValue, const QString& udi); 00051 void updateAcPlugState(bool newState); 00052 00053 private: 00054 Solid::AcAdapter* m_acadapter; 00055 QStringList m_sources; 00056 00057 QHash<QString, QString> m_batterySources; 00058 00059 }; 00060 00061 K_EXPORT_PLASMA_DATAENGINE(powermanagement, PowermanagementEngine) 00062 00063 #endif