feat: show received frontmatter fields in the message detail

This commit is contained in:
randogoth 2026-10-03 17:30:22 +03:00
parent 68f5620d35
commit dacbc9de38
5 changed files with 103 additions and 2 deletions

View file

@ -196,6 +196,7 @@ pub struct CarrierWidgets {
article_stack: gtk::Stack,
article_subject: gtk::Label,
article_meta: gtk::Label,
article_headers: gtk::Label,
article_view: gtk::TextView,
article_body: gtk::TextBuffer,
actions: gtk::Box,
@ -470,6 +471,15 @@ impl CarrierWidgets {
article_meta.set_wrap(true);
article_head.append(&subject_row);
article_head.append(&article_meta);
// The sender's own frontmatter fields, when a mail carries any:
// envelope data, so it reads like the contact detail's key block
// rather than like body prose.
let article_headers = label("", "caption mono");
article_headers.set_wrap(true);
article_headers.set_wrap_mode(gtk::pango::WrapMode::WordChar);
article_headers.set_selectable(true);
article_headers.set_visible(false);
article_head.append(&article_headers);
article.append(&article_head);
article.append(&gtk::Separator::new(Orientation::Horizontal));
let article_view = gtk::TextView::new();
@ -998,6 +1008,7 @@ impl CarrierWidgets {
article_stack,
article_subject,
article_meta,
article_headers,
article_view,
article_body,
actions,
@ -1483,6 +1494,13 @@ fn render(model: &Carrier, w: &mut CarrierWidgets, sender: &ComponentSender<Carr
meta.push_str(" · a server copy still exists");
}
w.article_meta.set_markup(&meta);
let headers: Vec<String> = msg
.headers
.iter()
.map(|(key, value)| format!("{key}: {value}"))
.collect();
w.article_headers.set_visible(!headers.is_empty());
w.article_headers.set_text(&headers.join("\n"));
w.article_body.set_text(&msg.body);
clear(&w.actions);