From f63ce388f7774ea015fdaa2362202c33f3ddacd4 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 9 Dec 2022 12:58:56 +0200 Subject: commands: move ManageMailboxes to Tab Actions --- src/command.rs | 2 +- src/command/actions.rs | 29 ++++++++--------------------- src/components/mail/listing.rs | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/command.rs b/src/command.rs index ea376922..c83008bf 100644 --- a/src/command.rs +++ b/src/command.rs @@ -847,7 +847,7 @@ Alternatives(&[to_stream!(One(Literal("add-attachment")), One(Filepath)), to_str fn manage_mailboxes(input: &[u8]) -> IResult<&[u8], Action> { let (input, _) = tag("manage-mailboxes")(input.trim())?; let (input, _) = eof(input)?; - Ok((input, ManageMailboxes)) + Ok((input, Tab(ManageMailboxes))) } ) }, diff --git a/src/command/actions.rs b/src/command/actions.rs index a4bdf02c..8cc89aea 100644 --- a/src/command/actions.rs +++ b/src/command/actions.rs @@ -61,6 +61,7 @@ pub enum TabAction { Close, Kill(Uuid), New(Option>), + ManageMailboxes, } #[derive(Debug)] @@ -120,7 +121,6 @@ pub enum Action { PrintEnv(String), Compose(ComposeAction), Mailbox(AccountName, MailboxOperation), - ManageMailboxes, AccountAction(AccountName, AccountAction), PrintSetting(String), ReloadConfiguration, @@ -130,26 +130,13 @@ pub enum Action { impl Action { pub fn needs_confirmation(&self) -> bool { - match self { - Action::Listing(ListingAction::Delete) => true, - Action::Listing(_) => false, - Action::ViewMailbox(_) => false, - Action::Sort(_, _) => false, - Action::SubSort(_, _) => false, - Action::Tab(_) => false, - Action::MailingListAction(_) => true, - Action::View(_) => false, - Action::SetEnv(_, _) => false, - Action::PrintEnv(_) => false, - Action::Compose(_) => false, - Action::Mailbox(_, _) => true, - Action::AccountAction(_, _) => false, - Action::PrintSetting(_) => false, - Action::ToggleMouse => false, - Action::ManageMailboxes => false, - Action::Quit => true, - Action::ReloadConfiguration => false, - } + matches!( + self, + Action::Listing(ListingAction::Delete) + | Action::MailingListAction(_) + | Action::Mailbox(_, _) + | Action::Quit + ) } } diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs index a77fd417..849d2370 100644 --- a/src/components/mail/listing.rs +++ b/src/components/mail/listing.rs @@ -1881,7 +1881,7 @@ impl Component for Listing { .push_back(UIEvent::Action(Tab(New(Some(Box::new(composer)))))); return true; } - UIEvent::Action(Action::ManageMailboxes) => { + UIEvent::Action(Action::Tab(ManageMailboxes)) => { let account_pos = self.cursor_pos.0; let mgr = MailboxManager::new(context, account_pos); context -- cgit v1.2.3