summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-09-21 10:35:14 (GMT)
committermread <qt-info@nokia.com>2011-09-21 10:49:02 (GMT)
commit849694e4cb9d010517b54b2b30035485487b0e12 (patch)
treebf3558f740675db0fea8ab6b072de9186e6faddb
parentd04f37fa73d2fbb78dd85a02e9d3180ed4ddbdab (diff)
downloadQt-849694e4cb9d010517b54b2b30035485487b0e12.zip
Qt-849694e4cb9d010517b54b2b30035485487b0e12.tar.gz
Qt-849694e4cb9d010517b54b2b30035485487b0e12.tar.bz2
QML import path puts Qt dirs in correct Symbian order
The QML import path contains an entry for the standard import location on each drive on Symbian. These were being ordered so that Z:, the ROM drive, was listed first. In fact the drive order was the reverse of the normal Symbian drive search order. This had the effect that upgraded versions of QML imports installed on the device were generally ignored for older ROM based versions. The import path has now been changed to match the normal Symbian drive search order. This will make it more likely for upgraded QML imports to be picked up and used. Task-number: QTBUG-21409 Reviewed-by: Shane Kearns Reviewed-by: Martin Jones
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp25
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro2
3 files changed, 35 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 6e0b348..c25207a 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qpluginloader.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtCore/qalgorithms.h>
#include <QtDeclarative/qdeclarativeextensioninterface.h>
#include <private/qdeclarativeglobal_p.h>
#include <private/qdeclarativetypenamecache_p.h>
@@ -733,8 +734,12 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
}
RFs& fs = qt_s60GetRFs();
TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive
+ _LIT(KStartDir, "Y:");
+ TFileName dirPath(KStartDir);
+ dirPath.Append(tempPathPtr);
TFindFile finder(fs);
- TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
+ TInt err = finder.FindByDir(tempPathPtr, dirPath);
while (err == KErrNone) {
QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
finder.File().Length());
@@ -742,6 +747,9 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
addImportPath(foundDir);
err = finder.Find();
}
+ // TFindFile found the directories in the order we want, but addImportPath reverses it.
+ // Reverse the order again to get it right.
+ QAlgorithmsPrivate::qReverse(fileImportPath.begin(), fileImportPath.end());
} else {
addImportPath(installImportsPath);
}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index 2cc2971..96bea68 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QDebug>
+#include <QtCore/qlibraryinfo.h>
#include "../shared/testhttpserver.h"
#include "../../../shared/util.h"
@@ -70,6 +71,7 @@ private slots:
void remoteImportWithUnquotedUri();
void versionNotInstalled();
void versionNotInstalled_data();
+ void importPath();
};
#ifdef Q_OS_SYMBIAN
@@ -308,6 +310,29 @@ void tst_qdeclarativemoduleplugin::versionNotInstalled()
VERIFY_ERRORS(errorFile.toLatin1().constData());
}
+void tst_qdeclarativemoduleplugin::importPath()
+{
+#ifndef Q_OS_SYMBIAN
+ QSKIP("Import path order testing for Symbian only", SkipAll);
+#else
+ QDeclarativeEngine engine;
+ QStringList imports = engine.importPathList();
+ QString installImportsPath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::ImportsPath));
+ QString driveOrder(QLatin1String("ZABCDEFGHIJKLMNOPQRSTUVWXY"));
+ int lastOrder = 30;
+ foreach(QString import, imports)
+ {
+ if (import.endsWith(installImportsPath))
+ {
+ int order = driveOrder.indexOf(import[0]);
+ QVERIFY(order < lastOrder);
+ lastOrder = order;
+ }
+ }
+ QVERIFY(lastOrder != 30);
+#endif
+}
+
QTEST_MAIN(tst_qdeclarativemoduleplugin)
#include "tst_qdeclarativemoduleplugin.moc"
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
index a92d3a2..2716a8b 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
@@ -9,7 +9,7 @@ CONFIG -= app_bundle
symbian: {
importFiles.sources = data
importFiles.path = .
- DEPLOYMENT = importFiles
+ DEPLOYMENT += importFiles
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}