summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-09 12:58:56 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-09 12:58:56 +0200
commitf63ce388f7774ea015fdaa2362202c33f3ddacd4 (patch)
treeec5dd34c301843a0e4d694191b8cf5f811a90a29
parentc06c3f589315f017a412f31d80559a5a734d7b89 (diff)
downloadmeli-f63ce388f7774ea015fdaa2362202c33f3ddacd4.zip
commands: move ManageMailboxes to Tab Actions
-rw-r--r--src/command.rs2
-rw-r--r--src/command/actions.rs29
-rw-r--r--src/components/mail/listing.rs2
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<Box<dyn Component>>),
+ 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