compact.rs: use mail sorting parameters from config

Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
pull/144/head
Guillaume Ranquet 2022-07-19 21:43:01 +02:00 committed by Manos Pitsidianakis
parent 9205f3b8af
commit d921b3c320
1 changed files with 7 additions and 0 deletions

View File

@ -165,6 +165,7 @@ pub struct CompactListing {
new_cursor_pos: (AccountHash, MailboxHash, usize),
length: usize,
sort: (SortField, SortOrder),
sortcmd: bool,
subsort: (SortField, SortOrder),
all_threads: HashSet<ThreadHash>,
order: HashMap<ThreadHash, usize>,
@ -316,6 +317,10 @@ impl MailListingTrait for CompactListing {
let threads = account.collection.get_threads(self.cursor_pos.1);
self.order.clear();
// Use account settings only if no sortcmd has been used
if !self.sortcmd {
self.sort = context.accounts[&self.cursor_pos.0].settings.account.order
}
self.length = 0;
let mut rows = Vec::with_capacity(1024);
let mut min_width = (0, 0, 0, 0);
@ -877,6 +882,7 @@ impl CompactListing {
new_cursor_pos: (coordinates.0, coordinates.1, 0),
length: 0,
sort: (Default::default(), Default::default()),
sortcmd: false,
subsort: (SortField::Date, SortOrder::Desc),
all_threads: HashSet::default(),
order: HashMap::default(),
@ -1791,6 +1797,7 @@ impl Component for CompactListing {
Action::Sort(field, order) if !self.unfocused => {
debug!("Sort {:?} , {:?}", field, order);
self.sort = (*field, *order);
self.sortcmd = true;
if !self.filtered_selection.is_empty() {
// FIXME: perform sort
self.dirty = true;