Plasma
weatherengine.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2007-2009 by Shawn Starr <shawn.starr@rogers.com> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 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 General Public License * 00015 * 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 WEATHERENGINE_H 00021 #define WEATHERENGINE_H 00022 00023 #include <KService> 00024 #include <KGenericFactory> 00025 00026 #include <Solid/Networking> 00027 00028 #include <Plasma/DataEngine> 00029 00030 #include "ions/ion.h" 00031 00032 00039 class WeatherEngine : public Plasma::DataEngine 00040 { 00041 Q_OBJECT 00042 Q_PROPERTY(bool update READ update WRITE setUpdate) 00043 00044 public: 00049 WeatherEngine(QObject *parent, const QVariantList &args); 00050 00051 // Destructor 00052 ~WeatherEngine(); 00053 00054 // FIXME: Right now use a Q_PROPERTY to force the engine to update plugins installed with KNS, this isn't pretty at all :/ 00055 void setUpdate(bool update); 00056 bool update(void) const; 00057 00058 // initialization 00059 void init(); 00060 00066 DataEngine* loadIon(const QString& pluginName); 00067 00072 void unloadIon(const QString& name); 00073 00074 protected: 00079 bool sourceRequestEvent(const QString &source); 00080 00081 protected Q_SLOTS: 00087 void dataUpdated(const QString& source, Plasma::DataEngine::Data data); 00088 00094 void resetCompleted(IonInterface *, bool) const; 00095 00096 void triggerReset(void) const; 00097 00102 void newIonSource(const QString& source); 00107 void removeIonSource(const QString& source); 00112 bool updateSourceEvent(const QString& source); 00113 00117 void networkStatusChanged(Solid::Networking::Status); 00118 00122 void unloadIons(void); 00123 00124 private: 00125 class Private; 00126 Private *const d; 00127 }; 00128 00129 K_EXPORT_PLASMA_DATAENGINE(weather, WeatherEngine) 00130 00131 #endif
KDE 4.5 API Reference