diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 16:29:11 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 16:29:11 +0200 |
commit | f11bb429d17b27fb29ff068626c76e8346ac71d2 (patch) | |
tree | 4f2c0218c4f28f9e659f5c86eb79e116b58d5db5 /framework/qml/ConversationListView.qml | |
parent | 1bceb83479c74eb2035354b7fde0eeb9c655ead4 (diff) | |
download | kube-f11bb429d17b27fb29ff068626c76e8346ac71d2.tar.gz kube-f11bb429d17b27fb29ff068626c76e8346ac71d2.zip |
Some vim style keyboard navigation.
If nothing else it works as an example how we have to differentiate
between shortcuts and keyboard navigation (one is global to some extent,
the other is only when having focus), and shows that we'll need some
place to consolidate that configuration.
Diffstat (limited to 'framework/qml/ConversationListView.qml')
-rw-r--r-- | framework/qml/ConversationListView.qml | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/framework/qml/ConversationListView.qml b/framework/qml/ConversationListView.qml index dcb5e3a4..2f5c5c32 100644 --- a/framework/qml/ConversationListView.qml +++ b/framework/qml/ConversationListView.qml | |||
@@ -60,6 +60,14 @@ FocusScope { | |||
60 | setCurrentItem() | 60 | setCurrentItem() |
61 | } | 61 | } |
62 | 62 | ||
63 | function incrementCurrentIndex() { | ||
64 | flickable.incrementCurrentIndex() | ||
65 | } | ||
66 | |||
67 | function decrementCurrentIndex() { | ||
68 | flickable.decrementCurrentIndex() | ||
69 | } | ||
70 | |||
63 | Flickable { | 71 | Flickable { |
64 | id: flickable | 72 | id: flickable |
65 | anchors.fill: parent | 73 | anchors.fill: parent |
@@ -116,21 +124,13 @@ FocusScope { | |||
116 | if (currentIndex < repeater.count - 1) { | 124 | if (currentIndex < repeater.count - 1) { |
117 | currentIndex = currentIndex + 1 | 125 | currentIndex = currentIndex + 1 |
118 | } | 126 | } |
127 | scrollToIndex(currentIndex) | ||
119 | } | 128 | } |
120 | 129 | ||
121 | function decrementCurrentIndex() { | 130 | function decrementCurrentIndex() { |
122 | if (currentIndex > 0) { | 131 | if (currentIndex > 0) { |
123 | currentIndex = currentIndex - 1 | 132 | currentIndex = currentIndex - 1 |
124 | } | 133 | } |
125 | } | ||
126 | |||
127 | Keys.onDownPressed: { | ||
128 | incrementCurrentIndex() | ||
129 | scrollToIndex(currentIndex) | ||
130 | } | ||
131 | |||
132 | Keys.onUpPressed: { | ||
133 | decrementCurrentIndex() | ||
134 | scrollToIndex(currentIndex) | 134 | scrollToIndex(currentIndex) |
135 | } | 135 | } |
136 | 136 | ||