diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 15:41:16 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-03 15:41:16 +0200 |
| commit | cd0be6dc5e4741c2ad180d6bf6a275f000ab943a (patch) | |
| tree | c2c704065c398ba33d9549bfb025d30dbb0a46c4 /src/messageview.cpp | |
| parent | ab16342f6181f69e5cb1ef528f1dd0eb433bb74b (diff) | |
| download | qtmaildir-cd0be6dc5e4741c2ad180d6bf6a275f000ab943a.tar.gz qtmaildir-cd0be6dc5e4741c2ad180d6bf6a275f000ab943a.zip | |
feat: render tags as chips instead of a text column
Spelled out per row, tags ran to 500 pixels of largely repeated text and
took most of the thread list's width. The column is gone; tags render as
coloured chips split by what they actually mean.
An account tag says which mailbox a thread arrived in, and draws as a
chip in front of the subject. A functional tag says what state a thread
is in, and those fill one row under the message pane. One row keeps the
message area from shifting between threads with different tag counts, so
whatever does not fit collapses into a +N chip that names the rest in its
tooltip.
TagColors resolves a colour by exact tag first, then by top-level prefix,
so a single "shopping" entry covers shopping/amazon and shopping/nike
while shopping/amazon can still override its own. That matters at 96
tags. Built-in defaults cover the usual state tags, and anything left
unconfigured falls back to a hash of the name, stable so a chip does not
change colour as the list scrolls.
Diffstat (limited to 'src/messageview.cpp')
| -rw-r--r-- | src/messageview.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/messageview.cpp b/src/messageview.cpp index 3bb08a0..aebb81b 100644 --- a/src/messageview.cpp +++ b/src/messageview.cpp @@ -34,6 +34,7 @@ #include "cidschemehandler.h" #include "htmlbuilder.h" #include "requestinterceptor.h" +#include "tagstrip.h" #include "threadcidmap.h" namespace { @@ -118,17 +119,33 @@ MessageView::MessageView(QWidget *parent) m_attachmentBar = new QWidget(this); new QHBoxLayout(m_attachmentBar); + // Tags live under the message rather than in the thread list, where + // spelling them out cost most of the list's width. + m_tagStrip = new TagStrip(this); + m_tagStrip->hide(); + auto *layout = new QVBoxLayout(this); layout->addWidget(m_headerLabel); layout->addLayout(blockedRow); layout->addWidget(m_view, 1); layout->addWidget(m_attachmentBar); + layout->addWidget(m_tagStrip); clear(); } MessageView::~MessageView() = default; +void MessageView::setTagColors(const TagColors *colours) +{ + m_tagStrip->setTagColors(colours); +} + +void MessageView::setTags(const QStringList &tags) +{ + m_tagStrip->setTags(tags); +} + /// The single place that loads a document into the view. /// /// RequestInterceptor trusts exactly one qtmaildir: URL and denies every other @@ -145,6 +162,7 @@ void MessageView::setDocument(const QString &html) void MessageView::clear() { m_items.clear(); + m_tagStrip->setTags({}); // No thread is displayed, so nothing may be served or allowed. Without // this, the previous thread's parts would stay reachable. |
