include functionality

svn path=/trunk/KDE/kdebase/runtime/; revision=1144434
This commit is contained in:
Aaron J. Seigo 2010-06-29 22:11:15 +00:00
parent dcbdea927b
commit e36fc57156
2 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,8 @@
#include <QScriptEngine>
#include <Plasma/Package>
#include "authorization.h"
#include "scriptenv.h"
#include "simplebindings/dataengine.h"
@ -275,6 +277,16 @@ Plasma::Service *JavaScriptDataEngine::serviceForSource(const QString &source)
return 0;
}
bool JavaScriptDataEngine::include(const QString &script)
{
const QString path = package()->filePath("scripts", script);
if (path.isEmpty()) {
return false;
}
return m_env->include(path);
}
K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(javascriptdataengine, JavaScriptDataEngine)
#include <javascriptdataengine.moc>

View File

@ -51,6 +51,9 @@ public:
void jsSetPollingInterval(int interval);
int pollingInterval() const;
public Q_SLOTS:
bool include(const QString &file);
private Q_SLOTS:
void reportError(ScriptEnv *engine, bool fatal) const;