diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-05-24 01:11:57 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-05-24 02:37:36 (GMT) |
commit | b933f40a39a000ee79e80564b529a3b72365cfae (patch) | |
tree | 1f10d6fade41c633844dfaba705c9eda46e67c56 /src/declarative/qml/qdeclarativeimport.cpp | |
parent | 80f946828264c8e9e9213e0b8760f772090c979f (diff) | |
download | Qt-b933f40a39a000ee79e80564b529a3b72365cfae.zip Qt-b933f40a39a000ee79e80564b529a3b72365cfae.tar.gz Qt-b933f40a39a000ee79e80564b529a3b72365cfae.tar.bz2 |
Move copies of toLocalFileOrQrc() to QDeclarativeEnginePrivate
Diffstat (limited to 'src/declarative/qml/qdeclarativeimport.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeimport.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 0c87671..c658a31 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -49,22 +49,13 @@ #include <QtDeclarative/qdeclarativeextensioninterface.h> #include <private/qdeclarativeglobal_p.h> #include <private/qdeclarativetypenamecache_p.h> +#include <private/qdeclarativeengine_p.h> QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE) DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES) -static QString toLocalFileOrQrc(const QUrl& url) -{ - if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) { - if (url.authority().isEmpty()) - return QLatin1Char(':') + url.path(); - return QString(); - } - return url.toLocalFile(); -} - static bool greaterThan(const QString &s1, const QString &s2) { return s1 > s2; @@ -262,7 +253,7 @@ bool QDeclarativeImportedNamespace::find_helper(int i, const QByteArray& type, i if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) { // XXX search non-files too! (eg. zip files, see QT-524) - QFileInfo f(toLocalFileOrQrc(url)); + QFileInfo f(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url)); if (f.exists()) { if (base && *base == url) { // no recursion if (typeRecursionDetected) @@ -415,15 +406,15 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (importType == QDeclarativeScriptParser::Import::File && qmldircomponents.isEmpty()) { QUrl importUrl = base.resolved(QUrl(uri + QLatin1String("/qmldir"))); - QString localFileOrQrc = toLocalFileOrQrc(importUrl); + QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl); if (!localFileOrQrc.isEmpty()) { - QString dir = toLocalFileOrQrc(base.resolved(QUrl(uri))); + QString dir = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); if (dir.isEmpty() || !QDir().exists(dir)) { if (errorString) *errorString = QDeclarativeImportDatabase::tr("\"%1\": no such directory").arg(uri_arg); return false; // local import dirs must exist } - uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), database); + uri = resolvedUri(QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))), database); if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); if (QFile::exists(localFileOrQrc)) { @@ -433,7 +424,7 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp } else { if (prefix.isEmpty()) { // directory must at least exist for valid import - QString localFileOrQrc = toLocalFileOrQrc(base.resolved(QUrl(uri))); + QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) { if (errorString) { if (localFileOrQrc.isEmpty()) |