Keymap: remove item from user list, if the keymap isn't found

Fixes #4022.

When a user keymap was deleted in Tracker while the Keympas prefs
are open, the map is still visible in the list of user maps. It
just doesn't react on a click.

With this change, we just silently remove the item from the user map
list when it's clicked. Not totally nice (should I add a BAlert?),
but the suggested node monitoring for this seldomly encountered
situation is overkill, I think.

Change-Id: I5ea6dd2aa117f30a7be348a005a10f3757d52459
Reviewed-on: https://review.haiku-os.org/794
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Humdinger 2018-12-23 18:08:03 +01:00 committed by waddlesplash
parent 54782f4255
commit 16e5086044

View File

@ -305,7 +305,12 @@ KeymapWindow::MessageReceived(BMessage* message)
KeymapListItem* item KeymapListItem* item
= static_cast<KeymapListItem*>(listView->ItemAt(index)); = static_cast<KeymapListItem*>(listView->ItemAt(index));
if (item != NULL) { if (item != NULL) {
fCurrentMap.Load(item->EntryRef()); status_t status = fCurrentMap.Load(item->EntryRef());
if (status != B_OK) {
listView->RemoveItem(item);
break;
}
fAppliedMap = fCurrentMap; fAppliedMap = fCurrentMap;
fKeyboardLayoutView->SetKeymap(&fCurrentMap); fKeyboardLayoutView->SetKeymap(&fCurrentMap);
_UseKeymap(); _UseKeymap();