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
This commit is contained in:
Frank Reininghaus 2012-05-30 09:21:32 +02:00
parent 70512f5081
commit 93daadae28

View file

@ -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);
}