diff options
Diffstat (limited to 'framework/src/domain/maillistmodel.cpp')
-rw-r--r-- | framework/src/domain/maillistmodel.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/framework/src/domain/maillistmodel.cpp b/framework/src/domain/maillistmodel.cpp index 0c22b2c8..a1e137b3 100644 --- a/framework/src/domain/maillistmodel.cpp +++ b/framework/src/domain/maillistmodel.cpp | |||
@@ -139,14 +139,14 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
139 | case Date: | 139 | case Date: |
140 | return mail->getDate(); | 140 | return mail->getDate(); |
141 | case Unread: | 141 | case Unread: |
142 | if (mIsThreaded) { | 142 | if (mail->isAggregate()) { |
143 | return mail->getProperty("unreadCollected").toList().contains(true); | 143 | return mail->getCollectedProperty<Sink::ApplicationDomain::Mail::Unread>().contains(true); |
144 | } else { | 144 | } else { |
145 | return mail->getUnread(); | 145 | return mail->getImportant(); |
146 | } | 146 | } |
147 | case Important: | 147 | case Important: |
148 | if (mIsThreaded) { | 148 | if (mail->isAggregate()) { |
149 | return mail->getProperty("importantCollected").toList().contains(true); | 149 | return mail->getCollectedProperty<Sink::ApplicationDomain::Mail::Important>().contains(true); |
150 | } else { | 150 | } else { |
151 | return mail->getImportant(); | 151 | return mail->getImportant(); |
152 | } | 152 | } |
@@ -166,11 +166,7 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
166 | } | 166 | } |
167 | return mail->getMimeMessage(); | 167 | return mail->getMimeMessage(); |
168 | case ThreadSize: | 168 | case ThreadSize: |
169 | if (mIsThreaded) { | 169 | return mail->count(); |
170 | return mail->getProperty("count").toInt(); | ||
171 | } else { | ||
172 | return 1; | ||
173 | } | ||
174 | case Mail: | 170 | case Mail: |
175 | return QVariant::fromValue(mail); | 171 | return QVariant::fromValue(mail); |
176 | case Incomplete: | 172 | case Incomplete: |
@@ -224,11 +220,6 @@ void MailListModel::runQuery(const Sink::Query &query) | |||
224 | } | 220 | } |
225 | } | 221 | } |
226 | 222 | ||
227 | bool MailListModel::isThreaded() const | ||
228 | { | ||
229 | return mIsThreaded; | ||
230 | } | ||
231 | |||
232 | void MailListModel::setParentFolder(const QVariant &parentFolder) | 223 | void MailListModel::setParentFolder(const QVariant &parentFolder) |
233 | { | 224 | { |
234 | using namespace Sink::ApplicationDomain; | 225 | using namespace Sink::ApplicationDomain; |
@@ -242,16 +233,14 @@ void MailListModel::setParentFolder(const QVariant &parentFolder) | |||
242 | return; | 233 | return; |
243 | } | 234 | } |
244 | mCurrentQueryItem = folder->identifier(); | 235 | mCurrentQueryItem = folder->identifier(); |
236 | bool isThreaded = true; | ||
245 | if (folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::drafts) || | 237 | if (folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::drafts) || |
246 | folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::sent)) { | 238 | folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::sent)) { |
247 | mIsThreaded = false; | 239 | isThreaded = false; |
248 | } else { | ||
249 | mIsThreaded = true; | ||
250 | } | 240 | } |
251 | emit isThreadedChanged(); | ||
252 | 241 | ||
253 | Sink::Query query = [&] { | 242 | Sink::Query query = [&] { |
254 | if (mIsThreaded) { | 243 | if (isThreaded) { |
255 | return Sink::StandardQueries::threadLeaders(*folder); | 244 | return Sink::StandardQueries::threadLeaders(*folder); |
256 | } else { | 245 | } else { |
257 | Sink::Query query; | 246 | Sink::Query query; |