summaryrefslogtreecommitdiffstats
path: root/framework/qml/ConversationView.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-04-03 16:29:11 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-04-03 16:29:11 +0200
commitf11bb429d17b27fb29ff068626c76e8346ac71d2 (patch)
tree4f2c0218c4f28f9e659f5c86eb79e116b58d5db5 /framework/qml/ConversationView.qml
parent1bceb83479c74eb2035354b7fde0eeb9c655ead4 (diff)
downloadkube-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/ConversationView.qml')
-rw-r--r--framework/qml/ConversationView.qml13
1 files changed, 13 insertions, 0 deletions
diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml
index 0fd76f8f..4aa2b2c0 100644
--- a/framework/qml/ConversationView.qml
+++ b/framework/qml/ConversationView.qml
@@ -60,6 +60,18 @@ FocusScope {
60 mail: root.mail 60 mail: root.mail
61 } 61 }
62 62
63 Keys.onPressed: {
64 if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) {
65 listView.incrementCurrentIndex()
66 } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) {
67 listView.decrementCurrentIndex()
68 } else if (event.text == "d") {
69 //Not implemented as a shortcut because we want it only to apply if we have the focus
70 Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": listView.currentItem.currentData.mail})
71 }
72 }
73
74
63 delegate: FocusScope { 75 delegate: FocusScope {
64 id: delegateRoot 76 id: delegateRoot
65 77
@@ -77,6 +89,7 @@ FocusScope {
77 89
78 height: sheet.height + Kube.Units.gridUnit 90 height: sheet.height + Kube.Units.gridUnit
79 width: listView.width 91 width: listView.width
92 //FIXME breaks keyboard navigation because we don't jump over invisible items
80 visible: !((root.hideTrash && model.trash) || (root.hideNonTrash && !model.trash)) 93 visible: !((root.hideTrash && model.trash) || (root.hideNonTrash && !model.trash))
81 94
82 MouseArea { 95 MouseArea {