parent
99fab60990
commit
415ce2a27e
|
@ -234,41 +234,31 @@ impl MailListing {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Write an entire line for each envelope entry. */
|
/* Write an entire line for each envelope entry. */
|
||||||
/*
|
|
||||||
self.local_collection = (0..mailbox.collection.len()).collect();
|
self.local_collection = (0..mailbox.collection.len()).collect();
|
||||||
let sort = self.sort;
|
let sort = self.sort;
|
||||||
self.local_collection.sort_by(|a, b| match sort {
|
self.local_collection.sort_by(|a, b| match sort {
|
||||||
(SortField::Date, SortOrder::Desc) => {
|
(SortField::Date, SortOrder::Desc) => {
|
||||||
let a = mailbox.thread(*a);
|
let ma = &mailbox.collection[*a];
|
||||||
let b = mailbox.thread(*b);
|
let mb = &mailbox.collection[*b];
|
||||||
let ma = &mailbox.collection[*a.message().as_ref().unwrap()];
|
mb.date().cmp(&ma.date())
|
||||||
let mb = &mailbox.collection[*b.message().as_ref().unwrap()];
|
}
|
||||||
mb.date().cmp(&ma.date())
|
(SortField::Date, SortOrder::Asc) => {
|
||||||
}
|
let ma = &mailbox.collection[*a];
|
||||||
(SortField::Date, SortOrder::Asc) => {
|
let mb = &mailbox.collection[*b];
|
||||||
let a = mailbox.thread(*a);
|
ma.date().cmp(&mb.date())
|
||||||
let b = mailbox.thread(*b);
|
}
|
||||||
let ma = &mailbox.collection[*a.message().as_ref().unwrap()];
|
(SortField::Subject, SortOrder::Desc) => {
|
||||||
let mb = &mailbox.collection[*b.message().as_ref().unwrap()];
|
let ma = &mailbox.collection[*a];
|
||||||
ma.date().cmp(&mb.date())
|
let mb = &mailbox.collection[*b];
|
||||||
}
|
ma.subject().cmp(&mb.subject())
|
||||||
(SortField::Subject, SortOrder::Desc) => {
|
}
|
||||||
let a = mailbox.thread(*a);
|
(SortField::Subject, SortOrder::Asc) => {
|
||||||
let b = mailbox.thread(*b);
|
let ma = &mailbox.collection[*a];
|
||||||
let ma = &mailbox.collection[*a.message().as_ref().unwrap()];
|
let mb = &mailbox.collection[*b];
|
||||||
let mb = &mailbox.collection[*b.message().as_ref().unwrap()];
|
mb.subject().cmp(&ma.subject())
|
||||||
ma.subject().cmp(&mb.subject())
|
}
|
||||||
}
|
});
|
||||||
(SortField::Subject, SortOrder::Asc) => {
|
let envelope: &Envelope = &mailbox.collection[self.local_collection[idx]];
|
||||||
let a = mailbox.thread(*a);
|
|
||||||
let b = mailbox.thread(*b);
|
|
||||||
let ma = &mailbox.collection[*a.message().as_ref().unwrap()];
|
|
||||||
let mb = &mailbox.collection[*b.message().as_ref().unwrap()];
|
|
||||||
mb.subject().cmp(&ma.subject())
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
let envelope: &Envelope = &mailbox.collection[idx];
|
|
||||||
|
|
||||||
let fg_color = if !envelope.is_seen() {
|
let fg_color = if !envelope.is_seen() {
|
||||||
Color::Byte(0)
|
Color::Byte(0)
|
||||||
|
@ -471,8 +461,7 @@ impl MailListing {
|
||||||
if show_subject {
|
if show_subject {
|
||||||
s.push_str(&format!("{:.85}", envelope.subject()));
|
s.push_str(&format!("{:.85}", envelope.subject()));
|
||||||
}
|
}
|
||||||
/*
|
/* TODO Very slow since we have to build all attachments
|
||||||
* Very slow since we have to build all attachments
|
|
||||||
let attach_count = envelope.body(op).count_attachments();
|
let attach_count = envelope.body(op).count_attachments();
|
||||||
if attach_count > 1 {
|
if attach_count > 1 {
|
||||||
s.push_str(&format!(" {}∞ ", attach_count - 1));
|
s.push_str(&format!(" {}∞ ", attach_count - 1));
|
||||||
|
@ -539,7 +528,7 @@ impl Component for MailListing {
|
||||||
let i = mailbox.threaded_mail(idx);
|
let i = mailbox.threaded_mail(idx);
|
||||||
&mut mailbox.collection[i]
|
&mut mailbox.collection[i]
|
||||||
} else {
|
} else {
|
||||||
&mut mailbox.collection[idx]
|
&mut mailbox.collection[self.local_collection[idx]]
|
||||||
};
|
};
|
||||||
(envelope.hash(), envelope.is_seen())
|
(envelope.hash(), envelope.is_seen())
|
||||||
};
|
};
|
||||||
|
@ -555,7 +544,7 @@ impl Component for MailListing {
|
||||||
let i = mailbox.threaded_mail(idx);
|
let i = mailbox.threaded_mail(idx);
|
||||||
&mut mailbox.collection[i]
|
&mut mailbox.collection[i]
|
||||||
} else {
|
} else {
|
||||||
&mut mailbox.collection[idx]
|
&mut mailbox.collection[self.local_collection[idx]]
|
||||||
};
|
};
|
||||||
envelope.set_seen(op).unwrap();
|
envelope.set_seen(op).unwrap();
|
||||||
true
|
true
|
||||||
|
@ -602,7 +591,7 @@ impl Component for MailListing {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.view = Some(MailView::new(self.cursor_pos, None, None));
|
self.view = Some(MailView::new(self.cursor_pos, self.local_collection.clone(), None, None));
|
||||||
self.view.as_mut().unwrap().draw(
|
self.view.as_mut().unwrap().draw(
|
||||||
grid,
|
grid,
|
||||||
(set_y(upper_left, mid + 1), bottom_right),
|
(set_y(upper_left, mid + 1), bottom_right),
|
||||||
|
|
Loading…
Reference in New Issue