Commit 0337f979 authored by Thomas Surrel's avatar Thomas Surrel

[Folder View] Fix right/left arrow navigation in popup mode

Summary:
This patch fixes several issues in the popup mode:
- when using the Folder View in 'Icon mode', pressing the right arrow when on a folder would enter that folder instead of just moving the selection to the right
- when using the Folder View in 'list mode', navigating in a subfolder and pressing the right arrow several times while selection is on a file would result in having to press an equal number of times the left arrow before it navigates back to the parent folder
- using the left arrow now only navigates back. Pressing the left arrow while in the 'root' folder of the Folder View was also moving the selection up, which is inconsistent

Reviewers: #plasma, #vdg, hein

Reviewed By: #plasma, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15824
parent df458e9e
...@@ -960,8 +960,10 @@ FocusScope { ...@@ -960,8 +960,10 @@ FocusScope {
} }
Keys.onLeftPressed: { Keys.onLeftPressed: {
if (root.isPopup && dir.resolvedUrl != dir.resolve(plasmoid.configuration.url)) { if (root.isPopup && root.useListViewMode) {
doBack(); if (dir.resolvedUrl != dir.resolve(plasmoid.configuration.url)) {
doBack();
}
} else if (positioner.enabled) { } else if (positioner.enabled) {
var newIndex = positioner.nearestItem(currentIndex, var newIndex = positioner.nearestItem(currentIndex,
FolderTools.effectiveNavDirection(gridView.flow, gridView.effectiveLayoutDirection, Qt.LeftArrow)); FolderTools.effectiveNavDirection(gridView.flow, gridView.effectiveLayoutDirection, Qt.LeftArrow));
...@@ -984,9 +986,10 @@ FocusScope { ...@@ -984,9 +986,10 @@ FocusScope {
} }
Keys.onRightPressed: { Keys.onRightPressed: {
if (root.isPopup && currentIndex != -1 && dir.hasSelection()) { if (root.isPopup && root.useListViewMode) {
var func = root.isPopup ? doCd : dir.run; if (currentIndex != -1 && dir.hasSelection() && currentItem.isDir) {
func(positioner.map(currentIndex)); doCd(positioner.map(currentIndex));
}
} else if (positioner.enabled) { } else if (positioner.enabled) {
var newIndex = positioner.nearestItem(currentIndex, var newIndex = positioner.nearestItem(currentIndex,
FolderTools.effectiveNavDirection(gridView.flow, gridView.effectiveLayoutDirection, Qt.RightArrow)); FolderTools.effectiveNavDirection(gridView.flow, gridView.effectiveLayoutDirection, Qt.RightArrow));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment