InputMode as Option<Popup> in FileTransferActivity

This commit is contained in:
ChristianVisintin
2020-12-27 10:59:12 +01:00
parent 65e7ff22f7
commit d756bf7786
5 changed files with 98 additions and 116 deletions

View File

@@ -20,10 +20,7 @@
*/
// Locals
use super::{
Color, ConfigClient, FileTransferActivity, InputField, InputMode, LogLevel, LogRecord,
PopupType,
};
use super::{Color, ConfigClient, FileTransferActivity, InputField, LogLevel, LogRecord, Popup};
use crate::fs::explorer::{builder::FileExplorerBuilder, FileExplorer, FileSorting, GroupDirs};
use crate::system::environment;
use crate::system::sshkey_storage::SshKeyStorage;
@@ -59,14 +56,14 @@ impl FileTransferActivity {
LogLevel::Warn => Color::Yellow,
};
self.log(level, msg.as_str());
self.input_mode = InputMode::Popup(PopupType::Alert(color, msg));
self.popup = Some(Popup::Alert(color, msg));
}
/// ### create_quit_popup
///
/// Create quit popup input mode (since must be shared between different input handlers)
pub(super) fn create_disconnect_popup(&mut self) -> InputMode {
InputMode::Popup(PopupType::YesNo(
pub(super) fn create_disconnect_popup(&mut self) -> Option<Popup> {
Some(Popup::YesNo(
String::from("Are you sure you want to disconnect?"),
FileTransferActivity::disconnect,
FileTransferActivity::callback_nothing_to_do,
@@ -76,8 +73,8 @@ impl FileTransferActivity {
/// ### create_quit_popup
///
/// Create quit popup input mode (since must be shared between different input handlers)
pub(super) fn create_quit_popup(&mut self) -> InputMode {
InputMode::Popup(PopupType::YesNo(
pub(super) fn create_quit_popup(&mut self) -> Option<Popup> {
Some(Popup::YesNo(
String::from("Are you sure you want to quit?"),
FileTransferActivity::disconnect_and_quit,
FileTransferActivity::callback_nothing_to_do,