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/src/domain/mailcontroller.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'framework/src/domain/mailcontroller.h') diff --git a/framework/src/domain/mailcontroller.h b/framework/src/domain/mailcontroller.h index f6613558..0bc000f1 100644 --- a/framework/src/domain/mailcontroller.h +++ b/framework/src/domain/mailcontroller.h @@ -25,9 +25,15 @@ class MailController : public Kube::Controller { Q_OBJECT + //Use this instead of mail property to get overall status of thread. + KUBE_CONTROLLER_PROPERTY(bool, Unread, unread) + KUBE_CONTROLLER_PROPERTY(bool, Important, important) + KUBE_CONTROLLER_PROPERTY(bool, Trash, trash) + KUBE_CONTROLLER_PROPERTY(bool, Draft, draft) + KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail::Ptr, Mail, mail) - KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail::Ptr, ThreadLeader, threadLeader) KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Folder::Ptr, TargetFolder, targetFolder) + KUBE_CONTROLLER_PROPERTY(bool, OperateOnThreads, operateOnThreads) KUBE_CONTROLLER_ACTION(markAsRead) KUBE_CONTROLLER_ACTION(markAsUnread) KUBE_CONTROLLER_ACTION(markAsImportant) -- cgit v1.2.3