Add isf_control_open_ime_optipn_window_with_single_mode() API 38/279938/1
authorInHong Han <inhong1.han@samsung.com>
Fri, 19 Aug 2022 07:13:29 +0000 (16:13 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 19 Aug 2022 07:13:29 +0000 (16:13 +0900)
Change-Id: I5298a2f79867de5a195721b86666f9738b1f338a

ism/src/isf_control.cpp
ism/src/isf_control.h

index 78dc6a3..1c31990 100644 (file)
@@ -91,6 +91,43 @@ static bool app_control_launch (const char *app_id, app_control_launch_mode_e mo
     return (ret == APP_CONTROL_ERROR_NONE);
 }
 
+static int open_ime_optipn_window(app_control_launch_mode_e mode)
+{
+    IMControlClient imcontrol_client;
+    int ret = 0;
+    String ime_setting_appid;
+
+    if (!imcontrol_client.open_connection ())
+        return -1;
+
+    imcontrol_client.prepare ();
+    imcontrol_client.get_ise_setting_appid (ime_setting_appid);
+
+    if (!ime_setting_appid.empty ()) {
+        if (app_control_launch (ime_setting_appid.c_str (), mode)) {
+            LOGI("Succeeded to launch IME setting app : %s", ime_setting_appid.c_str ());
+        }
+        else {
+            LOGE("Failed to launch IME setting app : %s", ime_setting_appid.c_str ());
+            ret = -1;
+        }
+    }
+    else {
+        LOGD("No setting app ID. Request to show option window in IME");
+        imcontrol_client.prepare ();
+        imcontrol_client.show_ise_option_window ();
+
+        if (!imcontrol_client.send ()) {
+            LOGW("Failed to send show ise_option_window");
+            ret = -1;
+        }
+    }
+
+    imcontrol_client.close_connection ();
+
+    return ret;
+}
+
 EXAPI int isf_control_set_active_ise_by_uuid (const char *uuid)
 {
     if (uuid == NULL)
@@ -306,39 +343,7 @@ EXAPI int isf_control_get_ise_count (ISE_TYPE_T type)
 
 EXAPI int isf_control_show_ise_option_window (void)
 {
-    IMControlClient imcontrol_client;
-    int ret = 0;
-    String ime_setting_appid;
-
-    if (!imcontrol_client.open_connection ())
-        return -1;
-
-    imcontrol_client.prepare ();
-    imcontrol_client.get_ise_setting_appid (ime_setting_appid);
-
-    if (!ime_setting_appid.empty ()) {
-        if (app_control_launch (ime_setting_appid.c_str (), APP_CONTROL_LAUNCH_MODE_GROUP)) {
-            LOGI("Succeeded to launch IME setting app : %s", ime_setting_appid.c_str ());
-        }
-        else {
-            LOGE("Failed to launch IME setting app : %s", ime_setting_appid.c_str ());
-            ret = -1;
-        }
-    }
-    else {
-        LOGD("No setting app ID. Request to show option window in IME");
-        imcontrol_client.prepare ();
-        imcontrol_client.show_ise_option_window ();
-
-        if (!imcontrol_client.send ()) {
-            LOGW("Failed to send show ise_option_window");
-            ret = -1;
-        }
-    }
-
-    imcontrol_client.close_connection ();
-
-    return ret;
+    return open_ime_optipn_window (APP_CONTROL_LAUNCH_MODE_GROUP);
 }
 
 EXAPI int isf_control_get_all_ime_info (ime_info_s **info)
@@ -429,7 +434,12 @@ EXAPI int isf_control_get_ime_info (int index, ime_info_s **info)
 
 EXAPI int isf_control_open_ime_option_window (void)
 {
-    return isf_control_show_ise_option_window ();
+    return open_ime_optipn_window (APP_CONTROL_LAUNCH_MODE_GROUP);
+}
+
+EXAPI int isf_control_open_ime_optipn_window_with_single_mode (void)
+{
+    return open_ime_optipn_window (APP_CONTROL_LAUNCH_MODE_SINGLE);
 }
 
 EXAPI int isf_control_resume_ime_option_window (void)
index 4d118fb..c079449 100644 (file)
@@ -236,6 +236,23 @@ int isf_control_get_ime_info (int index, ime_info_s **info);
 int isf_control_open_ime_option_window (void);
 
 /**
+ * @brief Requests to open the current IME's option window using APP_CONTROL_LAUNCH_MODE_SINGLE.
+ *
+ * @remarks Each IME might have its option (setting) or not. This function should be called only if the current IME provides its option.
+ *
+ * @since_tizen 7.0
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/appmanager.launch
+ *
+ * @return 0 on success, otherwise return -1
+ *
+ * @pre The availability of IME option can be found using isf_control_get_all_ime_info() and isf_control_get_active_ime() functions.
+ */
+int isf_control_open_ime_optipn_window_with_single_mode (void);
+
+/**
  * @brief Requests to resume the current IME's option window.
  *
  * @remarks IME needs to show its option window if it has an option window that was created before and not destroyed yet.