summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r--src/declarative/qml/qmlengine.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 0a00092..aa66c17 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -144,6 +144,8 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
qtObject.setProperty(QLatin1String("playSound"), scriptEngine.newFunction(QmlEnginePrivate::playSound, 1));
qtObject.setProperty(QLatin1String("openUrlExternally"),scriptEngine.newFunction(desktopOpenUrl, 1));
qtObject.setProperty(QLatin1String("md5"),scriptEngine.newFunction(md5, 1));
+ qtObject.setProperty(QLatin1String("btoa"),scriptEngine.newFunction(btoa, 1));
+ qtObject.setProperty(QLatin1String("atob"),scriptEngine.newFunction(atob, 1));
//firebug/webkit compat
QScriptValue consoleObject = scriptEngine.newObject();
@@ -818,6 +820,26 @@ QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
return QScriptValue(QLatin1String(result.toHex()));
}
+QScriptValue QmlEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
+{
+ QByteArray data;
+
+ if (ctxt->argumentCount() >= 1)
+ data = ctxt->argument(0).toString().toUtf8();
+
+ return QScriptValue(QLatin1String(data.toBase64()));
+}
+
+QScriptValue QmlEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
+{
+ QByteArray data;
+
+ if (ctxt->argumentCount() >= 1)
+ data = ctxt->argument(0).toString().toUtf8();
+
+ return QScriptValue(QLatin1String(QByteArray::fromBase64(data)));
+}
+
QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 1)