From: sungwook79.park Date: Thu, 31 Mar 2016 08:34:01 +0000 (+0900) Subject: Add API to get the number of IME X-Git-Tag: submit/tizen/20160415.053318~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11aef997da54d5ca734a73574000e0e49ec3ad0c;p=platform%2Fcore%2Fapi%2Finputmethod-manager.git Add API to get the number of IME Change-Id: I82e2d2fb2b64de4644f8d3c4e079e8c5017f4d11 Signed-off-by: sungwook79.park --- diff --git a/include/inputmethod_manager.h b/include/inputmethod_manager.h old mode 100644 new mode 100755 index 59408d6..26f03a1 --- a/include/inputmethod_manager.h +++ b/include/inputmethod_manager.h @@ -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); + /** * @} */ diff --git a/src/inputmethod_manager.cpp b/src/inputmethod_manager.cpp old mode 100644 new mode 100755 index afc30be..2b2d842 --- a/src/inputmethod_manager.cpp +++ b/src/inputmethod_manager.cpp @@ -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; +}