diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-21 08:00:43 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-21 08:04:56 (GMT) |
commit | 25e2e372e43374c4f161c06e48f62e738b968370 (patch) | |
tree | 911133fa7768696afa2014f398cde9d1e31abfb4 /src/imports | |
parent | d5a86d924bfe331aeba6465b0f249cd27ef83ad4 (diff) | |
download | Qt-25e2e372e43374c4f161c06e48f62e738b968370.zip Qt-25e2e372e43374c4f161c06e48f62e738b968370.tar.gz Qt-25e2e372e43374c4f161c06e48f62e738b968370.tar.bz2 |
Fix FolderListModel parentFolder property's file drive handling
Task-number: QT-3315
Reviewed-by: Martin Jones
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp | 14 |
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); } /*! |