diff options
Diffstat (limited to 'framework/qml')
-rw-r--r-- | framework/qml/ConversationListView.qml | 18 | ||||
-rw-r--r-- | framework/qml/ConversationView.qml | 13 | ||||
-rw-r--r-- | framework/qml/MailListView.qml | 19 |
3 files changed, 34 insertions, 16 deletions
diff --git a/framework/qml/ConversationListView.qml b/framework/qml/ConversationListView.qml index dcb5e3a4..2f5c5c32 100644 --- a/framework/qml/ConversationListView.qml +++ b/framework/qml/ConversationListView.qml | |||
@@ -60,6 +60,14 @@ FocusScope { | |||
60 | setCurrentItem() | 60 | setCurrentItem() |
61 | } | 61 | } |
62 | 62 | ||
63 | function incrementCurrentIndex() { | ||
64 | flickable.incrementCurrentIndex() | ||
65 | } | ||
66 | |||
67 | function decrementCurrentIndex() { | ||
68 | flickable.decrementCurrentIndex() | ||
69 | } | ||
70 | |||
63 | Flickable { | 71 | Flickable { |
64 | id: flickable | 72 | id: flickable |
65 | anchors.fill: parent | 73 | anchors.fill: parent |
@@ -116,21 +124,13 @@ FocusScope { | |||
116 | if (currentIndex < repeater.count - 1) { | 124 | if (currentIndex < repeater.count - 1) { |
117 | currentIndex = currentIndex + 1 | 125 | currentIndex = currentIndex + 1 |
118 | } | 126 | } |
127 | scrollToIndex(currentIndex) | ||
119 | } | 128 | } |
120 | 129 | ||
121 | function decrementCurrentIndex() { | 130 | function decrementCurrentIndex() { |
122 | if (currentIndex > 0) { | 131 | if (currentIndex > 0) { |
123 | currentIndex = currentIndex - 1 | 132 | currentIndex = currentIndex - 1 |
124 | } | 133 | } |
125 | } | ||
126 | |||
127 | Keys.onDownPressed: { | ||
128 | incrementCurrentIndex() | ||
129 | scrollToIndex(currentIndex) | ||
130 | } | ||
131 | |||
132 | Keys.onUpPressed: { | ||
133 | decrementCurrentIndex() | ||
134 | scrollToIndex(currentIndex) | 134 | scrollToIndex(currentIndex) |
135 | } | 135 | } |
136 | 136 | ||
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 { |
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: { |