diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-24 11:22:10 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-24 11:22:10 +0200 |
| commit | 55fe1bca09242220e514394acbddb53be796fe40 (patch) | |
| tree | 217e3bb07cc63298ab32c30fce7ee625a84c03d7 /src | |
| parent | 2703d4c42710418b0f15a41fa896824e2e1a6170 (diff) | |
| download | qtmaildir-55fe1bca09242220e514394acbddb53be796fe40.tar.gz qtmaildir-55fe1bca09242220e514394acbddb53be796fe40.zip | |
fix(ui): move Compose back, drop the bar below the header, size its icons
Three corrections from looking at the built bar.
Compose returns to the main toolbar. The split this was built to, "about a
message" against "about the list", does not survive contact: what matters is
what the action NEEDS. Reply and Forward are meaningless without a message on
display, while Compose needs none and is disabled only when no account can
send. So the pane's bar holds exactly the two actions that depend on what it
is showing, and Compose sits with the window-wide ones.
The bar moves below the subject and details rows, directly above the web
view. At the top of the pane it read as window chrome rather than as
belonging to the message. The transient notice bars stay above it: they
explain the message rather than offer an action on it.
Its icons were the style's own default, 16px, which is tiny beside a 32px
toolbar. They are now 7/8 of toolbar_icon_size, which is the 28 the user
asked for at their 32, derived rather than hardcoded so the relation holds
if that key changes. The test asserts the relation as well as the value,
since a bare 28 would stop meaning anything the moment the key moved.
m_headerLabel gains an object name so the placement test can find the row it
must sit below.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 23 | ||||
| -rw-r--r-- | src/messageview.cpp | 15 | ||||
| -rw-r--r-- | src/messageview.h | 3 |
3 files changed, 31 insertions, 10 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fd59f47..5cb1ab8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1970,10 +1970,13 @@ void MainWindow::buildMenus() const int iconSize = m_config.toolbarIconSize(); toolBar->setIconSize(QSize(iconSize, iconSize)); - // Compose, Reply and Forward are NOT here (item 140). They act on a - // message, where everything below acts on the list or on the selection, - // and mixing the two is what made this toolbar read as the place for - // everything. They live on the message pane's own bar instead. + // Compose stays here, and Reply and Forward do not (item 140). The split + // is what the action NEEDS: composing a new message requires no message at + // all, so it belongs with the window-wide operations, while Reply and + // Forward act on whatever the pane is showing and live on its own bar. + toolBar->addAction(m_actions.value(QStringLiteral("compose"))); + toolBar->addSeparator(); + QAction *syncAction = m_actions.value(QStringLiteral("sync")); // Carried over from the QPushButton this replaced: with no command // configured the control is disabled, and the tooltip is the only thing @@ -1997,11 +2000,17 @@ void MainWindow::populateMessageBar() // The window's own QActions, shown a second time rather than copied: a // duplicate QAction would need its own enablement and would drift from the // menu entry that updateComposeActions() keeps in step. + // Reply and Forward only: Compose needs no message and sits on the main + // toolbar with the other window-wide actions. + // + // Slightly smaller than the main toolbar's icons, deriving from the + // configured size rather than hardcoding one, so the bar stays subordinate + // to the chrome above it however the user sets that key. + const int iconSize = qMax(16, (m_config.toolbarIconSize() * 7) / 8); m_messageView->setBarActions( - { m_actions.value(QStringLiteral("compose")), - m_actions.value(QStringLiteral("reply")), + { m_actions.value(QStringLiteral("reply")), m_actions.value(QStringLiteral("forward")) }, - { m_actions.value(QStringLiteral("toggle_html")) }); + { m_actions.value(QStringLiteral("toggle_html")) }, iconSize); } void MainWindow::showShortcutReference() diff --git a/src/messageview.cpp b/src/messageview.cpp index c8395f1..4c2a9d0 100644 --- a/src/messageview.cpp +++ b/src/messageview.cpp @@ -342,6 +342,7 @@ MessageView::MessageView(QWidget *parent) qApp->installEventFilter(this); m_headerLabel = new QLabel(this); + m_headerLabel->setObjectName(QStringLiteral("messageHeader")); m_headerLabel->setTextFormat(Qt::RichText); m_headerLabel->setWordWrap(true); m_headerLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); @@ -470,13 +471,20 @@ MessageView::MessageView(QWidget *parent) style()->styleHint(QStyle::SH_ToolButtonStyle, nullptr, m_messageBar))); m_messageBar->setMovable(false); m_messageBar->hide(); + // Set by MainWindow, which owns the configured size this is derived from. + // Left at the style's own default until then, which is what a MessageView + // built on its own in a test gets. auto *layout = new QVBoxLayout(this); - layout->addWidget(m_messageBar); layout->addLayout(headerRow); layout->addWidget(m_blockedBar); layout->addWidget(m_receiveOnlyRibbon); layout->addWidget(m_staleBar); + // Directly above the message it acts on, below the subject and details + // rows: the bar belongs to the body, not to the pane's heading. The + // transient notice bars stay above it, since they explain the message + // rather than offer an action on it. + layout->addWidget(m_messageBar); layout->addWidget(m_view, 1); layout->addWidget(m_attachmentBar); layout->addWidget(m_tagStrip); @@ -583,9 +591,12 @@ void MessageView::applyNoticeBarStyles() } void MessageView::setBarActions(const QList<QAction *> &messageActions, - const QList<QAction *> &viewControls) + const QList<QAction *> &viewControls, + int iconSize) { m_messageBar->clear(); + if (iconSize > 0) + m_messageBar->setIconSize(QSize(iconSize, iconSize)); for (QAction *action : messageActions) { if (action) diff --git a/src/messageview.h b/src/messageview.h index b28dcdc..c81a4f6 100644 --- a/src/messageview.h +++ b/src/messageview.h @@ -253,7 +253,8 @@ public: /// and changing how it is displayed are different scopes, which is the /// confusion the bar exists to remove one level up. void setBarActions(const QList<QAction *> &messageActions, - const QList<QAction *> &viewControls); + const QList<QAction *> &viewControls, + int iconSize = 0); /// Tells the pane whether the query bar currently holds anything. /// |
