feat: copying entry fields
This commit is contained in:
parent
95bfede1e0
commit
b7c5a05c6e
4 changed files with 420 additions and 476 deletions
27
src/db.rs
27
src/db.rs
|
|
@ -1,5 +1,32 @@
|
|||
use std::{fs, io};
|
||||
|
||||
#[derive(Clone, Copy, Default, PartialEq, Eq)]
|
||||
pub enum BasicField {
|
||||
Title,
|
||||
#[default]
|
||||
Username,
|
||||
Password,
|
||||
Url,
|
||||
}
|
||||
impl BasicField {
|
||||
pub fn next(&mut self) {
|
||||
*self = match self {
|
||||
Self::Title => Self::Username,
|
||||
Self::Username => Self::Password,
|
||||
Self::Password => Self::Url,
|
||||
Self::Url => Self::Title,
|
||||
}
|
||||
}
|
||||
pub fn previous(&mut self) {
|
||||
*self = match self {
|
||||
Self::Title => Self::Url,
|
||||
Self::Username => Self::Title,
|
||||
Self::Password => Self::Username,
|
||||
Self::Url => Self::Password,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_last_opened() -> io::Result<String> {
|
||||
Ok(fs::read_to_string(
|
||||
dirs::data_dir()
|
||||
|
|
|
|||
Loading…
Reference in a new issue