mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
KeyboardSettings: Also activate keymap via ListView's on_activation
This commit is contained in:
parent
0317882b61
commit
6ed2ded77c
2 changed files with 12 additions and 1 deletions
|
@ -181,7 +181,8 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
|
||||||
keymaps_list_model.set_active_keymap(m_initial_active_keymap);
|
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 = 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();
|
auto& selection = m_selected_keymaps_listview->selection();
|
||||||
if (!selection.is_empty()) {
|
if (!selection.is_empty()) {
|
||||||
auto& selected_keymap = keymaps_list_model.keymap_at(selection.first().row());
|
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 = find_descendant_of_type_named<GUI::Button>("add_keymap_button");
|
||||||
|
|
||||||
m_add_keymap_button->on_click = [&](auto) {
|
m_add_keymap_button->on_click = [&](auto) {
|
||||||
|
|
|
@ -40,4 +40,6 @@ private:
|
||||||
RefPtr<GUI::Button> m_remove_keymap_button;
|
RefPtr<GUI::Button> m_remove_keymap_button;
|
||||||
RefPtr<GUI::TextEditor> m_test_typing_area;
|
RefPtr<GUI::TextEditor> m_test_typing_area;
|
||||||
RefPtr<GUI::Button> m_clear_test_typing_area_button;
|
RefPtr<GUI::Button> m_clear_test_typing_area_button;
|
||||||
|
|
||||||
|
Function<void()> m_activate_keymap_event;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue