summaryrefslogtreecommitdiffstats
path: root/src/notmuchworker.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 20:49:25 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:54:12 +0200
commit8e65d8f5eba78acc9558e26f9b728521f323b1a6 (patch)
treeb757abae9cfe2a7797332e0190845edfb52ab0a6 /src/notmuchworker.cpp
parent4175f3e7314410a5e35bb3c06a0faf9065ce2e7a (diff)
downloadqtmaildir-8e65d8f5eba78acc9558e26f9b728521f323b1a6.tar.gz
qtmaildir-8e65d8f5eba78acc9558e26f9b728521f323b1a6.zip
feat(worker): list every tag in the database
Query bar completion cannot offer tag names without a way to enumerate them, and libnotmuch had no call wired up for it. Follows the existing generation-counter pattern; the result crosses the thread boundary as a QStringList. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/notmuchworker.cpp')
-rw-r--r--src/notmuchworker.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/notmuchworker.cpp b/src/notmuchworker.cpp
index ed97e39..a5096d2 100644
--- a/src/notmuchworker.cpp
+++ b/src/notmuchworker.cpp
@@ -332,3 +332,24 @@ void NotmuchWorker::applyTags(const TagChange &change)
emit tagsApplied(change);
}
+
+void NotmuchWorker::requestAllTags(quint64 generation)
+{
+ if (!openReadOnly())
+ return;
+
+ NmTags tags(notmuch_database_get_all_tags(m_db));
+ if (!tags) {
+ emit errorOccurred(QStringLiteral("Cannot list tags"));
+ return;
+ }
+
+ QStringList result;
+ for (; notmuch_tags_valid(tags.get()); notmuch_tags_move_to_next(tags.get()))
+ result.append(QString::fromUtf8(notmuch_tags_get(tags.get())));
+
+ // Sorted once here so no consumer has to sort again. notmuch returns tags
+ // in Xapian term order, which is byte order, not the user's locale order.
+ result.sort();
+ emit allTagsReady(result, generation);
+}