Improved error message wording
authorMatthew Vogt <matthew.vogt@nokia.com>
Mon, 16 Jul 2012 06:31:45 +0000 (16:31 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 16 Jul 2012 23:10:08 +0000 (01:10 +0200)
When a qmldir contains multiple definitions with the same name and
version numbers, the error message should indicate that the problem is
localized to that qmldir file.

Change-Id: I02cd4862c9ead2fd7ed1c75d0fa6949ab3eda6f6
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
src/qml/qml/qqmlimport.cpp
tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp

index 937d2df..00ea8c5 100644 (file)
@@ -917,7 +917,7 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte
                 (cit2->minorVersion == cit->minorVersion)) {
                 // This entry clashes with a predecessor
                 QQmlError error;
-                error.setDescription(QQmlImportDatabase::tr("\"%1\" version %2.%3 is already defined in module \"%4\"")
+                error.setDescription(QQmlImportDatabase::tr("\"%1\" version %2.%3 is defined more than once in module \"%4\"")
                                      .arg(cit->typeName).arg(cit->majorVersion).arg(cit->minorVersion).arg(uri));
                 errors->prepend(error);
                 return false;
@@ -941,7 +941,7 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte
                 (sit2->minorVersion == sit->minorVersion)) {
                 // This entry clashes with a predecessor
                 QQmlError error;
-                error.setDescription(QQmlImportDatabase::tr("\"%1\" version %2.%3 is already defined in module \"%4\"")
+                error.setDescription(QQmlImportDatabase::tr("\"%1\" version %2.%3 is defined more than once in module \"%4\"")
                                      .arg(sit->nameSpace).arg(sit->majorVersion).arg(sit->minorVersion).arg(uri));
                 errors->prepend(error);
                 return false;
index 1878156..2c9593b 100644 (file)
@@ -2196,12 +2196,12 @@ void tst_qqmllanguage::importsInstalled_data()
         << "import com.nokia.installedtest1 1.0\n"
            "Test {}"
         << ""
-        << "\"Test\" version 1.0 is already defined in module \"com.nokia.installedtest1\"";
+        << "\"Test\" version 1.0 is defined more than once in module \"com.nokia.installedtest1\"";
     QTest::newRow("installed import version JS clash")
         << "import com.nokia.installedtest2 1.0\n"
            "Test {}"
         << ""
-        << "\"Test\" version 1.0 is already defined in module \"com.nokia.installedtest2\"";
+        << "\"Test\" version 1.0 is defined more than once in module \"com.nokia.installedtest2\"";
 }
 
 void tst_qqmllanguage::importsInstalled()