scim-initial-locale-hotkey-20070922.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132
  1. --- scim-1.4.5/src/scim_hotkey.cpp.8-hotkey~ 2005-06-18 23:19:35.000000000 +1000
  2. +++ scim-1.4.5/src/scim_hotkey.cpp 2007-04-17 10:15:41.000000000 +1000
  3. @@ -362,11 +362,26 @@
  4. if (config.null () || !config->valid ()) return;
  5. KeyEventList keys;
  6. + String lang = scim_get_locale_language (scim_get_current_locale ());
  7. + String userconf = scim_get_user_data_dir () + String (SCIM_PATH_DELIM_STRING) + String ("config");
  8. + bool userconf_exist = true;
  9. +
  10. + //If this is the first time to run scim on a machine.
  11. + if (access (userconf.c_str (), R_OK) !=0)
  12. + userconf_exist = false;
  13. // Load the least important hotkeys first.
  14. for (int i = SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU; i >= SCIM_FRONTEND_HOTKEY_TRIGGER; --i) {
  15. - if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
  16. - m_impl->m_matcher.add_hotkeys (keys, i);
  17. + if (userconf_exist == false ) {
  18. + String config_paths = String (__scim_frontend_hotkey_config_paths [i]) + "/" + lang;
  19. + if (scim_string_to_key_list (keys, config->read (config_paths, String (__scim_frontend_hotkey_defaults [i]))))
  20. + m_impl->m_matcher.add_hotkeys (keys, i);
  21. + config->write (String (__scim_frontend_hotkey_config_paths [i]),
  22. + config->read (config_paths, String (__scim_frontend_hotkey_defaults [i])));
  23. + } else {
  24. + if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
  25. + m_impl->m_matcher.add_hotkeys (keys, i);
  26. + }
  27. }
  28. }