Revamp desktop usability and multiline fields
This commit is contained in:
@@ -57,7 +57,6 @@ pub enum UiAction {
|
||||
MoveEntry,
|
||||
CopyEntry,
|
||||
DeleteEntry,
|
||||
ToggleReveal,
|
||||
GenerateOtp,
|
||||
CopyOtp,
|
||||
ImportOtp,
|
||||
@@ -104,7 +103,6 @@ impl UiAction {
|
||||
Self::MoveEntry => "move-entry",
|
||||
Self::CopyEntry => "copy-entry",
|
||||
Self::DeleteEntry => "delete-entry",
|
||||
Self::ToggleReveal => "toggle-reveal",
|
||||
Self::GenerateOtp => "generate-otp",
|
||||
Self::CopyOtp => "copy-otp",
|
||||
Self::ImportOtp => "import-otp",
|
||||
@@ -173,7 +171,6 @@ pub struct ActionContext {
|
||||
pub switching_vault: bool,
|
||||
pub modal_open: bool,
|
||||
pub focused_field: bool,
|
||||
pub focused_sensitive: bool,
|
||||
pub focused_generatable: bool,
|
||||
pub focused_otp: bool,
|
||||
pub entry_path: bool,
|
||||
@@ -198,7 +195,12 @@ pub const ACTIONS: &[ActionSpec] = &[
|
||||
"Initialize Store…",
|
||||
None,
|
||||
),
|
||||
spec(UiAction::NewFolder, MenuGroup::File, "New Folder…", None),
|
||||
spec(
|
||||
UiAction::NewFolder,
|
||||
MenuGroup::File,
|
||||
"New Folder…",
|
||||
Some("⇧⌘N"),
|
||||
),
|
||||
spec(
|
||||
UiAction::Quit,
|
||||
MenuGroup::App,
|
||||
@@ -223,12 +225,17 @@ pub const ACTIONS: &[ActionSpec] = &[
|
||||
spec(UiAction::Undo, MenuGroup::Edit, "Undo", Some("⌘Z")),
|
||||
spec(UiAction::Redo, MenuGroup::Edit, "Redo", Some("⇧⌘Z")),
|
||||
spec(UiAction::Cut, MenuGroup::Edit, "Cut", Some("⌘X")),
|
||||
spec(UiAction::CopyField, MenuGroup::Entry, "Copy Field", None),
|
||||
spec(
|
||||
UiAction::CopyField,
|
||||
MenuGroup::Entry,
|
||||
"Copy Field",
|
||||
Some("⌘C"),
|
||||
),
|
||||
spec(
|
||||
UiAction::CopyEditedField,
|
||||
MenuGroup::Entry,
|
||||
"Copy Edited Field",
|
||||
None,
|
||||
Some("⌘C"),
|
||||
),
|
||||
spec(UiAction::Paste, MenuGroup::Edit, "Paste", Some("⌘V")),
|
||||
spec(UiAction::Find, MenuGroup::Edit, "Find", Some("⌘F")),
|
||||
@@ -255,9 +262,14 @@ pub const ACTIONS: &[ActionSpec] = &[
|
||||
UiAction::ReloadEntry,
|
||||
MenuGroup::Entry,
|
||||
"Reload Entry",
|
||||
None,
|
||||
Some("⇧⌘R"),
|
||||
),
|
||||
spec(
|
||||
UiAction::EditEntry,
|
||||
MenuGroup::Entry,
|
||||
"Edit Entry",
|
||||
Some("⌘E"),
|
||||
),
|
||||
spec(UiAction::EditEntry, MenuGroup::Entry, "Edit Entry", None),
|
||||
spec(
|
||||
UiAction::GeneratePassword,
|
||||
MenuGroup::Entry,
|
||||
@@ -272,12 +284,6 @@ pub const ACTIONS: &[ActionSpec] = &[
|
||||
),
|
||||
spec(UiAction::CopyEntry, MenuGroup::Entry, "Copy Entry…", None),
|
||||
spec(UiAction::DeleteEntry, MenuGroup::Entry, "Delete…", None),
|
||||
spec(
|
||||
UiAction::ToggleReveal,
|
||||
MenuGroup::Entry,
|
||||
"Reveal or Hide Field",
|
||||
None,
|
||||
),
|
||||
spec(
|
||||
UiAction::GenerateOtp,
|
||||
MenuGroup::Entry,
|
||||
@@ -434,12 +440,6 @@ pub fn enabled(action: UiAction, context: ActionContext) -> bool {
|
||||
&& !context.switching_vault
|
||||
&& !context.modal_open
|
||||
}
|
||||
UiAction::ToggleReveal => {
|
||||
context.unlocked
|
||||
&& context.document_open
|
||||
&& !context.switching_vault
|
||||
&& context.focused_sensitive
|
||||
}
|
||||
UiAction::GenerateOtp
|
||||
| UiAction::CopyOtp
|
||||
| UiAction::ShowOtpUri
|
||||
@@ -577,10 +577,6 @@ pub fn disabled_reason(action: UiAction, context: ActionContext) -> Option<&'sta
|
||||
UiAction::MoveEntry | UiAction::CopyEntry | UiAction::DeleteEntry => {
|
||||
"Close the current screen first"
|
||||
}
|
||||
UiAction::ToggleReveal if !context.unlocked => "Unlock an entry first",
|
||||
UiAction::ToggleReveal if !context.document_open => "Open an entry first",
|
||||
UiAction::ToggleReveal if !context.focused_sensitive => "Select a sensitive field first",
|
||||
UiAction::ToggleReveal => "Wait for vault validation",
|
||||
UiAction::GenerateOtp
|
||||
| UiAction::CopyOtp
|
||||
| UiAction::ShowOtpUri
|
||||
@@ -696,7 +692,6 @@ pub const fn aliases(action: UiAction) -> &'static [&'static str] {
|
||||
UiAction::MoveEntry => &["rename", "mv", "move folder"],
|
||||
UiAction::CopyEntry => &["duplicate entry", "copy folder", "pass cp"],
|
||||
UiAction::DeleteEntry => &["remove", "rm", "delete folder"],
|
||||
UiAction::ToggleReveal => &["show password", "hide password", "reveal field"],
|
||||
UiAction::GenerateOtp => &["totp", "hotp", "one time password"],
|
||||
UiAction::CopyOtp => &["copy totp", "copy hotp", "otp clipboard"],
|
||||
UiAction::ImportOtp => &["add otp", "scan qr", "import otpauth"],
|
||||
@@ -734,6 +729,7 @@ pub fn shortcut_action_for(
|
||||
}
|
||||
match key.as_ref() {
|
||||
keyboard::Key::Character(",") => Some(UiAction::Settings),
|
||||
keyboard::Key::Character("n" | "N") if modifiers.shift() => Some(UiAction::NewFolder),
|
||||
keyboard::Key::Character("n" | "N") => Some(UiAction::NewEntry),
|
||||
keyboard::Key::Character("o" | "O") => Some(UiAction::OpenFolder),
|
||||
keyboard::Key::Character("s" | "S") => Some(UiAction::Save),
|
||||
@@ -747,7 +743,9 @@ pub fn shortcut_action_for(
|
||||
keyboard::Key::Character("f" | "F") if modifiers.shift() => Some(UiAction::SearchContents),
|
||||
keyboard::Key::Character("f" | "F") => Some(UiAction::Find),
|
||||
keyboard::Key::Character("k" | "K") => Some(UiAction::CommandPalette),
|
||||
keyboard::Key::Character("r" | "R") if modifiers.shift() => Some(UiAction::ReloadEntry),
|
||||
keyboard::Key::Character("r" | "R") => Some(UiAction::Refresh),
|
||||
keyboard::Key::Character("e" | "E") => Some(UiAction::EditEntry),
|
||||
keyboard::Key::Character("l" | "L") => Some(UiAction::Lock),
|
||||
keyboard::Key::Character("m" | "M") => Some(UiAction::Minimize),
|
||||
_ => None,
|
||||
@@ -772,7 +770,6 @@ mod tests {
|
||||
switching_vault: false,
|
||||
modal_open: false,
|
||||
focused_field: true,
|
||||
focused_sensitive: true,
|
||||
focused_generatable: true,
|
||||
focused_otp: true,
|
||||
entry_path: true,
|
||||
@@ -804,7 +801,6 @@ mod tests {
|
||||
assert!(enabled(UiAction::CopyEditedField, ready));
|
||||
assert!(enabled(UiAction::GeneratePassword, ready));
|
||||
assert!(!enabled(UiAction::CopyField, ready));
|
||||
assert!(enabled(UiAction::ToggleReveal, ready));
|
||||
for action in [
|
||||
UiAction::GitStatus,
|
||||
UiAction::GitPull,
|
||||
@@ -844,7 +840,6 @@ mod tests {
|
||||
UiAction::Save,
|
||||
UiAction::CopyField,
|
||||
UiAction::CopyEditedField,
|
||||
UiAction::ToggleReveal,
|
||||
UiAction::GeneratePassword,
|
||||
UiAction::GenerateOtp,
|
||||
UiAction::CopyOtp,
|
||||
@@ -908,7 +903,6 @@ mod tests {
|
||||
UiAction::ReloadEntry,
|
||||
UiAction::EditEntry,
|
||||
UiAction::GeneratePassword,
|
||||
UiAction::ToggleReveal,
|
||||
UiAction::Find,
|
||||
UiAction::SearchContents,
|
||||
UiAction::MoveEntry,
|
||||
|
||||
Reference in New Issue
Block a user