summaryrefslogtreecommitdiffstats
path: root/src/imports/folderlistmodel
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-21 22:00:43 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-21 22:00:43 (GMT)
commitf81fcf9b50360d79aa186d5719d480d736ac576f (patch)
tree70f1608ac1a3c04754f44769b515bd7c95e00f66 /src/imports/folderlistmodel
parentcb23151d3abfdbdf291abe8a1510592db2011927 (diff)
parent93315950003e14df6a43bea50829d17adef7fe30 (diff)
downloadQt-f81fcf9b50360d79aa186d5719d480d736ac576f.zip
Qt-f81fcf9b50360d79aa186d5719d480d736ac576f.tar.gz
Qt-f81fcf9b50360d79aa186d5719d480d736ac576f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Fix FolderListModel parentFolder property's file drive handling Add license headers for .qml files. Also show file/line numbers on XML query errors. Print warnings for xml query syntax errors Clean up Add XmlListModel::get()
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 6a7383a..fccb9d4 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -179,7 +179,8 @@ void QDeclarativeFolderListModel::setFolder(const QUrl &folder)
if (folder == d->folder)
return;
QModelIndex index = d->model.index(folder.toLocalFile());
- if (index.isValid() && d->model.isDir(index)) {
+ if ((index.isValid() && d->model.isDir(index)) || folder.toLocalFile().isEmpty()) {
+
d->folder = folder;
QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
emit folderChanged();
@@ -188,26 +189,23 @@ void QDeclarativeFolderListModel::setFolder(const QUrl &folder)
QUrl QDeclarativeFolderListModel::parentFolder() const
{
- QUrl r;
QString localFile = d->folder.toLocalFile();
if (!localFile.isEmpty()) {
QDir dir(localFile);
-#if defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WIN)
if (dir.isRoot())
dir.setPath("");
else
#endif
dir.cdUp();
- r = d->folder;
- r.setPath(dir.path());
+ localFile = dir.path();
} else {
int pos = d->folder.path().lastIndexOf(QLatin1Char('/'));
if (pos == -1)
return QUrl();
- r = d->folder;
- r.setPath(d->folder.path().left(pos));
+ localFile = d->folder.path().left(pos);
}
- return r;
+ return QUrl::fromLocalFile(localFile);
}
/*!