summaryrefslogtreecommitdiffstats
path: root/src/threadlistmodel.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 14:57:11 +0200
committerDanilo M. <danix@danix.xyz>2026-08-03 14:57:11 +0200
commit1371a3901857a8d2ac4fcf235fb29e7caaf63cae (patch)
treeef8c08db29a7ce6b4052e6533c4f66b8f5a258bf /src/threadlistmodel.h
parent95d0d19a4c1323a4839c1544f3bc1c0323f85dd9 (diff)
downloadqtmaildir-1371a3901857a8d2ac4fcf235fb29e7caaf63cae.tar.gz
qtmaildir-1371a3901857a8d2ac4fcf235fb29e7caaf63cae.zip
feat: show that a tag action landed
Selecting a thread and hitting Delete changed nothing on screen, so there was no way to tell the action had stuck. The tag was always applied: applyTagChange() emitted dataChanged across the row, and the Tags column did update. But Subject was set to stretch while Tags came after it, so Subject took all free width and pushed Tags out of view. The feedback lived in the one column that could not be seen. Columns are now Tags, Date, From, Subject, with Subject stretching last so nothing can be pushed off the right edge. A thread tagged deleted or spam fills its whole row, muted red or orange with white struck-through text, through the background, foreground and font roles, so no cue depends on one column remaining visible. Strike-through accompanies the fill on purpose: it survives a theme that overrides backgrounds and reads without colour. Bold for unread still composes with it. Archive adds no tag, so an archived row is left unstyled for now.
Diffstat (limited to 'src/threadlistmodel.h')
-rw-r--r--src/threadlistmodel.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/threadlistmodel.h b/src/threadlistmodel.h
index eb1a7ff..01fd241 100644
--- a/src/threadlistmodel.h
+++ b/src/threadlistmodel.h
@@ -19,6 +19,7 @@
#pragma once
#include <QAbstractTableModel>
+#include <QColor>
#include <QVector>
#include "types.h"
@@ -29,11 +30,14 @@ class ThreadListModel : public QAbstractTableModel
{
Q_OBJECT
public:
+ /// Subject stretches to fill the view, so it must come last: anything
+ /// after it is pushed out of sight. Tags leads, being the column that
+ /// changes when the user acts on a thread.
enum Column {
- DateColumn = 0,
+ TagsColumn = 0,
+ DateColumn,
AuthorsColumn,
SubjectColumn,
- TagsColumn,
ColumnCount,
};
@@ -44,6 +48,13 @@ public:
ThreadIdRole = Qt::UserRole + 1,
};
+ /// Row fill for a thread tagged `deleted`, and for one tagged `spam`.
+ /// 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.
+ static QColor deletedColour();
+ static QColor spamColour();
+
explicit ThreadListModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = {}) const override;