summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/maillistmodel.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-16 17:47:48 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-04-16 17:47:48 +0200
commitef8a9f2f1d9f91358541b83fab63603aa3001bff (patch)
tree205a945c83a5029c7f700c0cb9c682a99fba30b2 /framework/src/domain/maillistmodel.h
parent899ca952964a09bf2c2304b42d2ce0d859c99c39 (diff)
downloadkube-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/src/domain/maillistmodel.h')
-rw-r--r--framework/src/domain/maillistmodel.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/framework/src/domain/maillistmodel.h b/framework/src/domain/maillistmodel.h
index 44347661..5ed081f4 100644
--- a/framework/src/domain/maillistmodel.h
+++ b/framework/src/domain/maillistmodel.h
@@ -32,6 +32,7 @@ class MailListModel : public QSortFilterProxyModel
32 Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) 32 Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder)
33 Q_PROPERTY (QVariant mail READ mail WRITE setMail) 33 Q_PROPERTY (QVariant mail READ mail WRITE setMail)
34 Q_PROPERTY (QString filter READ filter WRITE setFilter) 34 Q_PROPERTY (QString filter READ filter WRITE setFilter)
35 Q_PROPERTY (bool isThreaded READ isThreaded NOTIFY isThreadedChanged)
35 36
36public: 37public:
37 enum Status { 38 enum Status {
@@ -49,6 +50,8 @@ public:
49 bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; 50 bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
50 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; 51 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE;
51 52
53 bool isThreaded() const;
54
52 enum Roles { 55 enum Roles {
53 Subject = Qt::UserRole + 1, 56 Subject = Qt::UserRole + 1,
54 Sender, 57 Sender,
@@ -84,6 +87,9 @@ public:
84 void setFilter(const QString &mail); 87 void setFilter(const QString &mail);
85 QString filter() const; 88 QString filter() const;
86 89
90signals:
91 void isThreadedChanged();
92
87private: 93private:
88 void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); 94 void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail);
89 95
@@ -91,4 +97,5 @@ private:
91 bool mFetchMails = false; 97 bool mFetchMails = false;
92 QSet<QByteArray> mFetchedMails; 98 QSet<QByteArray> mFetchedMails;
93 QByteArray mCurrentQueryItem; 99 QByteArray mCurrentQueryItem;
100 bool mIsThreaded = true;
94}; 101};