summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlengine.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-10-28 03:52:12 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-10-28 03:52:12 (GMT)
commit6eea4cc05ac2bc903e3708a8219a22bbcccb7140 (patch)
tree2264837c55d0915c89f8d8e39a2af8bcc73cce20 /src/declarative/qml/qmlengine.cpp
parentfc5050497e207abda676d79dc7694f5635bf0f11 (diff)
downloadQt-6eea4cc05ac2bc903e3708a8219a22bbcccb7140.zip
Qt-6eea4cc05ac2bc903e3708a8219a22bbcccb7140.tar.gz
Qt-6eea4cc05ac2bc903e3708a8219a22bbcccb7140.tar.bz2
Minor cleanup of global object
removed desktopServices member, changed openUrl to openUrlExternally and placed it on the Qt object.
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r--src/declarative/qml/qmlengine.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 0e239ce..6c303e3 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -110,14 +110,6 @@ struct StaticQtMetaObject : public QObject
{ return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; }
};
-QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
-{
- if(!ctxt->argumentCount())
- return e->newVariant(QVariant(false));
- bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString()));
- return e->newVariant(QVariant(ret));
-}
-
static QString userLocalDataPath(const QString& app)
{
return QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/") + app;
@@ -131,9 +123,6 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
{
QScriptValue qtObject =
scriptEngine.newQMetaObject(StaticQtMetaObject::get());
- QScriptValue desktopObject = scriptEngine.newObject();
- desktopObject.setProperty(QLatin1String("openUrl"),scriptEngine.newFunction(desktopOpenUrl, 1));
- qtObject.setProperty(QLatin1String("DesktopServices"), desktopObject);
scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject);
offlineStoragePath = userLocalDataPath(QLatin1String("QML/OfflineStorage"));
@@ -155,6 +144,7 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
//misc methods
qtObject.setProperty(QLatin1String("playSound"), scriptEngine.newFunction(QmlEnginePrivate::playSound, 1));
+ qtObject.setProperty(QLatin1String("openUrlExternally"),scriptEngine.newFunction(desktopOpenUrl, 1));
scriptEngine.globalObject().setProperty(QLatin1String("createQmlObject"),
scriptEngine.newFunction(QmlEnginePrivate::createQmlObject, 1));
@@ -897,6 +887,13 @@ QScriptValue QmlEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *en
return engine->undefinedValue();
}
+QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
+{
+ if(ctxt->argumentCount() < 1)
+ return e->newVariant(QVariant(false));
+ bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString()));
+ return e->newVariant(QVariant(ret));
+}
/*!
This function allows tinting one color with another.