diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 17:17:25 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-03 17:17:25 +0200 |
| commit | e45f68b04b5ee2400a7885d5f5b054a889061df5 (patch) | |
| tree | bcf0a90e65dd2a85665b83694fdf4a39bf97c565 /src/threadlistmodel.h | |
| parent | 7f505624b1f385a89c9ff32e15f4d4e68595e5b8 (diff) | |
| download | qtmaildir-e45f68b04b5ee2400a7885d5f5b054a889061df5.tar.gz qtmaildir-e45f68b04b5ee2400a7885d5f5b054a889061df5.zip | |
feat: show a paperclip for threads with attachments
An attachment was only discoverable by opening the thread. A narrow
leftmost column now marks the threads that carry one.
No new worker query is involved: notmuch applies the "attachment" tag
while indexing, so ThreadSummary already holds what this needs. The
marker is a glyph rather than an icon resource, which ships no new asset
and inherits the row font, so it strikes through with a doomed thread
like every other cell. It falls back to "*" where the system font cannot
draw U+1F4CE, since an unrenderable codepoint reads as breakage rather
than as a marker.
Two silent Qt behaviours had to be handled, both found by probe:
QHeaderView::restoreState() returns true for a blob saved against fewer
columns and applies the old widths shifted one place right. Adding a
column in front would therefore have mangled every existing saved
layout with no error to detect it by. The column count is now stored
beside the blob and a mismatch discards it, so the widths reset once on
upgrade instead of landing on the wrong columns.
QHeaderView's default minimumSectionSize is 58px on this platform, and
setColumnWidth() clamps to it without reporting the smaller value back,
so the column could not be narrow at all until it was lowered.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/threadlistmodel.h')
| -rw-r--r-- | src/threadlistmodel.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/threadlistmodel.h b/src/threadlistmodel.h index 7ed8fef..ab9378e 100644 --- a/src/threadlistmodel.h +++ b/src/threadlistmodel.h @@ -36,7 +36,11 @@ public: /// under the message pane, and the account tag renders as a chip in front /// of the subject. enum Column { - DateColumn = 0, + /// A paperclip when the thread has an attachment, so it is visible + /// without opening the thread. Icon only and deliberately narrow; + /// it carries no text. + AttachmentColumn = 0, + DateColumn, AuthorsColumn, SubjectColumn, ColumnCount, @@ -64,6 +68,10 @@ public: /// Muted rather than saturated: a bulk delete paints every selected row, /// and a wall of pure red is harder to read than the list it replaces. /// Exposed so a test names the same colour the model uses. + /// The character shown in AttachmentColumn for a thread that has one. + /// A paperclip when the system font can draw it, "*" otherwise. + static QString attachmentGlyph(); + static QColor deletedColour(); static QColor spamColour(); |
