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/ConversationView.qml | |
parent | 72a9eeb01cdfd4f0ee5dbffcd3fe083897d8a390 (diff) | |
download | kube-a301d1db33fdecb0e66495b51019922a9b040c1f.tar.gz kube-a301d1db33fdecb0e66495b51019922a9b040c1f.zip |
Conversation view keyboard navigation
Diffstat (limited to 'framework/qml/ConversationView.qml')
-rw-r--r-- | framework/qml/ConversationView.qml | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 8331e581..1109ad8e 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml | |||
@@ -17,7 +17,7 @@ | |||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.9 |
21 | import QtQuick.Controls 2 | 21 | import QtQuick.Controls 2 |
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 |
23 | import org.kube.framework 1.0 as Kube | 23 | import org.kube.framework 1.0 as Kube |
@@ -38,6 +38,22 @@ FocusScope { | |||
38 | onMessageReceived: root.searchString = message.searchString | 38 | onMessageReceived: root.searchString = message.searchString |
39 | } | 39 | } |
40 | 40 | ||
41 | Kube.Listener { | ||
42 | filter: Kube.Messages.selectNextMessage | ||
43 | onMessageReceived: { | ||
44 | listView.incrementCurrentIndex() | ||
45 | listView.forceActiveFocus() | ||
46 | } | ||
47 | } | ||
48 | |||
49 | Kube.Listener { | ||
50 | filter: Kube.Messages.selectPreviousMessage | ||
51 | onMessageReceived: { | ||
52 | listView.decrementCurrentIndex() | ||
53 | listView.forceActiveFocus() | ||
54 | } | ||
55 | } | ||
56 | |||
41 | Rectangle { | 57 | Rectangle { |
42 | anchors.fill: parent | 58 | anchors.fill: parent |
43 | color: Kube.Colors.backgroundColor | 59 | color: Kube.Colors.backgroundColor |
@@ -61,21 +77,9 @@ FocusScope { | |||
61 | } | 77 | } |
62 | 78 | ||
63 | Keys.onPressed: { | 79 | Keys.onPressed: { |
64 | if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { | 80 | if (event.text == "d") { |
65 | listView.scrollDown() | 81 | //Not implemented as a shortcut because we want it only to apply if we have the focus |
66 | } else if (event.text == "J" || event.matches(StandardKey.MoveToNextPage)) { | 82 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": listView.currentItem.currentData.mail}) |
67 | listView.incrementCurrentIndex() | ||
68 | } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { | ||
69 | listView.scrollUp() | ||
70 | } else if (event.text == "K" || event.matches(StandardKey.MoveToPreviousPage)) { | ||
71 | listView.decrementCurrentIndex() | ||
72 | } else if (event.text == "n") { | ||
73 | Kube.Fabric.postMessage(Kube.Messages.nextConversation, {}) | ||
74 | } else if (event.text == "p") { | ||
75 | Kube.Fabric.postMessage(Kube.Messages.previousConversation, {}) | ||
76 | } else if (event.text == "d") { | ||
77 | //Not implemented as a shortcut because we want it only to apply if we have the focus | ||
78 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": listView.currentItem.currentData.mail}) | ||
79 | } | 83 | } |
80 | } | 84 | } |
81 | 85 | ||