mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibGUI: Move editing key handling up to AbstractView
We want all views to respond to the editing key as long as the relevant edit trigger is activated.
This commit is contained in:
parent
ece555b684
commit
f52527ef9c
Notes:
sideshowbarker
2024-07-19 02:15:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f52527ef9cd
3 changed files with 8 additions and 16 deletions
|
@ -447,6 +447,14 @@ void AbstractView::set_edit_triggers(unsigned triggers)
|
|||
|
||||
void AbstractView::keydown_event(KeyEvent& event)
|
||||
{
|
||||
if (event.key() == KeyCode::Key_F2) {
|
||||
if (is_editable() && edit_triggers() & EditTrigger::EditKeyPressed) {
|
||||
begin_editing(cursor_index());
|
||||
event.accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SelectionUpdate selection_update = SelectionUpdate::Set;
|
||||
if (event.modifiers() == KeyModifier::Mod_Shift) {
|
||||
selection_update = SelectionUpdate::Shift;
|
||||
|
|
|
@ -610,14 +610,6 @@ void IconView::keydown_event(KeyEvent& event)
|
|||
if (!m_visual_row_count || !m_visual_column_count)
|
||||
return;
|
||||
|
||||
if (event.key() == KeyCode::Key_F2) {
|
||||
if (is_editable() && edit_triggers() & EditTrigger::EditKeyPressed) {
|
||||
begin_editing(cursor_index());
|
||||
event.accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
activate_selected();
|
||||
return;
|
||||
|
|
|
@ -166,14 +166,6 @@ void TableView::keydown_event(KeyEvent& event)
|
|||
if (!model())
|
||||
return;
|
||||
|
||||
if (event.key() == KeyCode::Key_F2) {
|
||||
if (is_editable() && edit_triggers() & EditTrigger::EditKeyPressed) {
|
||||
begin_editing(cursor_index());
|
||||
event.accept();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
activate(cursor_index());
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue