Cargo fmt
This commit is contained in:
parent
a747b03c17
commit
27e2d682a5
2 changed files with 64 additions and 68 deletions
|
|
@ -235,9 +235,10 @@ impl PasswordManager {
|
||||||
|
|
||||||
// Don't do anything if nothing have changed
|
// Don't do anything if nothing have changed
|
||||||
if let Some(original) = &original
|
if let Some(original) = &original
|
||||||
&& original == &input_state.input {
|
&& original == &input_state.input
|
||||||
return Task::none();
|
{
|
||||||
}
|
return Task::none();
|
||||||
|
}
|
||||||
|
|
||||||
cosmic::task::future(async move {
|
cosmic::task::future(async move {
|
||||||
if let Err(err) = store::add_password(identifier.clone(), password.clone()).await {
|
if let Err(err) = store::add_password(identifier.clone(), password.clone()).await {
|
||||||
|
|
@ -247,16 +248,13 @@ impl PasswordManager {
|
||||||
} else {
|
} else {
|
||||||
if let Some(original) = original
|
if let Some(original) = original
|
||||||
&& original.identifier != identifier
|
&& original.identifier != identifier
|
||||||
&& let Err(err) =
|
&& let Err(err) = store::delete_password(original.identifier.clone()).await
|
||||||
store::delete_password(original.identifier.clone()).await
|
{
|
||||||
{
|
return Message::PasswordManager(PasswordManagerMessage::Error(format!(
|
||||||
return Message::PasswordManager(PasswordManagerMessage::Error(
|
"Failed to delete password {}: {err}",
|
||||||
format!(
|
original.identifier
|
||||||
"Failed to delete password {}: {err}",
|
)));
|
||||||
original.identifier
|
}
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
Message::PasswordManager(PasswordManagerMessage::None)
|
Message::PasswordManager(PasswordManagerMessage::None)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -312,72 +310,69 @@ impl PasswordManager {
|
||||||
.spacing(space_xxs),
|
.spacing(space_xxs),
|
||||||
);
|
);
|
||||||
|
|
||||||
if expanded
|
if expanded && let Some(input_state) = &self.input_state {
|
||||||
&& let Some(input_state) = &self.input_state {
|
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
||||||
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
widget::column::with_children(vec![
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::column::with_children(vec![
|
widget::text(fl!("password-input-description")).into(),
|
||||||
widget::text(fl!("password-input-description")).into(),
|
widget::text_input("", input_state.input.identifier.clone())
|
||||||
widget::text_input("", input_state.input.identifier.clone())
|
|
||||||
.on_input(move |text| {
|
|
||||||
Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::DescriptionInput(text),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.on_submit(move |text| {
|
|
||||||
Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::DescriptionInputAndUpdate(text),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.on_unfocus(Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::Update,
|
|
||||||
))
|
|
||||||
.into(),
|
|
||||||
])
|
|
||||||
.spacing(space_xxxs)
|
|
||||||
.into(),
|
|
||||||
widget::column::with_children(vec![
|
|
||||||
widget::text(fl!("password-input")).into(),
|
|
||||||
widget::secure_input(
|
|
||||||
"",
|
|
||||||
input_state.input.password.clone(),
|
|
||||||
Some(Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::ToggleShowPassword,
|
|
||||||
)),
|
|
||||||
!input_state.show_password,
|
|
||||||
)
|
|
||||||
.on_input(move |text| {
|
.on_input(move |text| {
|
||||||
Message::PasswordManager(PasswordManagerMessage::PasswordInput(
|
Message::PasswordManager(
|
||||||
text,
|
PasswordManagerMessage::DescriptionInput(text),
|
||||||
))
|
)
|
||||||
})
|
})
|
||||||
.on_submit(move |text| {
|
.on_submit(move |text| {
|
||||||
Message::PasswordManager(
|
Message::PasswordManager(
|
||||||
PasswordManagerMessage::PasswordInputAndUpdate(text),
|
PasswordManagerMessage::DescriptionInputAndUpdate(text),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.on_unfocus(Message::PasswordManager(
|
.on_unfocus(Message::PasswordManager(
|
||||||
PasswordManagerMessage::Update,
|
PasswordManagerMessage::Update,
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.spacing(space_xxxs)
|
.spacing(space_xxxs)
|
||||||
|
.into(),
|
||||||
|
widget::column::with_children(vec![
|
||||||
|
widget::text(fl!("password-input")).into(),
|
||||||
|
widget::secure_input(
|
||||||
|
"",
|
||||||
|
input_state.input.password.clone(),
|
||||||
|
Some(Message::PasswordManager(
|
||||||
|
PasswordManagerMessage::ToggleShowPassword,
|
||||||
|
)),
|
||||||
|
!input_state.show_password,
|
||||||
|
)
|
||||||
|
.on_input(move |text| {
|
||||||
|
Message::PasswordManager(PasswordManagerMessage::PasswordInput(
|
||||||
|
text,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.on_submit(move |text| {
|
||||||
|
Message::PasswordManager(
|
||||||
|
PasswordManagerMessage::PasswordInputAndUpdate(text),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.on_unfocus(Message::PasswordManager(PasswordManagerMessage::Update))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.padding([0, space_s])
|
.spacing(space_xxxs)
|
||||||
.spacing(space_xs),
|
.into(),
|
||||||
);
|
])
|
||||||
|
.padding([0, space_s])
|
||||||
|
.spacing(space_xs),
|
||||||
|
);
|
||||||
|
|
||||||
let padding = Padding {
|
let padding = Padding {
|
||||||
top: 0.0,
|
top: 0.0,
|
||||||
bottom: 0.0,
|
bottom: 0.0,
|
||||||
left: space_s.into(),
|
left: space_s.into(),
|
||||||
right: space_s.into(),
|
right: space_s.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
passwords_section =
|
passwords_section =
|
||||||
passwords_section.add(widget::container(expanded_section).padding(padding))
|
passwords_section.add(widget::container(expanded_section).padding(padding))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sections.push(passwords_section.into());
|
sections.push(passwords_section.into());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,10 +246,11 @@ impl ShortcutsConfig {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(default_action) = self.defaults.0.get(binding)
|
if let Some(default_action) = self.defaults.0.get(binding)
|
||||||
&& *default_action == reset_action {
|
&& *default_action == reset_action
|
||||||
// Remove binding that overrode a default
|
{
|
||||||
return false;
|
// Remove binding that overrode a default
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue