From a301d1db33fdecb0e66495b51019922a9b040c1f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 6 Apr 2018 16:45:04 +0200 Subject: Conversation view keyboard navigation --- framework/qml/MailListView.qml | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'framework/qml/MailListView.qml') 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 { find.forceActiveFocus() } - Shortcut { - sequences: [StandardKey.Delete] - enabled: !isTrash - onActivated: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail":currentMail}) + Kube.Listener { + filter: Kube.Messages.selectNextConversation + onMessageReceived: { + listView.incrementCurrentIndex() + listView.forceActiveFocus() + } + } + + Kube.Listener { + filter: Kube.Messages.selectPreviousConversation + onMessageReceived: { + listView.decrementCurrentIndex() + listView.forceActiveFocus() + } } Kube.Label { @@ -59,16 +69,6 @@ FocusScope { text: qsTr("Nothing here...") } - Kube.Listener { - filter: Kube.Messages.nextConversation - onMessageReceived: listView.incrementCurrentIndex() - } - - Kube.Listener { - filter: Kube.Messages.previousConversation - onMessageReceived: listView.decrementCurrentIndex() - } - ColumnLayout { anchors.fill: parent @@ -123,7 +123,6 @@ FocusScope { clip: true focus: true - //BEGIN keyboard nav onActiveFocusChanged: { if (activeFocus && currentIndex < 0) { currentIndex = 0 @@ -131,18 +130,12 @@ FocusScope { } Keys.onPressed: { - if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { - incrementCurrentIndex() - } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { - decrementCurrentIndex() - } else if (event.text == "d") { + 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": root.currentMail}) } } - //END keyboard nav - onCurrentItemChanged: { if (currentItem) { var currentData = currentItem.currentData; -- cgit v1.2.3