KeyboardSettings: Also activate keymap via ListView's on_activation

This commit is contained in:
Romain Chardiny 2022-04-18 00:07:01 +02:00 committed by Linus Groh
parent 0317882b61
commit 6ed2ded77c
Notes: sideshowbarker 2024-07-18 04:38:32 +09:00
2 changed files with 12 additions and 1 deletions

View File

@ -181,7 +181,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
keymaps_list_model.set_active_keymap(m_initial_active_keymap);
m_activate_keymap_button = find_descendant_of_type_named<GUI::Button>("activate_keymap_button");
m_activate_keymap_button->on_click = [&](auto) {
m_activate_keymap_event = [&]() {
auto& selection = m_selected_keymaps_listview->selection();
if (!selection.is_empty()) {
auto& selected_keymap = keymaps_list_model.keymap_at(selection.first().row());
@ -189,6 +190,14 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
}
};
m_activate_keymap_button->on_click = [&](auto) {
m_activate_keymap_event();
};
m_selected_keymaps_listview->on_activation = [&](auto) {
m_activate_keymap_event();
};
m_add_keymap_button = find_descendant_of_type_named<GUI::Button>("add_keymap_button");
m_add_keymap_button->on_click = [&](auto) {

View File

@ -40,4 +40,6 @@ private:
RefPtr<GUI::Button> m_remove_keymap_button;
RefPtr<GUI::TextEditor> m_test_typing_area;
RefPtr<GUI::Button> m_clear_test_typing_area_button;
Function<void()> m_activate_keymap_event;
};