return true;
}
+#ifdef HAVE_PKGMGR_INFO
+int get_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ int ret = 0;
+ char *appid = NULL, *pkgid = NULL, *pkgtype = NULL, *exec = NULL, *label = NULL, *path = NULL;
+ pkgmgrinfo_pkginfo_h pkginfo_handle = NULL;
+ ImeInfoDB ime_db;
+ int *result = static_cast<int*>(user_data);
+
+ if (result) /* in this case, need to check category */ {
+ bool exist = true;
+ ret = pkgmgrinfo_appinfo_is_category_exist (handle, "http://tizen.org/category/ime", &exist);
+ if (ret != PMINFO_R_OK || !exist) {
+ return 0;
+ }
+ }
+
+ /* appid */
+ ret = pkgmgrinfo_appinfo_get_appid (handle, &appid);
+ if (ret == PMINFO_R_OK)
+ ime_db.appid = String (appid ? appid : "");
+ else {
+ LOGE ("pkgmgrinfo_appinfo_get_appid failed! error code=%d", ret);
+ return 0;
+ }
+
+ ime_db.iconpath = "";
+
+ /* pkgid */
+ ret = pkgmgrinfo_appinfo_get_pkgid (handle, &pkgid);
+ if (ret == PMINFO_R_OK)
+ ime_db.pkgid = String (pkgid ? pkgid : "");
+ else {
+ LOGE ("pkgmgrinfo_appinfo_get_pkgid failed! error code=%d", ret);
+ return 0;
+ }
+
+ /* exec path */
+ ret = pkgmgrinfo_appinfo_get_exec (handle, &exec);
+ if (ret == PMINFO_R_OK)
+ ime_db.exec = String (exec ? exec : "");
+ else {
+ LOGE ("pkgmgrinfo_appinfo_get_exec failed! error code=%d", ret);
+ return 0;
+ }
+
+ /* label */
+ ret = pkgmgrinfo_appinfo_get_label (handle, &label);
+ if (ret == PMINFO_R_OK)
+ ime_db.label = String (label ? label : "");
+
+ /* get pkgmgrinfo_pkginfo_h */
+ /* Try to get in global packages */
+ ret = pkgmgrinfo_pkginfo_get_pkginfo (pkgid, &pkginfo_handle);
+ if (ret != PMINFO_R_OK) {
+ /* Try to get in user packages */
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo (pkgid, getpid (), &pkginfo_handle);
+ }
+
+ if (ret == PMINFO_R_OK && pkginfo_handle) {
+ /* pkgtype */
+ ret = pkgmgrinfo_pkginfo_get_type (pkginfo_handle, &pkgtype);
+
+ if (ret == PMINFO_R_OK)
+ ime_db.pkgtype = String (pkgtype ? pkgtype : "");
+ else {
+ ISF_SAVE_LOG ("pkgtype is not available!");
+ pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+ return 0;
+ }
+
+ /* pkgrootpath */
+ pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
+ }
+
+ ime_db.languages = "en";
+ ime_db.display_lang = "";
+
+ if (ime_db.pkgtype.compare ("rpm") == 0 && //1 Inhouse IMEngine ISE(IME)
+ ime_db.exec.find ("scim-launcher") != String::npos) // Some IMEngine's pkgid doesn't have "ise-engine" prefix.
+ {
+ ime_db.mode = TOOLBAR_KEYBOARD_MODE;
+ ime_db.options = 0;
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("IMEngine");
+ ime_db.module_name = ime_db.pkgid;
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ ime_db.has_option = 0; // It doesn't matter. No option for IMEngine...
+ }
+ else {
+ ime_db.mode = TOOLBAR_HELPER_MODE;
+ if (ime_db.pkgtype.compare ("rpm") == 0) //1 Inhouse Helper ISE(IME)
+ {
+#ifdef _TV
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT;
+#else
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
+#endif
+ ime_db.module_name = ime_db.pkgid;
+
+ String module_path = String (path) + String ("/lib");
+ String fullpath = module_path + String (SCIM_PATH_DELIM_STRING) + ime_db.module_name + String (".so");
+ struct stat st;
+ if (stat (fullpath.c_str (), &st) < 0) {
+ /* Not found in lib directory of package's root path */
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
+ }
+ else {
+ ime_db.module_path = module_path;
+ }
+
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ ime_db.has_option = 1; // Let's assume the inhouse IME always has an option menu.
+ }
+ else if (ime_db.pkgtype.compare ("wgt") == 0) //1 Download Web IME
+ {
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
+ | SCIM_HELPER_NEED_SPOT_LOCATION_INFO | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
+ ime_db.module_name = String ("ise-web-helper-agent");
+ if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ }
+ else {
+#ifdef _MOBILE
+ ime_db.is_enabled = 0;
+#else
+ ime_db.is_enabled = 1;
+#endif
+ ime_db.is_preinstalled = 0;
+ }
+ ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
+ }
+ else if (ime_db.pkgtype.compare ("tpk") == 0) //1 Download Native IME
+ {
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
+ | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
+ if (path)
+ ime_db.module_path = String (path) + String ("/lib");
+ else
+ ime_db.module_path = String (tzplatform_getenv(TZ_SYS_RW_APP)) + ime_db.pkgid + String ("/lib");
+ ime_db.module_name = String ("lib") + ime_db.exec.substr (ime_db.exec.find_last_of (SCIM_PATH_DELIM) + 1);
+ if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ }
+ else {
+#ifdef _MOBILE
+ ime_db.is_enabled = 0;
+#else
+ ime_db.is_enabled = 1;
+#endif
+ ime_db.is_preinstalled = 0;
+ }
+ ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
+ }
+ else {
+ LOGE ("Unsupported pkgtype(%s)", ime_db.pkgtype.c_str ());
+ if (pkginfo_handle) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+ pkginfo_handle = NULL;
+ }
+ return 0;
+ }
+ }
+
+ _ime_info.push_back(ime_db);
+
+ if (pkginfo_handle) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+ pkginfo_handle = NULL;
+ }
+
+ return 0;
+}
+#endif
+
/**
* @brief Set active ISE.
*
bool ise_changed = false, valid = false;
+ if (_ime_info.size () == 0) {
+#ifdef HAVE_PKGMGR_INFO
+ pkgmgrinfo_appinfo_filter_h handle;
+ int ret = pkgmgrinfo_appinfo_filter_create (&handle);
+ 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, get_ime_app_list_cb, NULL);
+ else {
+ LOGE ("pkgmgrinfo_appinfo_filter_add_string failed(%d)", ret);
+ }
+ pkgmgrinfo_appinfo_filter_destroy (handle);
+ }
+ else {
+ LOGE ("pkgmgrinfo_appinfo_filter_create failed(%d)", ret);
+ }
+#endif
+ }
+
for (unsigned int i = 0; i < _ime_info.size (); i++) {
if (!uuid.compare (_ime_info[i].appid)) {
if (TOOLBAR_KEYBOARD_MODE == _ime_info[i].mode)