Add desktop store and entry creation workflows
This commit is contained in:
@@ -35,6 +35,21 @@ impl EntryEditor {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_entry(
|
||||
document: EntryDocument,
|
||||
password: SecretBytes,
|
||||
) -> Result<Self, DocumentError> {
|
||||
let mut editor = Self::new(document);
|
||||
editor.add_after(None)?;
|
||||
let id = editor
|
||||
.focused
|
||||
.expect("new entry receives its password field");
|
||||
if !password.expose().is_empty() {
|
||||
editor.replace_value(id, password)?;
|
||||
}
|
||||
Ok(editor)
|
||||
}
|
||||
|
||||
pub fn entry(&self) -> String {
|
||||
self.document.path().to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user