[Telegram] Change the selected words & Fixed language change issue 65/61965/1
authormoon87.park <moon87.park@samsung.com>
Fri, 11 Mar 2016 12:22:10 +0000 (21:22 +0900)
committermoon87.park <moon87.park@samsung.com>
Fri, 11 Mar 2016 12:22:10 +0000 (21:22 +0900)
Change-Id: I56d67593c2dcd907fcdb50bc0d3f347f883884db

TelegramTizen/contacts_utils/device_contacts_manager.c
TelegramTizen/contacts_utils/device_contacts_manager.h
TelegramTizen/src/contact_selection_view.c
TelegramTizen/src/telegramtizen.c
TelegramTizen/src/tg_db_wrapper.c
TelegramTizen/src/tg_init_screen.c
TelegramTizen/src/tg_search_message_view.c
TelegramTizen/src/tg_search_peer_view.c
TelegramTizen/tg_utils/tg_common.c
TelegramTizen/tg_utils/tg_common.h
TelegramTizen/tizen-manifest.xml

index c2768b2..ebd8211 100644 (file)
@@ -89,6 +89,7 @@ Eina_List *get_contact_list_from_device_db()
 
                        contact_data->contact_id = id;
                        contact_data->display_name = strdup(elm_entry_utf8_to_markup(name));
+                       contact_data->highlight_name = NULL;
 
                        char *first_name = NULL;
                        if (sc_cdetails_get_contact_val(CF_FIRST_NAME, contact_data->contact_id, &first_name)) {
@@ -191,7 +192,7 @@ Eina_List *get_contact_list_from_device_db()
 
 void free_contact_list(Eina_List *contact_data)
 {
-       contact_data_scontact = NULL;
+       contact_data_s *contact = NULL;
        EINA_LIST_FREE(contact_data,contact) {
                if (contact) {
                        if (contact->display_name) {
@@ -210,6 +211,10 @@ void free_contact_list(Eina_List *contact_data)
                                free(contact->phone_number);
                                contact->phone_number = NULL;
                        }
+                       if (contact->highlight_name) {
+                                       free(contact->highlight_name);
+                                       contact->highlight_name = NULL;
+                       }
                }
                free(contact);
        }
index ee21b9a..6b7aa99 100644 (file)
@@ -33,6 +33,7 @@ typedef struct contact_data {
        char *last_name;
        char *phone_number;
        char *pic_url;
+       char *highlight_name;
 } contact_data_s;
 
 
index f6fda72..5ae3ae5 100755 (executable)
@@ -121,7 +121,12 @@ char* on_buddy_name_get_cb(void *data, Evas_Object *obj, const char *part)
                        user_data_s* user = item->use_data;
 
                        if (user && user->print_name) {
-                               char* user_name = replace(user->print_name, '_', " ");
+                               char* user_name = NULL;
+                               if (user->highlight_name) {
+                                       user_name = replace(user->highlight_name, '_', " ");
+                               } else {
+                                       user_name = replace(user->print_name, '_', " ");
+                               }
                                char buf[512] = {'\0'};
                                snprintf(buf, 512, "<align=left><font_size=35><color=#000000>%s</color></font_size></align>", user_name);
                                free(user_name);
@@ -450,8 +455,15 @@ static void _on_search_entry_changed(void *data, Evas_Object *obj, void *event_i
                LOGD("entry_text is not jamo, %s", entry_text);
                EINA_LIST_FOREACH(ad->known_buddy_list, l, item) {
                        user = item->use_data;
+                       if (!user) continue;
+                       if (user->highlight_name) {
+                               free(user->highlight_name);
+                               user->highlight_name = NULL;
+                       }
 
                        if (ucol_search(user->print_name, entry_text) != -ENOENT) {
+                               char *last_name = str_case_replace(user->print_name, entry_text, "<font=Tizen:style=Large color=#2da5e0 align=left>", "</font>");
+                               user->highlight_name = last_name;
                                result_list = eina_list_append(result_list, item);
                        }
                }
@@ -648,6 +660,11 @@ void free_known_buddylist(appdata_s *ad)
                        free(user_data->username);
                        user_data->username = NULL;
                }
+
+               if (user_data->highlight_name) {
+                       free(user_data->highlight_name);
+                       user_data->highlight_name = NULL;
+               }
                free(user_data);
                free(item);
        }
index 002e321..6705859 100755 (executable)
@@ -517,6 +517,7 @@ void load_main_list_data(appdata_s *ad)
                        main_list_item->date_lbl = NULL;
                        main_list_item->msg_status_lbl = NULL;
                        main_list_item->main_item_layout = NULL;
+                       main_list_item->highlight_text = NULL;
                        ad->main_list = eina_list_append(ad->main_list, main_list_item);
 
                        // delete message object
@@ -560,6 +561,7 @@ void load_main_list_data(appdata_s *ad)
                                main_list_item->date_lbl = NULL;
                                main_list_item->msg_status_lbl = NULL;
                                main_list_item->main_item_layout = NULL;
+                               main_list_item->highlight_text = NULL;
                                ad->main_list = eina_list_append(ad->main_list, main_list_item);
                        }
                }
@@ -711,6 +713,7 @@ void load_unknown_buddy_list_data(appdata_s *ad)
                        user_data->is_unknown = *temp_is_unknown;
                        free(temp_is_unknown);
                }
+               user_data->highlight_name = NULL;
 
                user_data_with_pic_s *item = (user_data_with_pic_s *)malloc(sizeof(*item));
                item->use_data = user_data;
@@ -763,6 +766,10 @@ void load_buddy_list_data(appdata_s *ad)
                        free(user_data->username);
                        user_data->username = NULL;
 
+               if (user_data->highlight_name)
+                       free(user_data->highlight_name);
+                       user_data->highlight_name = NULL;
+
                free(user_data);
                free(item);
        }
@@ -863,6 +870,7 @@ void load_buddy_list_data(appdata_s *ad)
                        user_data->is_unknown = *temp_is_unknown;
                        free(temp_is_unknown);
                }
+               user_data->highlight_name = NULL;
 
                user_data_with_pic_s *item = (user_data_with_pic_s *) malloc(sizeof(*item));
                item->use_data = user_data;
@@ -3020,6 +3028,7 @@ void app_nf_back_cb(void *data, Evas_Object *obj, void *event_info)
                                                                        main_list_item->date_lbl = NULL;
                                                                        main_list_item->msg_status_lbl = NULL;
                                                                        main_list_item->main_item_layout = NULL;
+                                                                       main_list_item->highlight_text = NULL;
                                                                        ad->main_list = eina_list_prepend(ad->main_list, main_list_item);
                                                                }
                                                        }
@@ -3883,6 +3892,10 @@ void free_app_data(appdata_s *app_data, Eina_Bool destroy_server)
                        free(user_data->username);
                        user_data->username = NULL;
                }
+               if (user_data->highlight_name) {
+                       free(user_data->highlight_name);
+                       user_data->highlight_name = NULL;
+               }
                free(user_data);
                free(item);
        }
@@ -3934,6 +3947,10 @@ void free_app_data(appdata_s *app_data, Eina_Bool destroy_server)
                        free(user_data->username);
                        user_data->username = NULL;
                }
+               if (user_data->highlight_name) {
+                       free(user_data->highlight_name);
+                       user_data->highlight_name = NULL;
+               }
                free(user_data);
                free(item);
        }
@@ -3973,6 +3990,9 @@ void free_app_data(appdata_s *app_data, Eina_Bool destroy_server)
                if (user_data->username)
                        free(user_data->username);
                        user_data->username = NULL;
+               if (user_data->highlight_name)
+                       free(user_data->highlight_name);
+                       user_data->highlight_name = NULL;
 
                free(user_data);
                free(item);
index 699e73a..39a6f44 100755 (executable)
@@ -2742,6 +2742,8 @@ Eina_List *load_buddy_data_by_name(int current_user, char *name)
                        free(temp_is_unknown);
                }
 
+               user_data->highlight_name = NULL;
+
                user_data_with_pic_s *item = (user_data_with_pic_s*) malloc(sizeof(user_data_with_pic_s));
                item->use_data = user_data;
                item->contact_icon = NULL;
index 36a96f3..33f7e7e 100644 (file)
@@ -62,61 +62,71 @@ static void _set_init_screen(Evas_Object *layout)
                evas_object_color_set(bg, 214, 82, 64, 255);
                elm_object_signal_emit(content_layout, "fast", "icon");
                elm_object_signal_emit(button, "2,button", "button");
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_FAST"));
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_FAST");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_DELIVERS_MESSAGES_NFASTER_THAN_ANY_OTHER_APP")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        case 2:
                evas_object_color_set(bg, 242, 184, 24, 255);
                elm_object_signal_emit(content_layout, "free", "icon");
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_FREE"));
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_FREE");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_IS_FREE_FOREVER_N_NNO_ADS_NO_SUBSCRIPTION_FEES")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        case 3:
                evas_object_color_set(bg, 118, 196, 69, 255);
                elm_object_signal_emit(content_layout, "secure", "icon");
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_SECURE"));
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_SECURE");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_KEEPS_YOUR_MESSAGES_NSAFE_FROM_HACKERS")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        case 4:
                evas_object_color_set(bg, 129, 97, 194, 255);
                elm_object_signal_emit(content_layout, "powerful", "icon");
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_POWERFUL"));
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_POWERFUL");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_HAS_NO_LIMITS_ON_THE_SIZE_OF_NCHATS_AND_MEDIA_YOU_CAN_SHARE")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        case 5:
                evas_object_color_set(bg, 63, 184, 212, 255);
                elm_object_signal_emit(content_layout, "cloud", "icon");
                elm_object_signal_emit(button, "2,button", "button");
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_CLOUD_BASED_ABB"));
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_CLOUD_BASED_ABB");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_ALLOWS_YOU_TO_ACCESS_NYOUR_MESSAGES_FROM_MULTIPLE_DEVICES")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        case 6:
                evas_object_color_set(bg, 237, 116, 36, 255);
                elm_object_signal_emit(content_layout, "private", "icon");
                elm_object_signal_emit(button, "1,button", "button");
-               elm_object_part_text_set(center_btn, "text", i18n_get_text("IDS_TGRAM_BUTTON_PREVIOUS"));
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_PRIVATE"));
+               elm_object_translatable_part_text_set(center_btn, "text", "IDS_TGRAM_BUTTON_PREVIOUS");
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_PRIVATE");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_P1SSTELEGRAMP2SS_MESSAGES_ARE_STRONGLY_ENCRYPTED_NAND_CAN_BE_DELETED_AUTOMATICALLY")), "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        default:
                evas_object_color_set(bg, 45, 165, 224, 255);
                elm_object_signal_emit(content_layout, "telegram", "icon");
                elm_object_signal_emit(button, "1,button", "button");
-               elm_object_part_text_set(center_btn, "text", i18n_get_text("IDS_TGRAM_BUTTON_NEXT_ABB5"));
-               elm_object_translatable_part_text_set(content_layout, "title", i18n_get_text("IDS_TGRAM_HEADER_TELEGRAM"));
+               elm_object_translatable_part_text_set(center_btn, "text", "IDS_TGRAM_BUTTON_NEXT_ABB5");
+               elm_object_translatable_part_text_set(content_layout, "title", "IDS_TGRAM_HEADER_TELEGRAM");
                snprintf(value, sizeof(value), elm_entry_utf8_to_markup(i18n_get_text("IDS_TGRAM_SBODY_THE_WORLDS_P1SSFASTESTP2SS_MESSAGING_APP_NIT_IS_P3SSFREEP4SS_AND_P5SSSECUREP6SS")), "<b>", "</b>", "<b>", "</b>", "<b>", "</b>");
-               elm_object_translatable_part_text_set(content_layout, "comment", value);
+               elm_object_part_text_set(content_layout, "comment", value);
                break;
        }
        index_bring_in(index, page_idx);
 }
 
+static void _layout_lang_changed(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *layout = data;
+       if (!layout) {
+               LOGE("Failed to get the layout");
+       }
+       LOGD("language is changed in init view layout");
+       _set_init_screen(layout);
+}
+
 static void _bottom_btn_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
        Evas_Object *layout = data;
@@ -191,7 +201,7 @@ static Evas_Object *_create_bottom_button(Evas_Object *layout, char *edj_path)
        evas_object_size_hint_min_set(right_btn, ELM_SCALE_SIZE(RIGHT_BUTTON_WIDTH), ELM_SCALE_SIZE(RIGHT_BUTTON_HEIGHT));
        evas_object_size_hint_max_set(right_btn, ELM_SCALE_SIZE(RIGHT_BUTTON_WIDTH), ELM_SCALE_SIZE(RIGHT_BUTTON_HEIGHT));
        evas_object_show(right_btn);
-       elm_object_part_text_set(right_btn, "text", i18n_get_text("IDS_TGRAM_BUTTON_NEXT_ABB5"));
+       elm_object_translatable_part_text_set(right_btn, "text","IDS_TGRAM_BUTTON_NEXT_ABB5");
        elm_object_part_content_set(bottom_layout, "right,button", right_btn);
        elm_object_signal_callback_add(right_btn, "clicked", "button", _bottom_btn_clicked, layout);
        evas_object_data_set(right_btn, "kind", (void *) 1);
@@ -203,7 +213,7 @@ static Evas_Object *_create_bottom_button(Evas_Object *layout, char *edj_path)
        evas_object_size_hint_min_set(left_btn, ELM_SCALE_SIZE(LEFT_BUTTON_WIDTH), ELM_SCALE_SIZE(LEFT_BUTTON_HEIGHT));
        evas_object_size_hint_max_set(left_btn, ELM_SCALE_SIZE(LEFT_BUTTON_WIDTH), ELM_SCALE_SIZE(LEFT_BUTTON_HEIGHT));
        evas_object_show(left_btn);
-       elm_object_part_text_set(left_btn, "text", i18n_get_text("IDS_TGRAM_BUTTON_PREVIOUS"));
+       elm_object_translatable_part_text_set(left_btn, "text", "IDS_TGRAM_BUTTON_PREVIOUS");
        elm_object_part_content_set(bottom_layout, "left,button", left_btn);
        elm_object_signal_callback_add(left_btn, "clicked", "button", _bottom_btn_clicked, layout);
        evas_object_data_set(left_btn, "kind", (void *) 2);
@@ -215,7 +225,7 @@ static Evas_Object *_create_bottom_button(Evas_Object *layout, char *edj_path)
        evas_object_size_hint_min_set(center_btn, ELM_SCALE_SIZE(CENTER_BUTTON_WIDTH), ELM_SCALE_SIZE(CENTER_BUTTON_HEIGHT));
        evas_object_size_hint_max_set(center_btn, ELM_SCALE_SIZE(CENTER_BUTTON_WIDTH), ELM_SCALE_SIZE(CENTER_BUTTON_HEIGHT));
        evas_object_show(center_btn);
-       elm_object_part_text_set(center_btn, "text", i18n_get_text("IDS_TGRAM_BUTTON_NEXT_ABB5"));
+       elm_object_translatable_part_text_set(center_btn, "text", "IDS_TGRAM_BUTTON_NEXT_ABB5");
        elm_object_part_content_set(bottom_layout, "center,button", center_btn);
        elm_object_signal_callback_add(center_btn, "clicked", "button", _bottom_btn_clicked, layout);
        evas_object_data_set(center_btn, "kind", (void *) 3);
@@ -275,6 +285,7 @@ void launch_init_screen(appdata_s* ad)
        evas_object_size_hint_align_set(content_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
        elm_object_part_content_set(layout, "setup,main", content_layout);
        evas_object_show(content_layout);
+       evas_object_smart_callback_add(content_layout, "language,changed", _layout_lang_changed, layout);
 
        _set_init_screen(layout);
 
@@ -283,7 +294,7 @@ void launch_init_screen(appdata_s* ad)
        evas_object_size_hint_weight_set(pbt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(pbt, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(pbt);
-       elm_object_part_text_set(pbt, "text", i18n_get_text("IDS_TGRAM_ACBUTTON_START_MESSAGING"));
+       elm_object_translatable_part_text_set(pbt, "text", "IDS_TGRAM_ACBUTTON_START_MESSAGING");
        elm_object_part_content_set(layout, "start,button", pbt);
        elm_object_signal_callback_add(pbt, "clicked", "button", on_start_btn_clicked, ad);
 
index 43daaba..d591393 100644 (file)
@@ -260,7 +260,12 @@ static char* on_chat_text_load_requested(void *data, Evas_Object *obj, const cha
                return NULL;
 
        if (!strcmp(part, "elm.text")) {
-               char* user_name = str_replace(item->buddy_display_name, "_null_", "");
+               char* user_name = NULL;
+               if (item->highlight_text) {
+                       user_name = str_replace(item->highlight_text, "_null_", "");
+               } else {
+                       user_name = str_replace(item->buddy_display_name, "_null_", "");
+               }
                char buf[512] = {'\0'};
                snprintf(buf, sizeof(buf), "<font=Tizen:style=Large color=#000000 align=left><font_size=40>%s</font_size></font>", user_name);
                free(user_name);
@@ -337,8 +342,19 @@ static void _on_search_entry_changed(void *data, Evas_Object *obj, void *event_i
        } else {
                LOGD("entry_text is not jamo, %s", entry_text);
                EINA_LIST_FOREACH(ad->main_list, l, item) {
-                       if (ucol_search(item->peer_print_name, entry_text) != -ENOENT)
+                       if (!item) continue;
+                       int select_start = -ENOENT;
+                       if (item->highlight_text) {
+                               free(item->highlight_text);
+                               item->highlight_text = NULL;
+                       }
+
+                       select_start = ucol_search(item->peer_print_name, entry_text);
+                       if (select_start != -ENOENT) {
+                               char *last_name = str_case_replace(item->buddy_display_name, entry_text, "<font=Tizen:style=Large color=#2da5e0 align=left>", "</font>");
+                               item->highlight_text = last_name;
                                result_list = eina_list_append(result_list, item);
+                       }
                }
        }
 
index 1d896e6..e6d2463 100755 (executable)
@@ -82,7 +82,12 @@ char* on_peer_list_name_requested(void *data, Evas_Object *obj, const char *part
                return NULL;
 
        if (!strcmp(part, "elm.text.main.left.top") || !strcmp(part, "elm.text")) {
-               char *full_name = replace(user->print_name, '_', " ");
+               char *full_name = NULL;
+               if (user->highlight_name) {
+                       full_name = replace(user->highlight_name, '_', " ");
+               } else {
+                       full_name = replace(user->print_name, '_', " ");
+               }
                return full_name;
        } else if (!strcmp(part, "elm.text.sub.left.bottom") || !strcmp(part, "elm.text.sub")) {
                char* last_seen = get_budy_state(ad, user->user_id.id);
@@ -1158,7 +1163,11 @@ char* on_contact_list_name_requested(void *data, Evas_Object *obj, const char *p
                return NULL;
 
        if (!strcmp(part, "elm.text.main.left.top") || !strcmp(part, "elm.text")) {
-               return strdup(contact->display_name);
+               if (contact->highlight_name) {
+                       return strdup(contact->highlight_name);
+               } else {
+                       return strdup(contact->display_name);
+               }
        } else if (!strcmp(part, "elm.text.sub.left.bottom") || !strcmp(part, "elm.text.sub")) {
                return NULL;
        }
@@ -1297,8 +1306,15 @@ static void _on_search_entry_changed(void *data, Evas_Object *obj, void *event_i
                LOGD("entry_text is not jamo, %s", entry_text);
                EINA_LIST_FOREACH(ad->search_peer_list, l, tl_item) {
                        tl_user = tl_item->use_data;
+                       if (!tl_user) continue;
+                       if (tl_user->highlight_name) {
+                               free(tl_user->highlight_name);
+                               tl_user->highlight_name = NULL;
+                       }
 
                        if (ucol_search(tl_user->print_name, entry_text) != -ENOENT) {
+                               char *last_name = str_case_replace(tl_user->print_name, entry_text, "<font=Tizen:style=Large color=#2da5e0 align=left>", "</font>");
+                               tl_user->highlight_name = last_name;
                                tl_result_list = eina_list_append(tl_result_list, tl_item);
                        }
                }
@@ -1316,8 +1332,17 @@ static void _on_search_entry_changed(void *data, Evas_Object *obj, void *event_i
        } else {
                LOGD("entry_text is not jamo, %s", entry_text);
                EINA_LIST_FOREACH(ad->contact_list, l, cn_item) {
-                       if (ucol_search(cn_item->display_name, entry_text) != -ENOENT)
+                       if (!cn_item) continue;
+
+                       if (cn_item->highlight_name) {
+                               free(cn_item->highlight_name);
+                               cn_item->highlight_name = NULL;
+                       }
+                       if (ucol_search(cn_item->display_name, entry_text) != -ENOENT) {
+                               char *last_name = str_case_replace(cn_item->display_name, entry_text, "<font=Tizen:style=Large color=#2da5e0 align=left>", "</font>");
+                               cn_item->highlight_name = last_name;
                                contact_result_list = eina_list_append(contact_result_list, cn_item);
+                       }
                }
        }
 
index e5ccc8c..14e46ee 100644 (file)
@@ -26,6 +26,7 @@
 #include "tg_search_peer_view.h"
 #include "tg_settings_view.h"
 #include "tg_add_contact.h"
+#include "ucol.h"
 
 uint64_t get_time_stamp_in_macro()
 {
@@ -397,6 +398,11 @@ void free_user_data(user_data_s *user_data)
                user_data->username = NULL;
        }
 
+       if (user_data->highlight_name) {
+               free(user_data->highlight_name);
+               user_data->highlight_name = NULL;
+       }
+
        free(user_data);
        user_data = NULL;
 }
@@ -627,7 +633,61 @@ char *str_replace(char *orig, char *rep, char *with)
        return result;
 }
 
+char *str_case_replace(char *orig, char *rep, char *with_pre, char *with_fi)
+{
+       char *result; // the return string
+       char *ins;    // the next insert point
+       char *tmp;    // varies
+       char *search_text;
+       int search_result = 0;
+       int len_rep;  // length of rep
+       int len_with; // length of with
+       int len_front; // distance between rep and end of last rep
+       int count = 0;    // number of replacements
+
+       if (!orig)
+               return NULL;
+       if (!rep)
+               rep = "";
+       len_rep = strlen(rep);
+       if (!with_pre)
+               with_pre = "";
+       if (!with_fi)
+               with_fi = "";
+       len_with = strlen(with_pre) + strlen(rep) + strlen(with_fi);
+
+       ins = orig;
 
+       while (search_result != -ENOENT) {
+               search_result = ucol_search(ins, rep);
+               tmp = ins + search_result;
+               ins = tmp + len_rep;
+               if (search_result != -ENOENT) count ++;
+       }
+
+       tmp = result = malloc(strlen(orig) + (len_with - len_rep) * count + 1);
+
+       if (!result)
+               return NULL;
+
+       while (count--) {
+               int tmp_length = 0;
+               search_result = ucol_search(orig, rep);
+               ins = orig + search_result;
+               search_text = (char *)malloc(len_rep+1);
+               strncpy(search_text, ins, len_rep);
+               search_text[len_rep] = '\0';
+
+               len_front = ins - orig;
+               tmp_length = len_front + strlen(with_pre) + len_rep + 1 + strlen(with_fi);
+               snprintf(tmp, tmp_length, "%.*s%s%s%s",len_front, orig, with_pre, search_text, with_fi);
+               tmp += (tmp_length-1);
+               orig += len_front+len_rep; // move to next "end of rep"
+       }
+
+       strcpy(tmp, orig);
+       return result;
+}
 
 char* get_display_name_from_contact(tg_peer_info_s* peer_info)
 {
index 723c1a5..310d7b0 100755 (executable)
@@ -345,6 +345,7 @@ typedef struct user_data {
        char *real_first_name;
        char *real_last_name;
        char *username;
+       char *highlight_name;
        int online;
        int last_seen;
        Eina_Bool is_selected;
@@ -527,6 +528,7 @@ typedef struct tg_main_list_item {
        Evas_Object* main_item_layout;
        Eina_Bool is_selected;
        char *buddy_display_name;
+       char *highlight_text;
 } tg_main_list_item_s;
 
 typedef struct appdata {
@@ -1144,6 +1146,8 @@ extern void on_floating_icon_clicked(void *data, Evas_Object *obj, void *event_i
 
 extern char *str_replace(char *orig, char *rep, char *with);
 
+extern char *str_case_replace(char *orig, char *rep, char *with_pre, char *with_fi);
+
 extern Eina_Bool on_load_main_view_requested(void *data);
 
 extern void launch_tg_server(void *data);
index 40a2d4b..2cc991d 100644 (file)
@@ -1,33 +1,33 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.tizen.telegram_tizen_client" version="1.0.1">
     <profile name="mobile"/>
-    <ui-application appid="org.tizen.telegram_tizen_client" auto-restart="false" exec="telegram_tizen" hw-acceleration="on" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+    <ui-application appid="org.tizen.telegram_tizen_client" auto-restart="false" exec="telegram_tizen_client" hw-acceleration="on" multiple="false" nodisplay="false" taskmanage="true" type="capp">
         <label>Telegram</label>
         <icon>ic_launcher.png</icon>
     </ui-application>
     <privileges>
+        <privilege>http://tizen.org/privilege/call</privilege>
         <privilege>http://tizen.org/privilege/location</privilege>
-        <privilege>http://tizen.org/privilege/datasharing</privilege>
-        <privilege>http://tizen.org/privilege/network.get</privilege>
+        <privilege>http://tizen.org/privilege/contact.read</privilege>
+        <privilege>http://tizen.org/privilege/account.read</privilege>
+        <privilege>http://tizen.org/privilege/network.set</privilege>
         <privilege>http://tizen.org/privilege/keymanager</privilege>
-        <privilege>http://tizen.org/privilege/callhistory.read</privilege>
-        <privilege>http://tizen.org/privilege/contact.write</privilege>
+        <privilege>http://tizen.org/privilege/email</privilege>
+        <privilege>http://tizen.org/privilege/datasharing</privilege>
+        <privilege>http://tizen.org/privilege/externalstorage</privilege>
         <privilege>http://tizen.org/privilege/content.write</privilege>
+        <privilege>http://tizen.org/privilege/callhistory.write</privilege>
+        <privilege>http://tizen.org/privilege/network.get</privilege>
         <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
-        <privilege>http://tizen.org/privilege/message.write</privilege>
+        <privilege>http://tizen.org/privilege/contact.write</privilege>
         <privilege>http://tizen.org/privilege/push</privilege>
-        <privilege>http://tizen.org/privilege/account.read</privilege>
-        <privilege>http://tizen.org/privilege/externalstorage</privilege>
-        <privilege>http://tizen.org/privilege/recorder</privilege>
+        <privilege>http://tizen.org/privilege/message.write</privilege>
         <privilege>http://tizen.org/privilege/bluetooth</privilege>
         <privilege>http://tizen.org/privilege/internet</privilege>
-        <privilege>http://tizen.org/privilege/network.set</privilege>
+        <privilege>http://tizen.org/privilege/callhistory.read</privilege>
         <privilege>http://tizen.org/privilege/notification</privilege>
+        <privilege>http://tizen.org/privilege/recorder</privilege>
         <privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
-        <privilege>http://tizen.org/privilege/callhistory.write</privilege>
-        <privilege>http://tizen.org/privilege/email</privilege>
-        <privilege>http://tizen.org/privilege/call</privilege>
-        <privilege>http://tizen.org/privilege/contact.read</privilege>
     </privileges>
     <feature name="http://tizen.org/feature/screen.size.normal.720.1280">true</feature>
 </manifest>