diff --git a/scriptengines/javascript/javascriptdataengine.cpp b/scriptengines/javascript/javascriptdataengine.cpp index f5be7b58b..c1aff8b9e 100644 --- a/scriptengines/javascript/javascriptdataengine.cpp +++ b/scriptengines/javascript/javascriptdataengine.cpp @@ -21,6 +21,8 @@ #include +#include + #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 diff --git a/scriptengines/javascript/javascriptdataengine.h b/scriptengines/javascript/javascriptdataengine.h index 700fb244d..61d791212 100644 --- a/scriptengines/javascript/javascriptdataengine.h +++ b/scriptengines/javascript/javascriptdataengine.h @@ -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;