libplasma
dataenginescript.cpp
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 #include "dataenginescript.h" 00021 00022 #include "dataengine.h" 00023 00024 namespace Plasma 00025 { 00026 00027 class DataEngineScriptPrivate 00028 { 00029 public: 00030 DataEngine* dataEngine; 00031 }; 00032 00033 DataEngineScript::DataEngineScript(QObject *parent) 00034 : ScriptEngine(parent), 00035 d(new DataEngineScriptPrivate) 00036 { 00037 } 00038 00039 DataEngineScript::~DataEngineScript() 00040 { 00041 // delete d; 00042 } 00043 00044 void DataEngineScript::setDataEngine(DataEngine *dataEngine) 00045 { 00046 d->dataEngine = dataEngine; 00047 } 00048 00049 DataEngine* DataEngineScript::dataEngine() const 00050 { 00051 return d->dataEngine; 00052 } 00053 00054 bool DataEngineScript::sourceRequestEvent(const QString &name) 00055 { 00056 Q_UNUSED(name) 00057 return false; 00058 } 00059 00060 bool DataEngineScript::updateSourceEvent(const QString& source) 00061 { 00062 Q_UNUSED(source) 00063 return false; 00064 } 00065 00066 void DataEngineScript::setData(const QString& source, const QString& key, 00067 const QVariant& value) 00068 { 00069 if (d->dataEngine) { 00070 d->dataEngine->setData(source, key, value); 00071 } 00072 } 00073 00074 void DataEngineScript::setData(const QString &source, const QVariant &value) 00075 { 00076 if (d->dataEngine) { 00077 d->dataEngine->setData(source, value); 00078 } 00079 } 00080 00081 void DataEngineScript::removeAllData(const QString& source) 00082 { 00083 if (d->dataEngine) { 00084 d->dataEngine->removeAllData(source); 00085 } 00086 } 00087 00088 void DataEngineScript::removeData(const QString& source, const QString& key) 00089 { 00090 if (d->dataEngine) { 00091 d->dataEngine->removeData(source, key); 00092 } 00093 } 00094 00095 void DataEngineScript::setMaxSourceCount(uint limit) 00096 { 00097 if (d->dataEngine) { 00098 d->dataEngine->setMaxSourceCount(limit); 00099 } 00100 } 00101 00102 void DataEngineScript::setMinimumPollingInterval(int minimumMs) 00103 { 00104 if (d->dataEngine) { 00105 d->dataEngine->setMinimumPollingInterval(minimumMs); 00106 } 00107 } 00108 00109 int DataEngineScript::minimumPollingInterval() const 00110 { 00111 if (d->dataEngine) { 00112 return d->dataEngine->minimumPollingInterval(); 00113 } 00114 return 0; 00115 } 00116 00117 void DataEngineScript::setPollingInterval(uint frequency) 00118 { 00119 if (d->dataEngine) { 00120 d->dataEngine->setPollingInterval(frequency); 00121 } 00122 } 00123 00124 void DataEngineScript::removeAllSources() 00125 { 00126 if (d->dataEngine) { 00127 d->dataEngine->removeAllSources(); 00128 } 00129 } 00130 00131 } // Plasma namespace 00132 00133 #include "dataenginescript.moc"