ui: handle ViewMailbox in listing.rs
handling viewmailbox inside a listing instead of their parent/manager component is a leftover from before they even had a parent/manager.async
parent
647cb10b33
commit
22fb0c0844
|
@ -639,6 +639,19 @@ impl Component for Listing {
|
||||||
self.component.set_dirty(true);
|
self.component.set_dirty(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Action::ViewMailbox(idx) => {
|
||||||
|
if let Some((_, folder_hash)) =
|
||||||
|
self.accounts[self.cursor_pos.0].entries.get(*idx)
|
||||||
|
{
|
||||||
|
self.cursor_pos.1 = *idx;
|
||||||
|
self.component
|
||||||
|
.set_coordinates((self.cursor_pos.0, *folder_hash));
|
||||||
|
self.set_dirty(true);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
UIEvent::ChangeMode(UIMode::Normal) => {
|
UIEvent::ChangeMode(UIMode::Normal) => {
|
||||||
|
|
|
@ -1353,19 +1353,6 @@ impl Component for CompactListing {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UIEvent::Action(ref action) => match action {
|
UIEvent::Action(ref action) => match action {
|
||||||
Action::ViewMailbox(idx) => {
|
|
||||||
if context.accounts[self.cursor_pos.0]
|
|
||||||
.folders_order
|
|
||||||
.get(*idx)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
self.filtered_selection.clear();
|
|
||||||
self.new_cursor_pos.1 = *idx;
|
|
||||||
self.refresh_mailbox(context, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Action::Listing(Filter(ref filter_term)) if !self.unfocused => {
|
Action::Listing(Filter(ref filter_term)) if !self.unfocused => {
|
||||||
self.filter(filter_term, context);
|
self.filter(filter_term, context);
|
||||||
self.dirty = true;
|
self.dirty = true;
|
||||||
|
|
|
@ -1290,19 +1290,6 @@ impl Component for ConversationsListing {
|
||||||
self.dirty = true;
|
self.dirty = true;
|
||||||
}
|
}
|
||||||
UIEvent::Action(ref action) => match action {
|
UIEvent::Action(ref action) => match action {
|
||||||
Action::ViewMailbox(idx) => {
|
|
||||||
if context.accounts[self.cursor_pos.0]
|
|
||||||
.folders_order
|
|
||||||
.get(*idx)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
self.set_coordinates((self.new_cursor_pos.0, *idx));
|
|
||||||
self.refresh_mailbox(context, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Action::Listing(Filter(ref filter_term)) if !self.unfocused => {
|
Action::Listing(Filter(ref filter_term)) if !self.unfocused => {
|
||||||
self.filter(filter_term, context);
|
self.filter(filter_term, context);
|
||||||
self.dirty = true;
|
self.dirty = true;
|
||||||
|
|
|
@ -1180,26 +1180,10 @@ impl Component for PlainListing {
|
||||||
self.refresh_mailbox(context, false);
|
self.refresh_mailbox(context, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
UIEvent::Action(ref action) => match action {
|
UIEvent::Action(Action::Listing(Filter(ref filter_term))) if !self.unfocused => {
|
||||||
Action::ViewMailbox(idx) => {
|
self.filter(filter_term, context);
|
||||||
if context.accounts[self.cursor_pos.0]
|
self.dirty = true;
|
||||||
.folders_order
|
}
|
||||||
.get(*idx)
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
self.filtered_selection.clear();
|
|
||||||
self.new_cursor_pos.1 = *idx;
|
|
||||||
self.refresh_mailbox(context, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Action::Listing(Filter(ref filter_term)) if !self.unfocused => {
|
|
||||||
self.filter(filter_term, context);
|
|
||||||
self.dirty = true;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
|
|
@ -661,12 +661,6 @@ impl Component for ThreadListing {
|
||||||
self.dirty = true;
|
self.dirty = true;
|
||||||
}
|
}
|
||||||
UIEvent::Action(ref action) => match action {
|
UIEvent::Action(ref action) => match action {
|
||||||
Action::ViewMailbox(idx_m) => {
|
|
||||||
self.new_cursor_pos.1 = *idx_m;
|
|
||||||
self.dirty = true;
|
|
||||||
self.refresh_mailbox(context, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Action::SubSort(field, order) => {
|
Action::SubSort(field, order) => {
|
||||||
debug!("SubSort {:?} , {:?}", field, order);
|
debug!("SubSort {:?} , {:?}", field, order);
|
||||||
self.subsort = (*field, *order);
|
self.subsort = (*field, *order);
|
||||||
|
|
Loading…
Reference in New Issue