diff options
Diffstat (limited to 'src/mailview.rs')
-rw-r--r-- | src/mailview.rs | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/mailview.rs b/src/mailview.rs deleted file mode 100644 index 236eea5..0000000 --- a/src/mailview.rs +++ /dev/null @@ -1,80 +0,0 @@ -use cursive::Printer; -use cursive::Rect; -use cursive::View; -use cursive::XY; -use cursive::direction::Direction; -use cursive::event::Event; -use cursive::event::EventResult; -use cursive::view::Selector; -use cursive::views::TextView; -use itertools::Itertools; - -use crate::maillist_view::MailListingData; - -pub struct MailView(TextView); - -impl MailView { - pub fn create_for(mldata: MailListingData) -> Self { - let text = indoc::formatdoc!(r#" - Id : {id} - Tags : {tags} - Date : {date} - From : {from} - To : {to} - Subject: {subject} - "#, - id = mldata.mail_id(), - tags = mldata.tags().iter().join(", "), - date = mldata.date(), - from = mldata.from(), - to = mldata.to(), - subject = mldata.subject(), - ); - MailView(TextView::new(text)) - } -} - -impl View for MailView { - fn draw(&self, printer: &Printer) { - self.0.draw(printer) - } - - fn layout(&mut self, xy: XY<usize>) { - self.0.layout(xy) - } - - fn needs_relayout(&self) -> bool { - self.0.needs_relayout() - } - - fn required_size(&mut self, constraint: XY<usize>) -> XY<usize> { - self.0.required_size(constraint) - } - - fn on_event(&mut self, e: Event) -> EventResult { - self.0.on_event(e) - } - - fn call_on_any<'a>(&mut self, s: &Selector, tpl: &'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a)) { - self.0.call_on_any(s, tpl); - } - - fn focus_view(&mut self, s: &Selector) -> Result<(), ()> { - self.0.focus_view(s) - } - - fn take_focus(&mut self, source: Direction) -> bool { - self.0.take_focus(source) - } - - fn important_area(&self, view_size: XY<usize>) -> Rect { - self.0.important_area(view_size) - } - - fn type_name(&self) -> &'static str { - self.0.type_name() - } - -} - - |