diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 16:31:34 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-04 12:53:39 +0200 |
| commit | e36115208f588ea90483b7da93378bbb71155cce (patch) | |
| tree | 1e071cbf364619d96f67fb44d426fe9f6207bc2b /src/mainwindow.cpp | |
| parent | 0364f7d48813a350e9c02d78e652f6b58c31abec (diff) | |
| download | qtmaildir-e36115208f588ea90483b7da93378bbb71155cce.tar.gz qtmaildir-e36115208f588ea90483b7da93378bbb71155cce.zip | |
feat: choose the startup query by name
The app opened whichever saved query sorted first alphabetically, which
is not a choice anyone made: [queries] is read through childKeys(), so
savedQueries().first() means "Flagged" before "Inbox" before "Unread"
rather than anything the user expressed.
[general] startup_query names the entry to open and defaults to Unread,
so a fresh install comes up on the unified unread list. Saved-query
button order is untouched and stays alphabetical.
A name matching no saved query falls back to the first one rather than
starting with an empty view. That is reported as a problem only when the
user actually wrote the name; the built-in default naming a query they
never created is not something they got wrong, and warning about it
would fire on every launch of a config that has no Unread entry.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c4955b6..2a79988 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -171,8 +171,12 @@ MainWindow::MainWindow(const Config &config, QWidget *parent) // modifier shortcuts such as Ctrl+Q still work there, which the old // filter blocked. - if (!m_config.savedQueries().isEmpty()) { - m_queryEdit->setText(m_config.savedQueries().first().query); + // Not savedQueries().first(): [queries] is read through childKeys(), which + // sorts alphabetically, so "first" means whatever happens to sort first + // rather than anything the user chose. Config resolves the name. + const SavedQuery startup = m_config.startupSavedQuery(); + if (!startup.query.isEmpty()) { + m_queryEdit->setText(startup.query); runCurrentQuery(); } } |
