diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-14 05:18:52 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-14 05:18:52 (GMT) |
commit | 8e9a0667ee8856558694d9d661585d36f7f41da8 (patch) | |
tree | 7f71e351fbc4cd7d45186076c9450065428c1f38 /src/declarative/qml/qmlengine.cpp | |
parent | c84227fbd5e068859f8de15e4c522b076885b9dc (diff) | |
parent | 8a8ddeb9e29abb0734bb7cd703de8302c3e1a506 (diff) | |
download | Qt-8e9a0667ee8856558694d9d661585d36f7f41da8.zip Qt-8e9a0667ee8856558694d9d661585d36f7f41da8.tar.gz Qt-8e9a0667ee8856558694d9d661585d36f7f41da8.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml/qmlengine.cpp')
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 4dbc336..f0ecf1d 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -959,6 +959,15 @@ QVariant QmlScriptClass::toVariant(QmlEngine *engine, const QScriptValue &val) return QVariant(); } +// XXX this beyonds in QUrl::toLocalFile() +static QString toLocalFileOrQrc(const QUrl& url) +{ + QString r = url.toLocalFile(); + if (r.isEmpty() && url.scheme() == QLatin1String("qrc")) + r = QLatin1Char(':') + url.path(); + return r; +} + ///////////////////////////////////////////////////////////// struct QmlEnginePrivate::ImportedNamespace { QStringList urls; @@ -989,7 +998,7 @@ struct QmlEnginePrivate::ImportedNamespace { QUrl url = QUrl(urls.at(i) + QLatin1String("/") + QString::fromUtf8(type) + QLatin1String(".qml")); if (vmaj || vmin) { // Check version file - XXX cache these in QmlEngine! - QFile qmldir(QUrl(urls.at(i)+QLatin1String("/qmldir")).toLocalFile()); + QFile qmldir(toLocalFileOrQrc(QUrl(urls.at(i)+QLatin1String("/qmldir")))); if (qmldir.open(QIODevice::ReadOnly)) { do { QByteArray lineba = qmldir.readLine(); @@ -1020,7 +1029,7 @@ struct QmlEnginePrivate::ImportedNamespace { } } else { // XXX search non-files too! (eg. zip files, see QT-524) - QFileInfo f(url.toLocalFile()); + QFileInfo f(toLocalFileOrQrc(url)); if (f.exists()) { if (url_return) *url_return = url; |