diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-04-03 19:01:04 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:42 +0300 |
commit | ff821e4fca2bae5974b25d2578c893a0c2d2756f (patch) | |
tree | 3ca16a12ada0fb12b122d03c18b8069192812ae4 /ui/src/components/mail/listing | |
parent | c91f0d73a53b325d015be47b1f8103d34860b24c (diff) |
ui: don't set seen flag in Plainlisting
Diffstat (limited to 'ui/src/components/mail/listing')
-rw-r--r-- | ui/src/components/mail/listing/plain.rs | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/ui/src/components/mail/listing/plain.rs b/ui/src/components/mail/listing/plain.rs index 4e8862a2..16368f95 100644 --- a/ui/src/components/mail/listing/plain.rs +++ b/ui/src/components/mail/listing/plain.rs @@ -212,20 +212,9 @@ impl PlainListing { } } - fn highlight_line_self(&mut self, idx: usize, context: &Context) { - let mailbox = &context.accounts[self.cursor_pos.0][self.cursor_pos.1] - .as_ref() - .unwrap(); - let envelope: &Envelope = &mailbox.collection[&self.local_collection[idx]]; - - let fg_color = if !envelope.is_seen() { - Color::Byte(0) - } else { - Color::Default - }; - let bg_color = if !envelope.is_seen() { - Color::Byte(251) - } else if idx % 2 == 0 { + fn unhighlight_line(&mut self, idx: usize) { + let fg_color = Color::Default; + let bg_color = if idx % 2 == 0 { Color::Byte(236) } else { Color::Default @@ -350,42 +339,21 @@ impl Component for PlainListing { } /* Mark message as read */ let idx = self.cursor_pos.2; - let must_highlight = { + let must_unhighlight = { if self.length == 0 { false } else { let account = &mut context.accounts[self.cursor_pos.0]; - let (hash, is_seen) = { - let mailbox = &mut account[self.cursor_pos.1].as_mut().unwrap(); - let envelope: &mut Envelope = &mut mailbox - .collection - .entry(self.local_collection[idx]) - .or_default(); - (envelope.hash(), envelope.is_seen()) - }; - if !is_seen { - let folder_hash = { - let mailbox = &mut account[self.cursor_pos.1].as_mut().unwrap(); - mailbox.folder.hash() - }; - let op = { - let backend = &account.backend; - backend.operation(hash, folder_hash) - }; - let mailbox = &mut account[self.cursor_pos.1].as_mut().unwrap(); - let envelope: &mut Envelope = &mut mailbox - .collection - .entry(self.local_collection[idx]) - .or_default(); - envelope.set_seen(op).unwrap(); - true - } else { - false - } + let mailbox = &mut account[self.cursor_pos.1].as_mut().unwrap(); + let envelope: &mut Envelope = &mut mailbox + .collection + .entry(self.local_collection[idx]) + .or_default(); + !envelope.is_seen() } }; - if must_highlight { - self.highlight_line_self(idx, context); + if must_unhighlight { + self.unhighlight_line(idx); } let mid = get_y(upper_left) + total_rows - bottom_entity_rows; self.draw_list( |