aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 15:41:33 +0200
committerDanilo M. <danix@danix.xyz>2026-08-03 15:41:33 +0200
commitdb7bbb81f02b52c2a1b299fe140abffab7e74642 (patch)
tree01cd604bc471cdbf11d22e85f6b0f24159ebc509 /src/config.cpp
parentcd0be6dc5e4741c2ad180d6bf6a275f000ab943a (diff)
downloadqtmaildir-db7bbb81f02b52c2a1b299fe140abffab7e74642.tar.gz
qtmaildir-db7bbb81f02b52c2a1b299fe140abffab7e74642.zip
feat: let an account set its chip colour and label
Two optional keys in an [account.<key>] stanza. color fills the chip, label sets its text. Both belong to the account rather than to [tagcolors] because an account tag is a different taxonomy: which mailbox a thread arrived in, not what state it is in. label is display only. "account-privateemail-danilo.macri" is a lot of row for one bit of information, but the notmuch tag is never renamed, so existing queries and external tagging are unaffected. Unset falls back to the account key, and an empty label is ignored rather than rendering a blank chip.
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index de6a783..f21bba9 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -89,6 +89,23 @@ void Config::load(const QString &path)
account.address = settings.value(QStringLiteral("address")).toString();
account.maildir = settings.value(QStringLiteral("maildir")).toString();
account.drafts = settings.value(QStringLiteral("drafts")).toString();
+
+ // Both optional, and both describe this account's chip in the thread
+ // list. An account tag is a different taxonomy from a functional one,
+ // saying which mailbox a thread arrived in rather than what state it
+ // is in, so these live here rather than in [tagcolors].
+ account.label = settings.value(QStringLiteral("label")).toString();
+
+ const QString colour = settings.value(QStringLiteral("color")).toString();
+ if (!colour.isEmpty()) {
+ account.color = QColor(colour);
+ if (!account.color.isValid()) {
+ addProblem(
+ QStringLiteral("Account '%1' has an unparseable color '%2'; "
+ "using a generated one.")
+ .arg(account.key, colour));
+ }
+ }
settings.endGroup();
if (!account.isValid()) {