┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-05-30 09:21:32 +0200
committerFrank Reininghaus <[email protected]>2012-05-30 09:26:31 +0200
commit397f8783d98dea4f8a34b15bb0a2db82dc8b848e (patch)
treee4357605ee8001379c5dddc1c9f5701ed908947f
parent203449110e1763cbaee332a9b15d171c333e2df4 (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. CCBUG: 300582 (cherry picked from commit 93daadae28f7e3b5cffd7b713a2a287e4fa62ccd)
-rw-r--r--src/kitemviews/kitemlistcontroller.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index 1b9c53ccf..1b3209303 100644
--- a/src/kitemviews/kitemlistcontroller.cpp
+++ b/src/kitemviews/kitemlistcontroller.cpp
@@ -251,7 +251,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);
}