Added delete movie functionality
This commit is contained in:
+4
-2
@@ -15,8 +15,9 @@ pub trait KeyEventHandler<'a, T: Into<Route>> {
|
||||
_ if *key == DEFAULT_KEYBINDINGS.down.key => self.handle_scroll_down(),
|
||||
_ if *key == DEFAULT_KEYBINDINGS.home.key => self.handle_home(),
|
||||
_ if *key == DEFAULT_KEYBINDINGS.end.key => self.handle_end(),
|
||||
_ if *key == DEFAULT_KEYBINDINGS.delete.key => self.handle_delete(),
|
||||
_ if *key == DEFAULT_KEYBINDINGS.left.key || *key == DEFAULT_KEYBINDINGS.right.key => {
|
||||
self.handle_tab_action()
|
||||
self.handle_left_right_action()
|
||||
}
|
||||
_ if *key == DEFAULT_KEYBINDINGS.submit.key => self.handle_submit(),
|
||||
_ if *key == DEFAULT_KEYBINDINGS.esc.key => self.handle_esc(),
|
||||
@@ -34,7 +35,8 @@ pub trait KeyEventHandler<'a, T: Into<Route>> {
|
||||
fn handle_scroll_down(&mut self);
|
||||
fn handle_home(&mut self);
|
||||
fn handle_end(&mut self);
|
||||
fn handle_tab_action(&mut self);
|
||||
fn handle_delete(&mut self);
|
||||
fn handle_left_right_action(&mut self);
|
||||
fn handle_submit(&mut self);
|
||||
fn handle_esc(&mut self);
|
||||
fn handle_char_key_event(&mut self);
|
||||
|
||||
@@ -56,7 +56,9 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for CollectionDetailsHandler<'a>
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_tab_action(&mut self) {}
|
||||
fn handle_delete(&mut self) {}
|
||||
|
||||
fn handle_left_right_action(&mut self) {}
|
||||
|
||||
fn handle_submit(&mut self) {
|
||||
if ActiveRadarrBlock::CollectionDetails == *self.active_radarr_block {
|
||||
|
||||
@@ -171,7 +171,15 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for RadarrHandler<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_tab_action(&mut self) {
|
||||
fn handle_delete(&mut self) {
|
||||
if *self.active_radarr_block == ActiveRadarrBlock::Movies {
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::DeleteMoviePrompt.into());
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_left_right_action(&mut self) {
|
||||
match self.active_radarr_block {
|
||||
ActiveRadarrBlock::Movies | ActiveRadarrBlock::Downloads | ActiveRadarrBlock::Collections => {
|
||||
match self.key {
|
||||
@@ -202,6 +210,14 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for RadarrHandler<'a> {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
ActiveRadarrBlock::DeleteMoviePrompt => match self.key {
|
||||
_ if *self.key == DEFAULT_KEYBINDINGS.left.key
|
||||
|| *self.key == DEFAULT_KEYBINDINGS.right.key =>
|
||||
{
|
||||
self.app.data.radarr_data.prompt_confirm = !self.app.data.radarr_data.prompt_confirm;
|
||||
}
|
||||
_ => (),
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -268,6 +284,10 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for RadarrHandler<'a> {
|
||||
.set_items(filtered_collections);
|
||||
}
|
||||
}
|
||||
ActiveRadarrBlock::DeleteMoviePrompt => {
|
||||
self.app.should_refresh = self.app.data.radarr_data.prompt_confirm;
|
||||
self.app.pop_navigation_stack();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -281,6 +301,10 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for RadarrHandler<'a> {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.data.radarr_data.reset_search();
|
||||
}
|
||||
ActiveRadarrBlock::DeleteMoviePrompt => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.data.radarr_data.prompt_confirm = false;
|
||||
}
|
||||
_ => {
|
||||
self.app.data.radarr_data.reset_search();
|
||||
handle_clear_errors(self.app);
|
||||
|
||||
@@ -68,7 +68,9 @@ impl<'a> KeyEventHandler<'a, ActiveRadarrBlock> for MovieDetailsHandler<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_tab_action(&mut self) {
|
||||
fn handle_delete(&mut self) {}
|
||||
|
||||
fn handle_left_right_action(&mut self) {
|
||||
match self.active_radarr_block {
|
||||
ActiveRadarrBlock::MovieDetails
|
||||
| ActiveRadarrBlock::MovieHistory
|
||||
|
||||
Reference in New Issue
Block a user