diff options
Diffstat (limited to 'framework/domain/maillistmodel.cpp')
-rw-r--r-- | framework/domain/maillistmodel.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/framework/domain/maillistmodel.cpp b/framework/domain/maillistmodel.cpp index 278dca22..3a507e05 100644 --- a/framework/domain/maillistmodel.cpp +++ b/framework/domain/maillistmodel.cpp | |||
@@ -158,6 +158,18 @@ bool MailListModel::lessThan(const QModelIndex &left, const QModelIndex &right) | |||
158 | return leftDate < rightDate; | 158 | return leftDate < rightDate; |
159 | } | 159 | } |
160 | 160 | ||
161 | bool MailListModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const | ||
162 | { | ||
163 | auto idx = sourceModel()->index(sourceRow, 0, sourceParent); | ||
164 | auto regExp = filterRegExp(); | ||
165 | if (regExp.isEmpty()) { | ||
166 | return true; | ||
167 | } | ||
168 | auto mail = idx.data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>(); | ||
169 | return mail->getSubject().contains(regExp) || | ||
170 | mail->getSender().name.contains(regExp); | ||
171 | } | ||
172 | |||
161 | void MailListModel::runQuery(const Sink::Query &query) | 173 | void MailListModel::runQuery(const Sink::Query &query) |
162 | { | 174 | { |
163 | m_model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); | 175 | m_model = Sink::Store::loadModel<Sink::ApplicationDomain::Mail>(query); |