From a9b086954e17d6f2d64ac94b225577cb0e416f4f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 22 Feb 2018 15:22:22 +0100 Subject: Use the new changes regarding aggregated properties. This fixes marking partially unread threads as read. --- framework/src/domain/maillistmodel.cpp | 29 +++++++++-------------------- framework/src/domain/maillistmodel.h | 7 ------- 2 files changed, 9 insertions(+), 27 deletions(-) (limited to 'framework/src') 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 case Date: return mail->getDate(); case Unread: - if (mIsThreaded) { - return mail->getProperty("unreadCollected").toList().contains(true); + if (mail->isAggregate()) { + return mail->getCollectedProperty().contains(true); } else { - return mail->getUnread(); + return mail->getImportant(); } case Important: - if (mIsThreaded) { - return mail->getProperty("importantCollected").toList().contains(true); + if (mail->isAggregate()) { + return mail->getCollectedProperty().contains(true); } else { return mail->getImportant(); } @@ -166,11 +166,7 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const } return mail->getMimeMessage(); case ThreadSize: - if (mIsThreaded) { - return mail->getProperty("count").toInt(); - } else { - return 1; - } + return mail->count(); case Mail: return QVariant::fromValue(mail); case Incomplete: @@ -224,11 +220,6 @@ void MailListModel::runQuery(const Sink::Query &query) } } -bool MailListModel::isThreaded() const -{ - return mIsThreaded; -} - void MailListModel::setParentFolder(const QVariant &parentFolder) { using namespace Sink::ApplicationDomain; @@ -242,16 +233,14 @@ void MailListModel::setParentFolder(const QVariant &parentFolder) return; } mCurrentQueryItem = folder->identifier(); + bool isThreaded = true; if (folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::drafts) || folder->getSpecialPurpose().contains(Sink::ApplicationDomain::SpecialPurpose::Mail::sent)) { - mIsThreaded = false; - } else { - mIsThreaded = true; + isThreaded = false; } - emit isThreadedChanged(); Sink::Query query = [&] { - if (mIsThreaded) { + if (isThreaded) { return Sink::StandardQueries::threadLeaders(*folder); } else { Sink::Query query; diff --git a/framework/src/domain/maillistmodel.h b/framework/src/domain/maillistmodel.h index 27e8d036..f83656b9 100644 --- a/framework/src/domain/maillistmodel.h +++ b/framework/src/domain/maillistmodel.h @@ -35,7 +35,6 @@ class MailListModel : public QSortFilterProxyModel Q_PROPERTY (bool showInbox READ showInbox WRITE setShowInbox) Q_PROPERTY (QString filter READ filter WRITE setFilter) - Q_PROPERTY (bool isThreaded READ isThreaded NOTIFY isThreadedChanged) public: enum Status { @@ -53,8 +52,6 @@ public: bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; - bool isThreaded() const; - enum Roles { Subject = Qt::UserRole + 1, Sender, @@ -96,9 +93,6 @@ public: void setShowInbox(bool); bool showInbox() const; -signals: - void isThreadedChanged(); - private: void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); @@ -106,6 +100,5 @@ private: bool mFetchMails = false; QSet mFetchedMails; QByteArray mCurrentQueryItem; - bool mIsThreaded = true; Sink::Query mQuery; }; -- cgit v1.2.3