diff --git a/qmlUiKirigami/Main.qml b/qmlUiKirigami/Main.qml --- a/qmlUiKirigami/Main.qml +++ b/qmlUiKirigami/Main.qml @@ -102,7 +102,10 @@ Koko.SortModel { id: imageFolderModel sourceModel: Koko.ImageFolderModel { - url: imagePathArgument == "" ? "" : imagePathArgument[imagePathArgument.length -1] + /** + * imagePathArgument[0] sets the column 0 of the pageStack to reflect either a foreign path or ~/Pictures + */ + url: imagePathArgument == "" ? "" : imagePathArgument[0] /** * makes sure that operation only occurs after the model is populated */ diff --git a/src/imagefoldermodel.cpp b/src/imagefoldermodel.cpp --- a/src/imagefoldermodel.cpp +++ b/src/imagefoldermodel.cpp @@ -81,36 +81,21 @@ Q_ASSERT( QUrl(url).isLocalFile()); url = QUrl(url).path(); - QStringList locations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); if (url.isEmpty()) { + QStringList locations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); Q_ASSERT(locations.size() > 1); url = locations.first().append("/"); } - QString directoryUrl; + url = QUrl::fromLocalFile(url).toString(); - if (QDir(url).exists()) { - directoryUrl = QUrl::fromLocalFile(url).toString(); - } else { - m_imagePath = url; - directoryUrl = QUrl::fromLocalFile(url.left(url.lastIndexOf('/'))).toString(); - } - - /** - * Sets the url to ~/Pictures if the path is ~/Pictures path - * and leave it as it is, if it is foreign path - */ - if (directoryUrl.contains(QUrl::fromLocalFile(locations.first()).toString())) { - directoryUrl = QUrl::fromLocalFile(locations.first()).toString(); - } - - if (dirLister()->url().path() == directoryUrl) { - dirLister()->updateDirectory(QUrl(directoryUrl)); + if (dirLister()->url().path() == QUrl(url).path()) { + dirLister()->updateDirectory(QUrl(url)); return; } beginResetModel(); - dirLister()->openUrl(QUrl(directoryUrl)); + dirLister()->openUrl(QUrl(url)); endResetModel(); emit urlChanged(); } diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -93,6 +93,8 @@ tempImagePath = tempImagePath.left( tempImagePath.lastIndexOf('/')); directoryUrls.prepend(tempImagePath); } + } else { + directoryUrls.prepend(tempImagePath.left( tempImagePath.lastIndexOf('/'))); } }