summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <frank78ac@googlemail.com>2012-05-30 07:21:32 (GMT)
committerFrank Reininghaus <frank78ac@googlemail.com>2012-05-30 07:21:32 (GMT)
commit93daadae28f7e3b5cffd7b713a2a287e4fa62ccd (patch)
tree190b4d975f7c4e82303f81493f34be1ec47ad59f
parent70512f5081b1d2e64cd19b0e60cb59386b15fdf6 (diff)
Improve arrow key navigation in Details View with expanded folders
If the current folder is collapsed, pressing the left arrow key now moves the focus to the parent folder. BUG: 300582 FIXED-IN: 4.8.4
-rw-r--r--dolphin/src/kitemviews/kitemlistcontroller.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/dolphin/src/kitemviews/kitemlistcontroller.cpp b/dolphin/src/kitemviews/kitemlistcontroller.cpp
index d7826a9..9b1c5e3 100644
--- a/dolphin/src/kitemviews/kitemlistcontroller.cpp
+++ b/dolphin/src/kitemviews/kitemlistcontroller.cpp
@@ -231,7 +231,15 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
case Qt::Key_Left:
if (index > 0) {
- --index;
+ const int expandedParentsCount = m_model->expandedParentsCount(index);
+ if (expandedParentsCount == 0) {
+ --index;
+ } else {
+ // Go to the parent of the current item.
+ do {
+ --index;
+ } while (index > 0 && m_model->expandedParentsCount(index) == expandedParentsCount);
+ }
m_keyboardAnchorIndex = index;
m_keyboardAnchorPos = keyboardAnchorPos(index);
}