diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-04 19:16:07 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-04 19:16:07 +0200 |
| commit | 69e777cc72bd846c250d68656a8d558c9401fcd5 (patch) | |
| tree | 52eb0b736167c035c9c38b1d8aac88aa008e34e1 /src/mainwindow.h | |
| parent | b34b18c3a6288031c4eed1687f8e53487c3af56f (diff) | |
| download | qtmaildir-69e777cc72bd846c250d68656a8d558c9401fcd5.tar.gz qtmaildir-69e777cc72bd846c250d68656a8d558c9401fcd5.zip | |
feat(ui): disable Sync during a background sync, and blank the pane on Esc
Items 29 and 32.
29 was a constraint item 27 specified and that shipped unbuilt: while a
cron sync held the lock the Sync button stayed clickable, and pressing it
could only produce the EX_TEMPFAIL skip. The progress bar and the button
are now written by one updateSyncControls() taking both sync sources,
which the item asked for by name: two independent assignments, one per
path, means whichever finishes second wins, so a background sync ending
would re-enable the button in the middle of a local run.
Unknown re-enables the button, deliberately. It means /proc/locks could
not be read and nothing was observed, so leaving the button disabled
would strand it permanently wherever the lock cannot be seen.
32 adds a clear_pane action on Esc. It clears m_currentThreadId with the
pane, not merely alongside it, or a threadLoaded still in flight would
paint the thread straight back; and it cancels any pending mark-read,
since a thread blanked from view must not be marked read two seconds
later. The selection, the query and the undo stack are untouched.
The one real risk in 32 was Escape being stolen from the query
completer, the way Return was once lost to a window shortcut. Probed
rather than reasoned about: a popup consumes the key before a
window-level shortcut sees it, so the completer still dismisses.
Every test here was verified by reverting the code it covers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/mainwindow.h')
| -rw-r--r-- | src/mainwindow.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h index 66044dc..61722aa 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -175,6 +175,14 @@ private: /// says "working, duration unknown", which is the truth. void setSyncBusy(bool busy); + /// Applies the sync progress bar and button state from BOTH sync sources. + /// + /// One function of both, never two assignments: with a local and a + /// background sync each writing the widgets independently, whichever + /// finished second would win and re-enable the button while the other was + /// still running. + void updateSyncControls(); + /// Opens the tag dialog on the current selection and applies its result. /// @@ -223,6 +231,15 @@ private: /// MailSync::isRunning() is already false and can no longer answer "was /// that ours?". bool m_localSyncHoldsLock = false; + + /// True while a sync this window started is running. Half of the input to + /// updateSyncControls(). + bool m_localSyncBusy = false; + + /// True while a sync this window did NOT start holds the lock. The other + /// half. Tracked here rather than read back from SyncMonitor so the state + /// the UI acted on is the state it was told about. + bool m_externalSyncBusy = false; QUndoStack m_undoStack; QLineEdit *m_queryEdit = nullptr; |
