aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/folderlistmodel
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-08-06 16:07:23 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-06 18:26:47 +0200
commitf1b9ba8c6ee6b991ef4e513bc4f39045fd55d1e6 (patch)
treecd587156a07344e98aca0cd1511075fe272bfec5 /src/imports/folderlistmodel
parent27deff6d2b5a9eb1d98cd7b377ab934a35086664 (diff)
parent1d3b9db5b54d8ae99c6b149c8d3d91eda19b5838 (diff)
Merge "Merge branch 'stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp16
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()));
}
/*!