feat(core): add search bar context menu entry

This commit is contained in:
Federico Terzi 2021-08-13 20:39:00 +02:00
parent 80a197376c
commit 5c06699a80

View File

@ -31,6 +31,7 @@ const CONTEXT_ITEM_ENABLE: u32 = 2;
const CONTEXT_ITEM_DISABLE: u32 = 3;
const CONTEXT_ITEM_SECURE_INPUT_EXPLAIN: u32 = 4;
const CONTEXT_ITEM_SECURE_INPUT_TRIGGER_WORKAROUND: u32 = 5;
const CONTEXT_ITEM_OPEN_SEARCH: u32 = 6;
pub struct ContextMenuMiddleware {
is_enabled: RefCell<bool>,
@ -71,6 +72,10 @@ impl Middleware for ContextMenuMiddleware {
label: "Enable".to_string(),
}
}),
MenuItem::Simple(SimpleMenuItem {
id: CONTEXT_ITEM_OPEN_SEARCH,
label: "Open search bar".to_string(),
}),
MenuItem::Separator,
MenuItem::Simple(SimpleMenuItem {
id: CONTEXT_ITEM_RELOAD,
@ -133,6 +138,10 @@ impl Middleware for ContextMenuMiddleware {
dispatch(Event::caused_by(event.source_id, EventType::LaunchSecureInputAutoFix));
Event::caused_by(event.source_id, EventType::NOOP)
}
CONTEXT_ITEM_OPEN_SEARCH => {
dispatch(Event::caused_by(event.source_id, EventType::ShowSearchBar));
Event::caused_by(event.source_id, EventType::NOOP)
}
custom => {
// TODO: handle dynamic items
todo!()