diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-10-01 01:11:45 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-10-01 06:03:42 (GMT) |
commit | 6f74eef81cfbebce797f4a3464ea0cefbd268d7b (patch) | |
tree | a2aba15e1f9135a926603d18c2cfe4e442232703 /src/declarative/qml | |
parent | 5a6f2b7ed7d1d37379324898161a6d03457c591e (diff) | |
download | Qt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.zip Qt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.tar.gz Qt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.tar.bz2 |
Qt.openUrlExternally should resolve relative URLs.
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index bbd3ac1..584c5ec 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -284,9 +284,11 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) { if (p) { - QDeclarativeContextData *ctxt = QDeclarativeEnginePrivate::get(this)->getContext(context); - Q_ASSERT(ctxt); - return ctxt->resolvedUrl(url); + QDeclarativeContextData *ctxt = p->getContext(context); + if (ctxt) + return ctxt->resolvedUrl(url); + else + return p->getUrl(context).resolved(url); } return baseUrl.resolved(url); } @@ -1146,12 +1148,8 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS QString arg = ctxt->argument(0).toString(); if (arg.isEmpty()) return engine->nullValue(); - QUrl url; + QUrl url = QDeclarativeScriptEngine::get(engine)->resolvedUrl(ctxt, QUrl(arg)); QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt); - if (context) - url = QUrl(context->resolvedUrl(QUrl(arg))); - else - url = activeEnginePriv->getUrl(ctxt).resolved(QUrl(arg)); QDeclarativeComponent *c = new QDeclarativeComponent(activeEngine, url, activeEngine); QDeclarativeComponentPrivate::get(c)->creationContext = context; QDeclarativeData::get(c, true)->setImplicitDestructible(); @@ -1635,7 +1633,7 @@ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QSc return QScriptValue(e, false); bool ret = false; #ifndef QT_NO_DESKTOPSERVICES - ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString())); + ret = QDesktopServices::openUrl(QDeclarativeScriptEngine::get(e)->resolvedUrl(ctxt, QUrl(ctxt->argument(0).toString()))); #endif return QScriptValue(e, ret); } |