diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-07-26 14:40:09 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-29 13:49:48 +0200 |
commit | c71c7dadda2b15d7dbde6591172a1d7e85b7fbe6 (patch) | |
tree | 1a496afbbf9abc2b7b51aacce7656a38aa3692d9 /src/imports | |
parent | 646503bfcd53897a630a1844860e139157d65640 (diff) |
FolderListModel: Do not return invalid URLs like "file:" when navigating up.
Task-number: QTBUG-32139
Change-Id: I715b97eb85bc4235de6a2bb696131efae56477fd
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index ca0739270a..2f61a9abe7 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -483,16 +483,12 @@ QUrl QQuickFolderListModel::parentFolder() const QString localFile = d->currentDir.toLocalFile(); if (!localFile.isEmpty()) { QDir dir(localFile); -#if defined(Q_OS_WIN) - if (dir.isRoot()) - dir.setPath(""); - else -#endif - dir.cdUp(); + if (dir.isRoot() || !dir.cdUp()) + return QUrl(); localFile = dir.path(); } else { - int pos = d->currentDir.path().lastIndexOf(QLatin1Char('/')); - if (pos == -1) + const int pos = d->currentDir.path().lastIndexOf(QLatin1Char('/')); + if (pos <= 0) return QUrl(); localFile = d->currentDir.path().left(pos); } |