summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeimport.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-07-05 23:59:41 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-07-05 23:59:41 (GMT)
commitcabdb16f5ea6458dec9a2ec3b70a01e498b27dbc (patch)
tree5c7bea7f618edb91be5d365913324967857e89e2 /src/declarative/qml/qdeclarativeimport.cpp
parent48fa690558a8a73b6845aaea13fc29965150e733 (diff)
downloadQt-cabdb16f5ea6458dec9a2ec3b70a01e498b27dbc.zip
Qt-cabdb16f5ea6458dec9a2ec3b70a01e498b27dbc.tar.gz
Qt-cabdb16f5ea6458dec9a2ec3b70a01e498b27dbc.tar.bz2
Fix inconsistent reporting of module import errors when using versions.
Task-number: QTBUG-11936
Diffstat (limited to 'src/declarative/qml/qdeclarativeimport.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index fe05d20..8d81b34 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -447,11 +447,23 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) {
QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin();
+ int lowest_maj = INT_MAX;
+ int lowest_min = INT_MAX;
+ int highest_maj = INT_MIN;
+ int highest_min = INT_MIN;
for (; it != qmldircomponents.end(); ++it) {
- if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin))
- break;
+ if (it->majorVersion > highest_maj || (it->majorVersion == highest_maj && it->minorVersion > highest_min)) {
+ highest_maj = it->majorVersion;
+ highest_min = it->minorVersion;
+ }
+ if (it->majorVersion < lowest_maj || (it->majorVersion == lowest_maj && it->minorVersion < lowest_min)) {
+ lowest_maj = it->majorVersion;
+ lowest_min = it->minorVersion;
+ }
}
- if (it == qmldircomponents.end()) {
+ if (lowest_maj > vmaj || (lowest_maj == vmaj && lowest_min > vmin)
+ || highest_maj < vmaj || (highest_maj == vmaj && highest_min < vmin))
+ {
*errorString = QDeclarativeImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin);
return false;
}