diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-05-26 18:44:59 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:50 +0300 |
commit | d0039740b0e28906d79adeaa0fe38f003f0d8a6a (patch) | |
tree | f0dddfd60348237c21d5bcda23fadec4b5cf3ae4 /ui/src/components/mail | |
parent | 03317d74ca1fb3e7d41c65c19d32b97f299b9ff8 (diff) |
melib: add has_attachments property to Envelope
Check subattachments in has_attachments check.
Instead of getting a flattened attachment view of multipart/mixed (eg
[multipart/mixed, text/plain, text/plain]) get only the subattachments
(eg [text/plain, text/plain]). Don't count text-only multipart/mixed as attachments
Diffstat (limited to 'ui/src/components/mail')
-rw-r--r-- | ui/src/components/mail/listing/compact.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index 3839deb4..07a22f4f 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -112,9 +112,10 @@ impl MailboxView { FromString(address_list!((e.from()) as comma_sep_list)), DateString(MailboxView::format_date(e)), SubjectString(format!( - "{} ({}){}", + "{} ({}){}{}", e.subject(), len, + if e.has_attachments() { " 🔗" } else { "" }, if is_snoozed { " 💤" } else { "" } )), ) @@ -124,8 +125,9 @@ impl MailboxView { FromString(address_list!((e.from()) as comma_sep_list)), DateString(MailboxView::format_date(e)), SubjectString(format!( - "{}{}", + "{}{}{}", e.subject(), + if e.has_attachments() { " 🔗" } else { "" }, if is_snoozed { " 💤" } else { "" } )), ) @@ -343,8 +345,23 @@ impl MailboxView { ((_x, idx), (widths.2 + _x, idx)), false, ); - if threads.is_snoozed(root_idx) { - self.content[(x - 1, idx)].set_fg(Color::Red); + match ( + threads.is_snoozed(root_idx), + &context.accounts[self.cursor_pos.0] + .get_env(&i) + .has_attachments(), + ) { + (true, true) => { + self.content[(x - 1, idx)].set_fg(Color::Red); + self.content[(x - 2, idx)].set_fg(Color::Byte(103)); + } + (true, false) => { + self.content[(x - 1, idx)].set_fg(Color::Red); + } + (false, true) => { + self.content[(x - 1, idx)].set_fg(Color::Byte(103)); + } + (false, false) => {} } self.order.insert(i, idx); |