diff options
-rw-r--r-- | src/declarative/qml/qdeclarativedirparser.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativedirparser_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeimport.cpp | 9 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativetypeloader.cpp | 9 |
4 files changed, 20 insertions, 15 deletions
diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp index 401eea9..fcc74da 100644 --- a/src/declarative/qml/qdeclarativedirparser.cpp +++ b/src/declarative/qml/qdeclarativedirparser.cpp @@ -108,14 +108,14 @@ bool QDeclarativeDirParser::parse() QFile file(_filePathSouce); if (!QDeclarative_isFileCaseCorrect(_filePathSouce)) { QDeclarativeError error; - error.setDescription(QString::fromUtf8("cannot load module \"%1\": File name case mismatch for \"%2\"").arg(_url.toString()).arg(_filePathSouce)); + error.setDescription(QString::fromUtf8("cannot load module \"$$URI$$\": File name case mismatch for \"%1\"").arg(_filePathSouce)); _errors.prepend(error); return false; } else if (file.open(QFile::ReadOnly)) { _source = QString::fromUtf8(file.readAll()); } else { QDeclarativeError error; - error.setDescription(QString::fromUtf8("module \"%1\" definition \"%2\" not readable").arg(_url.toString()).arg(_filePathSouce)); + error.setDescription(QString::fromUtf8("module \"$$URI$$\" definition \"%1\" not readable").arg(_filePathSouce)); _errors.prepend(error); return false; } @@ -243,9 +243,16 @@ bool QDeclarativeDirParser::hasError() const return false; } -QList<QDeclarativeError> QDeclarativeDirParser::errors() const +QList<QDeclarativeError> QDeclarativeDirParser::errors(const QString &uri) const { - return _errors; + QList<QDeclarativeError> errors = _errors; + for (int i = 0; i < errors.size(); ++i) { + QDeclarativeError &e = errors[i]; + QString description = e.description(); + description.replace(QLatin1String("$$URI$$"), uri); + e.setDescription(description); + } + return errors; } QList<QDeclarativeDirParser::Plugin> QDeclarativeDirParser::plugins() const diff --git a/src/declarative/qml/qdeclarativedirparser_p.h b/src/declarative/qml/qdeclarativedirparser_p.h index 347b229..bc84a42 100644 --- a/src/declarative/qml/qdeclarativedirparser_p.h +++ b/src/declarative/qml/qdeclarativedirparser_p.h @@ -80,7 +80,7 @@ public: bool parse(); bool hasError() const; - QList<QDeclarativeError> errors() const; + QList<QDeclarativeError> errors(const QString &uri) const; struct Plugin { diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 44fc849..734d63e 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -361,8 +361,11 @@ bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath Q_ASSERT(typeLoader); const QDeclarativeDirParser *qmldirParser = typeLoader->qmlDirParser(absoluteFilePath); if (qmldirParser->hasError()) { - if (errorString) - *errorString = QDeclarativeImportDatabase::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); + if (errorString) { + const QList<QDeclarativeError> qmldirErrors = qmldirParser->errors(uri); + for (int i = 0; i < qmldirErrors.size(); ++i) + *errorString += qmldirErrors.at(i).description(); + } return false; } @@ -1022,7 +1025,7 @@ bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QSt if (!engineInitialized || !typesRegistered) { if (!QDeclarative_isFileCaseCorrect(absoluteFilePath)) { if (errorString) - *errorString = tr("File name case mismatch for \"%2\"").arg(absoluteFilePath); + *errorString = tr("File name case mismatch for \"%1\"").arg(absoluteFilePath); return false; } QPluginLoader loader(absoluteFilePath); diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index cd199ad..5e20617 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -789,18 +789,13 @@ Return a QDeclarativeDirParser for absoluteFilePath. The QDeclarativeDirParser const QDeclarativeDirParser *QDeclarativeTypeLoader::qmlDirParser(const QString &absoluteFilePath) { QDeclarativeDirParser *qmldirParser; -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_DARWIN) || defined(Q_OS_SYMBIAN) - QString lowPath(absoluteFilePath.toLower()); -#else - QString lowPath(absoluteFilePath); -#endif - QHash<QString,QDeclarativeDirParser*>::const_iterator it = m_importQmlDirCache.find(lowPath); + QHash<QString,QDeclarativeDirParser*>::const_iterator it = m_importQmlDirCache.find(absoluteFilePath); if (it == m_importQmlDirCache.end()) { qmldirParser = new QDeclarativeDirParser; qmldirParser->setFileSource(absoluteFilePath); qmldirParser->setUrl(QUrl::fromLocalFile(absoluteFilePath)); qmldirParser->parse(); - m_importQmlDirCache.insert(lowPath, qmldirParser); + m_importQmlDirCache.insert(absoluteFilePath, qmldirParser); } else { qmldirParser = *it; } |