From d9acc92806f525d43d0dd938010f6bac84c72a42 Mon Sep 17 00:00:00 2001 From: "shoum.chen@samsung.com" Date: Thu, 2 Jul 2015 19:58:32 +0800 Subject: [PATCH] Sort the ime list. Change-Id: Ifbfb621cc2ec3e6b5909e721bae832e569493f28 Signed-off-by: shoum.chen@samsung.com --- im_setting_list/input_method_setting_list_ui.cpp | 35 +++++++++++++- .../input_method_setting_selector_ui.cpp | 53 +++++++++++++++++----- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/im_setting_list/input_method_setting_list_ui.cpp b/im_setting_list/input_method_setting_list_ui.cpp index 8ab4616..0d74150 100644 --- a/im_setting_list/input_method_setting_list_ui.cpp +++ b/im_setting_list/input_method_setting_list_ui.cpp @@ -67,6 +67,15 @@ typedef enum { ISE_OPTION_MODULE_NO_EXIST } ISE_OPTION_MODULE_STATE; +class ime_info_compare +{ + public: + bool operator()(const ime_info_s &first, const ime_info_s &sec) + { + return (strcasecmp(first.label, sec.label) < 0); + } +}; + typedef void (*popup_ok_cb)(void *data, Evas_Object *obj, void *event_info); typedef void (*popup_cancel_cb)(void *data, Evas_Object *obj, void *event_info); @@ -166,8 +175,24 @@ static Evas_Object* im_setting_list_bg_create(Evas_Object *parent) return bg; } +static void im_setting_list_sort_ime_info(std::vector &preinstall, std::vector &user) +{ + std::sort(preinstall.begin(), preinstall.end(), ime_info_compare()); + std::sort(user.begin(), user.end(), ime_info_compare()); + for(unsigned int i=0; i ime_info_list_preinstall; + std::vector ime_info_list_user; ime_info_s *info = NULL; g_ime_info_list.clear(); int cnt = isf_control_get_all_ime_info(&info); @@ -176,7 +201,14 @@ static void im_setting_list_load_ime_info(void) for(int i=0; i #include #include - +#include #define IM_SETTING_SELECTOR_PACKAGE PACKAGE #define IM_SETTING_SELECTOR_LOCALE_DIR ("/usr/apps/"PACKAGE_NAME"/res/locale") #define IM_SETTING_SELECTOR_TITLE dgettext(PACKAGE, "IDS_ST_HEADER_DEFAULT_KEYBOARD_ABB") #define IM_SETTING_SELECT_KEYBOARD dgettext(PACKAGE, "IDS_IME_BODY_SELECT_KEYBOARD") -using namespace std; - static std::vector g_ime_info_list; static Elm_Genlist_Item_Class *itc_im_selector = NULL; static Evas_Object *group_radio = NULL; @@ -40,6 +38,15 @@ typedef struct { int index; }sel_cb_data; +class ime_info_compare +{ + public: + bool operator()(const ime_info_s &first, const ime_info_s &sec) + { + return (strcasecmp(first.label, sec.label) < 0); + } +}; + static void im_setting_selector_text_domain_set(void) { bindtextdomain(IM_SETTING_SELECTOR_PACKAGE, IM_SETTING_SELECTOR_LOCALE_DIR); @@ -71,31 +78,55 @@ im_setting_selector_main_window_create(const char *name) return eo; } +static void im_setting_selector_sort_ime_info(std::vector &preinstall, std::vector &user) +{ + std::sort(preinstall.begin(), preinstall.end(), ime_info_compare()); + std::sort(user.begin(), user.end(), ime_info_compare()); + for(unsigned int i=0; i ime_info_list_preinstall; + std::vector ime_info_list_user; g_ime_info_list.clear(); char *active_ime_appid = NULL; isf_control_get_active_ime(&active_ime_appid); ime_info_s *info = NULL; int cnt = isf_control_get_all_ime_info(&info); - int nIndex = -1; if(info) { for(int i=0; i