avoid an infinite loop

svn path=/trunk/KDE/kdebase/runtime/; revision=1128665
This commit is contained in:
Aaron J. Seigo 2010-05-19 21:58:18 +00:00
parent 01c231b642
commit a52bd2b9fb
2 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,7 @@ JavaScriptDataEngine::JavaScriptDataEngine(QObject *parent, const QVariantList &
: DataEngineScript(parent)
{
Q_UNUSED(args);
m_qscriptEngine = new QScriptEngine(this);
m_env = new ScriptEnv(this, m_qscriptEngine);
@ -77,19 +77,20 @@ void JavaScriptDataEngine::jsSetMinimumPollingInterval(int interval)
setMinimumPollingInterval(interval);
}
int JavaScriptDataEngine::minimumPollingInterval() const
int JavaScriptDataEngine::jsMinimumPollingInterval() const
{
return minimumPollingInterval();
}
void JavaScriptDataEngine::jsSetPollingInterval(int interval)
{
m_pollingInterval = interval;
setPollingInterval(interval);
}
int JavaScriptDataEngine::pollingInterval() const
{
return pollingInterval();
return m_pollingInterval;
}
QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEngine *engine)
@ -105,12 +106,12 @@ QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEng
return context->throwError(error);
}
QString source = context->argument(0).toString();
const QString source = context->argument(0).toString();
QString value = context->argument(1).toString();
if (context->argumentCount() > 2) {
QString key = value;
QString value = context->argument(2).toString();
const QString key = value;
value = context->argument(2).toString();
iFace->setData(source, key, value);
} else {
iFace->setData(source, value);

View File

@ -32,7 +32,7 @@ class JavaScriptDataEngine : public Plasma::DataEngineScript
{
Q_OBJECT
Q_PROPERTY(int sourceCount WRITE jsSetMaxSourceCount READ maxSourceCount)
Q_PROPERTY(int minimumPollingInterval WRITE jsSetMinimumPollingInterval READ minimumPollingInterval)
Q_PROPERTY(int minimumPollingInterval WRITE jsSetMinimumPollingInterval READ jsMinimumPollingInterval)
Q_PROPERTY(int pollingInterval WRITE jsSetPollingInterval READ pollingInterval)
public:
@ -47,7 +47,7 @@ public:
int maxSourceCount() const;
void jsSetMaxSourceCount(int count);
void jsSetMinimumPollingInterval(int interval);
int minimumPollingInterval() const;
int jsMinimumPollingInterval() const;
void jsSetPollingInterval(int interval);
int pollingInterval() const;
@ -66,6 +66,7 @@ private:
QScriptEngine *m_qscriptEngine;
ScriptEnv *m_env;
QScriptValue iface;
int m_pollingInterval;
};
#endif