diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-06 16:45:04 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-06 16:45:04 +0200 |
commit | a301d1db33fdecb0e66495b51019922a9b040c1f (patch) | |
tree | daa93751bcfd171b79d116d74f707e88175e0733 /framework/qml/MailListView.qml | |
parent | 72a9eeb01cdfd4f0ee5dbffcd3fe083897d8a390 (diff) | |
download | kube-a301d1db33fdecb0e66495b51019922a9b040c1f.tar.gz kube-a301d1db33fdecb0e66495b51019922a9b040c1f.zip |
Conversation view keyboard navigation
Diffstat (limited to 'framework/qml/MailListView.qml')
-rw-r--r-- | framework/qml/MailListView.qml | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index f5806d82..a8322f15 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -46,10 +46,20 @@ FocusScope { | |||
46 | find.forceActiveFocus() | 46 | find.forceActiveFocus() |
47 | } | 47 | } |
48 | 48 | ||
49 | Shortcut { | 49 | Kube.Listener { |
50 | sequences: [StandardKey.Delete] | 50 | filter: Kube.Messages.selectNextConversation |
51 | enabled: !isTrash | 51 | onMessageReceived: { |
52 | onActivated: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail":currentMail}) | 52 | listView.incrementCurrentIndex() |
53 | listView.forceActiveFocus() | ||
54 | } | ||
55 | } | ||
56 | |||
57 | Kube.Listener { | ||
58 | filter: Kube.Messages.selectPreviousConversation | ||
59 | onMessageReceived: { | ||
60 | listView.decrementCurrentIndex() | ||
61 | listView.forceActiveFocus() | ||
62 | } | ||
53 | } | 63 | } |
54 | 64 | ||
55 | Kube.Label { | 65 | Kube.Label { |
@@ -59,16 +69,6 @@ FocusScope { | |||
59 | text: qsTr("Nothing here...") | 69 | text: qsTr("Nothing here...") |
60 | } | 70 | } |
61 | 71 | ||
62 | Kube.Listener { | ||
63 | filter: Kube.Messages.nextConversation | ||
64 | onMessageReceived: listView.incrementCurrentIndex() | ||
65 | } | ||
66 | |||
67 | Kube.Listener { | ||
68 | filter: Kube.Messages.previousConversation | ||
69 | onMessageReceived: listView.decrementCurrentIndex() | ||
70 | } | ||
71 | |||
72 | ColumnLayout { | 72 | ColumnLayout { |
73 | anchors.fill: parent | 73 | anchors.fill: parent |
74 | 74 | ||
@@ -123,7 +123,6 @@ FocusScope { | |||
123 | clip: true | 123 | clip: true |
124 | focus: true | 124 | focus: true |
125 | 125 | ||
126 | //BEGIN keyboard nav | ||
127 | onActiveFocusChanged: { | 126 | onActiveFocusChanged: { |
128 | if (activeFocus && currentIndex < 0) { | 127 | if (activeFocus && currentIndex < 0) { |
129 | currentIndex = 0 | 128 | currentIndex = 0 |
@@ -131,18 +130,12 @@ FocusScope { | |||
131 | } | 130 | } |
132 | 131 | ||
133 | Keys.onPressed: { | 132 | Keys.onPressed: { |
134 | if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { | 133 | if (event.text == "d") { |
135 | incrementCurrentIndex() | ||
136 | } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { | ||
137 | decrementCurrentIndex() | ||
138 | } else if (event.text == "d") { | ||
139 | //Not implemented as a shortcut because we want it only to apply if we have the focus | 134 | //Not implemented as a shortcut because we want it only to apply if we have the focus |
140 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": root.currentMail}) | 135 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": root.currentMail}) |
141 | } | 136 | } |
142 | } | 137 | } |
143 | 138 | ||
144 | //END keyboard nav | ||
145 | |||
146 | onCurrentItemChanged: { | 139 | onCurrentItemChanged: { |
147 | if (currentItem) { | 140 | if (currentItem) { |
148 | var currentData = currentItem.currentData; | 141 | var currentData = currentItem.currentData; |