diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-10 08:29:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-10 08:29:57 +0200 |
| commit | c56d826673ec1bbd821cf703e6ee12cbef1a7ffc (patch) | |
| tree | d0af4a2cba33005e1a768a9ba6ca5135adeee607 /src/notmuchworker.cpp | |
| parent | 2d062241732f7396e8cb12295962d3f3e5c1a2b0 (diff) | |
| download | qtmaildir-c56d826673ec1bbd821cf703e6ee12cbef1a7ffc.tar.gz qtmaildir-c56d826673ec1bbd821cf703e6ee12cbef1a7ffc.zip | |
feat(worker): let a query choose newest or oldest first
Sorting was hardcoded NEWEST_FIRST. Two orders only: notmuch's other two are
MESSAGE_ID and UNSORTED, neither of which is an order a human wants, and sorting
by sender or subject would have to happen in the model after results arrive,
which fights the batching that makes a large query paint immediately.
loadThread keeps OLDEST_FIRST unconditionally: a thread reads chronologically
whichever way the list is sorted.
Diffstat (limited to 'src/notmuchworker.cpp')
| -rw-r--r-- | src/notmuchworker.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/notmuchworker.cpp b/src/notmuchworker.cpp index 7b999cf..a6b0a29 100644 --- a/src/notmuchworker.cpp +++ b/src/notmuchworker.cpp @@ -170,7 +170,8 @@ void NotmuchWorker::close() } } -void NotmuchWorker::runQuery(const QString &query, quint64 generation) +void NotmuchWorker::runQuery(const QString &query, quint64 generation, + SortOrder sort) { if (!openReadOnly()) return; @@ -180,7 +181,9 @@ void NotmuchWorker::runQuery(const QString &query, quint64 generation) emit errorOccurred(QStringLiteral("Invalid query: %1").arg(query)); return; } - notmuch_query_set_sort(nmQuery.get(), NOTMUCH_SORT_NEWEST_FIRST); + notmuch_query_set_sort(nmQuery.get(), + sort == OldestFirst ? NOTMUCH_SORT_OLDEST_FIRST + : NOTMUCH_SORT_NEWEST_FIRST); notmuch_threads_t *rawThreads = nullptr; const notmuch_status_t status = |
