Delete DefaultIseSelectorProgram from config 71/41771/1
authorSungmin Kwak <sungmin.kwak@samsung.com>
Tue, 9 Jun 2015 13:01:57 +0000 (22:01 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Wed, 17 Jun 2015 09:43:22 +0000 (17:43 +0800)
Change-Id: I146ba3cae13cc26cce042c29ebebe0130846cdbc

ism/configs/global
ism/extras/efl_panel/isf_panel_efl.cpp
ism/src/isf_control.cpp
ism/src/isf_control.h
ism/src/scim_config_path.h

index 57729f6..0993b3e 100755 (executable)
@@ -17,5 +17,4 @@
 /ChangeKeyboardModeByFocusMove = false
 /HideIseBasedOnFocus = false
 /SupportHWKeyboardMode = false
-/DefaultIseSelectorProgram = org.tizen.inputmethod-setting-selector
 /DefaultKbdModeChangerProgram = org.tizen.isf-kbd-mode-changer
index ab8b025..bbf76d8 100644 (file)
@@ -232,7 +232,6 @@ static void       slot_set_keyboard_mode               (int mode);
 static void       slot_get_ise_state                   (int &state);
 static void       slot_start_default_ise               (void);
 static void       slot_stop_default_ise                (void);
-static void       slot_show_ise_selector               (void);
 
 static Eina_Bool  panel_agent_handler                  (void *data, Ecore_Fd_Handler *fd_handler);
 
@@ -443,6 +442,9 @@ static E_DBus_Signal_Handler *edbus_handler;
 
 static Ecore_Event_Handler *_candidate_show_handler         = NULL;
 
+static String ime_selector_app = "";
+static String ime_list_app = "";
+
 enum {
     EMOJI_IMAGE_WIDTH = 0,
     EMOJI_IMAGE_HEIGHT,
@@ -3474,7 +3476,7 @@ static bool initialize_panel_agent (const String &config, const String &display,
     _panel_agent->signal_connect_get_ise_state              (slot (slot_get_ise_state));
     _panel_agent->signal_connect_start_default_ise          (slot (slot_start_default_ise));
     _panel_agent->signal_connect_stop_default_ise           (slot (slot_stop_default_ise));
-    _panel_agent->signal_connect_show_panel                 (slot (slot_show_ise_selector));
+    _panel_agent->signal_connect_show_panel                 (slot (slot_show_helper_ise_selector));
 
     _panel_agent->signal_connect_get_recent_ise_geometry    (slot (slot_get_recent_ise_geometry));
 
@@ -4813,7 +4815,12 @@ static void slot_set_enable_helper_ise_info (const String &appid, bool is_enable
     }
 }
 
-static int _filtered_inputmethod_setting_app_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
+/**
+ * @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)
 {
     if (user_data) {
         char **result = static_cast<char **>(user_data);
@@ -4847,14 +4854,21 @@ static void slot_show_helper_ise_list (void)
     char *app_id = NULL;
     pkgmgrinfo_appinfo_filter_h handle;
 
-    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 (ime_list_app.length() < 1) {
+        ret = pkgmgrinfo_appinfo_filter_create(&handle);
         if (ret == PMINFO_R_OK) {
-            ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _filtered_inputmethod_setting_app_cb, &app_id);
+            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);
+
+            if (app_id)
+                ime_list_app = String(app_id);
         }
-        pkgmgrinfo_appinfo_filter_destroy(handle);
     }
+    else
+        app_id = strdup(ime_list_app.c_str());
 
     if (app_id) {
         ret = app_control_create (&app_control);
@@ -4882,7 +4896,7 @@ static void slot_show_helper_ise_list (void)
 
         ret = app_control_send_launch_request(app_control, NULL, NULL);
         if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW("app_control_send_launch_request returned %d", ret);
+            LOGW("app_control_send_launch_request returned %d, app_id=%s", ret, app_id);
             app_control_destroy(app_control);
             free(app_id);
             return;
@@ -4908,14 +4922,21 @@ static void slot_show_helper_ise_selector (void)
     char *app_id = NULL;
     pkgmgrinfo_appinfo_filter_h handle;
 
-    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-selector");
+    if (ime_selector_app.length() < 1) {
+        ret = pkgmgrinfo_appinfo_filter_create(&handle);
         if (ret == PMINFO_R_OK) {
-            ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _filtered_inputmethod_setting_app_cb, &app_id);
+            ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime-selector");
+            if (ret == PMINFO_R_OK) {
+                ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _find_appid_from_category, &app_id);
+            }
+            pkgmgrinfo_appinfo_filter_destroy(handle);
+
+            if (app_id)
+                ime_selector_app = String(app_id);
         }
-        pkgmgrinfo_appinfo_filter_destroy(handle);
     }
+    else
+        app_id = strdup(ime_selector_app.c_str());
 
     if (app_id) {
         ret = app_control_create (&app_control);
@@ -4943,7 +4964,7 @@ static void slot_show_helper_ise_selector (void)
 
         ret = app_control_send_launch_request(app_control, NULL, NULL);
         if (ret != APP_CONTROL_ERROR_NONE) {
-            LOGW("app_control_send_launch_request returned %d", ret);
+            LOGW("app_control_send_launch_request returned %d, app_id=%s", ret, app_id);
             app_control_destroy(app_control);
             free(app_id);
             return;
@@ -5242,34 +5263,6 @@ static void slot_register_helper_properties (int id, const PropertyList &props)
     }
 }
 
-static void slot_show_ise_selector (void)
-{
-    SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
-
-    elm_config_scale_set (_system_scale);
-
-    /* Read configuations for notification app (ise-selector) */
-    String ise_selector = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_SELECTOR_PROGRAM), String (""));
-    ise_selector_module_noti.launch_app = ise_selector;
-
-    app_control_h app_control;
-
-    app_control_create (&app_control);
-    app_control_set_operation (app_control, APP_CONTROL_OPERATION_DEFAULT);
-    app_control_set_app_id (app_control, ise_selector_module_noti.launch_app.c_str ());
-
-    if (app_control_send_launch_request (app_control, NULL, NULL) == APP_CONTROL_ERROR_NONE)
-    {
-        LOGD ("Succeeded to launch %s", ise_selector_module_noti.launch_app.c_str ());
-    }
-    else
-    {
-        LOGD ("Failed to launch %s", ise_selector_module_noti.launch_app.c_str ());
-    }
-
-    app_control_destroy (app_control);
-}
-
 static void slot_show_ise (void)
 {
     SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
@@ -5826,11 +5819,31 @@ static Eina_Bool x_event_window_property_cb (void *data, int ev_type, void *even
 
                         ise_selector_module_noti.content = ise_name.c_str ();
 
-                        /* Read configuations for notification app (ise-selector) */
-                        String ise_selector = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_SELECTOR_PROGRAM), String (""));
-                        ise_selector_module_noti.launch_app = ise_selector.c_str ();
-                        LOGD ("Create ise_selector notification with : %s", ise_selector.c_str ());
-                        create_notification (&ise_selector_module_noti);
+                        /* Find IME Selector appid for notification */
+                        if (ime_selector_app.length() < 1) {
+                            char *app_id = NULL;
+                            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-selector");
+                                if (ret == PMINFO_R_OK) {
+                                    ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _find_appid_from_category, &app_id);
+                                }
+                                pkgmgrinfo_appinfo_filter_destroy(handle);
+
+                                if (app_id) {
+                                    ime_selector_app = String(app_id);
+                                    free (app_id);
+                                }
+                            }
+                        }
+                        if (ime_selector_app.length() > 0) {
+                            ise_selector_module_noti.launch_app = ime_selector_app;
+                            LOGD ("Create ise_selector notification with : %s", ime_selector_app.c_str ());
+                            create_notification (&ise_selector_module_noti);
+                        }
+                        else
+                            LOGW("AppID with http://tizen.org/category/ime-selector category is not available");
 #endif
                     }
                 }
index 02b9ec5..02c9dee 100644 (file)
@@ -204,19 +204,7 @@ EAPI int isf_control_get_initial_ise (char **uuid)
 
 EAPI int isf_control_show_ise_selector (void)
 {
-    IMControlClient imcontrol_client;
-    int ret = 0;
-    if (!imcontrol_client.open_connection ())
-        return -1;
-
-    imcontrol_client.prepare ();
-    imcontrol_client.show_ise_selector ();
-    if (!imcontrol_client.send ())
-        ret = -1;
-
-    imcontrol_client.close_connection ();
-
-    return ret;
+    return isf_control_show_ime_selector();
 }
 
 EAPI int isf_control_get_ise_count (ISE_TYPE_T type)
index dddc350..5a4b54b 100644 (file)
@@ -59,6 +59,8 @@ typedef struct {
 // Declaration of global functions.
 /////////////////////////////////////////////////////////////////////////////
 /**
+ * @deprecated Deprecated since tizen 2.4. [Use isf_control_set_active_ime() instead]
+ *
  * @brief Set active ISE by UUID.
  *
  * @param uuid The active ISE's UUID.
@@ -68,6 +70,8 @@ typedef struct {
 EAPI int isf_control_set_active_ise_by_uuid (const char *uuid);
 
 /**
+ * @deprecated Deprecated since tizen 2.4. [Use isf_control_get_active_ime() instead]
+ *
  * @brief Get active ISE's UUID.
  *
  * @param uuid The parameter is used to store active ISE's UUID.
@@ -148,6 +152,8 @@ EAPI int isf_control_set_initial_ise_by_uuid (const char *uuid);
 EAPI int isf_control_get_initial_ise (char **uuid);
 
 /**
+ * @deprecated Deprecated since tizen 2.4. [Use isf_control_show_ime_selector() instead]
+ *
  * @brief Show ISE selector.
  *
  * @return 0 if successfully, otherwise return -1;
@@ -164,6 +170,8 @@ EAPI int isf_control_show_ise_selector (void);
 EAPI int isf_control_get_ise_count (ISE_TYPE_T type);
 
 /**
+ * @deprecated Deprecated since tizen 2.4. [Use isf_control_open_ime_option_window() instead]
+ *
  * @brief Show ISE's option window.
  *
  * @return 0 if successfully, otherwise return -1
index a7dc2d8..fbe2684 100644 (file)
@@ -94,7 +94,6 @@ namespace scim {
 #define SCIM_GLOBAL_CONFIG_CHANGE_KEYBOARD_MODE_BY_FOCUS_MOVE       "/ChangeKeyboardModeByFocusMove"
 #define SCIM_GLOBAL_CONFIG_HIDE_ISE_BASED_ON_FOCUS                  "/HideIseBasedOnFocus"
 #define SCIM_GLOBAL_CONFIG_SUPPORT_HW_KEYBOARD_MODE                 "/SupportHWKeyboardMode"
-#define SCIM_GLOBAL_CONFIG_DEFAULT_ISE_SELECTOR_PROGRAM             "/DefaultIseSelectorProgram"
 #define SCIM_GLOBAL_CONFIG_DEFAULT_KBD_MODE_CHANGER_PROGRAM         "/DefaultKbdModeChangerProgram"
 
 #define ISF_CONFIG_HARDWARE_KEYBOARD_DETECT                         "/isf/hw_keyboard_detect"