diff options
Diffstat (limited to 'ui/src/components/mail/listing')
-rw-r--r-- | ui/src/components/mail/listing/compact.rs | 58 | ||||
-rw-r--r-- | ui/src/components/mail/listing/plain.rs | 9 | ||||
-rw-r--r-- | ui/src/components/mail/listing/thread.rs | 6 |
3 files changed, 33 insertions, 40 deletions
diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index 858b64b9..f29e8ebf 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -20,7 +20,7 @@ */ use super::*; -use components::utilities::PageMovement; +use crate::components::utilities::PageMovement; use std::cmp; use std::ops::{Deref, DerefMut}; @@ -242,7 +242,7 @@ impl MailboxView { } threads.thread_nodes()[&iter_ptr].message().unwrap() }; - if !context.accounts[self.cursor_pos.0].contains_key(&i) { + if !context.accounts[self.cursor_pos.0].contains_key(i) { debug!("key = {}", i); debug!( "name = {} {}", @@ -292,7 +292,7 @@ impl MailboxView { } threads.thread_nodes()[&iter_ptr].message().unwrap() }; - if !context.accounts[self.cursor_pos.0].contains_key(&i) { + if !context.accounts[self.cursor_pos.0].contains_key(i) { //debug!("key = {}", i); //debug!( // "name = {} {}", @@ -326,7 +326,7 @@ impl MailboxView { for x in x..min_width.0 { self.columns[0][(x, idx)].set_bg(bg_color); } - let (mut x, _) = write_string_to_grid( + let (x, _) = write_string_to_grid( &strings.1, &mut self.columns[1], fg_color, @@ -460,7 +460,7 @@ impl MailboxView { let (upper_left, bottom_right) = area; let grid = grid.unwrap(); - let (mut x, y) = upper_left; + let (mut x, _y) = upper_left; for i in 0..self.columns.len() { let (width, height) = self.columns[i].size(); if self.widths[i] == 0 { @@ -861,32 +861,28 @@ impl Component for MailboxView { return true; } Action::ToggleThreadSnooze => { - { - //FIXME NLL - let account = &mut context.accounts[self.cursor_pos.0]; - let folder_hash = account[self.cursor_pos.1] - .as_ref() - .map(|m| m.folder.hash()) - .unwrap(); - let threads = account.collection.threads.entry(folder_hash).or_default(); - let thread_group = threads.thread_nodes() - [&threads.root_set(self.cursor_pos.2)] - .thread_group(); - let thread_group = threads.find(thread_group); - /*let i = if let Some(i) = threads.thread_nodes[&thread_group].message() { - i - } else { - let mut iter_ptr = threads.thread_nodes[&thread_group].children()[0]; - while threads.thread_nodes()[&iter_ptr].message().is_none() { - iter_ptr = threads.thread_nodes()[&iter_ptr].children()[0]; - } - threads.thread_nodes()[&iter_ptr].message().unwrap() - };*/ - let root_node = threads.thread_nodes.entry(thread_group).or_default(); - let is_snoozed = root_node.snoozed(); - root_node.set_snoozed(!is_snoozed); - //self.row_updates.push(i); - } + let account = &mut context.accounts[self.cursor_pos.0]; + let folder_hash = account[self.cursor_pos.1] + .as_ref() + .map(|m| m.folder.hash()) + .unwrap(); + let threads = account.collection.threads.entry(folder_hash).or_default(); + let thread_group = + threads.thread_nodes()[&threads.root_set(self.cursor_pos.2)].thread_group(); + let thread_group = threads.find(thread_group); + /*let i = if let Some(i) = threads.thread_nodes[&thread_group].message() { + i + } else { + let mut iter_ptr = threads.thread_nodes[&thread_group].children()[0]; + while threads.thread_nodes()[&iter_ptr].message().is_none() { + iter_ptr = threads.thread_nodes()[&iter_ptr].children()[0]; + } + threads.thread_nodes()[&iter_ptr].message().unwrap() + };*/ + let root_node = threads.thread_nodes.entry(thread_group).or_default(); + let is_snoozed = root_node.snoozed(); + root_node.set_snoozed(!is_snoozed); + //self.row_updates.push(i); self.refresh_mailbox(context); return true; } diff --git a/ui/src/components/mail/listing/plain.rs b/ui/src/components/mail/listing/plain.rs index e5758356..b39c546e 100644 --- a/ui/src/components/mail/listing/plain.rs +++ b/ui/src/components/mail/listing/plain.rs @@ -246,8 +246,7 @@ impl PlainListing { 1 }; // Populate `CellBuffer` with every entry. - let mut idx = 0; - for y in 0..=self.length { + for (idx, y) in (0..=self.length).enumerate() { if idx >= self.length { /* No more entries left, so fill the rest of the area with empty space */ clear_area(&mut self.content, ((0, y), (MAX_COLS - 1, self.length))); @@ -280,7 +279,7 @@ impl PlainListing { self.content[(x, idx)].set_bg(bg_color); } let mut _x = widths.0 + column_sep; - let (mut x, _) = write_string_to_grid( + let (x, _) = write_string_to_grid( &rows[idx].2, &mut self.content, fg_color, @@ -317,8 +316,6 @@ impl PlainListing { self.content[(x, y)].set_ch(' '); self.content[(x, y)].set_bg(bg_color); } - - idx += 1; } } @@ -537,7 +534,7 @@ impl Component for PlainListing { coordinates.1, self.local_collection[self.cursor_pos.2], ); - self.view = Some(MailView::new(coordinates, None, None, context)); + self.view = Some(MailView::new(coordinates, None, None)); } self.view.as_mut().unwrap().draw( grid, diff --git a/ui/src/components/mail/listing/thread.rs b/ui/src/components/mail/listing/thread.rs index a9929291..772361d6 100644 --- a/ui/src/components/mail/listing/thread.rs +++ b/ui/src/components/mail/listing/thread.rs @@ -20,7 +20,7 @@ */ use super::*; -use components::utilities::PageMovement; +use crate::components::utilities::PageMovement; const MAX_COLS: usize = 500; @@ -475,7 +475,7 @@ impl Component for ThreadListing { (envelope.hash(), envelope.is_seen()) }; if !is_seen { - let op = account.operation(&hash); + let op = account.operation(hash); let envelope: &mut Envelope = account.get_env_mut(&self.locations[self.cursor_pos.2]); envelope.set_seen(op).unwrap(); @@ -533,7 +533,7 @@ impl Component for ThreadListing { if let Some(ref mut v) = self.view { v.update(coordinates); } else { - self.view = Some(MailView::new(coordinates, None, None, context)); + self.view = Some(MailView::new(coordinates, None, None)); } self.view.as_mut().unwrap().draw( |