diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-16 17:47:48 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-16 17:47:48 +0200 |
commit | ef8a9f2f1d9f91358541b83fab63603aa3001bff (patch) | |
tree | 205a945c83a5029c7f700c0cb9c682a99fba30b2 /framework/qml/MailListView.qml | |
parent | 899ca952964a09bf2c2304b42d2ce0d859c99c39 (diff) | |
download | kube-ef8a9f2f1d9f91358541b83fab63603aa3001bff.tar.gz kube-ef8a9f2f1d9f91358541b83fab63603aa3001bff.zip |
Don't thread drafts and sent
To do this we:
* Expose from the model wether or not the model is threaded
* Set the relevant properties from the model on the controller (so we
can switch between aggregate and non-aggregate versions)
* Keep the controller in the view it belongs to.
While this works it highlights a couple of issues:
* Controllers are view specific and should be kept within the view.
* The actions we execute in the controller are closely related to the
model. The model is essentially what the user sees, and therefore what
he operatees on.
* Sink should perhaps expose aggregates better. We have to pass around
the values from the model because the model dispatches between
aggregate and non-aggregate property depending on the threaded state.
Similary the controller operates on the thread or not depending on the
threaded state. Perhaps it would be more useful if sink actually
returned the aggregate somehow, with the regular properties. That way
the controller could use the regular properties from the entity it
gets (which would simply either be the aggregate or non-aggregate
depending on the executed query). If the aggregate already contains
all matched ids, then we would also not have to execute an additional
query to get the thread again, the modification would simply be
applied to all ids originally returned.
Diffstat (limited to 'framework/qml/MailListView.qml')
-rw-r--r-- | framework/qml/MailListView.qml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 1e0123cc..27fae7c2 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -28,6 +28,9 @@ Item { | |||
28 | property variant parentFolder | 28 | property variant parentFolder |
29 | property variant currentMail: null | 29 | property variant currentMail: null |
30 | property bool isDraft : false | 30 | property bool isDraft : false |
31 | property bool isImportant : false | ||
32 | property bool isTrash : false | ||
33 | property bool isUnread : false | ||
31 | property int currentIndex | 34 | property int currentIndex |
32 | property string filterString: searchBar.text; | 35 | property string filterString: searchBar.text; |
33 | 36 | ||
@@ -35,6 +38,34 @@ Item { | |||
35 | currentMail = null | 38 | currentMail = null |
36 | } | 39 | } |
37 | 40 | ||
41 | Kube.MailController { | ||
42 | id: mailController | ||
43 | Binding on mail { | ||
44 | //!! checks for the availability of the type | ||
45 | when: !!root.currentMail | ||
46 | value: root.currentMail | ||
47 | } | ||
48 | unread: root.isUnread | ||
49 | trash: root.isUnread | ||
50 | important: root.isUnread | ||
51 | draft: root.isUnread | ||
52 | operateOnThreads: mailListModel.isThreaded | ||
53 | } | ||
54 | |||
55 | Shortcut { | ||
56 | sequence: StandardKey.Delete | ||
57 | onActivated: mailController.moveToTrashAction.execute() | ||
58 | enabled: mailController.moveToTrashAction.enabled | ||
59 | } | ||
60 | Shortcut { | ||
61 | sequence: StandardKey.MoveToNextLine | ||
62 | onActivated: root.currentIndex++ | ||
63 | } | ||
64 | Shortcut { | ||
65 | sequence: StandardKey.MoveToPreviousLine | ||
66 | onActivated: root.currentIndex-- | ||
67 | } | ||
68 | |||
38 | ToolBar { | 69 | ToolBar { |
39 | id: toolbar | 70 | id: toolbar |
40 | 71 | ||
@@ -142,9 +173,13 @@ Item { | |||
142 | onCurrentItemChanged: { | 173 | onCurrentItemChanged: { |
143 | root.currentMail = currentItem.currentData.domainObject; | 174 | root.currentMail = currentItem.currentData.domainObject; |
144 | root.isDraft = currentItem.currentData.draft; | 175 | root.isDraft = currentItem.currentData.draft; |
176 | root.isTrash = currentItem.currentData.trash; | ||
177 | root.isImportant = currentItem.currentData.important; | ||
178 | root.isUnread = currentItem.currentData.unread; | ||
145 | } | 179 | } |
146 | 180 | ||
147 | model: Kube.MailListModel { | 181 | model: Kube.MailListModel { |
182 | id: mailListModel | ||
148 | parentFolder: root.parentFolder | 183 | parentFolder: root.parentFolder |
149 | filter: root.filterString | 184 | filter: root.filterString |
150 | } | 185 | } |