Fix bug where the dictionary selection was changed to invalid

This didn't happen the first time MotGuiWindow::updateLanguageSelectionUi
was called, but every time after that.
Clean up AcceleratorAssigner to use algorithms
Use the typedef in PreferredLanguagesList properly
Prevent undefined behavior

If the value is not found, qLowerBound returns the iterator the value
should be inserted at. In case that is the end of the container, trying
to read the value of the iterator results in undefined behavior.