Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-release-src > by-pkgid > 75dfb168763e3ec546909347add00ead > files > 3

scim-1.4.4-9mdv2007.0.src.rpm

diff -uNr scim-1.4.4.orig/src/scim_hotkey.cpp scim-1.4.4/src/scim_hotkey.cpp
--- scim-1.4.4.orig/src/scim_hotkey.cpp	2006-06-07 16:03:32.961933656 +0800
+++ scim-1.4.4/src/scim_hotkey.cpp	2006-06-07 17:13:56.089920616 +0800
@@ -362,12 +362,30 @@
     if (config.null () || !config->valid ()) return;
 
     KeyEventList keys;
+    String lang = scim_get_locale_language (scim_get_current_locale ());
+    String userconf = scim_get_user_data_dir () + String (SCIM_PATH_DELIM_STRING) + String ("config");
+    bool userconf_exist = true;
+
+    //If this is the first time to run scim on a machine.
+    if (access (userconf.c_str (), R_OK) !=0)
+        userconf_exist = false;
 
     // Load the least important hotkeys first.
     for (int i = SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU; i >= SCIM_FRONTEND_HOTKEY_TRIGGER; --i) {
-        if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
-            m_impl->m_matcher.add_hotkeys (keys, i);
+        if (userconf_exist == false ) {
+            String config_paths = String (String (__scim_frontend_hotkey_config_paths [i]) + "/" + lang);
+            if (scim_string_to_key_list (keys, config->read (config_paths, String (__scim_frontend_hotkey_defaults [i]))))
+                m_impl->m_matcher.add_hotkeys (keys, i);
+            config->write (String (__scim_frontend_hotkey_config_paths [i]), 
+                    config->read (config_paths, String (__scim_frontend_hotkey_defaults [i])));
+        } else {
+            if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
+                m_impl->m_matcher.add_hotkeys (keys, i);
+        }
     }
+    
+    if (userconf_exist == false) 
+        config->flush ();
 }
 
 void