diff options
Diffstat (limited to 'framework/mail/maillistmodel.cpp')
-rw-r--r-- | framework/mail/maillistmodel.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp index 3ff8efc4..9a55e265 100644 --- a/framework/mail/maillistmodel.cpp +++ b/framework/mail/maillistmodel.cpp | |||
@@ -30,9 +30,10 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | MailListModel::MailListModel(QObject *parent) | 32 | MailListModel::MailListModel(QObject *parent) |
33 | : QIdentityProxyModel() | 33 | : QSortFilterProxyModel() |
34 | { | 34 | { |
35 | 35 | setDynamicSortFilter(true); | |
36 | sort(0, Qt::DescendingOrder); | ||
36 | } | 37 | } |
37 | 38 | ||
38 | MailListModel::~MailListModel() | 39 | MailListModel::~MailListModel() |
@@ -121,7 +122,14 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
121 | return "Failed to read mail."; | 122 | return "Failed to read mail."; |
122 | } | 123 | } |
123 | } | 124 | } |
124 | return QIdentityProxyModel::data(idx, role); | 125 | return QSortFilterProxyModel::data(idx, role); |
126 | } | ||
127 | |||
128 | bool MailListModel::lessThan(const QModelIndex &left, const QModelIndex &right) const | ||
129 | { | ||
130 | const QVariant leftData = left.sibling(left.row(), 3).data(Qt::DisplayRole); | ||
131 | const QVariant rightData = right.sibling(right.row(), 3).data(Qt::DisplayRole); | ||
132 | return leftData.toDateTime() < rightData.toDateTime(); | ||
125 | } | 133 | } |
126 | 134 | ||
127 | void MailListModel::runQuery(const Sink::Query &query) | 135 | void MailListModel::runQuery(const Sink::Query &query) |