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