diff options
Diffstat (limited to 'src/ps_searcher.cpp')
-rwxr-xr-x | src/ps_searcher.cpp | 203 |
1 files changed, 143 insertions, 60 deletions
diff --git a/src/ps_searcher.cpp b/src/ps_searcher.cpp index 3327a40..b95cf4e 100755 --- a/src/ps_searcher.cpp +++ b/src/ps_searcher.cpp @@ -208,9 +208,13 @@ static int __search_sql_contact_search_result_cb(CTSvalue * value, } if((display_name) && strlen(display_name) > 0) { + char* markup_text_1line = elm_entry_utf8_to_markup(display_name); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(display_name, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); } /***********************************************************************/ @@ -218,9 +222,12 @@ static int __search_sql_contact_search_result_cb(CTSvalue * value, number = contacts_svc_value_get_str(value, CTS_LIST_NUM_NUMBER_STR); if((number) && strlen(number) > 0) { + char* markup_text_2line = elm_entry_utf8_to_markup(number); + strncpy(sel_mem_info->sub_buf, - search_markup_keyword(number, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); } /***********************************************************************/ @@ -373,11 +380,15 @@ int search_sql_calendar_search_result_by_api(int type, int offset, int limit, CAL_VALUE_TXT_SUMMARY); if ((summary) && (strlen(summary) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(summary); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(summary, - ad->search_word, - &is_word_in_str), - MAX_LENGTH_PER_LINE - 1); + search_markup_keyword(markup_text_1line, + ad->not_markup_search_word, + &is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); } snprintf(sel_mem_info->main_id, @@ -483,12 +494,26 @@ static void __search_sql_memo_search_result_cb(memo_data_t * value, sel_mem_info->type = type; /********** START : set search result to sel_mem_info buf ************/ + /* First, We should check comment field. It means drawing memo + * If comment field is NULL, then we check content field */ + if ((value->comment) && (strlen(value->comment) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(value->comment); + + strncpy(sel_mem_info->main_buf, + search_markup_keyword(markup_text_1line, ad->not_markup_search_word, + &is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); + } else if ((value->content) && (strlen(value->content) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(value->content); - if ((value->content) && (strlen(value->content) > 0)) { strncpy(sel_mem_info->main_buf, - search_markup_keyword(value->content, ad->search_word, - &is_word_in_str), - MAX_LENGTH_PER_LINE - 1); + search_markup_keyword(markup_text_1line, ad->not_markup_search_word, + &is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); } snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", value->id); @@ -629,21 +654,30 @@ int search_sql_email_search_result_by_api(int type, int offset, int limit, SEARCH_DEBUG_LOG("subject : %s", mail_list[i].subject); if((mail_list[i].subject) && (strlen(mail_list[i].subject) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(mail_list[i].subject); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(mail_list[i].subject, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_1line); } if((mail_list[i].from) && (strlen(mail_list[i].from) > 0)) { + char* markup_text_2line = elm_entry_utf8_to_markup(mail_list[i].from); + strncpy(sel_mem_info->sub_buf, - search_markup_keyword(mail_list[i].from, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); } if(is_word_in_str == false && (mail_list[i].recipients) && (strlen(mail_list[i].recipients) > 0)) { + char* markup_text_2line = elm_entry_utf8_to_markup(mail_list[i].recipients); + strncpy(sel_mem_info->sub_buf, - search_markup_keyword(mail_list[i].recipients, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); } elm_genlist_item_append(glist, @@ -791,11 +825,14 @@ static int __search_sql_media_search_result_by_api(int type, int offset, int lim sel_mem_info->type = type; if ((item->display_name) && (strlen(item->display_name) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(item->display_name); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(item->display_name, - ad->search_word, - &is_word_in_str), + search_markup_keyword(markup_text_1line, + ad->not_markup_search_word, + &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_1line); } snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID, "%d", @@ -946,7 +983,6 @@ int search_sql_music_search_result_by_api(int type, int offset, int limit, if (rc < 0) { break; } else { - if (loop_cnt == limit -1) break; @@ -988,40 +1024,51 @@ int search_sql_music_search_result_by_api(int type, int offset, int limit, sel_mem_info->type = type; if ((title) && (strlen(title) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(title); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(title, ad->search_word, &is_word_in_str), + search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_1line); } if (is_word_in_str) { if ((artist) && (strlen(artist) > 0)) { + char* markup_text_2line = elm_entry_utf8_to_markup(artist); + strncpy(sel_mem_info->sub_buf, - search_markup_keyword(artist, - ad->search_word, + search_markup_keyword(markup_text_2line, + ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); } } else { - memset(sel_mem_info->sub_buf, '\0', - MAX_LENGTH_PER_LINE); - - if ((artist) && (strlen(artist) > 0)) { - strncpy(sel_mem_info->sub_buf, - search_markup_keyword(artist, - ad->search_word, - &is_word_in_str), - MAX_LENGTH_PER_LINE - 1); - } + memset(sel_mem_info->sub_buf, '\0', MAX_LENGTH_PER_LINE); + + if ((artist) && (strlen(artist) > 0)) { + char* markup_text_2line = elm_entry_utf8_to_markup(artist); + + strncpy(sel_mem_info->sub_buf, + search_markup_keyword(markup_text_2line, + ad->not_markup_search_word, + &is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); + } if (is_word_in_str == false && (album) && (strlen(album) > 0)) { - strncpy(sel_mem_info->sub_buf, - search_markup_keyword(album, - ad->search_word, - &is_word_in_str), - MAX_LENGTH_PER_LINE - 1); - } - - if (is_word_in_str == false) { + char* markup_text_2line = elm_entry_utf8_to_markup(album); + + strncpy(sel_mem_info->sub_buf, + search_markup_keyword(markup_text_2line, + ad->not_markup_search_word, + &is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); + } + + if (is_word_in_str == false) { SEARCH_DEBUG_LOG("search_result is 0. No match keyword in title,album,artist string"); } } @@ -1113,9 +1160,16 @@ ail_cb_ret_e __search_sql_menu_search_result_cb( ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name); if ((name) && (strlen(name) > 0)) { + char* markup_text_1line = elm_entry_utf8_to_markup(name); + strncpy(sel_mem_info->main_buf, - search_markup_keyword(name, ad->search_word,&is_word_in_str), - MAX_LENGTH_PER_LINE - 1); + search_markup_keyword(markup_text_1line, ad->not_markup_search_word,&is_word_in_str), + MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_1line); + + SEARCH_DEBUG_LOG("name : %s", name); + } else { + SEARCH_DEBUG_LOG("name : null"); } if(ad->cate_info[type].next_point == 0) { /* Set group title */ @@ -1278,8 +1332,6 @@ int search_sql_msg_search_result_by_api(int type, int offset, int limit, bool is_more_btn = false; bool is_word_in_title = false; - const char *msg_address = NULL; - const char *msg_content = NULL; int address_cnt = 0; MSG_SEARCH_CONDITION_S searchCon = {0,}; @@ -1334,6 +1386,10 @@ int search_sql_msg_search_result_by_api(int type, int offset, int limit, /********** START : set search result to sel_mem_info buf ************/ for (i = 0; i < loop_cnt; i++) { + const char *text_1line = NULL; + const char *text_2line = NULL; + const char *msg_address = NULL; + const char *markup_keyword = NULL; sel_mem_info = (struct search_item_sel *) calloc(1,sizeof(struct search_item_sel)); @@ -1341,40 +1397,67 @@ int search_sql_msg_search_result_by_api(int type, int offset, int limit, snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", msg_get_message_id(msgList.msgInfo[i])); - msg_content = NULL; - + /* Set 1st line string */ if(msg_is_mms(msgList.msgInfo[i])) { - msg_content = msg_get_subject(msgList.msgInfo[i]); - } - - if((!msg_content) || (strlen(msg_content) == 0)) { - msg_content = msg_sms_get_message_body(msgList.msgInfo[i]); + /* MMS case */ + char* markup_text_1line = NULL; + + text_1line = msg_get_subject(msgList.msgInfo[i]); + markup_text_1line = elm_entry_utf8_to_markup(text_1line); + + markup_keyword = search_markup_keyword(markup_text_1line, + ad->not_markup_search_word, + &is_word_in_title); + + if (!is_word_in_title) { + text_1line = msg_mms_get_text_contents(msgList.msgInfo[i]); + markup_text_1line = elm_entry_utf8_to_markup(text_1line); + markup_keyword = search_markup_keyword(markup_text_1line, + ad->not_markup_search_word, + &is_word_in_title); } - if ((msg_content) && (strlen(msg_content) > 0)) { - strncpy(sel_mem_info->main_buf, - search_markup_keyword(msg_content, - ad->search_word, - &is_word_in_title), - MAX_LENGTH_PER_LINE - 1); + if ((text_1line) && (strlen(text_1line) > 0 )) + strncpy(sel_mem_info->main_buf, markup_keyword, MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); + } else { + /* SMS Case */ + char* markup_text_1line = NULL; + + text_1line = msg_sms_get_message_body(msgList.msgInfo[i]); + markup_text_1line = elm_entry_utf8_to_markup(text_1line); + markup_keyword = search_markup_keyword(markup_text_1line, + ad->not_markup_search_word, + &is_word_in_title); + + if ((text_1line) && (strlen(text_1line) > 0)) + strncpy(sel_mem_info->main_buf, markup_keyword, MAX_LENGTH_PER_LINE - 1); + + SEARCH_FREE(markup_text_1line); } + /* Set 2nd line string */ address_cnt = msg_get_address_count(msgList.msgInfo[i]); for(j = 0; j < address_cnt; j++) { if(msg_get_ith_contact_id(msgList.msgInfo[i],j) > 0) { - msg_address = msg_get_ith_name(msgList.msgInfo[i],j); + text_2line = msg_get_ith_name(msgList.msgInfo[i],j); } else { - msg_address = msg_get_ith_address(msgList.msgInfo[i],j); + text_2line = msg_get_ith_address(msgList.msgInfo[i],j); } - if ((msg_address) && (strlen(msg_address) > 0)) { + if ((text_2line) && (strlen(text_2line) > 0)) { + char* markup_text_2line = NULL; + + markup_text_2line = elm_entry_utf8_to_markup(text_2line); strncpy(sel_mem_info->sub_buf, - search_markup_keyword(msg_address, - ad->search_word, + search_markup_keyword(markup_text_2line, + ad->not_markup_search_word, &is_word_in_str), MAX_LENGTH_PER_LINE - 1); + SEARCH_FREE(markup_text_2line); } if ((is_word_in_title) || (is_word_in_str)) { |