From f11bb429d17b27fb29ff068626c76e8346ac71d2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 3 Apr 2018 16:29:11 +0200 Subject: 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. --- framework/qml/ConversationView.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'framework/qml/ConversationView.qml') 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 { mail: root.mail } + Keys.onPressed: { + if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { + listView.incrementCurrentIndex() + } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { + listView.decrementCurrentIndex() + } else if (event.text == "d") { + //Not implemented as a shortcut because we want it only to apply if we have the focus + Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": listView.currentItem.currentData.mail}) + } + } + + delegate: FocusScope { id: delegateRoot @@ -77,6 +89,7 @@ FocusScope { height: sheet.height + Kube.Units.gridUnit width: listView.width + //FIXME breaks keyboard navigation because we don't jump over invisible items visible: !((root.hideTrash && model.trash) || (root.hideNonTrash && !model.trash)) MouseArea { -- cgit v1.2.3