Add isf_control_get_initial_ise API 70/33570/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 6 Aug 2014 06:45:15 +0000 (15:45 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Tue, 13 Jan 2015 08:11:50 +0000 (16:11 +0800)
Change-Id: I871a614af72a9e34600c9904bf00e54af252cf6e

ism/demos/isf_imcontrol_efl.cpp
ism/src/isf_control.cpp
ism/src/isf_control.h

index fd2586b..4a2d71b 100644 (file)
@@ -39,6 +39,7 @@ static void test_input_panel_state_get (void *data, Evas_Object *obj, void *even
 static void test_get_active_ise (void *data, Evas_Object *obj, void *event_info);
 static void test_get_ise_list (void *data, Evas_Object *obj, void *event_info);
 static void test_get_ise_info (void *data, Evas_Object *obj, void *event_info);
+static void test_get_initial_ise (void *data, Evas_Object *obj, void *event_info);
 static void test_get_ise_count (void *data, Evas_Object *obj, void *event_info);
 static void test_reset_default_ise (void *data, Evas_Object *obj, void *event_info);
 static void test_show_ise_selector (void *data, Evas_Object *obj, void *event_info);
@@ -54,6 +55,7 @@ static struct _menu_item imcontrol_menu_its[] = {
     { "INPUT PANEL STATE GET", test_input_panel_state_get },
     { "GET ACTIVE ISE", test_get_active_ise },
     { "GET ACTIVE ISE INFO", test_get_ise_info },
+    { "GET INITIAL ISE", test_get_initial_ise },
     { "GET ISE LIST", test_get_ise_list },
     { "GET ISE COUNT", test_get_ise_count },
     { "RESET DEFAULT ISE", test_reset_default_ise },
@@ -209,6 +211,16 @@ static void test_show_ise_selector (void *data, Evas_Object *obj, void *event_in
         printf (" Show ISE selector is failed!!!\n");
 }
 
+static void test_get_initial_ise (void *data, Evas_Object *obj, void *event_info)
+{
+    char *uuid = NULL;
+    int ret = isf_control_get_initial_ise (&uuid);
+    if (ret > 0 && uuid)
+        printf (" Get initial ISE: %s\n", uuid);
+    if (uuid)
+        free (uuid);
+}
+
 static char *gli_label_get (void *data, Evas_Object *obj, const char *part)
 {
     int j = (int)data;
index 4b0631c..c0d0334 100644 (file)
@@ -25,7 +25,7 @@
 #define Uses_SCIM_CONFIG_PATH
 #define Uses_SCIM_TRANSACTION
 #define Uses_ISF_IMCONTROL_CLIENT
-
+#define Uses_SCIM_COMPOSE_KEY
 
 #include <string.h>
 #include "scim.h"
@@ -152,6 +152,18 @@ EAPI int isf_control_set_initial_ise_by_uuid (const char *uuid)
     return 0;
 }
 
+EAPI int isf_control_get_initial_ise (char **uuid)
+{
+    if (uuid == NULL)
+        return -1;
+
+    String strUuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (SCIM_COMPOSE_KEY_FACTORY_UUID));
+
+    *uuid = strUuid.length () ? strdup (strUuid.c_str ()) : strdup ("");
+
+    return strUuid.length ();
+}
+
 EAPI int isf_control_show_ise_selector (void)
 {
     IMControlClient imcontrol_client;
index 85bf262..5ea7265 100644 (file)
@@ -123,6 +123,16 @@ EAPI int isf_control_reset_ise_option (void);
 EAPI int isf_control_set_initial_ise_by_uuid (const char *uuid);
 
 /**
+ * @brief Get initial ISE UUID.
+ *
+ * @param uuid The parameter is used to store initial ISE's UUID.
+ *             Application needs free *uuid if it is not used.
+ *
+ * @return the length of UUID if successfully, otherwise return -1;
+ */
+EAPI int isf_control_get_initial_ise (char **uuid);
+
+/**
  * @brief Show ISE selector.
  *
  * @return 0 if successfully, otherwise return -1;