diff options
| author | Peter Penz <[email protected]> | 2011-12-26 22:16:32 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-12-26 22:22:50 +0100 |
| commit | 118fe89449a6e94065a0b30748f4f854b2fbeb27 (patch) | |
| tree | 7907ffd0445cb97dcd391987be95eb43f3920178 /src/kitemviews/kitemlistcontroller.h | |
| parent | 4dc571401662e6f8ac8c90aa2d74c071c9d73076 (diff) | |
Fix keyboard issues when groups are enabled
When groups are enabled in Dolphin the key-up and key-down keys did not behave
consistent in comparison to traditional views or like done in editors.
CCBUG: 261995
CCBUG: 262038
Diffstat (limited to 'src/kitemviews/kitemlistcontroller.h')
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.h | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index e0e8b0a9b..b2c7d65b2 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -220,6 +220,34 @@ private: */ KItemListWidget* widgetForPos(const QPointF& pos) const; + /** + * Updates m_keyboardAnchorIndex and m_keyboardAnchorPos. If no anchor is + * set, it will be adjusted to the current item. If it is set it will be + * checked whether it is still valid, otherwise it will be reset to the + * current item. + */ + void updateKeyboardAnchor(); + + /** + * @return Index for the next row based on the current index. + * If there is no next row the current index will be returned. + */ + int nextRowIndex() const; + + /** + * @return Index for the previous row based on the current index. + * If there is no previous row the current index will be returned. + */ + int previousRowIndex() const; + + /** + * Helper method for updateKeyboardAnchor(), previousRowIndex() and nextRowIndex(). + * @return The position of the keyboard anchor for the item with the index \a index. + * If a horizontal scrolling is used the y-position of the item will be returned, + * for the vertical scrolling the x-position will be returned. + */ + qreal keyboardAnchorPos(int index) const; + private: bool m_selectionTogglePressed; SelectionBehavior m_selectionBehavior; @@ -235,10 +263,27 @@ private: /** * When starting a rubberband selection during a Shift- or Control-key has been * pressed the current selection should never be deleted. To be able to restore - * the current selection it is remembered in m_oldSelection before + * the current selection it is remembered in m_oldSelection before the * rubberband gets activated. */ QSet<int> m_oldSelection; + + /** + * Assuming a view is given with a vertical scroll-orientation, grouped items and + * a maximum of 4 columns: + * + * 1 2 3 4 + * 5 6 7 + * 8 9 10 11 + * 12 13 14 + * + * If the current index is on 4 and key-down is pressed, then item 7 gets the current + * item. Now when pressing key-down again item 11 should get the current item and not + * item 10. This makes it necessary to keep track of the requested column to have a + * similar behavior like in a text editor: + */ + int m_keyboardAnchorIndex; + qreal m_keyboardAnchorXPos; }; #endif |
