removed args from SaveBookmark

This commit is contained in:
ChristianVisintin
2020-12-16 20:34:36 +01:00
parent 335bfc8460
commit 38e015efe4
3 changed files with 19 additions and 30 deletions

View File

@@ -25,7 +25,7 @@
use super::{
AuthActivity, DialogCallback, DialogYesNoOption, FileTransferProtocol, InputEvent, InputField,
InputForm, InputMode, OnInputSubmitCallback, PopupType,
InputForm, InputMode, PopupType,
};
use crossterm::event::{KeyCode, KeyModifiers};
@@ -163,10 +163,7 @@ impl AuthActivity {
// Default choice option to no
self.choice_opt = DialogYesNoOption::No;
// Save bookmark as...
self.input_mode = InputMode::Popup(PopupType::SaveBookmark(
String::from("Save bookmark as..."),
AuthActivity::callback_save_bookmark,
));
self.input_mode = InputMode::Popup(PopupType::SaveBookmark);
}
_ => { /* Nothing to do */ }
}
@@ -287,10 +284,7 @@ impl AuthActivity {
// Default choice option to no
self.choice_opt = DialogYesNoOption::No;
// Save bookmark as...
self.input_mode = InputMode::Popup(PopupType::SaveBookmark(
String::from("Save bookmark as..."),
AuthActivity::callback_save_bookmark,
));
self.input_mode = InputMode::Popup(PopupType::SaveBookmark);
}
_ => { /* Nothing to do */ }
},
@@ -370,10 +364,7 @@ impl AuthActivity {
// Default choice option to no
self.choice_opt = DialogYesNoOption::No;
// Save bookmark as...
self.input_mode = InputMode::Popup(PopupType::SaveBookmark(
String::from("Save bookmark as..."),
AuthActivity::callback_save_bookmark,
));
self.input_mode = InputMode::Popup(PopupType::SaveBookmark);
}
_ => { /* Nothing to do */ }
},
@@ -389,7 +380,7 @@ impl AuthActivity {
match ptype {
PopupType::Alert(_, _) => self.handle_input_event_mode_popup_alert(ev),
PopupType::Help => self.handle_input_event_mode_popup_help(ev),
PopupType::SaveBookmark(_, cb) => self.handle_input_event_mode_popup_save_bookmark(ev, cb),
PopupType::SaveBookmark => self.handle_input_event_mode_popup_save_bookmark(ev),
PopupType::YesNo(_, yes_cb, no_cb) => {
self.handle_input_event_mode_popup_yesno(ev, yes_cb, no_cb)
}
@@ -427,11 +418,7 @@ impl AuthActivity {
/// ### handle_input_event_mode_popup_save_bookmark
///
/// Input event handler for SaveBookmark popup
pub(super) fn handle_input_event_mode_popup_save_bookmark(
&mut self,
ev: &InputEvent,
cb: OnInputSubmitCallback,
) {
pub(super) fn handle_input_event_mode_popup_save_bookmark(&mut self, ev: &InputEvent) {
// If enter, close popup, otherwise push chars to input
if let InputEvent::Key(key) = ev {
match key.code {
@@ -452,7 +439,7 @@ impl AuthActivity {
// Set mode back to form BEFORE CALLBACKS!!! Callback can then overwrite this, clever uh?
self.input_mode = InputMode::Form;
// Call cb
cb(self, input_text);
self.callback_save_bookmark(input_text);
// Reset choice option to yes
self.choice_opt = DialogYesNoOption::Yes;
}