2008-01-25 01:04:03 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dataenginescript.h"
|
|
|
|
|
|
|
|
#include "dataengine.h"
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class DataEngineScript::Private
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DataEngine* dataEngine;
|
|
|
|
};
|
|
|
|
|
|
|
|
DataEngineScript::DataEngineScript(QObject *parent)
|
|
|
|
: ScriptEngine(parent),
|
2008-02-04 05:41:40 +01:00
|
|
|
d(new Private)
|
2008-01-25 01:04:03 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DataEngineScript::~DataEngineScript()
|
|
|
|
{
|
|
|
|
// delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataEngineScript::setDataEngine(DataEngine *dataEngine)
|
|
|
|
{
|
|
|
|
d->dataEngine = dataEngine;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataEngine* DataEngineScript::dataEngine() const
|
|
|
|
{
|
|
|
|
return d->dataEngine;
|
|
|
|
}
|
|
|
|
|
2008-04-26 14:59:44 +02:00
|
|
|
bool DataEngineScript::sourceRequestEvent(const QString &name)
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
Q_UNUSED(name)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-04-26 14:59:44 +02:00
|
|
|
bool DataEngineScript::updateSourceEvent(const QString& source)
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
Q_UNUSED(source)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataEngineScript::setData(const QString& source, const QString& key,
|
|
|
|
const QVariant& value)
|
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
|
|
|
d->dataEngine->setData(source, key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataEngineScript::setData(const QString &source, const QVariant &value)
|
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
|
|
|
d->dataEngine->setData(source, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-26 14:12:37 +02:00
|
|
|
void DataEngineScript::removeAllData(const QString& source)
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-24 10:10:30 +02:00
|
|
|
d->dataEngine->removeAllData(source);
|
2008-02-04 05:41:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataEngineScript::removeData(const QString& source, const QString& key)
|
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
|
|
|
d->dataEngine->removeData(source, key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-25 18:17:33 +02:00
|
|
|
void DataEngineScript::setMaxSourceCount(uint limit)
|
2008-04-24 22:16:21 +02:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-25 18:17:33 +02:00
|
|
|
d->dataEngine->setMaxSourceCount(limit);
|
2008-04-24 22:16:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-24 04:21:22 +02:00
|
|
|
void DataEngineScript::setMinimumPollingInterval(int minimumMs)
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-24 04:21:22 +02:00
|
|
|
d->dataEngine->setMinimumPollingInterval(minimumMs);
|
2008-02-04 05:41:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-24 04:21:22 +02:00
|
|
|
int DataEngineScript::minimumPollingInterval() const
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-24 04:21:22 +02:00
|
|
|
return d->dataEngine->minimumPollingInterval();
|
2008-02-04 05:41:40 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-24 04:21:22 +02:00
|
|
|
void DataEngineScript::setPollingInterval(uint frequency)
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-24 04:21:22 +02:00
|
|
|
d->dataEngine->setPollingInterval(frequency);
|
2008-02-04 05:41:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-26 14:30:42 +02:00
|
|
|
void DataEngineScript::removeAllSources()
|
2008-02-04 05:41:40 +01:00
|
|
|
{
|
|
|
|
if (d->dataEngine) {
|
2008-04-24 08:38:14 +02:00
|
|
|
d->dataEngine->removeAllSources();
|
2008-02-04 05:41:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-25 01:04:03 +01:00
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#include "dataenginescript.moc"
|