Skip to content

Commit 7ff1db1

Browse files
committed
manage-mailboxes: add delete option
While there was a delete-mailbox command, there was no option for it in the manage-mailboxes interface, so add it. Signed-off-by: Manos Pitsidianakis <[email protected]>
1 parent 35fa8e9 commit 7ff1db1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

meli/src/manage/mailboxes.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ use crate::components::prelude::*;
2323

2424
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2525
enum MailboxAction {
26-
Rename,
26+
Delete,
2727
Move,
28+
Rename,
2829
Subscribe,
2930
Unsubscribe,
3031
}
@@ -477,6 +478,21 @@ impl Component for MailboxManager {
477478
.replies
478479
.push_back(UIEvent::ChangeMode(UIMode::Command));
479480
}
481+
MailboxAction::Delete => {
482+
context.replies.push_back(UIEvent::CmdInput(Key::Paste(
483+
format!(
484+
"delete-mailbox \"{account_name}\" \
485+
\"{mailbox_path_src}\" ",
486+
account_name =
487+
context.accounts[&self.account_hash].name(),
488+
mailbox_path_src =
489+
self.entries[self.cursor_pos].ref_mailbox.path()
490+
),
491+
)));
492+
context
493+
.replies
494+
.push_back(UIEvent::ChangeMode(UIMode::Command));
495+
}
480496
MailboxAction::Subscribe => {
481497
if let Err(err) = context.accounts[&self.account_hash]
482498
.mailbox_operation(MailboxOperation::Subscribe(
@@ -664,6 +680,7 @@ impl Component for MailboxManager {
664680
(MailboxAction::Move, "move".into()),
665681
(MailboxAction::Subscribe, "subscribe".into()),
666682
(MailboxAction::Unsubscribe, "unsubscribe".into()),
683+
(MailboxAction::Delete, "delete (cannot be undone!)".into()),
667684
],
668685
true,
669686
Some(Box::new(

0 commit comments

Comments
 (0)