presentation/QuickMailBackendSort.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // F100-66: the mail list order of QuickMailBackend (flat pages and thread | ||
| 2 | // list), split from QuickMailBackend.cpp for its line limit. | ||
| 3 | #include "QuickMailBackend.h" | ||
| 4 | |||
| 5 | #include "app/core/MailSessionCore.h" | ||
| 6 | #include "controller/MailController.h" | ||
| 7 | #include <QLoggingCategory> | ||
| 8 | |||
| 9 | Q_DECLARE_LOGGING_CATEGORY(lcQuickBackend) | ||
| 10 | |||
| 11 | 88130 | QStringList QuickMailBackend::sortableColumns() const { | |
| 12 |
4/6✓ Branch 2 → 3 taken 8852 times.
✓ Branch 2 → 20 taken 79278 times.
✓ Branch 14 → 15 taken 26556 times.
✓ Branch 14 → 16 taken 8852 times.
✗ Branch 51 → 52 not taken.
✗ Branch 51 → 53 not taken.
|
123538 | if (m_threaded) return {QStringLiteral("date"), QStringLiteral("from"), QStringLiteral("subject")}; |
| 13 | 79278 | return {QStringLiteral("star"), QStringLiteral("from"), QStringLiteral("to"), QStringLiteral("subject"), | |
| 14 |
2/4✓ Branch 40 → 41 taken 475668 times.
✓ Branch 40 → 42 taken 79278 times.
✗ Branch 70 → 71 not taken.
✗ Branch 70 → 72 not taken.
|
634224 | QStringLiteral("date"), QStringLiteral("size")}; |
| 15 | 590354 | } | |
| 16 | |||
| 17 | 11 | void QuickMailBackend::sortMailList(const QString &columnId) { | |
| 18 | MailSortOrder::Column column; | ||
| 19 |
6/12✓ Branch 2 → 3 taken 11 times.
✓ Branch 4 → 5 taken 11 times.
✗ Branch 4 → 7 not taken.
✓ Branch 5 → 6 taken 11 times.
✗ Branch 6 → 7 not taken.
✓ Branch 6 → 8 taken 11 times.
✓ Branch 9 → 10 taken 11 times.
✗ Branch 9 → 11 not taken.
✗ Branch 11 → 12 not taken.
✓ Branch 11 → 13 taken 11 times.
✗ Branch 43 → 44 not taken.
✗ Branch 43 → 45 not taken.
|
11 | if (!sortableColumns().contains(columnId) || !MailSortOrder::columnFromId(columnId, &column)) return; |
| 20 | 11 | MailSortOrder next; | |
| 21 | 11 | next.column = column; | |
| 22 |
3/3✓ Branch 13 → 14 taken 5 times.
✓ Branch 13 → 15 taken 6 times.
✓ Branch 15 → 16 taken 6 times.
|
11 | next.ascending = column == m_mailSort.column ? !m_mailSort.ascending : MailSortOrder::defaultAscending(column); |
| 23 |
1/2✗ Branch 18 → 19 not taken.
✓ Branch 18 → 20 taken 11 times.
|
11 | if (next == m_mailSort) return; |
| 24 | 11 | m_mailSort = next; | |
| 25 |
2/2✓ Branch 20 → 21 taken 11 times.
✓ Branch 21 → 22 taken 11 times.
|
11 | m_preferences.setMailSort(m_mailSort.toString()); |
| 26 |
9/9✓ Branch 23 → 24 taken 11 times.
✓ Branch 27 → 28 taken 11 times.
✓ Branch 28 → 29 taken 11 times.
✓ Branch 29 → 30 taken 11 times.
✓ Branch 30 → 31 taken 11 times.
✓ Branch 31 → 32 taken 11 times.
✓ Branch 32 → 33 taken 11 times.
✓ Branch 37 → 25 taken 11 times.
✓ Branch 37 → 38 taken 11 times.
|
22 | qCInfo(lcQuickBackend) << "mail list sort" << m_mailSort.toString() << "threaded" << m_threaded; |
| 27 |
1/1✓ Branch 38 → 39 taken 11 times.
|
11 | applyMailSort(); |
| 28 |
1/1✓ Branch 39 → 40 taken 11 times.
|
11 | emit mailSortChanged(); |
| 29 | } | ||
| 30 | |||
| 31 | // The flat list reads its pages in this order; the thread list orders its | ||
| 32 | // threads by it (sender/subject of the first mail, else the newest mail). | ||
| 33 | 806 | void QuickMailBackend::applyMailSort() { | |
| 34 | 806 | m_session.controller()->setFlatSort(m_mailSort); | |
| 35 | 806 | m_threadList.setSortOrder(m_mailSort); | |
| 36 | 806 | } | |
| 37 |