make it possible to turn off all eternal extensions

svn path=/trunk/KDE/kdebase/runtime/; revision=1071432
This commit is contained in:
Aaron J. Seigo 2010-01-08 00:55:46 +00:00
parent f8eb8c96e9
commit e8796ab87c
4 changed files with 17 additions and 2 deletions

View File

@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KAuthorized>
#include "appletauthorization.h"
#include "simplejavascriptapplet.h"
@ -43,3 +45,8 @@ bool AppletAuthorization::authorizeOptionalExtension(const QString &extension)
return m_scriptEngine->applet()->hasAuthorization(extension);
}
bool AppletAuthorization::authorizeExternalExtensions()
{
}

View File

@ -30,6 +30,7 @@ public:
bool authorizeRequiredExtension(const QString &extension);
bool authorizeOptionalExtension(const QString &extension);
bool authorizeExternalExtensions();
private:
SimpleJavaScriptApplet *m_scriptEngine;

View File

@ -21,6 +21,8 @@
#include <QString>
#include <KAuthorized>
class Authorization
{
public:
@ -29,6 +31,7 @@ public:
virtual bool authorizeRequiredExtension(const QString &) { return true; }
virtual bool authorizeOptionalExtension(const QString &) { return true; }
virtual bool authorizeExternalExtensions() { return KAuthorized::authorize("plasma/external_script_extensions"); }
};
#endif

View File

@ -228,7 +228,9 @@ bool ScriptEnv::importExtensions(const KPluginInfo &info, QScriptValue &obj, Aut
}
if (!importBuiltinExtension(extension, obj)) {
importExtension(extension);
if (auth.authorizeExternalExtensions()) {
importExtension(extension);
}
}
if (hasUncaughtException()) {
@ -253,7 +255,9 @@ bool ScriptEnv::importExtensions(const KPluginInfo &info, QScriptValue &obj, Aut
}
if (!importBuiltinExtension(extension, obj)) {
importExtension(extension);
if (auth.authorizeExternalExtensions()) {
importExtension(extension);
}
}
if (hasUncaughtException()) {