aboutsummaryrefslogtreecommitdiffstats
path: root/src/mainwindow.h
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-29 18:18:33 +0200
committerDanilo M. <danix@danix.xyz>2026-09-29 18:18:33 +0200
commitbed9d291370b2b198b2d146c7081066b6dd70641 (patch)
tree23f1aa21358456c7df7b373fefed23538926b85b /src/mainwindow.h
parent04e7db97ae421212614a6ed92807485f743966d3 (diff)
downloadqtmaildir-bed9d291370b2b198b2d146c7081066b6dd70641.tar.gz
qtmaildir-bed9d291370b2b198b2d146c7081066b6dd70641.zip
fix: find a launch's thread in any account, and name a miss
recoverStaleThread() runs thread:<id> in the account dropdown's scope, so a --thread or --message for a conversation in another account than the one the window was left on came back with no rows, and the list went blank with nothing said. A thread or message selector now switches the dropdown to All accounts first, unless the launch named an account with --account, in which case that scope is kept. For a message the switch waits until the id has resolved, so a message that does not exist leaves the dropdown alone. When the selector's own thread:<id> query returns no rows, the miss is named in the status bar, reusing the existing "No thread matched" and "No message matched" strings, and the view that was on screen when the launch arrived comes back: the dropdown, the bar's text and the list, re-run in the scope it was built in. The notice waits for that query to land, since the query writes its row count to the bar and would cover it. A refused thread id and an unresolved message restore the dropdown the same way, and re-run nothing, since the list never changed. The judgement is keyed to a flag the selector paths set after the query and runQuery() clears, so the stale-thread notice and double-click, which share recoverStaleThread(), behave as before. README and CHANGELOG describe the selectors as they now behave: --account alone opens its startup view, the other two look in every account unless narrowed, brackets are accepted, and a miss keeps the view the user had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r--src/mainwindow.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d4b0975..87ed171 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -143,8 +143,8 @@ public:
/// against a running window means "raise yourself", and a raise is not a
/// navigation. The user is looking at something.
///
- /// A selector that matches nothing leaves the window on its configured
- /// view and names the miss in the status bar. Not an empty result, which
+ /// A selector that matches nothing leaves the window on the view it was
+ /// showing and names the miss in the status bar. Not an empty result, which
/// makes a stale link look like a broken client; not a refusal, which is
/// right for a script and wrong for a desktop launch.
///
@@ -758,6 +758,10 @@ private slots:
/// drive it through the meta-object.
void showTransientStatus(const QString &text);
+ /// Names a launch selector's miss and puts back the view m_launchView
+ /// recorded, re-running its query only when the list has since changed.
+ void reportLaunchMiss(const QString &text);
+
/// Announces an action that has just been sent, saying so when a sync is
/// holding it rather than claiming it landed.
///
@@ -1850,6 +1854,41 @@ private:
QString m_recoverThreadId;
QString m_recoverMessageId;
+ /// What was on screen before a launch's selectors started changing it, so
+ /// a miss can put it back (item 200: "the startup view stays and the miss
+ /// is named").
+ ///
+ /// The bar's text and the query the list was built from are BOTH kept:
+ /// the scope a re-run needs is read off whether they differ. Equal means
+ /// the text was already scoped (a filter, or All accounts); different
+ /// means runQuery() wrapped it in the dropdown's account.
+ struct LaunchView
+ {
+ int accountIndex = -1;
+ QString queryText;
+ QString lastQuery;
+ bool flat = false;
+ };
+ LaunchView m_launchView;
+
+ /// Whether the launch that set m_launchView named an account that exists.
+ /// Read when a --message resolve lands, which is after applySelectors()
+ /// has returned: without --account the conversation is looked for in
+ /// every account, with it the given scope is kept.
+ bool m_launchAccountGiven = false;
+
+ /// The miss to report if the selector's own thread:<id> query returns no
+ /// rows. Set AFTER recoverStaleThread(), for the reason the recovery target
+ /// is, and cleared by runQuery(), so only the selector's query is judged
+ /// by it and the stale-thread notice and double-click, which share the
+ /// recovery, keep their behaviour.
+ QString m_launchMiss;
+
+ /// A miss waiting for the restored view's query to land, since that
+ /// query's own row count is written to the status bar when it does and
+ /// would cover a notice shown any earlier.
+ QString m_launchMissNotice;
+
/// The thread the pane's current MESSAGE belongs to.
///
/// Selecting a message row clears m_currentThreadId (the pane shows one