From bdfdfae0838e000b5c5f846b50f6fdf1c5b11f4a Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sat, 14 Nov 2009 07:33:42 +0000 Subject: [PATCH] plasmoid.hasExtension(string) -> allows plasmoids to check which extensions actually made it into the run time svn path=/trunk/KDE/kdebase/runtime/; revision=1048914 --- scriptengines/javascript/appletinterface.cpp | 5 +++++ scriptengines/javascript/appletinterface.h | 1 + 2 files changed, 6 insertions(+) diff --git a/scriptengines/javascript/appletinterface.cpp b/scriptengines/javascript/appletinterface.cpp index 63fdaeeeb..eeedb80aa 100644 --- a/scriptengines/javascript/appletinterface.cpp +++ b/scriptengines/javascript/appletinterface.cpp @@ -326,6 +326,11 @@ bool AppletInterface::include(const QString &script) return m_appletScriptEngine->include(path); } +bool AppletInterface::hasExtension(const QString &extension) const +{ + return m_appletScriptEngine->loadedExtensions().contains(extension.toLower()); +} + void AppletInterface::debug(const QString &msg) { kDebug() << msg; diff --git a/scriptengines/javascript/appletinterface.h b/scriptengines/javascript/appletinterface.h index 836855eea..fd730ce7c 100644 --- a/scriptengines/javascript/appletinterface.h +++ b/scriptengines/javascript/appletinterface.h @@ -219,6 +219,7 @@ enum QtScrollBarPolicy { Q_INVOKABLE QString file(const QString &fileType, const QString &filePath); Q_INVOKABLE bool include(const QString &script); + Q_INVOKABLE bool hasExtension(const QString &extension) const; Q_INVOKABLE void debug(const QString &msg);