Author: axeld Date: 2011-07-10 23:02:12 +0200 (Sun, 10 Jul 2011) New Revision: 42404 Changeset: https://dev.haiku-os.org/changeset/42404 Ticket: https://dev.haiku-os.org/ticket/7765 Modified: haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp Log: * Provided a way to define language keymap mappings, and used them to solve bug #7765, ie. don't use the Dutch keymap but prefer US-International. Modified: haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp =================================================================== --- haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp 2011-07-10 16:21:09 UTC (rev 42403) +++ haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp 2011-07-10 21:02:12 UTC (rev 42404) @@ -47,6 +47,7 @@ MSG_KEYMAP_SELECTED = 'kmps' }; + #undef B_TRANSLATE_CONTEXT #define B_TRANSLATE_CONTEXT "BootPromptWindow" @@ -56,6 +57,15 @@ }; +static const char* kLanguageKeymapMappings[] = { + // While there is a "Dutch" keymap, it apparently has not been widely + // adopted, and the US-International keymap is common + "Dutch", "US-International" +}; +static const size_t kLanguageKeymapMappingsSize + = sizeof(kLanguageKeymapMappings) / sizeof(kLanguageKeymapMappings[0]); + + class LanguageItem : public BStringItem { public: LanguageItem(const char* label, const char* language) @@ -453,6 +463,14 @@ if (language.GetName(name, &english) != B_OK) return fDefaultKeymapItem; + // Check special mappings first + for (size_t i = 0; i < kLanguageKeymapMappingsSize; i += 2) { + if (!strcmp(name, kLanguageKeymapMappings[i])) { + name = kLanguageKeymapMappings[i + 1]; + break; + } + } + BMenu* menu = fKeymapsMenuField->Menu(); for (int32 i = 0; i < menu->CountItems(); i++) { BMenuItem* item = menu->ItemAt(i);