From ef8a9f2f1d9f91358541b83fab63603aa3001bff Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 16 Apr 2017 17:47:48 +0200 Subject: 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. --- framework/qml/ConversationView.qml | 1 + framework/qml/MailListView.qml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'framework/qml') diff --git a/framework/qml/ConversationView.qml b/framework/qml/ConversationView.qml index 8c6e2d38..83771925 100644 --- a/framework/qml/ConversationView.qml +++ b/framework/qml/ConversationView.qml @@ -149,6 +149,7 @@ Rectangle { when: !!root.currentMail value: root.currentMail } + operateOnThreads: false } Timer { 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 { property variant parentFolder property variant currentMail: null property bool isDraft : false + property bool isImportant : false + property bool isTrash : false + property bool isUnread : false property int currentIndex property string filterString: searchBar.text; @@ -35,6 +38,34 @@ Item { currentMail = null } + Kube.MailController { + id: mailController + Binding on mail { + //!! checks for the availability of the type + when: !!root.currentMail + value: root.currentMail + } + unread: root.isUnread + trash: root.isUnread + important: root.isUnread + draft: root.isUnread + operateOnThreads: mailListModel.isThreaded + } + + Shortcut { + sequence: StandardKey.Delete + onActivated: mailController.moveToTrashAction.execute() + enabled: mailController.moveToTrashAction.enabled + } + Shortcut { + sequence: StandardKey.MoveToNextLine + onActivated: root.currentIndex++ + } + Shortcut { + sequence: StandardKey.MoveToPreviousLine + onActivated: root.currentIndex-- + } + ToolBar { id: toolbar @@ -142,9 +173,13 @@ Item { onCurrentItemChanged: { root.currentMail = currentItem.currentData.domainObject; root.isDraft = currentItem.currentData.draft; + root.isTrash = currentItem.currentData.trash; + root.isImportant = currentItem.currentData.important; + root.isUnread = currentItem.currentData.unread; } model: Kube.MailListModel { + id: mailListModel parentFolder: root.parentFolder filter: root.filterString } -- cgit v1.2.3