Plasma
dataenginescript.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2007 by Aaron Seigo <aseigo@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, 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 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 PLASMA_DATAENGINESCRIPT_H 00021 #define PLASMA_DATAENGINESCRIPT_H 00022 00023 #include <kgenericfactory.h> 00024 #include <kplugininfo.h> 00025 00026 #include <plasma/plasma_export.h> 00027 #include <plasma/dataengine.h> 00028 #include <plasma/scripting/scriptengine.h> 00029 00030 namespace Plasma 00031 { 00032 00033 class DataEngineScriptPrivate; 00034 class Service; 00035 00041 class PLASMA_EXPORT DataEngineScript : public ScriptEngine 00042 { 00043 Q_OBJECT 00044 00045 public: 00053 explicit DataEngineScript(QObject *parent = 0); 00054 ~DataEngineScript(); 00055 00059 void setDataEngine(DataEngine *dataEngine); 00060 00064 DataEngine *dataEngine() const; 00065 00072 virtual QStringList sources() const; 00073 00081 virtual bool sourceRequestEvent(const QString &name); 00082 00091 virtual bool updateSourceEvent(const QString &source); 00092 00099 virtual Service *serviceForSource(const QString &source); 00100 00101 protected: 00105 QString mainScript() const; 00106 00112 const Package *package() const; 00113 00117 KPluginInfo description() const; 00118 00119 void setData(const QString &source, const QString &key, 00120 const QVariant &value); 00121 void setData(const QString &source, const QVariant &value); 00122 00129 void setData(const QString &source, const DataEngine::Data &values); 00130 00131 void removeAllData(const QString &source); 00132 void removeData(const QString &source, const QString &key); 00133 void setMaxSourceCount(uint limit); 00134 void setMinimumPollingInterval(int minimumMs); 00135 int minimumPollingInterval() const; 00136 void setPollingInterval(uint frequency); 00137 void removeAllSources(); 00138 void addSource(DataContainer *source); 00139 DataEngine::SourceDict containerDict() const; 00140 void setName(const QString &name); 00141 void setIcon(const QString &icon); 00142 void scheduleSourcesUpdated(); 00143 void removeSource(const QString &source); 00144 void updateAllSources(); 00145 void forceImmediateUpdateOfAllVisualizations(); 00146 00147 private: 00148 DataEngineScriptPrivate *const d; 00149 }; 00150 00151 #define K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(libname, classname) \ 00152 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ 00153 K_EXPORT_PLUGIN(factory("plasma_dataenginescriptengine_" #libname)) 00154 00155 } //Plasma namespace 00156 00157 #endif
KDE 4.6 API Reference