avoid an infinite loop
svn path=/trunk/KDE/kdebase/runtime/; revision=1128665
This commit is contained in:
parent
01c231b642
commit
a52bd2b9fb
@ -30,7 +30,7 @@ JavaScriptDataEngine::JavaScriptDataEngine(QObject *parent, const QVariantList &
|
|||||||
: DataEngineScript(parent)
|
: DataEngineScript(parent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(args);
|
Q_UNUSED(args);
|
||||||
|
|
||||||
m_qscriptEngine = new QScriptEngine(this);
|
m_qscriptEngine = new QScriptEngine(this);
|
||||||
m_env = new ScriptEnv(this, m_qscriptEngine);
|
m_env = new ScriptEnv(this, m_qscriptEngine);
|
||||||
|
|
||||||
@ -77,19 +77,20 @@ void JavaScriptDataEngine::jsSetMinimumPollingInterval(int interval)
|
|||||||
setMinimumPollingInterval(interval);
|
setMinimumPollingInterval(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
int JavaScriptDataEngine::minimumPollingInterval() const
|
int JavaScriptDataEngine::jsMinimumPollingInterval() const
|
||||||
{
|
{
|
||||||
return minimumPollingInterval();
|
return minimumPollingInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JavaScriptDataEngine::jsSetPollingInterval(int interval)
|
void JavaScriptDataEngine::jsSetPollingInterval(int interval)
|
||||||
{
|
{
|
||||||
|
m_pollingInterval = interval;
|
||||||
setPollingInterval(interval);
|
setPollingInterval(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
int JavaScriptDataEngine::pollingInterval() const
|
int JavaScriptDataEngine::pollingInterval() const
|
||||||
{
|
{
|
||||||
return pollingInterval();
|
return m_pollingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEngine *engine)
|
QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEngine *engine)
|
||||||
@ -105,12 +106,12 @@ QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEng
|
|||||||
return context->throwError(error);
|
return context->throwError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString source = context->argument(0).toString();
|
const QString source = context->argument(0).toString();
|
||||||
QString value = context->argument(1).toString();
|
QString value = context->argument(1).toString();
|
||||||
|
|
||||||
if (context->argumentCount() > 2) {
|
if (context->argumentCount() > 2) {
|
||||||
QString key = value;
|
const QString key = value;
|
||||||
QString value = context->argument(2).toString();
|
value = context->argument(2).toString();
|
||||||
iFace->setData(source, key, value);
|
iFace->setData(source, key, value);
|
||||||
} else {
|
} else {
|
||||||
iFace->setData(source, value);
|
iFace->setData(source, value);
|
||||||
|
@ -32,7 +32,7 @@ class JavaScriptDataEngine : public Plasma::DataEngineScript
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int sourceCount WRITE jsSetMaxSourceCount READ maxSourceCount)
|
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)
|
Q_PROPERTY(int pollingInterval WRITE jsSetPollingInterval READ pollingInterval)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
int maxSourceCount() const;
|
int maxSourceCount() const;
|
||||||
void jsSetMaxSourceCount(int count);
|
void jsSetMaxSourceCount(int count);
|
||||||
void jsSetMinimumPollingInterval(int interval);
|
void jsSetMinimumPollingInterval(int interval);
|
||||||
int minimumPollingInterval() const;
|
int jsMinimumPollingInterval() const;
|
||||||
void jsSetPollingInterval(int interval);
|
void jsSetPollingInterval(int interval);
|
||||||
int pollingInterval() const;
|
int pollingInterval() const;
|
||||||
|
|
||||||
@ -66,6 +66,7 @@ private:
|
|||||||
QScriptEngine *m_qscriptEngine;
|
QScriptEngine *m_qscriptEngine;
|
||||||
ScriptEnv *m_env;
|
ScriptEnv *m_env;
|
||||||
QScriptValue iface;
|
QScriptValue iface;
|
||||||
|
int m_pollingInterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user