feat: start work on edit mode
This commit is contained in:
parent
717aabb3d6
commit
a38b0ca3dc
1 changed files with 12 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ enum Message {
|
||||||
ChangeQuery(String),
|
ChangeQuery(String),
|
||||||
|
|
||||||
Copy,
|
Copy,
|
||||||
|
Edit,
|
||||||
|
|
||||||
FocusNext,
|
FocusNext,
|
||||||
FocusPrevious,
|
FocusPrevious,
|
||||||
|
|
@ -65,6 +66,8 @@ struct State {
|
||||||
selected_field: db::BasicField,
|
selected_field: db::BasicField,
|
||||||
query: String,
|
query: String,
|
||||||
|
|
||||||
|
editing_entry: Option<keepass::db::EntryId>,
|
||||||
|
|
||||||
status: Cow<'static, str>,
|
status: Cow<'static, str>,
|
||||||
error: Cow<'static, str>,
|
error: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
@ -182,6 +185,13 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Message::Edit => {
|
||||||
|
self.editing_entry = self
|
||||||
|
.db_view
|
||||||
|
.get(self.selected_entry)
|
||||||
|
.map(|entry| entry.id());
|
||||||
|
}
|
||||||
|
|
||||||
Message::FocusNext => return widget::operation::focus_next(),
|
Message::FocusNext => return widget::operation::focus_next(),
|
||||||
Message::FocusPrevious => return widget::operation::focus_previous(),
|
Message::FocusPrevious => return widget::operation::focus_previous(),
|
||||||
Message::FocusSearch => return widget::operation::focus("search"),
|
Message::FocusSearch => return widget::operation::focus("search"),
|
||||||
|
|
@ -404,6 +414,8 @@ impl State {
|
||||||
|
|
||||||
Key::Character("y" | "c") if db_loaded => Some(Message::Copy),
|
Key::Character("y" | "c") if db_loaded => Some(Message::Copy),
|
||||||
|
|
||||||
|
Key::Character("e") if db_loaded => Some(Message::Edit),
|
||||||
|
|
||||||
Key::Character("q") => Some(Message::Quit),
|
Key::Character("q") => Some(Message::Quit),
|
||||||
|
|
||||||
// ignore unused keys
|
// ignore unused keys
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue