diff options
Diffstat (limited to 'tools/qmlviewer/qmlfolderlistmodel.cpp')
-rw-r--r-- | tools/qmlviewer/qmlfolderlistmodel.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tools/qmlviewer/qmlfolderlistmodel.cpp b/tools/qmlviewer/qmlfolderlistmodel.cpp index 14d2324..4cbc426 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.cpp +++ b/tools/qmlviewer/qmlfolderlistmodel.cpp @@ -193,11 +193,25 @@ void QmlFolderListModel::setFolder(const QUrl &folder) QUrl QmlFolderListModel::parentFolder() const { - int pos = d->folder.path().lastIndexOf(QLatin1Char('/')); - if (pos == -1) - return QUrl(); - QUrl r = d->folder; - r.setPath(d->folder.path().left(pos)); + QUrl r; + QString localFile = d->folder.toLocalFile(); + if (!localFile.isEmpty()) { + QDir dir(localFile); +#if defined(Q_OS_SYMBIAN) + if (dir.isRoot()) + dir.setPath(""); + else +#endif + dir.cdUp(); + r = d->folder; + r.setPath(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)); + } return r; } |