summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-10-11 23:35:42 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-10-11 23:35:42 (GMT)
commit3f42986b357c5066adb9755454bc4bcc4915ab9f (patch)
treea1cb084bb5d9c89eb0c7c098f09afbb1a8d72f21 /src/declarative/qml
parented430f5b82df464e8c144bd809eb82f441c0197d (diff)
downloadQt-3f42986b357c5066adb9755454bc4bcc4915ab9f.zip
Qt-3f42986b357c5066adb9755454bc4bcc4915ab9f.tar.gz
Qt-3f42986b357c5066adb9755454bc4bcc4915ab9f.tar.bz2
Backport more imports directory caching changes.
Fixes error reporting on Windows. Change-Id: I49b559aa9d0c227be4e8e3d0fdc43c402273a302 Task-number: QTBUG-15899 Reviewed-by: Damian Jansen
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp15
-rw-r--r--src/declarative/qml/qdeclarativedirparser_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp9
-rw-r--r--src/declarative/qml/qdeclarativetypeloader.cpp9
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;
}