#include "isf_ondemand_efl.h"
#include "isf_input_hint_efl.h"
#include "isf_password_mode_efl.h"
-
-#if HAVE_UIGADGET
-#include <ui-gadget.h>
+#include <pkgmgr-info.h>
+#include <app_control.h>
static void isfsetting_bt (void *data, Evas_Object *obj, void *event_info);
-#endif
static struct _menu_item isf_demo_menu_its[] = {
{ "ISF Layout", ise_layout_bt },
{ "ISF Focus Movement", isf_focus_movement_bt },
{ "ISF Event", isf_event_demo_bt },
{ "ISF IM Control", imcontrolapi_bt },
-#if HAVE_UIGADGET
{ "ISF Setting", isfsetting_bt },
-#endif
/* do not delete below */
{ NULL, NULL }
elm_list_item_selected_set (it, EINA_FALSE);
}
-#if HAVE_UIGADGET
-static void layout_cb (ui_gadget_h ug, enum ug_mode mode, void *priv)
+/**
+ * @brief Finds appid with specific category
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative
+ */
+static int _find_appid_from_category(const pkgmgrinfo_appinfo_h handle, void *user_data)
{
- struct appdata *ad = NULL;
- Evas_Object *base = NULL;
-
- if (ug == NULL || priv == NULL)
- return;
-
- ad = (appdata *)priv;
-
- base = (Evas_Object *)ug_get_layout (ug);
- if (base == NULL)
- return;
-
- switch (mode) {
- case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set (base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add (ad->win_main, base);
- evas_object_show (base);
- break;
- case UG_MODE_FRAMEVIEW:
- LOGD ("please set ug mode to UG_MODE_FULLVIEW!\n");
- break;
- default:
- break;
+ if (user_data) {
+ char **result = (char **)user_data;
+ char *appid = NULL;
+ int ret = 0;
+
+ /* Get appid */
+ ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ if (ret == PMINFO_R_OK) {
+ *result = strdup(appid);
+ }
+ else {
+ LOGW("pkgmgrinfo_appinfo_get_appid failed!");
+ }
}
-}
-
-static void result_cb (ui_gadget_h ug, app_control_h s, void *priv)
-{
- char *name = NULL;
- app_control_get_extra_data (s, "name", &name);
-
- if (name) {
- free (name);
+ else {
+ LOGW("user_data is null!");
}
-}
-static void destroy_cb (ui_gadget_h ug, void *priv)
-{
- if (ug == NULL)
- return;
-
- ug_destroy (ug);
+ return -1; // This callback is no longer called.
}
static void isfsetting_bt (void *data, Evas_Object *obj, void *event_info)
{
- struct appdata *ad = (struct appdata *)data;
- struct ug_cbs cbs = {0, 0, 0, 0, 0, {0, 0, 0}};
-
- UG_INIT_EFL (ad->win_main, UG_OPT_INDICATOR_ENABLE);
+ // Launch IME List application; e.g., org.tizen.inputmethod-setting-list
+ int ret;
+ app_control_h app_control;
+ char *app_id = NULL;
+ pkgmgrinfo_appinfo_filter_h handle;
+
+ // Find appid with "http://tizen.org/category/ime-list" category; appid might be different in models.
+ 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-list");
+ if (ret == PMINFO_R_OK) {
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _find_appid_from_category, &app_id);
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ }
- cbs.layout_cb = layout_cb;
- cbs.result_cb = result_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.priv = ad;
- ug_create (NULL, "isfsetting-efl",
- UG_MODE_FULLVIEW,
- NULL, &cbs);
+ if (app_id) {
+ ret = app_control_create(&app_control);
+ if (ret == APP_CONTROL_ERROR_NONE) {
+ app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
+ app_control_set_app_id(app_control, app_id);
+ app_control_add_extra_data(app_control, "caller", "settings"); // Indicates Settings application is caller.
+ app_control_set_launch_mode(app_control, APP_CONTROL_LAUNCH_MODE_GROUP);
+ ret = app_control_send_launch_request(app_control, NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGW("app_control_send_launch_request failed(%d): %s", ret, app_id);
+ }
+ app_control_destroy(app_control);
+ }
+ free(app_id);
+ }
+ else {
+ LOGW("AppID with http://tizen.org/category/ime-list category is not available");
+ }
}
-#endif
static int create_demo_view (struct appdata *ad)
{
static int lang_changed (void *event_info, void *data)
{
-#if HAVE_UIGADGET
- ug_send_event (UG_EVENT_LANG_CHANGE);
-#endif
return 0;
}