From e36fc571560d179dce7516c1829f41f77b070daf Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 29 Jun 2010 22:11:15 +0000 Subject: [PATCH] include functionality svn path=/trunk/KDE/kdebase/runtime/; revision=1144434 --- scriptengines/javascript/javascriptdataengine.cpp | 12 ++++++++++++ scriptengines/javascript/javascriptdataengine.h | 3 +++ 2 files changed, 15 insertions(+) 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;