diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-29 17:14:21 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-29 17:14:21 +0200 |
| commit | 3524c2eb1267baf44301ea888abc784ecf85e76a (patch) | |
| tree | 28cb95387a1426c1d2fe5feec765378376b774ef /src/mainwindow.h | |
| parent | 0402b5b683c7412daace2414f4b903b677b5405c (diff) | |
| download | qtmaildir-3524c2eb1267baf44301ea888abc784ecf85e76a.tar.gz qtmaildir-3524c2eb1267baf44301ea888abc784ecf85e76a.zip | |
feat: apply the launch selectors to the window
One entry point, called both at startup and by the socket handler when a later
launch arrives. Two paths would drift, which is the lesson this file has
already learned from every other pair.
The account moves first, because a built-in filter composes with the dropdown
and a query run before it would carry the old scope. The thread case reuses
recoverStaleThread() whole, as item 91's double-click already does. A message
id resolves to its thread first through the worker: opening a message means
opening its conversation with that message selected.
A thread id must be hex or it is treated as a miss and never reaches notmuch.
recoverStaleThread() builds thread:<id> unquoted, which is safe for ids notmuch
handed out and not for ones from another program's command line, where
"0000 or tag:inbox" would widen the query to the whole inbox. The check uses
anchoredPattern() because a PCRE $ also matches before a trailing newline.
An empty selector set changes nothing. A bare launch against a running window
means raise yourself, and a raise is not a navigation.
Also drops an empty public: label left in notmuchworker.h by the previous
commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.h')
| -rw-r--r-- | src/mainwindow.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h index e965de2..6b841fa 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -32,6 +32,7 @@ #include "config.h" #include "htmlbuilder.h" #include "keymap.h" +#include "launchselectors.h" // Included rather than forward-declared: SyncPhaseTracker is held by value, so // its size must be known here. MailSync itself stays a forward declaration. #include "mailsync.h" @@ -131,6 +132,27 @@ public: QVector<PendingChange> pendingChangeSnapshot() const; + /// Applies what a launch asked for (item 200). + /// + /// ONE entry point, called both by main() at startup and by the socket + /// handler when a later launch arrives. Two paths through separate code + /// would drift, which is the lesson this file has already learned from + /// every other pair. + /// + /// An EMPTY selector set deliberately changes nothing: a bare launch + /// 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 + /// makes a stale link look like a broken client; not a refusal, which is + /// right for a script and wrong for a desktop launch. + /// + /// A thread id that is not hex is such a miss and never reaches notmuch: + /// recoverStaleThread() builds `thread:<id>` unquoted, which is safe for + /// ids notmuch handed out and not for ones from another program's argv. + void applySelectors(const LaunchSelectors &selectors); + /// Opens the list behind the unsynced-changes count. /// /// Takes the snapshot, asks the worker to resolve its subjects, and shows @@ -169,6 +191,13 @@ public: /// preserve comments or key order). static QString uiStatePath(); + /// Path of the single-instance socket (item 200). + /// + /// Beside uiStatePath() and built the same way, so the two cannot drift. + /// GenericStateLocation, not StateLocation: the latter appends both the + /// organization and the application name, and both are "qtmaildir". + static QString singleInstanceSocketPath(); + /// Kernel lock table every MainWindow's SyncMonitor watches, "/proc/locks" /// unless a test overrides it. /// @@ -628,6 +657,10 @@ private slots: /// point the button uses. void recoverStaleThread(const QString &threadId, const QString &messageId); + /// The worker's answer to a --message selector. + void onThreadForMessageResolved(const QString &messageId, + const QString &threadId); + /// Drills into the double-clicked row: the whole thread, expanded, alone in /// the view, with that row's own message in the pane. void onRowDoubleClicked(const QModelIndex &index); |
