summaryrefslogtreecommitdiffstats
path: root/src/completionentry.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-13 18:54:35 +0200
committerDanilo M. <danix@danix.xyz>2026-08-13 18:54:35 +0200
commita198c116e14622be6ba76b78fca5d92b4b4f62bd (patch)
tree1a1661ebade3f4d083b3dcd5dbc64425314f8aa1 /src/completionentry.h
parentaa722ec974c174298ea0313c988daa71ce43c775 (diff)
downloadqtmaildir-a198c116e14622be6ba76b78fca5d92b4b4f62bd.tar.gz
qtmaildir-a198c116e14622be6ba76b78fca5d92b4b4f62bd.zip
docs: move item 23's saved queries to a JSON file of their own
The user proposed managing saved queries the way the tagging rules are managed, in a JSON file rather than in the INI. It is a better answer than either option the entry had been weighing, a per-query pinned flag or a [general] pinned_queries list, because those each solved one problem and this solves three. Order is the one that could not be solved any other way. [queries] is read through childKeys(), which returns keys alphabetically rather than in file order, so the saved-query buttons appear alphabetically today and there is no way to arrange them; config.cpp already carries a comment saying a hand-rolled parser would be needed to change that. A JSON array is ordered intrinsically. On top of that the document has room for the pinned flag the two tiers need, and for the per-account scope the save dialog wants, which SavedQuery has nowhere to put: it is {name, query} and nothing else. The entry takes the shape of rules.json but explicitly not its machinery. rules.json is JSON because two independent implementations have to agree on it, this repo and mailctl's mailrules.py, and the unknown-field preservation and version handshake exist to keep them from destroying each other's writes. Queries have one reader, so only the versioned-document-with-unknown-fields part is worth carrying over. Migration reads [queries] once when queries.json is absent, writes the JSON, and leaves the INI section in place. Stripping it would mean rewriting a hand-edited file with QSettings, which drops comments and key order across the whole file and is the exact loss this decision was made to avoid; leaving it costs a few stale lines and keeps a downgrade working. Reading both forever was rejected as two sources of truth for one thing. This also retires the open question the entry had carried since 2026-08-04, where the write should go. Both of the original answers were poor, one machine-writing the user's hand-edited config and the other filing user intent as window state under ~/.local/state. A machine-written JSON document beside the hand-written INI is the cleaner split, in ~/.config so it lands in a config backup. Two constraints recorded that the build would otherwise meet late. startup_query names a saved query and must keep resolving, and its "first entry" fallback quietly changes meaning from alphabetically-first to first-in-the-user's-order, which is user-visible and belongs in the changelog. And the README documents [queries] in three places, one of which explains the alphabetical button order this change removes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/completionentry.h')
0 files changed, 0 insertions, 0 deletions