ui: make Composer account specific
parent
cfb7dcec64
commit
4bf1f6b9c9
|
@ -12,7 +12,7 @@ mod random;
|
|||
use super::parser;
|
||||
use fnv::FnvHashMap;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct Draft {
|
||||
// FIXME: Preserve header order
|
||||
// FIXME: Validate headers, allow custom ones
|
||||
|
|
|
@ -112,6 +112,12 @@ impl fmt::Display for Composer {
|
|||
}
|
||||
|
||||
impl Composer {
|
||||
pub fn new(account_cursor: usize) -> Self {
|
||||
Composer {
|
||||
account_cursor,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
/*
|
||||
* coordinates: (account index, mailbox index, root set thread_node index)
|
||||
* msg: index of message we reply to in thread_nodes
|
||||
|
|
|
@ -530,7 +530,7 @@ impl Component for CompactListing {
|
|||
UIEventType::Input(Key::Char('m')) if !self.unfocused => {
|
||||
context.replies.push_back(UIEvent {
|
||||
id: 0,
|
||||
event_type: UIEventType::Action(Tab(NewDraft)),
|
||||
event_type: UIEventType::Action(Tab(NewDraft(self.cursor_pos.0))),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ impl Component for PlainListing {
|
|||
UIEventType::Input(Key::Char('m')) if !self.unfocused => {
|
||||
context.replies.push_back(UIEvent {
|
||||
id: 0,
|
||||
event_type: UIEventType::Action(Tab(NewDraft)),
|
||||
event_type: UIEventType::Action(Tab(NewDraft(self.cursor_pos.0))),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -599,7 +599,7 @@ impl Component for ThreadListing {
|
|||
UIEventType::Input(Key::Char('m')) if !self.unfocused => {
|
||||
context.replies.push_back(UIEvent {
|
||||
id: 0,
|
||||
event_type: UIEventType::Action(Tab(NewDraft)),
|
||||
event_type: UIEventType::Action(Tab(NewDraft(self.cursor_pos.0))),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -999,8 +999,8 @@ impl Component for Tabbed {
|
|||
self.set_dirty();
|
||||
return true;
|
||||
}
|
||||
UIEventType::Action(Tab(NewDraft)) => {
|
||||
self.add_component(Box::new(Composer::default()));
|
||||
UIEventType::Action(Tab(NewDraft(account_idx))) => {
|
||||
self.add_component(Box::new(Composer::new(account_idx)));
|
||||
self.cursor_pos = self.children.len() - 1;
|
||||
self.children[self.cursor_pos].set_dirty();
|
||||
return true;
|
||||
|
|
|
@ -39,7 +39,7 @@ pub enum ListingAction {
|
|||
#[derive(Debug)]
|
||||
pub enum TabAction {
|
||||
TabOpen(Option<Box<Component>>),
|
||||
NewDraft,
|
||||
NewDraft(usize),
|
||||
Reply((usize, usize, usize), usize), // thread coordinates (account, mailbox, root_set idx) and message idx
|
||||
Close,
|
||||
Edit((usize, usize, usize), usize), // thread coordinates (account, mailbox, root_set idx) and message idx
|
||||
|
|
Loading…
Reference in New Issue