diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-14 13:01:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-14 13:01:04 +0200 |
| commit | 2f124b22920fb290684206a2c905996f1c378fd7 (patch) | |
| tree | 096143b345754b013fc4906ad2e005da0fe9df9e /src/messageview.cpp | |
| parent | 8a2e02a3e1a669a738d1de4615720378d5cc2d38 (diff) | |
| download | qtmaildir-2f124b22920fb290684206a2c905996f1c378fd7.tar.gz qtmaildir-2f124b22920fb290684206a2c905996f1c378fd7.zip | |
feat(details): rebuild the message details dialog as rows
A text box could not carry a per-value context menu without parsing displayed
text back into structure, and the user did not want a text box. Each row now
holds its own value, its message index and its query, built from the parsed
message.
Every value label states Qt::PlainText. The QPlainTextEdit this replaced was
plain by design rather than by style: header values come from strangers, and a
QLabel guesses the format under AutoText.
Diffstat (limited to 'src/messageview.cpp')
| -rw-r--r-- | src/messageview.cpp | 55 |
1 files changed, 6 insertions, 49 deletions
diff --git a/src/messageview.cpp b/src/messageview.cpp index 5f7c9d2..fbd43d6 100644 --- a/src/messageview.cpp +++ b/src/messageview.cpp @@ -22,8 +22,6 @@ #include <QDesktopServices> #include <QDialog> #include <QDialogButtonBox> -#include <QFontDatabase> -#include <QPlainTextEdit> #include <QDir> #include <QBuffer> #include <QFileDialog> @@ -50,6 +48,7 @@ #include "cidschemehandler.h" #include "htmlbuilder.h" +#include "messagedetailsdialog.h" #include "requestinterceptor.h" #include "searchterm.h" #include "tagstrip.h" @@ -616,53 +615,11 @@ void MessageView::showDetailsDialog() if (m_items.isEmpty()) return; - QDialog dialog(this); - dialog.setWindowTitle(tr("Message details")); - - auto *layout = new QVBoxLayout(&dialog); - - auto *details = new QPlainTextEdit(&dialog); - details->setReadOnly(true); - // A monospaced font keeps a long Received chain readable as the wrapped - // record it is. - details->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - details->setLineWrapMode(QPlainTextEdit::NoWrap); - - // setPlainText, and a QPlainTextEdit rather than a label: this dialog shows - // header values verbatim, and those come from strangers. Plain text cannot - // interpret markup, so there is nothing here to escape and nothing that - // could render. - QString text; - for (int i = 0; i < m_items.size(); ++i) { - const ParsedMessage &message = m_items.at(i).message; - - if (i > 0) - text += QLatin1Char('\n'); - if (m_items.size() > 1) - text += tr("--- Message %1 of %2 ---") - .arg(i + 1).arg(m_items.size()) + QLatin1Char('\n'); - - auto line = [&text](const QString &label, const QString &value) { - if (!value.isEmpty()) - text += label + QLatin1Char(' ') + value + QLatin1Char('\n'); - }; - - line(tr("Subject:"), message.subject); - line(tr("From:"), message.from); - line(tr("To:"), message.to); - line(tr("Cc:"), message.cc); - line(tr("Date:"), message.date); - line(tr("Message-Id:"), message.messageId); - } - details->setPlainText(text); - - layout->addWidget(details); - - auto *buttons = new QDialogButtonBox(QDialogButtonBox::Close, &dialog); - connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); - layout->addWidget(buttons); - - dialog.resize(700, 400); + MessageDetailsDialog dialog(m_items, this); + // The dialog's searches are the pane's searches: one signal reaches the + // window whichever surface the user used. + connect(&dialog, &MessageDetailsDialog::searchRequested, + this, &MessageView::searchRequested); dialog.exec(); } |
