Add operation to permanently delete trash items, fixes #841

This commit is contained in:
Jeremy Soller 2025-03-03 13:44:06 -07:00
parent 3cce822ffc
commit c8aa80fb2f
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
6 changed files with 101 additions and 18 deletions

View file

@ -151,7 +151,7 @@ pub fn context_menu<'a>(
children.push(menu_item(fl!("cut"), Action::Cut).into());
children.push(menu_item(fl!("copy"), Action::Copy).into());
// Should this simply bypass trash and remove the shortcut?
children.push(menu_item(fl!("move-to-trash"), Action::MoveToTrash).into());
children.push(menu_item(fl!("move-to-trash"), Action::Delete).into());
} else if selected > 0 {
if selected_dir == 1 && selected == 1 || selected_dir == 0 {
children.push(menu_item(fl!("open"), Action::Open).into());
@ -211,7 +211,7 @@ pub fn context_menu<'a>(
children.push(menu_item(fl!("add-to-sidebar"), Action::AddToSidebar).into());
}
children.push(divider::horizontal::light().into());
children.push(menu_item(fl!("move-to-trash"), Action::MoveToTrash).into());
children.push(menu_item(fl!("move-to-trash"), Action::Delete).into());
} else {
//TODO: need better designs for menu with no selection
//TODO: have things like properties but they apply to the folder?
@ -311,6 +311,8 @@ pub fn context_menu<'a>(
children.push(divider::horizontal::light().into());
children
.push(menu_item(fl!("restore-from-trash"), Action::RestoreFromTrash).into());
children.push(divider::horizontal::light().into());
children.push(menu_item(fl!("delete-permanently"), Action::Delete).into());
} else {
// TODO: Nested menu
children.push(sort_item(fl!("sort-by-name"), HeadingOptions::Name));
@ -537,7 +539,15 @@ pub fn menu_bar<'a>(
menu::Item::Divider,
menu_button_optional(fl!("add-to-sidebar"), Action::AddToSidebar, selected > 0),
menu::Item::Divider,
menu_button_optional(fl!("move-to-trash"), Action::MoveToTrash, selected > 0),
menu_button_optional(
if in_trash {
fl!("delete-permanently")
} else {
fl!("move-to-trash")
},
Action::Delete,
selected > 0,
),
menu::Item::Divider,
menu::Item::Button(fl!("close-tab"), None, Action::TabClose),
menu::Item::Button(fl!("quit"), None, Action::WindowClose),