From 07c36ce617512bb9514e604b614e95a15c390b04 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 25 Aug 2026 10:13:20 +0200 Subject: feat(compose): a menu bar on the composer File, Edit and Format, to the scope the user chose. Save draft (Ctrl+S) is the only new action: saveDraftNow() was reachable from the autosave timer, the send path and closeEvent, so there was no way for the user to ask for a save. It routes through that same function, which is what emits draftSaved for item 158's indexing, reports through item 160's status bar and raises the failure banner; a second write path would have to repeat all three. The menus show the toolbar's own QAction objects rather than copies, as item 140 required for the message pane's bar. Two needed hand-building. The HTML toggle is a QToolButton and cannot go in a menu, so a checkable twin mirrors it in both directions, since a menu entry that only follows the button is half a control. The signature entry takes the switch's own QMenu pointer, because that menu is rebuilt whenever the signatures change and copied entries would go stale. Edit's entries drive QPlainTextEdit and follow its own undoAvailable and copyAvailable, so a greyed entry tells the truth about what pressing it would do. theMenuBarReachesEveryComposerAction() is item 132's reachability rule applied to the composer: it walks the real menu bar and collects the composer's actions with findChildren, so an action added to the toolbar and forgotten in the menus fails without the test being touched. It skips actions owning a submenu, since Qt emits no triggered for those. The composer's actions stay out of KeyMap, per item 148: they are parented to this window, so they are WindowShortcuts dispatched to the active composer and the main window's namespace is untouched. lrelease reports 496 finished, 0 unfinished. Closes item 161. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01UUQS6n3cmsFrsjCNmwNtf8 --- src/composewindow.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/composewindow.h') diff --git a/src/composewindow.h b/src/composewindow.h index dc7f3c0..2eaeeea 100644 --- a/src/composewindow.h +++ b/src/composewindow.h @@ -228,6 +228,10 @@ private: void applyEdit(const MarkdownFormat::Edit &edit); void markDirty(); + /// Builds the menu bar (item 161). Called after buildFormatToolbar(), + /// since the menus SHOW its actions rather than owning copies. + void buildMenuBar(); + /// Builds the status bar carrying the unsaved cue and the age line. void buildDraftStatusBar(); @@ -310,6 +314,12 @@ private: QPlainTextEdit *m_sendLog = nullptr; QToolBar *m_formatToolbar = nullptr; QAction *m_sendAction = nullptr; + QAction *m_saveAction = nullptr; + QAction *m_closeAction = nullptr; + + /// The menu twin of the m_sendHtml tool button, which is a QToolButton + /// and cannot be put in a menu. Kept in step both ways. + QAction *m_sendHtmlAction = nullptr; QAction *m_attachAction = nullptr; QAction *m_detachAction = nullptr; -- cgit v1.2.3