Replace uuid with appid and Insert initial DB. 93/41193/2
authorSungmin Kwak <sungmin.kwak@samsung.com>
Fri, 9 Jan 2015 04:40:29 +0000 (13:40 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Wed, 17 Jun 2015 08:52:59 +0000 (16:52 +0800)
Change-Id: I1d64f1b59e6ce13dac19382f184453614735733d

ism/configs/global
ism/extras/efl_panel/iseselector.cpp
ism/extras/efl_panel/isf_panel_efl.cpp
ism/extras/efl_panel/isf_panel_utility.cpp
ism/modules/frontend/scim_socket_frontend.cpp
ism/modules/imengine/scim_socket_imengine.cpp
ism/src/isf_query_utility.cpp
ism/src/scim_backend.cpp
packaging/isf.spec

index 1f8ddd7..45e6832 100755 (executable)
@@ -9,7 +9,7 @@
 /DefaultHelperManagerSocketAddress = local:/tmp/scim-socket-frontend
 /DefaultSocketTimeout = 5000
 /InitialIseType = 1
-/InitialIseUuid = 12aa3425-f88d-45f4-a509-cee8dfe904e3
+/InitialIseUuid = com.samsung.ise-multilingual-lite
 /InitialIseName = Tizen Keyboard
 /PreloadKeyboardIse = true
 /LaunchIseOnRequest = false
index 9e4584d..ed77ffc 100644 (file)
@@ -123,7 +123,7 @@ gl_ise_selected_cb (void *data, Evas_Object *obj, void *event_info)
         return;
     }
 
-    LOGD ("Set active ISE : %s\n", _ime_info[index].uuid.c_str ());
+    LOGD ("Set active ISE : %s\n", _ime_info[index].appid.c_str ());
 
     if (_ise_selector_selected_cb)
         _ise_selector_selected_cb (index);
index ef6a63e..da5c46a 100644 (file)
@@ -581,7 +581,7 @@ static void minictrl_clicked_cb (void *data, Evas_Object *o, const char *emissio
 
 static void ise_selected_cb (unsigned int index)
 {
-    set_active_ise (_ime_info[index].uuid, _soft_keyboard_launched);
+    set_active_ise (_ime_info[index].appid, _soft_keyboard_launched);
     _ise_launch_timer = ecore_timer_add (ISE_LAUNCH_TIMEOUT, ise_launch_timeout, NULL);
 }
 
@@ -1022,7 +1022,7 @@ static unsigned int get_ise_index (const String uuid)
     unsigned int index = 0;
     if (uuid.length () > 0) {
         for (unsigned int i = 0; i < _ime_info.size (); i++) {
-            if (uuid == _ime_info[i].uuid) {
+            if (uuid == _ime_info[i].appid) {
                 index = i;
                 break;
             }
@@ -1150,11 +1150,10 @@ static void delete_ise_directory_em (void) {
  * @brief Set keyboard ISE.
  *
  * @param uuid The keyboard ISE's uuid.
- * @param module_name The keyboard ISE's module name.
  *
  * @return false if keyboard ISE change is failed, otherwise return true.
  */
-static bool set_keyboard_ise (const String &uuid, const String &module_name)
+static bool set_keyboard_ise (const String &uuid)
 {
     SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
 
@@ -1185,12 +1184,11 @@ static bool set_keyboard_ise (const String &uuid, const String &module_name)
  * @brief Set helper ISE.
  *
  * @param uuid The helper ISE's uuid.
- * @param module_name The helper ISE's module name.
  * @param launch_ise The flag for launching helper ISE.
  *
  * @return false if helper ISE change is failed, otherwise return true.
  */
-static bool set_helper_ise (const String &uuid, const String &module_name, bool launch_ise)
+static bool set_helper_ise (const String &uuid, bool launch_ise)
 {
     SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
 
@@ -1235,11 +1233,11 @@ static bool set_active_ise (const String &uuid, bool launch_ise)
     bool ise_changed = false;
 
     for (unsigned int i = 0; i < _ime_info.size (); i++) {
-        if (!uuid.compare (_ime_info[i].uuid)) {
+        if (!uuid.compare (_ime_info[i].appid)) {
             if (TOOLBAR_KEYBOARD_MODE == _ime_info[i].mode)
-                ise_changed = set_keyboard_ise (_ime_info[i].uuid, _ime_info[i].module_name);
+                ise_changed = set_keyboard_ise (_ime_info[i].appid);
             else if (TOOLBAR_HELPER_MODE == _ime_info[i].mode)
-                ise_changed = set_helper_ise (_ime_info[i].uuid, _ime_info[i].module_name, launch_ise);
+                ise_changed = set_helper_ise (_ime_info[i].appid, launch_ise);
             _panel_agent->set_current_toolbar_mode (_ime_info[i].mode);
             if (ise_changed) {
                 _panel_agent->set_current_helper_option (_ime_info[i].options);
@@ -1254,7 +1252,7 @@ static bool set_active_ise (const String &uuid, bool launch_ise)
                 if (_candidate_window)
                     ui_create_candidate_window ();
 
-                scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _ime_info[i].uuid);
+                scim_global_config_write (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _ime_info[i].appid);
                 scim_global_config_flush ();
 
                 _config->flush ();
@@ -3383,30 +3381,33 @@ static bool update_ise_list (std::vector<String> &list)
     }
 
     for (iter = _ime_info.begin (); iter != _ime_info.end (); iter++) {
-        uuids.push_back(iter->uuid);
+        uuids.push_back(iter->appid);
         modes.push_back(iter->mode);
     }
-    list.clear ();
-    list = uuids;
 
-    _panel_agent->update_ise_list (list);
+    if (uuids.size() > 0) {
+        list.clear ();
+        list = uuids;
 
-    if (_initial_ise_uuid.length () > 0) {
-        String active_uuid   = _initial_ise_uuid;
-        String default_uuid  = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
-        if (std::find (uuids.begin (), uuids.end (), default_uuid) == uuids.end ()) {
-            if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (modes[get_ise_index (_initial_ise_uuid)] != TOOLBAR_KEYBOARD_MODE)) {
-                active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
-            }
-            set_active_ise (active_uuid, _soft_keyboard_launched);
-        } else if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {    // Check whether keyboard engine is installed
-            String IMENGINE_KEY  = String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + String ("~other");
-            String keyboard_uuid = _config->read (IMENGINE_KEY, String (""));
-            if (std::find (uuids.begin (), uuids.end (), keyboard_uuid) == uuids.end ()) {
-                active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
-                _panel_agent->change_factory (active_uuid);
-                _config->write (IMENGINE_KEY, active_uuid);
-                _config->flush ();
+        _panel_agent->update_ise_list (list);
+
+        if (_initial_ise_uuid.length () > 0) {
+            String active_uuid   = _initial_ise_uuid;
+            String default_uuid  = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
+            if (std::find (uuids.begin (), uuids.end (), default_uuid) == uuids.end ()) {
+                if ((_panel_agent->get_current_toolbar_mode () == TOOLBAR_KEYBOARD_MODE) && (modes[get_ise_index (_initial_ise_uuid)] != TOOLBAR_KEYBOARD_MODE)) {
+                    active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
+                }
+                set_active_ise (active_uuid, _soft_keyboard_launched);
+            } else if (_panel_agent->get_current_toolbar_mode () == TOOLBAR_HELPER_MODE) {    // Check whether keyboard engine is installed
+                String IMENGINE_KEY  = String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + String ("~other");
+                String keyboard_uuid = _config->read (IMENGINE_KEY, String (""));
+                if (std::find (uuids.begin (), uuids.end (), keyboard_uuid) == uuids.end ()) {
+                    active_uuid = String (SCIM_COMPOSE_KEY_FACTORY_UUID);
+                    _panel_agent->change_factory (active_uuid);
+                    _config->write (IMENGINE_KEY, active_uuid);
+                    _config->flush ();
+                }
             }
         }
     }
@@ -4488,7 +4489,7 @@ static bool slot_get_ise_list (std::vector<String> &list)
 
     std::vector<String> uuids;
     for (std::vector<ImeInfoDB>::iterator iter = _ime_info.begin(); iter != _ime_info.end(); iter++) {
-        uuids.push_back(iter->uuid);
+        uuids.push_back(iter->appid);
     }
     if (_ime_info.size () > 0) {
         list =  uuids;
@@ -4522,7 +4523,7 @@ static bool slot_get_ise_information (String uuid, String &name, String &languag
         update_ise_locale ();
 
         for (unsigned int i = 0; i < _ime_info.size (); i++) {
-            if (uuid == _ime_info[i].uuid) {
+            if (uuid == _ime_info[i].appid) {
                 name = _ime_info[i].label;
                 language = _ime_info[i].languages;
                 type  = _ime_info[i].mode;
@@ -4626,8 +4627,8 @@ static bool slot_get_ise_info (const String &uuid, ISE_INFO &info)
     SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
 
     for (unsigned int i = 0; i < _ime_info.size (); i++) {
-        if (!uuid.compare (_ime_info[i].uuid)) {
-            info.uuid   = _ime_info[i].uuid;
+        if (!uuid.compare (_ime_info[i].appid)) {
+            info.uuid   = _ime_info[i].appid;
             info.name   = _ime_info[i].label;
             info.icon   = _ime_info[i].iconpath;
             info.lang   = _ime_info[i].languages;
@@ -4652,7 +4653,7 @@ static void slot_set_keyboard_ise (const String &uuid)
     std::vector<String> uuids;
     std::vector<ImeInfoDB>::iterator iter;
     for (iter = _ime_info.begin(); iter != _ime_info.end(); iter++) {
-        uuids.push_back(iter->uuid);
+        uuids.push_back(iter->appid);
     }
 
     if (uuid.length () <= 0 || std::find (uuids.begin (), uuids.end (), uuid) == uuids.end ())
@@ -5173,8 +5174,8 @@ static void change_keyboard_mode (TOOLBAR_MODE_T mode)
                     scim_split_string_list (ise_langs, helper_language);
                     for (size_t i = 0; i < _groups[ise_langs[0]].size (); ++i) {
                         int j = _groups[ise_langs[0]][i];
-                        if (_ime_info[j].uuid != uuid && _ime_info[j].mode == TOOLBAR_KEYBOARD_MODE) {
-                            uuid = _ime_info[j].uuid;
+                        if (_ime_info[j].appid != uuid && _ime_info[j].mode == TOOLBAR_KEYBOARD_MODE) {
+                            uuid = _ime_info[j].appid;
                             break;
                         }
                     }
index 802fe9d..0b06fd9 100644 (file)
@@ -89,8 +89,8 @@ void isf_get_keyboard_ise (const ConfigPointer &config, String &ise_uuid, String
     if (ise_uuid.length () > 0)
         uuid = ise_uuid;
     for (unsigned int i = 0; i < _ime_info.size (); i++) {
-        if (uuid == _ime_info[i].uuid) {
-            ise_uuid = _ime_info[i].uuid;
+        if (uuid == _ime_info[i].appid) {
+            ise_uuid = _ime_info[i].appid;
             ise_name = _ime_info[i].label;
             ise_option = _ime_info[i].options;
             return;
@@ -124,8 +124,8 @@ void isf_get_keyboard_ises_in_languages (const std::vector<String> &lang_list,
                     continue;
                 if (bCheckOption && (_ime_info[it->second[i]].options & SCIM_IME_NOT_SUPPORT_HARDWARE_KEYBOARD))
                     continue;
-                if (std::find (uuid_list.begin (), uuid_list.end (), _ime_info[it->second[i]].uuid) == uuid_list.end ()) {
-                    uuid_list.push_back (_ime_info[it->second[i]].uuid);
+                if (std::find (uuid_list.begin (), uuid_list.end (), _ime_info[it->second[i]].appid) == uuid_list.end ()) {
+                    uuid_list.push_back (_ime_info[it->second[i]].appid);
                     name_list.push_back (_ime_info[it->second[i]].label);
                 }
             }
@@ -152,8 +152,8 @@ void isf_get_helper_ises_in_languages (const std::vector<String> &lang_list, std
                 if (_ime_info[it->second[i]].mode != TOOLBAR_HELPER_MODE)
                     continue;
                 // Avoid to add the same ISE
-                if (std::find (uuid_list.begin (), uuid_list.end (), _ime_info[it->second[i]].uuid) == uuid_list.end ()) {
-                    uuid_list.push_back (_ime_info[it->second[i]].uuid);
+                if (std::find (uuid_list.begin (), uuid_list.end (), _ime_info[it->second[i]].appid) == uuid_list.end ()) {
+                    uuid_list.push_back (_ime_info[it->second[i]].appid);
                     name_list.push_back (_ime_info[it->second[i]].label);
                 }
             }
index 4f67067..49531aa 100644 (file)
@@ -170,7 +170,6 @@ void SocketFrontEnd::load_helper_modules (const std::vector<String> &load_engine
 
     if (mod_list.size ()) {
         HelperInfo           info;
-        std::vector<String>  tmp_list;
         std::vector<ImeInfoDB> ime_info;
 
         isf_db_select_all_ime_info(ime_info);
@@ -179,13 +178,12 @@ void SocketFrontEnd::load_helper_modules (const std::vector<String> &load_engine
             if (ime_info[i].mode == TOOLBAR_KEYBOARD_MODE)
                 continue;
             if (std::find (mod_list.begin (), mod_list.end (), ime_info[i].module_name) != mod_list.end ()) {
-                info.uuid   = ime_info[i].uuid;
+                info.uuid   = ime_info[i].appid;
                 info.name   = ime_info[i].label;
                 info.icon   = ime_info[i].iconpath;
                 info.option = ime_info[i].options;
                 SCIM_DEBUG_MAIN (3) << "  " << info.uuid << ": " << info.name << "\n";
                 __helpers.push_back (std::make_pair (info, ime_info[i].module_name));
-                tmp_list.push_back (ime_info[i].module_name);
             }
         }
     }
index 7592c0b..342894e 100644 (file)
@@ -207,7 +207,7 @@ SocketIMEngineGlobal::init ()
     for (it = ime_info.begin(); it != ime_info.end(); it++) {
         if (it->mode == TOOLBAR_KEYBOARD_MODE) {
             info.name = it->label;
-            info.uuid = it->uuid;
+            info.uuid = it->appid;
             info.module = it->module_name;
             info.language = it->languages;
             info.icon = it->iconpath;
@@ -215,8 +215,8 @@ SocketIMEngineGlobal::init ()
             info.option = it->options;
             info.locales = "";
 
-            m_peer_factories.push_back (it->uuid);
-            ise_info_repository[it->uuid] = info;
+            m_peer_factories.push_back (it->appid);
+            ise_info_repository[it->appid] = info;
         }
     }
 }
index e3c70af..ecf33ad 100644 (file)
@@ -63,20 +63,20 @@ using namespace scim;
  * DB Table schema
  *
  * ime_info
- * +-------+------+-------+-----------+-----------+-------+-------------+-----------+-----------+
- * | appid | uuid | label | languages | iconpath  | pkgid | pkgrootpath |  pkgtype  |  kbdtype  |
- * +-------+------+-------+-----------+-----------+-------+-------------+-----------+-----------+
- * |   -   |  -   |   -   |     -     |   -       |   -   |     -       |     -     |      -    |
- * +-------+------+-------+-----------+-----------+-------+-------------+-----------+-----------+
+ * +-------+------+-------+-----------+-----------+-------+-------------+-----------+
+ * | appid | uuid | label | languages | iconpath  | pkgid | pkgrootpath |  pkgtype  |
+ * +-------+------+-------+-----------+-----------+-------+-------------+-----------+
+ * |   -   |  -   |   -   |     -     |   -       |   -   |     -       |     -     |
+ * +-------+------+-------+-----------+-----------+-------+-------------+-----------+
  *
- * CREATE TABLE ime_info ( appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT, kbdtype TEXT)
+ * CREATE TABLE ime_info ( appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT)
  *
  */
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // DATABASE
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-#define DB_PATH "/opt/usr/dbspace/.ime_parser.db"
+#define DB_PATH "/opt/usr/dbspace/.ime_info.db"
 static struct {
     const char* pPath;
     sqlite3* pHandle;
@@ -153,10 +153,11 @@ static inline int _commit_transaction(void)
 static inline int _db_create_ime_info(void)
 {
        char* pException = NULL;
-       static const char* pQuery = "CREATE TABLE ime_info (appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT, kbdtype TEXT)";
+       static const char* pQuery = "CREATE TABLE ime_info (appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT)";
 
        if (sqlite3_exec(databaseInfo.pHandle, pQuery, NULL, NULL, &pException) != SQLITE_OK) {
                LOGE("%s", pException);
+               sqlite3_free(pException);
                return -EIO;
        }
 
@@ -186,7 +187,7 @@ static inline int _db_init(void)
 
        int ret = db_util_open(databaseInfo.pPath, &databaseInfo.pHandle, DB_UTIL_REGISTER_HOOK_METHOD);
        if (ret != SQLITE_OK) {
-               LOGE("sqlite3 return code: %d", ret);
+               LOGE("db_util_open returned code: %d", ret);
                return -EIO;
        }
 
@@ -250,7 +251,7 @@ static inline int _db_insert_ime_info(std::vector<ImeInfoDB> &ime_info)
        int ret = 0, i = 0;
        sqlite3_stmt* pStmt = NULL;
        std::vector<ImeInfoDB>::iterator iter;
-       static const char* pQuery = "INSERT INTO ime_info (appid, uuid, label, languages, iconpath, pkgid, pkgrootpath, pkgtype, kbdtype) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+       static const char* pQuery = "INSERT INTO ime_info (appid, uuid, label, languages, iconpath, pkgid, pkgrootpath, pkgtype) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
 
        ret = sqlite3_prepare_v2(databaseInfo.pHandle, pQuery, -1, &pStmt, NULL);
        if (ret != SQLITE_OK) {
@@ -313,16 +314,21 @@ static inline int _db_insert_ime_info(std::vector<ImeInfoDB> &ime_info)
                        goto out;
                }
 
-               if (sqlite3_step(pStmt) != SQLITE_DONE) {
-                       LOGE("sqlite3_step: %s", sqlite3_errmsg(databaseInfo.pHandle));
+               ret = sqlite3_step(pStmt);
+               if (ret != SQLITE_DONE) {
+                       char buf[256] = {0};
+                       snprintf (buf, sizeof (buf), "pid:%d    %s      %s      sqlite3_step returned %d, %s\n",
+                               getpid (), __FILE__, __func__, ret, sqlite3_errmsg(databaseInfo.pHandle));
+                       isf_save_log(buf);
+                       LOGE("sqlite3_step returned %d, %s", ret, sqlite3_errmsg(databaseInfo.pHandle));
                        ret = SQLITE_ERROR;
                        goto out;
                }
                else {
-                       LOGD("Insert \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
+                       LOGD("Insert \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
                                iter->appid.c_str(), iter->uuid.c_str(), iter->label.c_str(), iter->languages.c_str(),
-                               iter->iconpath.c_str(), iter->pkgid.c_str(), iter->pkgrootpath.c_str(), iter->pkgtype.c_str(),
-                               iter->kbdtype.c_str());
+                               iter->iconpath.c_str(), iter->pkgid.c_str(), iter->pkgrootpath.c_str(), iter->pkgtype.c_str());
+                       ret = SQLITE_OK;
                }
                sqlite3_reset(pStmt);
                sqlite3_clear_bindings(pStmt);
@@ -380,7 +386,11 @@ static inline int _db_update_label_ime_info(const char *appid, const char *label
 
        ret = sqlite3_step(pStmt);
        if (ret != SQLITE_DONE) {
-               LOGE("sqlite3_step: %s", sqlite3_errmsg(databaseInfo.pHandle));
+               char buf[256] = {0};
+               snprintf (buf, sizeof (buf), "pid:%d    %s      %s      sqlite3_step returned %d, %s\n",
+                       getpid (), __FILE__, __func__, ret, sqlite3_errmsg(databaseInfo.pHandle));
+               isf_save_log(buf);
+               LOGE("sqlite3_step returned %d, %s", ret, sqlite3_errmsg(databaseInfo.pHandle));
                ret = 0;
        }
        else {
@@ -395,7 +405,15 @@ out:
        return ret;
 }
 
-static int filtered_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
+/**
+ * @brief Read data from ime category manifest and insert initial db
+ *
+ * @param handle       pkgmgrinfo_appinfo_h pointer
+ * @param user_data    The data to pass to this callback.
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.
+ */
+static int _filtered_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
 {
        int ret = 0;
        char *appid = NULL, *icon = NULL, *pkgid = NULL, *pkgtype = NULL, *label = NULL, *path = NULL;
@@ -440,6 +458,8 @@ static int filtered_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_d
        }
 
        ime_db.languages = String("en");
+// TODO: Need to remove these after replace uuid with appid...
+       ime_db.uuid = ime_db.appid;
 
        ime_info.push_back(ime_db);
        _db_insert_ime_info(ime_info);
@@ -465,7 +485,6 @@ static inline int _db_select_all_ime_info(std::vector<ImeInfoDB> &ime_info)
        size_t found = 0;
        static const char* pQuery = "SELECT * FROM ime_info";
 
-
        do {
                if (i == 0) {
                        ret = sqlite3_prepare_v2(databaseInfo.pHandle, pQuery, -1, &pStmt, NULL);
@@ -485,28 +504,30 @@ static inline int _db_select_all_ime_info(std::vector<ImeInfoDB> &ime_info)
                        info.pkgid = String((char *)sqlite3_column_text(pStmt, 5));
                        info.pkgrootpath = String((char *)sqlite3_column_text(pStmt, 6));
                        info.pkgtype = String((char *)sqlite3_column_text(pStmt, 7));
-                       info.kbdtype = String((char *)sqlite3_column_text(pStmt, 8));
 
-                       LOGD("appid=\"%s\", uuid=\"%s\", label=\"%s\", languages=\"%s\", iconpath=\"%s\", pkgid=\"%s\", pkgrootpath=\"%s\", pkgtype=\"%s\", kbdtype=\"%s\"",
-                               info.appid.c_str(),
-                               info.uuid.c_str(),
-                               info.label.c_str(),
-                               info.languages.c_str(),
-                               info.iconpath.c_str(),
-                               info.pkgid.c_str(),
-                               info.pkgrootpath.c_str(),
-                               info.pkgtype.c_str(),
-                               info.kbdtype.c_str());
+                       if (info.pkgtype.compare("rpm") == 0 && info.appid.find("ise-engine") != String::npos) {
+                               info.mode = TOOLBAR_KEYBOARD_MODE;
+                               info.options = 0;
+
+                               found = info.appid.find_last_of('.');
+                               if (found != String::npos)
+                                       info.module_name = info.appid.substr(found+1);
+                               else
+                                       info.module_name = info.appid;
 
-                       if (info.kbdtype.compare("SOFTWARE_KEYBOARD_ISE") == 0) {
+                               if (scim_get_imengine_module_list(module_list)) {
+                                       if (std::find (module_list.begin(), module_list.end(), info.module_name) == module_list.end())
+                                               LOGE("Module name \"%s\" can't be found in scim_get_imengine_module_list().", info.module_name.c_str());
+                               }
+                       }
+                       else {
                                info.mode = TOOLBAR_HELPER_MODE;
-                               info.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
 
                                if (info.pkgtype.compare("wgt") == 0) {
-                                       info.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_NEED_SPOT_LOCATION_INFO | SCIM_HELPER_AUTO_RESTART;
+                                       info.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART | SCIM_HELPER_NEED_SPOT_LOCATION_INFO;
                                        info.module_name = String("ise-web-helper-agent");
                                }
-                               else    {
+                               else {
                                        info.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
 
                                        found = info.appid.find_last_of('.');
@@ -521,21 +542,19 @@ static inline int _db_select_all_ime_info(std::vector<ImeInfoDB> &ime_info)
                                        }
                                }
                        }
-                       else /*if (info.kbdtype.compare("HARDWARE_KEYBOARD_ISE") == 0)*/ {
-                               info.mode = TOOLBAR_KEYBOARD_MODE;
-                               info.options = 0;
-
-                               found = info.appid.find_last_of('.');
-                               if (found != String::npos)
-                                       info.module_name = info.appid.substr(found+1);
-                               else
-                                       info.module_name = info.appid;
 
-                               if (scim_get_imengine_module_list(module_list)) {
-                                       if (std::find (module_list.begin(), module_list.end(), info.module_name) == module_list.end())
-                                               LOGE("Module name \"%s\" can't be found in scim_get_imengine_module_list().", info.module_name.c_str());
-                               }
-                       }
+                       LOGD("appid=\"%s\", uuid=\"%s\", label=\"%s\", languages=\"%s\", iconpath=\"%s\", pkgid=\"%s\", pkgrootpath=\"%s\", pkgtype=\"%s\", module_name=\"%s\", mode=%d, options=%u",
+                               info.appid.c_str(),
+                               info.uuid.c_str(),
+                               info.label.c_str(),
+                               info.languages.c_str(),
+                               info.iconpath.c_str(),
+                               info.pkgid.c_str(),
+                               info.pkgrootpath.c_str(),
+                               info.pkgtype.c_str(),
+                               info.module_name.c_str(),
+                               info.mode,
+                               info.options);
 
                        ime_info.push_back(info);
                        i++;
@@ -553,7 +572,7 @@ static inline int _db_select_all_ime_info(std::vector<ImeInfoDB> &ime_info)
                        if (ret == PMINFO_R_OK) {
                                ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
                                if (ret == PMINFO_R_OK) {
-                                       ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, filtered_app_list_cb, NULL);
+                                       ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _filtered_app_list_cb, NULL);
                                }
                                pkgmgrinfo_appinfo_filter_destroy(handle);
                        }
@@ -598,7 +617,6 @@ static inline int _db_select_ime_info(const char *appid, ImeInfoDB *pImeInfo)
        pImeInfo->pkgid.clear();
        pImeInfo->pkgrootpath.clear();
        pImeInfo->pkgtype.clear();
-       pImeInfo->kbdtype.clear();
 
        ret = sqlite3_prepare_v2(databaseInfo.pHandle, pQuery, -1, &pStmt, NULL);
        if (ret != SQLITE_OK) {
@@ -627,9 +645,8 @@ static inline int _db_select_ime_info(const char *appid, ImeInfoDB *pImeInfo)
        pImeInfo->pkgid = String((char*)sqlite3_column_text(pStmt, 5));
        pImeInfo->pkgrootpath = String((char*)sqlite3_column_text(pStmt, 6));
        pImeInfo->pkgtype = String((char*)sqlite3_column_text(pStmt, 7));
-       pImeInfo->kbdtype = String((char*)sqlite3_column_text(pStmt, 8));
 
-       LOGD("appid=\"%s\", uuid=\"%s\", label=\"%s\", languages=\"%s\", iconpath=\"%s\", pkgid=\"%s\", pkgrootpath=\"%s\", pkgtype=\"%s\", kbdtype=\"%s\"",
+       LOGD("appid=\"%s\", uuid=\"%s\", label=\"%s\", languages=\"%s\", iconpath=\"%s\", pkgid=\"%s\", pkgrootpath=\"%s\", pkgtype=\"%s\"",
                pImeInfo->appid.c_str(),
                pImeInfo->uuid.c_str(),
                pImeInfo->label.c_str(),
@@ -637,8 +654,7 @@ static inline int _db_select_ime_info(const char *appid, ImeInfoDB *pImeInfo)
                pImeInfo->iconpath.c_str(),
                pImeInfo->pkgid.c_str(),
                pImeInfo->pkgrootpath.c_str(),
-               pImeInfo->pkgtype.c_str(),
-               pImeInfo->kbdtype.c_str());
+               pImeInfo->pkgtype.c_str());
 
 out:
        sqlite3_reset(pStmt);
index e607aa7..16d090c 100644 (file)
@@ -759,9 +759,9 @@ CommonBackEnd::add_module_info_from_db (const ConfigPointer &config, std::vector
     for (iter = ime_info.begin(); iter != ime_info.end(); iter++) {
         it = std::find (modules.begin(), modules.end(), iter->module_name);
         if (iter->mode == TOOLBAR_KEYBOARD_MODE && it != modules.end()) {
-            if (m_impl->m_factory_module_repository.find (iter->uuid) == m_impl->m_factory_module_repository.end ()) {
-                add_specific_factory (iter->uuid, IMEngineFactoryPointer (0));
-                m_impl->m_factory_module_repository[iter->uuid] = iter->module_name;
+            if (m_impl->m_factory_module_repository.find (iter->appid) == m_impl->m_factory_module_repository.end ()) {
+                add_specific_factory (iter->appid, IMEngineFactoryPointer (0));
+                m_impl->m_factory_module_repository[iter->appid] = iter->module_name;
             }
         }
     }
index f9de634..7a24bb2 100644 (file)
@@ -110,10 +110,10 @@ rm -rf %{buildroot}
 mkdir -p %{buildroot}/opt/etc/dump.d/module.d
 cp -af ism/dump/isf_log_dump.sh %{buildroot}/opt/etc/dump.d/module.d
 mkdir -p %{buildroot}/opt/usr/dbspace
-if [ ! -s %{buildroot}/opt/usr/dbspace/.ime_parser.db ]; then
+if [ ! -s %{buildroot}/opt/usr/dbspace/.ime_info.db ]; then
 echo "The database file for ime will be created."
-sqlite3 %{buildroot}/opt/usr/dbspace/.ime_parser.db <<EOF
-CREATE TABLE ime_info ( appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT, kbdtype TEXT);
+sqlite3 %{buildroot}/opt/usr/dbspace/.ime_info.db <<EOF
+CREATE TABLE ime_info ( appid TEXT PRIMARY KEY NOT NULL, uuid TEXT, label TEXT, languages TEXT, iconpath TEXT, pkgid TEXT, pkgrootpath TEXT, pkgtype TEXT);
 EOF
 fi
 
@@ -172,7 +172,7 @@ cat scim.lang > isf.lang
 %{_libdir}/libscim-*.so*
 %license COPYING
 /opt/etc/dump.d/module.d/*
-/opt/usr/dbspace/.ime_parser.db*
+%attr(660,root,app) /opt/usr/dbspace/.ime_info.db*
 
 %files devel
 %defattr(-,root,root,-)