diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 16:29:11 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 16:29:11 +0200 |
commit | f11bb429d17b27fb29ff068626c76e8346ac71d2 (patch) | |
tree | 4f2c0218c4f28f9e659f5c86eb79e116b58d5db5 /framework/qml/MailListView.qml | |
parent | 1bceb83479c74eb2035354b7fde0eeb9c655ead4 (diff) | |
download | kube-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/MailListView.qml')
-rw-r--r-- | framework/qml/MailListView.qml | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 55a3aaff..eb124102 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -16,7 +16,7 @@ | |||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | import QtQuick 2.7 | 19 | import QtQuick 2.9 |
20 | import QtQuick.Controls 2.0 | 20 | import QtQuick.Controls 2.0 |
21 | import QtQuick.Controls 1.4 as Controls | 21 | import QtQuick.Controls 1.4 as Controls |
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 |
@@ -48,7 +48,7 @@ FocusScope { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | Shortcut { | 50 | Shortcut { |
51 | sequence: StandardKey.Delete | 51 | sequences: [StandardKey.Delete] |
52 | enabled: !isTrash | 52 | enabled: !isTrash |
53 | onActivated: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail":currentMail}) | 53 | onActivated: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail":currentMail}) |
54 | } | 54 | } |
@@ -121,12 +121,17 @@ FocusScope { | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | Keys.onDownPressed: { | 124 | Keys.onPressed: { |
125 | incrementCurrentIndex() | 125 | if (event.text == "j" || event.matches(StandardKey.MoveToNextLine)) { |
126 | } | 126 | incrementCurrentIndex() |
127 | Keys.onUpPressed: { | 127 | } else if (event.text == "k" || event.matches(StandardKey.MoveToPreviousLine)) { |
128 | decrementCurrentIndex() | 128 | decrementCurrentIndex() |
129 | } else if (event.text == "d") { | ||
130 | //Not implemented as a shortcut because we want it only to apply if we have the focus | ||
131 | Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": root.currentMail}) | ||
132 | } | ||
129 | } | 133 | } |
134 | |||
130 | //END keyboard nav | 135 | //END keyboard nav |
131 | 136 | ||
132 | onCurrentItemChanged: { | 137 | onCurrentItemChanged: { |