using namespace scim;
static String ime_setting_app;
+static bool setting_app_changed;
#ifdef HAVE_PKGMGR_INFO
/**
#ifdef HAVE_PKGMGR_INFO
/**
+ * @brief Finds ime_setting with specific metadata
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative
+ */
+static int _metadata_func (const char *key, const char *value, void *user_data)
+{
+ if (!user_data) {
+ LOGW ("user_data is null!");
+ return -1;
+ }
+
+ String ime_pkgid = String(static_cast<char *>(user_data));
+ LOGD ("key : %s, value : %s, ime pkg id : %s", key, value, ime_pkgid.c_str ());
+
+ if (strncmp (key, "ime-package-id", strlen (key)) == 0 && strncmp (value, ime_pkgid.c_str (), strlen (value)) == 0) {
+ setting_app_changed = true;
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
* @brief Finds appid with specific category
*
* @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative
ime_setting_app = String (ime_setting_appid);
return -1;
}
+ else {
+ pkgmgrinfo_appinfo_h appinfo_handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(ime_setting_appid, &appinfo_handle);
+ if (ret != PMINFO_R_OK)
+ return 0;
+ setting_app_changed = false;
+ ret = pkgmgrinfo_appinfo_foreach_metadata (appinfo_handle, _metadata_func, static_cast<char *>(user_data));
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_handle);
+ return 0;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_handle);
+
+ if (setting_app_changed) {
+ ime_setting_app = String (ime_setting_appid);
+ return -1;
+ }
+ }
}
else {
LOGW ("pkgmgrinfo_appinfo_get_appid failed!");