diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-08-06 16:07:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-06 18:26:47 +0200 |
commit | f1b9ba8c6ee6b991ef4e513bc4f39045fd55d1e6 (patch) | |
tree | cd587156a07344e98aca0cd1511075fe272bfec5 /src/imports/folderlistmodel | |
parent | 27deff6d2b5a9eb1d98cd7b377ab934a35086664 (diff) | |
parent | 1d3b9db5b54d8ae99c6b149c8d3d91eda19b5838 (diff) |
Merge "Merge branch 'stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 2f9c07cf20..bb65ddbccc 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -488,16 +488,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); } @@ -541,8 +537,8 @@ void QQuickFolderListModel::componentComplete() { Q_D(QQuickFolderListModel); - if (!d->currentDir.isValid() || d->currentDir.toLocalFile().isEmpty() || !QDir().exists(d->currentDir.toLocalFile())) - setFolder(QUrl(QLatin1String("file://")+QDir::currentPath())); + if (!d->currentDir.isValid() || !d->currentDir.isLocalFile() || !QDir().exists(d->currentDir.toLocalFile())) + setFolder(QUrl::fromLocalFile(QDir::currentPath())); } /*! |