Add API to get the number of IME 93/64293/9
authorsungwook79.park <sungwook79.park@samsung.com>
Thu, 31 Mar 2016 08:34:01 +0000 (17:34 +0900)
committersungwook79.park <sungwook79.park@samsung.com>
Mon, 11 Apr 2016 05:27:24 +0000 (14:27 +0900)
Change-Id: I82e2d2fb2b64de4644f8d3c4e079e8c5017f4d11
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
include/inputmethod_manager.h [changed mode: 0644->0755]
src/inputmethod_manager.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 59408d6..26f03a1
@@ -61,7 +61,7 @@ typedef enum {
  * @retval #IME_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
  * @retval #IME_MANAGER_ERROR_OPERATION_FAILED Operation failed
  *
- * @see ime_manager_show_ime_selector
+ * @see ime_manager_show_ime_selector()
  */
 EXPORT_API int ime_manager_show_ime_list(void);
 
@@ -81,7 +81,7 @@ EXPORT_API int ime_manager_show_ime_list(void);
  * @retval #IME_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
  * @retval #IME_MANAGER_ERROR_OPERATION_FAILED Operation failed
  *
- * @see ime_manager_show_ime_list
+ * @see ime_manager_show_ime_list()
  */
 EXPORT_API int ime_manager_show_ime_selector(void);
 
@@ -105,7 +105,7 @@ EXPORT_API int ime_manager_show_ime_selector(void);
  * @retval #IME_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
  * @retval #IME_MANAGER_ERROR_OPERATION_FAILED Operation failed
  *
- * @see ime_manager_show_ime_list
+ * @see ime_manager_show_ime_list()
  */
 EXPORT_API int ime_manager_is_ime_enabled(const char *app_id, bool *enabled);
 
@@ -128,10 +128,33 @@ EXPORT_API int ime_manager_is_ime_enabled(const char *app_id, bool *enabled);
  * @retval #IME_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
  * @retval #IME_MANAGER_ERROR_OPERATION_FAILED Operation failed
  *
- * @see ime_manager_show_ime_selector
+ * @see ime_manager_show_ime_selector()
  */
 EXPORT_API int ime_manager_get_active_ime(char **app_id);
 
+/**
+ * @brief Gets the number of IMEs which are enabled (usable).
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ *
+ * @privlevel public
+ *
+ * @privilege %http://tizen.org/privilege/imemanager
+ *
+ * @return The @a number of enabled IMEs on success, otherwise @c 0.
+ *
+ * @exception IME_MANAGER_ERROR_NONE Successful
+ * @exception IME_MANAGER_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @exception IME_MANAGER_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see ime_manager_is_ime_enabled()
+ * @see ime_manager_show_ime_selector()
+ */
+EXPORT_API int ime_manager_get_enabled_ime_count(void);
+
 /**
  * @}
  */
old mode 100644 (file)
new mode 100755 (executable)
index afc30be..2b2d842
@@ -136,3 +136,32 @@ int ime_manager_get_active_ime(char **app_id)
     return IME_MANAGER_ERROR_NONE;
 }
 
+int ime_manager_get_enabled_ime_count(void)
+{
+    ime_manager_error_e retVal = IME_MANAGER_ERROR_NONE;
+    ime_info_s *ime_info = NULL;
+    int i, enable_ime_count = 0, total_ime_count;
+
+    retVal = _check_privilege();
+    if (retVal != IME_MANAGER_ERROR_NONE) {
+        set_last_result(IME_MANAGER_ERROR_PERMISSION_DENIED);
+        LOGE("_check_privilege returned %d.", retVal);
+        return enable_ime_count;
+    }
+
+    total_ime_count = isf_control_get_all_ime_info(&ime_info);
+    if (ime_info) {
+        for (i = 0; i < total_ime_count; i++) {
+            if (ime_info[i].is_enabled)
+                enable_ime_count++;
+        }
+        free(ime_info);
+    }
+
+    if (enable_ime_count == 0)
+        set_last_result(IME_MANAGER_ERROR_OPERATION_FAILED);
+    else
+        set_last_result(IME_MANAGER_ERROR_NONE);
+
+    return enable_ime_count;
+}