diff options
-rw-r--r-- | framework/domain/maillistmodel.cpp | 12 | ||||
-rw-r--r-- | framework/domain/maillistmodel.h | 1 |
2 files changed, 13 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); |
diff --git a/framework/domain/maillistmodel.h b/framework/domain/maillistmodel.h index 8e22da60..44347661 100644 --- a/framework/domain/maillistmodel.h +++ b/framework/domain/maillistmodel.h | |||
@@ -47,6 +47,7 @@ public: | |||
47 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | 47 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
48 | 48 | ||
49 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; | 49 | bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE; |
50 | bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE; | ||
50 | 51 | ||
51 | enum Roles { | 52 | enum Roles { |
52 | Subject = Qt::UserRole + 1, | 53 | Subject = Qt::UserRole + 1, |