make it possible to turn off all eternal extensions
svn path=/trunk/KDE/kdebase/runtime/; revision=1071432
This commit is contained in:
parent
f8eb8c96e9
commit
e8796ab87c
@ -16,6 +16,8 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <KAuthorized>
|
||||||
|
|
||||||
#include "appletauthorization.h"
|
#include "appletauthorization.h"
|
||||||
#include "simplejavascriptapplet.h"
|
#include "simplejavascriptapplet.h"
|
||||||
|
|
||||||
@ -43,3 +45,8 @@ bool AppletAuthorization::authorizeOptionalExtension(const QString &extension)
|
|||||||
return m_scriptEngine->applet()->hasAuthorization(extension);
|
return m_scriptEngine->applet()->hasAuthorization(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppletAuthorization::authorizeExternalExtensions()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
|
|
||||||
bool authorizeRequiredExtension(const QString &extension);
|
bool authorizeRequiredExtension(const QString &extension);
|
||||||
bool authorizeOptionalExtension(const QString &extension);
|
bool authorizeOptionalExtension(const QString &extension);
|
||||||
|
bool authorizeExternalExtensions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SimpleJavaScriptApplet *m_scriptEngine;
|
SimpleJavaScriptApplet *m_scriptEngine;
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <KAuthorized>
|
||||||
|
|
||||||
class Authorization
|
class Authorization
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -29,6 +31,7 @@ public:
|
|||||||
|
|
||||||
virtual bool authorizeRequiredExtension(const QString &) { return true; }
|
virtual bool authorizeRequiredExtension(const QString &) { return true; }
|
||||||
virtual bool authorizeOptionalExtension(const QString &) { return true; }
|
virtual bool authorizeOptionalExtension(const QString &) { return true; }
|
||||||
|
virtual bool authorizeExternalExtensions() { return KAuthorized::authorize("plasma/external_script_extensions"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -228,8 +228,10 @@ bool ScriptEnv::importExtensions(const KPluginInfo &info, QScriptValue &obj, Aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!importBuiltinExtension(extension, obj)) {
|
if (!importBuiltinExtension(extension, obj)) {
|
||||||
|
if (auth.authorizeExternalExtensions()) {
|
||||||
importExtension(extension);
|
importExtension(extension);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasUncaughtException()) {
|
if (hasUncaughtException()) {
|
||||||
emit reportError(this, true);
|
emit reportError(this, true);
|
||||||
@ -253,8 +255,10 @@ bool ScriptEnv::importExtensions(const KPluginInfo &info, QScriptValue &obj, Aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!importBuiltinExtension(extension, obj)) {
|
if (!importBuiltinExtension(extension, obj)) {
|
||||||
|
if (auth.authorizeExternalExtensions()) {
|
||||||
importExtension(extension);
|
importExtension(extension);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hasUncaughtException()) {
|
if (hasUncaughtException()) {
|
||||||
emit reportError(this, false);
|
emit reportError(this, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user