From: Frank Reininghaus Date: Wed, 30 May 2012 07:21:32 +0000 (+0200) Subject: Improve arrow key navigation in Details View with expanded folders X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/397f8783d98dea4f8a34b15bb0a2db82dc8b848e 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) --- 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); }