This commit is contained in:
veeso
2021-03-26 22:19:24 +01:00
parent de3983e53f
commit 423f84353d
8 changed files with 34 additions and 45 deletions

View File

@@ -83,11 +83,8 @@ impl AuthActivity {
.view
.get_value(super::COMPONENT_RADIO_BOOKMARK_SAVE_PWD)
{
Some(Payload::Unsigned(choice)) => match choice {
0 => Some(password), // Yes
_ => None, // No
},
_ => None, // No such component
Some(Payload::Unsigned(0)) => Some(password), // Yes
_ => None, // No such component / No
},
false => None,
};

View File

@@ -274,14 +274,10 @@ impl AuthActivity {
Some(Payload::Text(s)) => s,
_ => String::new(),
};
let save_pwd: bool =
match self.view.get_value(COMPONENT_RADIO_BOOKMARK_SAVE_PWD) {
Some(Payload::Unsigned(idx)) => match idx {
0 => true,
_ => false,
},
_ => false,
};
let save_pwd: bool = matches!(
self.view.get_value(COMPONENT_RADIO_BOOKMARK_SAVE_PWD),
Some(Payload::Unsigned(0))
);
// Save bookmark
self.save_bookmark(bookmark_name, save_pwd);
// Umount popup

View File

@@ -732,16 +732,13 @@ impl FileTransferActivity {
{
Some(props) => {
// Get width
let width: usize = match self
let width: usize = self
.context
.as_ref()
.unwrap()
.store
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
{
Some(val) => val,
None => 256, // Default
};
.unwrap_or(256);
let hostname: String = match hostname::get() {
Ok(h) => {
let hostname: String = h.as_os_str().to_string_lossy().to_string();
@@ -787,16 +784,13 @@ impl FileTransferActivity {
{
Some(props) => {
// Get width
let width: usize = match self
let width: usize = self
.context
.as_ref()
.unwrap()
.store
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
{
Some(val) => val,
None => 256, // Default
};
.unwrap_or(256);
let params = self.context.as_ref().unwrap().ft_params.as_ref().unwrap();
let hostname: String = format!(
"{}:{} ",
@@ -830,16 +824,13 @@ impl FileTransferActivity {
match self.view.get_props(super::COMPONENT_LOG_BOX).as_mut() {
Some(props) => {
// Get width
let width: usize = match self
let width: usize = self
.context
.as_ref()
.unwrap()
.store
.get_unsigned(super::STORAGE_LOGBOX_WIDTH)
{
Some(val) => val,
None => 256, // Default
};
.unwrap_or(256);
// Make log entries
let mut table: TableBuilder = TableBuilder::default();
for (idx, record) in self.log_records.iter().enumerate() {
@@ -952,8 +943,8 @@ impl FileTransferActivity {
None => None,
Some(props) => {
let props = props.build();
let title: String = props.texts.title.clone().unwrap_or(String::new());
let mut props = PropsBuilder::from(props.clone());
let title: String = props.texts.title.clone().unwrap_or_default();
let mut props = PropsBuilder::from(props);
// Prepare files
let file_texts: Vec<TextSpan> = self
.found

View File

@@ -703,7 +703,7 @@ impl SetupActivity {
.get_props(super::COMPONENT_INPUT_FILE_FMT)
.as_mut()
{
let file_fmt: String = cli.get_file_fmt().unwrap_or(String::new());
let file_fmt: String = cli.get_file_fmt().unwrap_or_default();
let props = props.with_value(PropValue::Str(file_fmt)).build();
let _ = self.view.update(super::COMPONENT_INPUT_FILE_FMT, props);
}
@@ -734,19 +734,13 @@ impl SetupActivity {
if let Some(Payload::Unsigned(opt)) =
self.view.get_value(super::COMPONENT_RADIO_HIDDEN_FILES)
{
let show: bool = match opt {
0 => true,
_ => false,
};
let show: bool = matches!(opt, 0);
cli.set_show_hidden_files(show);
}
if let Some(Payload::Unsigned(opt)) =
self.view.get_value(super::COMPONENT_RADIO_UPDATES)
{
let check: bool = match opt {
0 => true,
_ => false,
};
let check: bool = matches!(opt, 0);
cli.set_check_for_updates(check);
}
if let Some(Payload::Text(fmt)) = self.view.get_value(super::COMPONENT_INPUT_FILE_FMT) {