From ab3d462590e29488e2f5cff8338745347ff80742 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 4 Apr 2018 13:11:22 +0200 Subject: Keyboard navigation in conversation view. One problem with the current setting is that j/k is used for scrolling in the conversation view, but for moving to the next mail in the maillist view. To normalize this we could be using j/k for moving to the next conversation instead, and n/p to go to the next/previous mail, which is also what gmail does. --- framework/qml/ConversationView.qml | 8 ++++++++ framework/qml/MailListView.qml | 10 ++++++++++ framework/qml/Messages.qml | 3 +++ 3 files changed, 21 insertions(+) diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 4aa2b2c0..8331e581 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml @@ -62,9 +62,17 @@ FocusScope { Keys.onPressed: { if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { + listView.scrollDown() + } else if (event.text == "J" || event.matches(StandardKey.MoveToNextPage)) { listView.incrementCurrentIndex() } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { + listView.scrollUp() + } else if (event.text == "K" || event.matches(StandardKey.MoveToPreviousPage)) { listView.decrementCurrentIndex() + } else if (event.text == "n") { + Kube.Fabric.postMessage(Kube.Messages.nextConversation, {}) + } else if (event.text == "p") { + Kube.Fabric.postMessage(Kube.Messages.previousConversation, {}) } 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}) diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index eb124102..ff72a59c 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml @@ -60,6 +60,16 @@ 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 diff --git a/framework/qml/Messages.qml b/framework/qml/Messages.qml index 35aa750a..a3f6ef00 100644 --- a/framework/qml/Messages.qml +++ b/framework/qml/Messages.qml @@ -51,5 +51,8 @@ Item { property string sendOutbox: "sendOutbox" property string componentDone: "done" + + property string nextConversation: "nextConversation" + property string previousConversation: "previousConversation" } -- cgit v1.2.3