diff options
author | Arda Cinar <kuzux92@gmail.com> | 2022-12-09 16:02:09 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-10 12:00:30 +0000 |
commit | 6361584d4a92c351f4f66ddf7b7924beb11e55ae (patch) | |
tree | 66049945e8c5ee37121f1c09807aa7740f7eb09d /Userland | |
parent | 0e90b0921e309c7cf87554d39d84476624e39beb (diff) | |
download | serenity-6361584d4a92c351f4f66ddf7b7924beb11e55ae.zip |
KeyboardSettings: Disable "activate keymap" button if keymap is active
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index e87952cad5..74e4305681 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -228,7 +228,13 @@ KeyboardSettingsWidget::KeyboardSettingsWidget() m_selected_keymaps_listview->on_selection_change = [&]() { auto& selection = m_selected_keymaps_listview->selection(); m_remove_keymap_button->set_enabled(!selection.is_empty() && keymaps_list_model.keymaps().size() > 1); - m_activate_keymap_button->set_enabled(!selection.is_empty()); + if (selection.is_empty()) { + m_activate_keymap_button->set_enabled(false); + } else { + auto& highlighted_keymap = keymaps_list_model.keymap_at(selection.first().row()); + auto& active_keymap = keymaps_list_model.active_keymap(); + m_activate_keymap_button->set_enabled(highlighted_keymap != active_keymap); + } }; m_test_typing_area = *find_descendant_of_type_named<GUI::TextEditor>("test_typing_area"); |