PhoneBookStubsToOthers.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:281k
源码类别:
MTK
开发平台:
C/C++
- {
- CharInfo = pCharInfoBuffer[i] - ZI8_BASE_PINYIN + 0x0061;
- memcpy(output_string + out, &CharInfo, 2);
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- while ((pCharInfoBuffer[i] != 0x0000) && (i <= 7))
- {
- memcpy(output_string + out, &pCharInfoBuffer[i], 2);
- out = out + 2;
- i = i + 1;
- }
- break;
- default:
- break;
- }
- *out_len = i;
- return TRUE;
- }
- memcpy(output_string, input_string, 2);
- *out_len = 1;
- return TRUE;
- }
- *out_len = 0;
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_cache
- * DESCRIPTION
- * This function convert first character of name field into cache.
- * PARAMETERS
- * index [IN] Phonebook entry index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_convert_cache(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 code;
- U16 mode;
- U16 pCharInfoBuffer[MMI_PHB_CONVERT_BUFF_ZI];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memcpy(&code, PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- /* Change to proper input method. */
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- mode = ZI8_GETMODE_BOPOMOFO;
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- mode = ZI8_GETMODE_PINYIN;
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- mode = ZI8_GETMODE_STROKES;
- break;
- default:
- memcpy(&g_phb_generic_qsearch_cache[index], PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- return;
- }
- /* Begin to convert and store the result according to the input method. */
- if ((code >= 0x4e00) && (code <= 0x9fa5) &&
- Zi8GetCharInfo(code, (U16*) pCharInfoBuffer, MMI_PHB_CONVERT_BUFF_ZI, mode))
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- g_phb_generic_qsearch_cache[index] = pCharInfoBuffer[0] - ZI8_BASE_BPMF + 0x3105;
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- g_phb_generic_qsearch_cache[index] = pCharInfoBuffer[0] - ZI8_BASE_PINYIN + 0x0061;
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- g_phb_generic_qsearch_cache[index] = pCharInfoBuffer[0];
- break;
- default:
- memcpy(&g_phb_generic_qsearch_cache[index], PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- break;
- }
- }
- else
- {
- memcpy(&g_phb_generic_qsearch_cache[index], PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- }
- }
- //KP Jerry add on 2007-3-21 start
- #elif defined(__MMI_CSTAR__)
- BOOL mmi_phb_generic_quick_search_convert_to_spelling(U8* input_string, U8* output_string, U8* out_len)
- {
- int c;
- int mode;
- U16 code;
- U16 buf[16];
- mode = MMI_current_input_mode;
- switch (mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- break;
- default:
- *out_len = 0;
- return FALSE;
- }
- if ( (input_string[0] == 0) && (input_string[1] == 0) )
- {
- *out_len = 0;
- return FALSE;
- }
- memcpy(&code, input_string, 2);
- c = CstarQueryCharInfo(code, buf, 16, mode);
- if (c <= 0)
- {
- memcpy(output_string, input_string, 2);
- *out_len = 1;
- return TRUE;
- }
- if (c > 7)
- c = 7;
- memcpy(output_string, buf, sizeof(U16) * c);
- *out_len = (U8)c;
- return TRUE;
- }
- void mmi_phb_generic_quick_search_convert_cache(U16 index)
- {
- int c;
- int mode;
- U16 code;
- U16 buf[16];
- mode = MMI_current_input_mode;
- switch (mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- break;
- default:
- memcpy(&g_phb_generic_qsearch_cache[index], PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- return;
- }
- memcpy(&code, PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- c = CstarQueryCharInfo(code, buf, 16, mode);
- if (c <= 0)
- {
- memcpy(&g_phb_generic_qsearch_cache[index], PhoneBook[g_phb_name_index[index]].alpha_id.name, 2);
- return;
- }
- g_phb_generic_qsearch_cache[index] = buf[0];
- }
- //KP Jerry add on 2007-3-21 end
- #elif defined(__MMI_ITAP__)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #else /* No default input method library */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_to_spelling
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * input_string [?]
- * output_string [?]
- * out_len [?]
- * a(?) [IN/OUT] First variable, used as returns
- * b(?) [IN] Second variable
- * RETURNS
- * the description of return value, if any.
- *****************************************************************************/
- BOOL mmi_phb_generic_quick_search_convert_to_spelling(U8 *input_string, U8 *output_string, U8 *out_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memcpy(output_string, input_string, 2);
- *out_len = 1;
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_cache
- * DESCRIPTION
- * This function convert first character of name field into cache.
- * PARAMETERS
- * index [IN] Phonebook entry index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_convert_cache(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_generic_qsearch_cache[index] = (U16) PhoneBook[g_phb_name_index[index]].alpha_id.name[0];
- }
- #endif
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_make_cache
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_make_cache(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 index;
- U16 pre_store_index;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_T9__)
- /* Switch to the proper input language, only for T9 */
- switch (MMI_current_input_mode)
- {
- #if defined(__MMI_T9_TR_CHINESE__)
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- T9ChangeLanguageToTRChineseBoPoMo();
- break;
- case INPUT_MODE_MMI_TR_STROKE:
- T9ChangeLanguageToTRChineseStroke();
- break;
- #endif /* defined(__MMI_T9_TR_CHINESE__) */
- #if defined(__MMI_T9_SM_CHINESE__)
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- T9ChangeLanguageToSMChinesePinYin();
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- T9ChangeLanguageToSMChineseStroke();
- break;
- #endif /* defined(__MMI_T9_SM_CHINESE__) */
- default:
- break;
- }
- #endif /* defined(__MMI_T9__) */
- /* Begin to convert first character of name field to associated input method string. */
- for (index = 0; index < PhoneBookEntryCount; index++)
- {
- store_index = g_phb_name_index[index];
- if (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name) > 0)
- {
- /* The Entry Name is an UCS2 string */
- if (PhoneBook[store_index].alpha_id.name_dcs == PHB_UCS2)
- {
- if (index != 0)
- {
- pre_store_index = g_phb_name_index[index - 1];
- /* If character is the same, do not convert again. */
- if ((PhoneBook[pre_store_index].alpha_id.name[0] == PhoneBook[store_index].alpha_id.name[0]) &&
- (PhoneBook[pre_store_index].alpha_id.name[1] == PhoneBook[store_index].alpha_id.name[1]))
- {
- g_phb_generic_qsearch_cache[index] = g_phb_generic_qsearch_cache[index - 1];
- continue;
- }
- }
- mmi_phb_generic_quick_search_convert_cache(index);
- }
- else
- /* This is an ASCII string */
- {
- g_phb_generic_qsearch_cache[index] = (U16) PhoneBook[store_index].alpha_id.name[0];
- }
- }
- /* The name field is Empty */
- else
- {
- g_phb_generic_qsearch_cache[index] = 0x0000;
- }
- }
- g_phb_generic_qsearch_is_cache = 1; /* Convert cache done */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_find_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * keyword [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_generic_quick_search_find_entry(U8 *keyword)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 key_length;
- U8 flag;
- U16 i;
- U16 code1, code2;
- U16 result_count;
- U8 same_count;
- U8 convert_result;
- S32 distance;
- S8 *string1, *string2 = NULL;
- S8 convert_string[22 * ENCODING_LENGTH]; /* 7*3 + 1 => (char1 + char2 + char3 + Null Terminator) */
- U8 char1[7 * ENCODING_LENGTH]; /* Cache 1st character convert result */
- U8 char2[7 * ENCODING_LENGTH]; /* Cache 2nd character convert result */
- U8 char3[7 * ENCODING_LENGTH]; /* Cache 3rd character convert result */
- U8 len1, len2, len3;
- U16 store_index;
- U8 prev_ucs2 = 0; /* Is previous record ucs2 encoding */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check if cache already build up before using */
- if (!g_phb_generic_qsearch_is_cache)
- {
- StopTimer(PHB_QUICK_SEARCH_TIMER);
- mmi_phb_generic_quick_search_make_cache();
- }
- /* Count the input string length to decide behavior */
- key_length = (U8) pfnUnicodeStrlen((S8*) keyword);
- result_count = 0;
- /* For each entry, check if it is in the quick search sub-list */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- flag = FALSE;
- store_index = g_phb_name_index[i];
- /*
- * search length == 1, compare whole list with first character only.
- */
- if (key_length == 1)
- {
- code1 = (U16) g_phb_generic_qsearch_cache[i];
- memcpy(&code2, keyword, 2);
- if (mmi_phb_compare_chars(code1, code2) == 0)
- {
- flag = TRUE;
- }
- }
- /*
- * search length > 1, compare subset list with maximum search character.
- */
- else if (key_length > 1)
- {
- code1 = (U16) g_phb_generic_qsearch_cache[i];
- memcpy(&code2, keyword, 2);
- /* Compare character in cache first. If match, compare the rest part. */
- if (mmi_phb_compare_chars(code1, code2) == 0)
- {
- //store_index = g_phb_name_index[i];
- flag = FALSE;
- if (PhoneBook[store_index].alpha_id.name_dcs == MMI_PHB_UCS2)
- {
- /* Use previous record convert result as cache */
- if (i != 0)
- {
- string2 = (S8*) PhoneBook[g_phb_name_index[i - 1]].alpha_id.name;
- }
- /* Current record */
- string1 = (S8*) PhoneBook[store_index].alpha_id.name;
- /*
- * Convert 1st character
- */
- if ((i != 0) && (string2[0] == string1[0]) && (string2[1] == string1[1]) && prev_ucs2)
- {
- convert_result = 10; /* Use 10 to represent that first character is the same as previous one */
- }
- else
- {
- U16 code;
- memcpy(&code, &PhoneBook[store_index].alpha_id.name[0], 2);
- if ((code >= 0x4e00) && (code <= 0x9fa5))
- {
- convert_result = mmi_phb_generic_quick_search_convert_to_spelling(
- &PhoneBook[store_index].alpha_id.name[0],
- char1,
- &len1);
- }
- else
- {
- convert_result = FALSE;
- }
- }
- if (convert_result)
- {
- memset(convert_string, 0, 22 * ENCODING_LENGTH); /* Clear String in advance, to make sure there will be terminator */
- len1 = (len1 > 7) ? 7 : len1;
- memcpy(convert_string, char1, (len1 * ENCODING_LENGTH));
- /*
- * Convert 2nd Character
- */
- if (len1 < key_length)
- {
- if ((convert_result == 10) && (string2[2] == string1[2]) && (string2[3] == string1[3]) &&
- prev_ucs2)
- {
- convert_result = 20; /* Use 20 to represent that second character is the same as previous one */
- }
- else
- {
- convert_result = mmi_phb_generic_quick_search_convert_to_spelling(
- &PhoneBook[store_index].alpha_id.name[2],
- char2,
- &len2);
- }
- if (convert_result)
- {
- len2 = (len2 > 7) ? 7 : len2;
- memcpy((convert_string + len1 * ENCODING_LENGTH), char2, (len2 * ENCODING_LENGTH));
- /*
- * Convert 3rd Character
- */
- if ((len1 + len2) < key_length)
- {
- if ((convert_result == 20) && (string2[4] == string1[4]) &&
- (string2[5] == string1[5]) && prev_ucs2)
- {
- convert_result = 30; /* Use 30 to represent that third character is the same as previous one */
- }
- else
- {
- convert_result = mmi_phb_generic_quick_search_convert_to_spelling(
- &PhoneBook[store_index].alpha_id. name[4],
- char3,
- &len3);
- }
- if (convert_result)
- {
- len3 = (len3 > 7) ? 7 : len3;
- memcpy(
- (convert_string + (len1 + len2) * ENCODING_LENGTH),
- char3,
- (len3 * ENCODING_LENGTH));
- }
- else
- {
- memcpy(
- (convert_string + len1 * ENCODING_LENGTH),
- &PhoneBook[store_index].alpha_id.name[4],
- 2);
- }
- }
- }
- else
- {
- memcpy(
- (convert_string + len1 * ENCODING_LENGTH),
- &PhoneBook[store_index].alpha_id.name[2],
- 2);
- }
- }
- /* Chinese convert successfully, use convert result to compare */
- string1 = convert_string;
- prev_ucs2 = 1;
- }
- else /* Not Chinese */
- {
- string1 = (S8*) PhoneBook[store_index].alpha_id.name;
- prev_ucs2 = 0;
- }
- }
- else /* ASCII */
- {
- string1 = (S8*) PhoneBook[store_index].alpha_id.name;
- prev_ucs2 = 0;
- }
- mmi_phb_compare_ucs2_strings((S8*) string1, (S8*) keyword, &same_count, &distance);
- if (same_count == key_length)
- {
- flag = TRUE;
- }
- }
- }
- /*
- *search length == 0, display whole list.
- */
- else
- {
- flag = TRUE;
- }
- /* Add to list if entry is a subset of a quick search result */
- if (flag)
- {
- /* g_phb_qsearch[i] = 1; */
- g_phb_generic_qsearch_bitmask[i >> BYTE_SIZE_SHIFT_ARITHMETIC] |= 1 << (i % BYTE_SIZE);
- if (PhoneBook[store_index].field & 0x1E)
- {
- result_count++;
- }
- }
- else
- {
- /* g_phb_qsearch[i] = 0; */
- g_phb_generic_qsearch_bitmask[i >> BYTE_SIZE_SHIFT_ARITHMETIC] &= (kal_uint8) (~(1 << (i % BYTE_SIZE)));
- }
- }
- if (result_count == 0) /* Clear send key when no entry found */
- {
- ClearKeyHandler(KEY_SEND, KEY_EVENT_UP);
- }
- return result_count;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_filter_list_get_item
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_phb_generic_filter_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = 0;
- S32 i = -1;
- S32 inner_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < item_index)
- {
- store_index = g_phb_name_index[inner_index];
- if (g_phb_generic_qsearch_bitmask[inner_index >> BYTE_SIZE_SHIFT_ARITHMETIC] & (1 << (inner_index % BYTE_SIZE)))
- {
- if (PhoneBook[store_index].field & 0x1E)
- {
- i++;
- }
- }
- inner_index++;
- }
- if (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name))
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) PhoneBook[store_index].alpha_id.name);
- }
- else
- {
- mmi_phb_convert_get_ucs2_number((S8*) str_buff, store_index);
- }
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- *img_buff_p = get_image(IMG_STORAGE_SIM);
- }
- else
- {
- *img_buff_p = get_image(IMG_STORAGE_HANDSET);
- }
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_filter_list_get_hint
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_generic_filter_list_get_hint(S32 item_index, UI_string_type *hint_array)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = 0;
- S8 temp_number[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- S32 i = -1;
- S32 inner_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < item_index)
- {
- store_index = g_phb_name_index[inner_index];
- if (g_phb_generic_qsearch_bitmask[inner_index >> BYTE_SIZE_SHIFT_ARITHMETIC] & (1 << (inner_index % BYTE_SIZE)))
- {
- if (PhoneBook[store_index].field & 0x1E)
- {
- i++;
- }
- }
- inner_index++;
- }
- mmi_phb_convert_get_ucs2_number((S8*) temp_number, store_index);
- if (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name) && pfnUnicodeStrlen((S8*) temp_number))
- {
- pfnUnicodeStrcpy((S8*) hint_array[0], (S8*) temp_number);
- }
- else
- {
- return 0;
- }
- return 1; /* One hint data only, can be more hints. */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_change_input_mode
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_change_input_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- // memset(g_phb_qsearch,1,MAX_PB_ENTRIES); /*All records are in the subset at the beginning*/
- memset(g_phb_generic_qsearch_bitmask, 0xff, (MAX_PB_ENTRIES + 7) / 8);
- g_phb_generic_qsearch_is_cache = 0;
- /*
- * Make cache according to the current input method.
- * Start a timer to avoid convert cache each time when user change input method quickly.
- */
- StopTimer(PHB_QUICK_SEARCH_TIMER);
- StartTimer(PHB_QUICK_SEARCH_TIMER, 500, mmi_phb_generic_quick_search_make_cache);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_by_store_location_fourth
- * DESCRIPTION
- * call back function for dynamic list to get index according to the fileter list.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_by_store_location_fourth(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = 0;
- S32 i = -1;
- S32 inner_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (i < nIndex)
- {
- store_index = g_phb_name_index[inner_index];
- if (g_phb_generic_qsearch_bitmask[inner_index >> BYTE_SIZE_SHIFT_ARITHMETIC] & (1 << (inner_index % BYTE_SIZE)))
- {
- if (PhoneBook[store_index].field & 0x1E)
- {
- i++;
- }
- }
- inner_index++;
- }
- g_phb_cntx.active_index_fourth = store_index;
- }
- #if defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
- extern void EntryQuickSearchInputMethodScreen(void);
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_go_back_editor
- * DESCRIPTION
- * Go back screen after change input method.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_go_back_editor(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBackToHistory(SCR_PBOOK_LIST);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_highlight_quick_search_input_method
- * DESCRIPTION
- * Highlight function to enter change input method
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_highlight_quick_search_input_method(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(EntryQuickSearchInputMethodScreen, KEY_EVENT_UP);
- SetKeyHandler(EntryQuickSearchInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- RegisterInputMethodScreenCloseFunction(mmi_phb_generic_quick_search_go_back_editor);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_highlight_quick_search_op_option
- * DESCRIPTION
- * Highlight function to enter entry option.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_highlight_quick_search_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_phb_entry_sms_choose_number, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_sms_choose_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_entry_quick_search_option
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_entry_quick_search_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nStrItemList[10];
- U8 *guiBuffer;
- U16 nNumofItem;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_PHB_SMS_QUICK_SEARCH_OPTIONS, NULL, mmi_phb_generic_entry_quick_search_option, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_PHB_SMS_QUICK_SEARCH_OPTIONS);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- nNumofItem = GetNumOfChild(MENU_ID_PHB_SMS_QUICK_SEARCH_OPTION);
- GetSequenceStringIds(MENU_ID_PHB_SMS_QUICK_SEARCH_OPTION, nStrItemList);
- SetParentHandler(MENU_ID_PHB_SMS_QUICK_SEARCH_OPTION);
- ShowCategory15Screen(
- STR_GLOBAL_OPTIONS,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- //1,
- 0,
- guiBuffer);
- // RegisterInputMethodScreenCloseFunction(fmgr_return_to_editor);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_exit_quick_search_option
- * DESCRIPTION
- * Exit function of phonebook quick search option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_exit_quick_search_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_ID_PHB_SMS_QUICK_SEARCH_OPTIONS;
- }
- #endif /* defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_frm_enter_send_entry
- * DESCRIPTION
- * Displays the PHB list for SMS to send SMS
- * to one or many numbers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_frm_enter_send_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 SMSEntryCount = 0;
- U16 entryCount;
- U16 store_index;
- U8 *guiBuffer;
- //MMI_BOOL alpha_index = MMI_TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_frm_enter_send_entry.>n", __FILE__,
- __LINE__));
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- else
- #endif /* __SYNCML_SUPPORT__ */
- if (g_phb_cntx.phb_ready && !g_phb_cntx.processing)
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Build list according to filter */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (PhoneBook[store_index].field & 0x1E)
- {
- g_phb_cntx.list_filter[SMSEntryCount] = store_index;
- SMSEntryCount++;
- }
- }
- if (SMSEntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_FRM;
- EntryNewScreen(SCR_PBOOK_LIST, mmi_phb_exit_list, mmi_phb_frm_enter_send_entry, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_LIST);
- if (g_phb_cntx.new_highlight_entry < 0xffff)
- {
- change_list_menu_category_history(guiBuffer, g_phb_cntx.new_highlight_entry, SMSEntryCount, 0);
- g_phb_cntx.new_highlight_entry = 0xffff;
- }
- RegisterHighlightHandler(mmi_phb_get_index_by_store_location_fourth);
- RegisterCat200SearchFunction(mmi_phb_generic_quick_search_find_entry);
- /* First Time enter or any entry has been modified.. */
- if ((guiBuffer == NULL) || (g_phb_cntx.refresh_list == MMI_PHB_ENTRY_REFRESH))
- {
- g_phb_cntx.highlight_entry = 0;
- memset(g_phb_generic_qsearch_input, 0, ENCODING_LENGTH);
- memset(g_phb_generic_qsearch_bitmask, 0xff, (MAX_PB_ENTRIES + 7) / 8);
- entryCount = SMSEntryCount;
- guiBuffer = NULL;
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_QSEARCH; /* '2' is used only for this screen. */
- }
- else
- {
- entryCount = (U16) mmi_phb_generic_quick_search_find_entry(g_phb_generic_qsearch_input);
- }
- #ifdef __MMI_UI_HINTS_IN_MENUITEM__
- set_force_icon_on_highlight_only_in_menuitem();
- #endif
- #if defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
- ShowCategory200Screen(
- STR_SCR_PBOOK_VIEW_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- entryCount,
- mmi_phb_generic_filter_list_get_item,
- mmi_phb_generic_filter_list_get_hint,
- g_phb_cntx.highlight_entry,
- IMG_ID_PHB_QUICK_SEARCH_FIND,
- (U8*) g_phb_generic_qsearch_input,
- MMI_PHB_GENERIC_QUICK_SEARCH_INPUT_LENGTH,
- guiBuffer);
- SetCategory200LeftSoftkeyFunction(mmi_phb_generic_entry_quick_search_option, KEY_EVENT_UP);
- SetLeftSoftkeyFunction(mmi_phb_generic_entry_quick_search_option, KEY_EVENT_UP);
- #else /* defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */
- ShowCategory200Screen(
- STR_SCR_PBOOK_VIEW_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- entryCount,
- mmi_phb_generic_filter_list_get_item,
- mmi_phb_generic_filter_list_get_hint,
- g_phb_cntx.highlight_entry,
- IMG_ID_PHB_QUICK_SEARCH_FIND,
- (U8*) g_phb_generic_qsearch_input,
- MMI_PHB_GENERIC_QUICK_SEARCH_INPUT_LENGTH,
- guiBuffer);
- SetCategory200LeftSoftkeyFunction(mmi_phb_entry_sms_choose_number, KEY_EVENT_UP);
- SetLeftSoftkeyFunction(mmi_phb_entry_sms_choose_number, KEY_EVENT_UP);
- #endif /* defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */
- SetCategory200RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_frm_sms_end_key_from_send, KEY_END, KEY_EVENT_DOWN);
- if (guiBuffer == NULL)
- {
- g_phb_generic_qsearch_is_cache = 0;
- mmi_phb_generic_quick_search_make_cache();
- }
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_PHB_NO_ENTRY_TO_SELECT),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- mmi_phb_list_free_filter();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- #else /* defined(__MMI_PHB_QUICK_SEARCH__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_frm_enter_send_entry
- * DESCRIPTION
- * Displays the PHB list for SMS to send SMS
- * to one or many numbers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_frm_enter_send_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 EntryCount = 0;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_frm_enter_send_entry.>n", __FILE__,
- __LINE__));
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- else
- #endif /* __SYNCML_SUPPORT__ */
- if (g_phb_cntx.phb_ready && !g_phb_cntx.processing)
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Build list according to filter */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (PhoneBook[store_index].field & 0x1E)
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- }
- }
- if (EntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_FRM;
- mmi_phb_entry_list(
- EntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_by_store_location_second, /* Highlight Callback */
- mmi_phb_entry_sms_choose_number, /* LSK Callback */
- mmi_phb_entry_sms_choose_number, /* SEND Key Callback */
- mmi_phb_filter_list_get_item, /* List Callback */
- mmi_phb_filter_list_get_hint, /* Hint Callback */
- mmi_phb_frm_enter_send_entry, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_frm_sms_end_key_from_send, KEY_END, KEY_EVENT_DOWN);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_PHB_NO_ENTRY_TO_SELECT),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- mmi_phb_list_free_filter();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) */
- //quick search end
- #if defined(__MMI_MESSAGES_SEND_BY_GROUP__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_enter_send_by_group
- * DESCRIPTION
- * Displays the Caller Groups list for SMS to send message
- * to all numbers belonging to this group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_enter_send_by_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_get_address_from_caller_group((U8)MMI_PHB_ENTRY_FIELD_NUMBER, mmi_msg_send_msg_to_group);
- }
- #endif /* defined(__MMI_MESSAGES_SEND_BY_GROUP__) */
- #if defined(__MMI_MESSAGES_SEND_BY_GROUP__) || defined(__UNIFIED_COMPOSER_SUPPORT__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_send_data_for_group
- * DESCRIPTION
- * Sends the names & numbers info of the selected
- * caller group to SMS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_send_data_for_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 *indices;
- U16 i, j = 0;
- S16 pError;
- U16 store_index;
- U8 optid_record, optid_index, current_record = 0;
- PHB_OPTIONAL_IDS_STRUCT PhbOptIDs[OPTIONAL_IDS_RECORD_TOTAL];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Clear key immediately to avoid user press twice. */
- ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_cntx.active_index >= MAX_PB_CALLER_GROUPS)
- {
- #if (MAX_PB_ENTRIES >= 1000)
- indices = (U16*)g_phb_list_filter;
- #else
- indices = OslMalloc(MAX_PB_SIM_ENTRIES*sizeof(U16));
- #endif /* MAX_PB_ENTRIES >= 1000 */
- for (i = 0; i < PhoneBookEntryCount ; ++i)
- {
- store_index = g_phb_name_index[i];
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- /* Compare caller group ID */
- if (g_phb_cntx.group_type[store_index-MAX_PB_PHONE_ENTRIES] ==
- (g_phb_cntx.active_index_second+1-MAX_PB_CALLER_GROUPS) &&
- PhoneBook[store_index].field & phb_list_view_type)
- {
- indices[j++] = store_index;
- }
- }
- }
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_SendDataForCallerGrp, j ));
- phb_group_view_call_back(j, indices);
- #if (MAX_PB_ENTRIES < 1000)
- OslMfree(indices);
- #endif /* MAX_PB_ENTRIES < 1000 */
- return;
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #if (MAX_PB_ENTRIES >= 1000)
- indices = (U16*) g_phb_list_filter;
- #else /* (MAX_PB_ENTRIES >= 1000) */
- #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- indices = OslMalloc(MAX_PB_ENTRIES * sizeof(U16));
- #else
- indices = OslMalloc(MAX_PB_PHONE_ENTRIES * sizeof(U16));
- #endif
- #endif /* MAX_PB_ENTRIES >= 1000 */
- for (i = 0; i < PhoneBookEntryCount; ++i)
- {
- store_index = g_phb_name_index[i];
- #if !defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- #endif
- {
- /* Get optional IDs record. */
- optid_record = (store_index / OPTIONAL_IDS_RECORD_TOTAL) + 1;
- optid_index = store_index - (optid_record - 1) * OPTIONAL_IDS_RECORD_TOTAL;
- if (optid_record != current_record)
- {
- ReadRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- current_record = optid_record;
- }
- /* Compare caller group ID */
- if (PhbOptIDs[optid_index].callerGroupID == (g_phb_cntx.active_index_second + 1) &&
- PhoneBook[store_index].field & phb_list_view_type)
- {
- indices[j++] = store_index;
- }
- }
- }
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_SendDataForCallerGrp, j));
- phb_group_view_call_back(j, indices);
- #if (MAX_PB_ENTRIES < 1000)
- OslMfree(indices);
- #endif /* MAX_PB_ENTRIES < 1000 */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_caller_group_data
- * DESCRIPTION
- * Get the all numbers belonging to this group for UM to send message
- * PARAMETERS
- * address_type [IN] address type: number or e-mail
- * get_address_call_back [IN] call back function after user chooses a group
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_address_from_caller_group(U8 address_type, mmi_phb_get_index_from_group_callback_type get_address_call_back)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- else
- #endif /* __SYNCML_SUPPORT__ */
- if (g_phb_cntx.phb_ready && !g_phb_cntx.processing)
- {
- if (PhoneBookEntryCount)
- {
- phbListView = MMI_PHB_LIST_FOR_GET_ADDRESS_FROM_GROUP;
- phb_list_view_type = address_type;
- phb_group_view_call_back = get_address_call_back;
- mmi_phb_entry_callergroup(); /* Entry caller group main screen. */
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- #endif /* defined(__MMI_MESSAGES_SEND_BY_GROUP__) || defined(__UNIFIED_COMPOSER_SUPPORT__) */
- #if defined(__UNIFIED_COMPOSER_SUPPORT__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_email_p
- * DESCRIPTION
- * Get the all numbers belonging to this group for UM to send message
- * PARAMETERS
- * store_index [IN] store index of the phonebook entry
- * address_length [OUT] email address length
- * RETURNS
- * email address pointer
- *****************************************************************************/
- U8* mmi_phb_get_email_p(U16 store_index, U8* address_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- if (store_index < MAX_PB_PHONE_ENTRIES) /* in NVRAM */
- {
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- *address_length = strlen((PS8)PhoneBookOptionalFields.emailAddress);
- return (U8*)PhoneBookOptionalFields.emailAddress;
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- #ifdef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* in USIM */
- {
- *address_length = phb_email[store_index - MAX_PB_PHONE_ENTRIES].email_length;
- return (U8*) phb_email[store_index - MAX_PB_PHONE_ENTRIES].email_address;
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- *address_length = 0;
- return NULL;
- }
- #endif /* defined(__UNIFIED_COMPOSER_SUPPORT__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_send_data_choose_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_send_data_choose_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_entry_list_choose_number(
- g_phb_name_index[g_phb_cntx.active_index_second],
- mmi_phb_sms_send_data_choose_entry,
- mmi_phb_sms_send_data_for_entry_list,
- mmi_phb_sms_send_data_for_entry,
- STR_SMS_NUM_CANNOT_BE_EMPTY,
- FALSE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_send_data_for_entry_name_only
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_send_data_for_entry_name_only(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_sms_send_data_for_entry(NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_send_data_for_entry_list
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_send_data_for_entry_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* DeleteNScrId(SCR_PBOOK_LIST); */
- mmi_phb_sms_send_data_for_entry((PS8) g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_send_data_for_entry
- * DESCRIPTION
- * Sends the name & number info of the selected PHB entry to SMS
- * PARAMETERS
- * number [IN] Input number string
- * RETURNS
- * void
- *****************************************************************************/
- extern void mmi_frm_sms_get_phb_number(U8 name[], U8 number[]);
- void mmi_phb_sms_send_data_for_entry(S8 *number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 type = 0;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- #if defined(__MMI_MESSAGES_CHAT__)
- if ((phbListView == MMI_PHB_LIST_FOR_CHAT) || (phbListView == MMI_PHB_LIST_FOR_CHAT_NO_CHECK))
- {
- if (pfnUnicodeStrlen((PS8) PhoneBook[store_index].alpha_id.name) == 0 &&
- phbListView == MMI_PHB_LIST_FOR_CHAT_NO_CHECK)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NAME_CANNOT_BE_EMPTY),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else
- {
- SetNameNumberForChatScreen(PhoneBook[store_index].alpha_id.name, (U8*) number);
- }
- return;
- }
- #endif /* defined(__MMI_MESSAGES_CHAT__) */
- if (number[0] == '+')
- {
- type = 1;
- }
- if (pfnUnicodeStrlen((PS8) number) <= ((MAX_PB_NUMBER_LENGTH / ENCODING_LENGTH) + type))
- {
- if (pfnUnicodeStrlen((PS8) number) == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_CANNOT_BE_EMPTY),
- IMG_GLOBAL_UNFINISHED,
- 1,
- PHB_NOTIFY_TIMEOUT,
- (U8) ERROR_TONE);
- }
- else if (phbListView == MMI_PHB_LIST_FOR_FRM)
- {
- mmi_frm_sms_get_phb_number(PhoneBook[store_index].alpha_id.name, (U8*) number);
- }
- else
- {
- mmi_msg_get_number_from_phb(PhoneBook[store_index].alpha_id.name, (U8*) number);
- }
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_LEN_EXCEEDED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- PHB_NOTIFY_TIMEOUT,
- (U8) ERROR_TONE);
- }
- }
- #ifdef __MMI_PHB_SEND_MMS_FROM_PHB__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_send_data_for_entry
- * DESCRIPTION
- * Sends the name & number info of the selected PHB entry to SMS
- * PARAMETERS
- * number [IN] Input number string
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_mms_send_data_for_entry(S8 *number)
- {
- #ifdef WAP_SUPPORT
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((PS8) number) <= MAX_PB_NUMBER_LENGTH)
- {
- if (pfnUnicodeStrlen((PS8) number) == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_CANNOT_BE_EMPTY),
- IMG_GLOBAL_UNFINISHED,
- 1,
- PHB_NOTIFY_TIMEOUT,
- (U8) ERROR_TONE);
- }
- else
- {
- mms_address_insert_hdlr((char*)number);
- }
- }
- else
- #endif /* WAP_SUPPORT */ /* WAP_SUPOPRT */
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_LEN_EXCEEDED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- PHB_NOTIFY_TIMEOUT,
- (U8) ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_send_data_for_entry_list
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_mms_send_data_for_entry_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_mms_send_data_for_entry((PS8) g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_send_data_choose_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_mms_send_data_choose_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_entry_list_choose_number(
- g_phb_name_index[g_phb_cntx.active_index_second],
- mmi_phb_mms_send_data_choose_entry,
- mmi_phb_mms_send_data_for_entry_list,
- mmi_phb_mms_send_data_for_entry,
- STR_SMS_NUM_CANNOT_BE_EMPTY,
- FALSE);
- }
- #endif /* __MMI_PHB_SEND_MMS_FROM_PHB__ */
- #define MMI_PHB_UPDATE_INLINE_LIST
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_update_delete_image
- * DESCRIPTION
- * Deletes the image id from PHB records if
- * one of the downloaded/factory/system images
- * are deleted.
- * PARAMETERS
- * imageId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_update_delete_image(U16 imageId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U8 flag = 0;
- S16 pError;
- U8 optid_record = 0, optid_index, current_record = 0;
- PHB_OPTIONAL_IDS_STRUCT PhbOptIDs[OPTIONAL_IDS_RECORD_TOTAL];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_PB_PHONE_ENTRIES; ++i)
- {
- /* Get optional IDs record. */
- optid_record = (i / OPTIONAL_IDS_RECORD_TOTAL) + 1;
- optid_index = i - (optid_record - 1) * OPTIONAL_IDS_RECORD_TOTAL;
- if (optid_record != current_record)
- {
- if (current_record != 0 && flag == 1) /* Write result back for previous optional ID record. */
- {
- WriteRecord(NVRAM_EF_PHB_IDS_LID, current_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- flag = 0;
- }
- /* Read out next record. */
- ReadRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- current_record = optid_record;
- }
- if (PhbOptIDs[optid_index].pictureTagID == imageId)
- {
- PhbOptIDs[optid_index].pictureTagID = IMG_PHB_DEFAULT;
- flag = 1;
- }
- }
- /* Write back for last record. */
- if (flag)
- {
- WriteRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_update_delete_image_caller_group
- * DESCRIPTION
- * Deletes the image id from caller group if
- * one of the downloaded/factory/system images
- * are deleted.
- * PARAMETERS
- * imageId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_update_delete_image_caller_group(U16 imageId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i;
- U8 flag = 0;
- S16 pError;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- for (i = 0; i < MAX_PB_CALLER_GROUPS; ++i)
- {
- if (callerGroups[i].pictureTagID == imageId)
- {
- callerGroups[i].pictureTagID = IMG_PHB_DEFAULT;
- flag = 1;
- }
- }
- if (flag)
- {
- WriteRecord(NVRAM_EF_PHB_CALLER_GROUPS_LID, 1, callerGroups, CALLER_GROUPS_RECORD_SIZE, &pError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_update_delete_audio
- * DESCRIPTION
- * Deletes the audio id from PHB records if
- * one of the downloaded/factory/system/composed
- * images are deleted.
- * PARAMETERS
- * audioId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_update_delete_audio(U16 audioId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U8 flag = 0;
- S16 pError;
- U8 optid_record = 0, optid_index, current_record = 0;
- PHB_OPTIONAL_IDS_STRUCT PhbOptIDs[OPTIONAL_IDS_RECORD_TOTAL];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_PB_PHONE_ENTRIES; ++i)
- {
- /* Get optional IDs record. */
- optid_record = (i / OPTIONAL_IDS_RECORD_TOTAL) + 1;
- optid_index = i - (optid_record - 1) * OPTIONAL_IDS_RECORD_TOTAL;
- if (optid_record != current_record)
- {
- if (current_record != 0 && flag == 1) /* Write result back for previous optional ID record. */
- {
- WriteRecord(NVRAM_EF_PHB_IDS_LID, current_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- flag = 0;
- }
- /* Read out next record. */
- ReadRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- current_record = optid_record;
- }
- if (PhbOptIDs[optid_index].ringToneID == audioId)
- {
- PhbOptIDs[optid_index].ringToneID = 0;
- flag = 1;
- }
- }
- /* Write back for last record. */
- if (flag)
- {
- WriteRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_update_delete_audio_caller_group
- * DESCRIPTION
- * Deletes the audio id from CallerGroup records if
- * one of the downloaded/factory/system/composed
- * images are deleted.
- * PARAMETERS
- * audioId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_update_delete_audio_caller_group(U16 audioId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i, flag = 0;
- S16 pError;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- for (i = 0; i < MAX_PB_CALLER_GROUPS; ++i)
- {
- if (callerGroups[i].ringToneID == audioId)
- {
- callerGroups[i].ringToneID = 0;
- flag = 1;
- }
- }
- if (flag)
- {
- WriteRecord(NVRAM_EF_PHB_CALLER_GROUPS_LID, 1, callerGroups, CALLER_GROUPS_RECORD_SIZE, &pError);
- }
- }
- #define MMI_PHB_INTERFACE_FOR_SPEED_DIAL
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_speed_dial_enter_phb
- * DESCRIPTION
- * Displays the PHB list for Speed key mapping
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_speed_dial_enter_phb(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_SPEED_DIAL;
- mmi_phb_list_pre_entry_second_level();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_pre_send_data
- * DESCRIPTION
- * Send choosed number to MMS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_pre_send_data(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phb_list_view_call_back(pbName, (S8*) g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_choose_number
- * DESCRIPTION
- * Entry Choose entry screen if there are more then one entry with number field.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U8 *guiBuffer;
- U16 numberTypeImageList[5];
- S16 pError;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (phbListView == MMI_PHB_LIST_FOR_MMS_ALL)
- {
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- }
- else
- {
- store_index = g_phb_cntx.active_index_second;
- }
- pfnUnicodeStrcpy(pbName, (PS8) PhoneBook[store_index].alpha_id.name);
- /* For SMS insert phonebook name */
- if (phb_list_view_type == MMI_PHB_ENTRY_FIELD_NAME)
- {
- g_phb_cntx.number_to_dial[0] = NULL;
- g_phb_cntx.active_index_third = 0;
- mmi_phb_pre_send_data();
- return;
- }
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index); /* BCD number format. */
- #ifndef __MMI_PHB_USIM_FIELD__
- if ((phb_list_view_type & MMI_PHB_ENTRY_FIELD_ALL_NUMBER) && (store_index >= MAX_PB_PHONE_ENTRIES)) /* In SIM */
- {
- if (!pfnUnicodeStrlen(pbNumber))
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_NUMBER_TO_DIAL),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else
- {
- g_phb_cntx.number_to_dial[0] = (U8*) pbNumber;
- g_phb_cntx.active_index_third = 0;
- mmi_phb_pre_send_data();
- }
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- {
- i = 0;
- if ((phb_list_view_type& MMI_PHB_ENTRY_FIELD_ALL_NUMBER) && pfnUnicodeStrlen(pbNumber))
- {
- g_phb_cntx.number_to_dial[i] = (U8*) pbNumber;
- numberTypeImageList[i++] = IMG_MOBILE_NUMBER;
- }
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- #ifdef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- mmi_phb_op_set_option_data_by_usim_index((U16) store_index, &PhoneBookOptionalFields);
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- {
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- }
- if (phb_list_view_type & MMI_PHB_ENTRY_FIELD_ALL_NUMBER)
- {
- AnsiiToUnicodeString(pbHomeNumber, (PS8) PhoneBookOptionalFields.homeNumber);
- if (pfnUnicodeStrlen(pbHomeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbHomeNumber;
- numberTypeImageList[i++] = IMG_HOME_NUMBER;
- }
- AnsiiToUnicodeString(pbOfficeNumber, (PS8) PhoneBookOptionalFields.officeNumber);
- if (pfnUnicodeStrlen(pbOfficeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbOfficeNumber;
- numberTypeImageList[i++] = IMG_OFFICE_NUMBER;
- }
- AnsiiToUnicodeString(pbFaxNumber, (PS8) PhoneBookOptionalFields.faxNumber);
- if (pfnUnicodeStrlen(pbFaxNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbFaxNumber;
- numberTypeImageList[i++] = IMG_FAX_NUMBER;
- }
- }
- if (phb_list_view_type & MMI_PHB_ENTRY_FIELD_EMAIL)
- {
- AnsiiToUnicodeString(pbEmailAddress, (PS8) PhoneBookOptionalFields.emailAddress);
- if (pfnUnicodeStrlen(pbEmailAddress))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbEmailAddress;
- numberTypeImageList[i++] = IMG_EMAIL_ADDRESS;
- }
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- if (!i)
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_NUMBER_TO_DIAL),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else if (i == 1)
- {
- g_phb_cntx.active_index_third = 0;
- mmi_phb_pre_send_data();
- }
- else
- {
- EntryNewScreen(
- SCR_ID_PHB_MMS_CHOOSE_ENTRY,
- mmi_phb_exit_mms_choose_number,
- mmi_phb_entry_choose_number,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_PHB_MMS_CHOOSE_ENTRY);
- RegisterHighlightHandler(mmi_phb_get_index_third_level);
- ShowCategory53Screen(
- STR_CHOOSE_NUMBER_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- i,
- g_phb_cntx.number_to_dial,
- numberTypeImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_phb_pre_send_data, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_entry_for_number_and_email
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- *
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_entry_for_number_and_email(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 EntryCount = 0;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB,
- "File: [%s] Line: [%d] <<mmi_phb_list_entry_for_number_and_email.>n", __FILE__,
- __LINE__));
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- else
- #endif /* __SYNCML_SUPPORT__ */
- if (g_phb_cntx.phb_ready && !g_phb_cntx.processing)
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Build list according to filter */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (phb_list_view_type == MMI_PHB_ENTRY_FIELD_NAME ||
- PhoneBook[store_index].field & phb_list_view_type)
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- }
- }
- if (EntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_OTHER_APP;
- mmi_phb_entry_list(
- EntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_by_store_location_second, /* Highlight Callback */
- mmi_phb_entry_choose_number, /* LSK Callback */
- mmi_phb_entry_choose_number, /* SEND Key Callback */
- mmi_phb_mms_email_list_get_item, /* List Callback */
- mmi_phb_mms_email_list_get_hint, /* Hint Callback */
- mmi_phb_list_entry_for_number_and_email, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_PHB_NO_ENTRY_TO_SELECT),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- mmi_phb_list_free_filter();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_entry_for_number_and_email
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- * filter_type [IN] filter type
- * list_view_call_back [IN] call back function after user chooses an entry
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_pre_entry_for_number_and_email(U8 filter_type, mmi_phb_get_data_callback_type list_view_call_back)
- {
- phb_list_view_type = filter_type;
- phb_list_view_call_back = list_view_call_back;
- mmi_phb_list_entry_for_number_and_email();
- }
- /*------------------------------------------------------ Interface for MMS ------------------------------------------------------*/
- #define MMI_PHB_INTERFACE_FOR_MMS
- #if (defined(MMS_SUPPORT) && (defined(OBIGO_SUPPORT) || defined (JATAAYU_SUPPORT)))
- /*****************************************************************************
- * FUNCTION
- * EntryPhbFromMMSNumber
- * DESCRIPTION
- * Entry phonebook list from MMS, list entry with number field only
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryPhbFromMMSNumber(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_list_pre_entry_for_number_and_email(MMI_PHB_ENTRY_FIELD_ALL_NUMBER, mmi_phb_mms_send_data_to_mms);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryPhbFromMMSEmail
- * DESCRIPTION
- * Entry phonebook list from MMS, list entry with email field only
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryPhbFromMMSEmail(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_list_pre_entry_for_number_and_email(MMI_PHB_ENTRY_FIELD_EMAIL, mmi_phb_mms_send_data_to_mms);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryPhbFromMMSAll
- * DESCRIPTION
- * Entry phonebook list from MMS, list all entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryPhbFromMMSAll(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_MMS_ALL;
- mmi_phb_list_pre_entry_second_level();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_mms_choose_number
- * DESCRIPTION
- * Entry Choose entry screen if there are more then one entry with number field.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_mms_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U8 *guiBuffer;
- U16 numberTypeImageList[5];
- S16 pError;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- pfnUnicodeStrcpy(pbName, (PS8) PhoneBook[store_index].alpha_id.name);
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index); /* BCD number format. */
- #ifndef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* In SIM */
- {
- if (!pfnUnicodeStrlen(pbNumber))
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_NUMBER_TO_DIAL),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else
- {
- g_phb_cntx.number_to_dial[0] = (U8*) pbNumber;
- g_phb_cntx.active_index_third = 0;
- mmi_phb_mms_pre_send_data_to_mms();
- }
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- {
- i = 0;
- if (pfnUnicodeStrlen(pbNumber))
- {
- g_phb_cntx.number_to_dial[i] = (U8*) pbNumber;
- numberTypeImageList[i++] = IMG_MOBILE_NUMBER;
- }
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- #ifdef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- mmi_phb_op_set_option_data_by_usim_index((U16) store_index, &PhoneBookOptionalFields);
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- {
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- }
- /* All Number */
- AnsiiToUnicodeString(pbHomeNumber, (PS8) PhoneBookOptionalFields.homeNumber);
- if (pfnUnicodeStrlen(pbHomeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbHomeNumber;
- numberTypeImageList[i++] = IMG_HOME_NUMBER;
- }
- AnsiiToUnicodeString(pbOfficeNumber, (PS8) PhoneBookOptionalFields.officeNumber);
- if (pfnUnicodeStrlen(pbOfficeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbOfficeNumber;
- numberTypeImageList[i++] = IMG_OFFICE_NUMBER;
- }
- AnsiiToUnicodeString(pbFaxNumber, (PS8) PhoneBookOptionalFields.faxNumber);
- if (pfnUnicodeStrlen(pbFaxNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbFaxNumber;
- numberTypeImageList[i++] = IMG_FAX_NUMBER;
- }
- /* Email */
- AnsiiToUnicodeString(pbEmailAddress, (PS8) PhoneBookOptionalFields.emailAddress);
- if (pfnUnicodeStrlen(pbEmailAddress))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbEmailAddress;
- numberTypeImageList[i++] = IMG_EMAIL_ADDRESS;
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- if (!i)
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_NUMBER_TO_DIAL),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else if (i == 1)
- {
- g_phb_cntx.active_index_third = 0;
- mmi_phb_mms_pre_send_data_to_mms();
- }
- else
- {
- EntryNewScreen(
- SCR_ID_PHB_MMS_CHOOSE_ENTRY,
- mmi_phb_exit_mms_choose_number,
- mmi_phb_entry_mms_choose_number,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_PHB_MMS_CHOOSE_ENTRY);
- RegisterHighlightHandler(mmi_phb_get_index_third_level);
- ShowCategory53Screen(
- STR_CHOOSE_NUMBER_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- i,
- g_phb_cntx.number_to_dial,
- numberTypeImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_phb_mms_pre_send_data_to_mms, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_pre_send_data_to_mms
- * DESCRIPTION
- * Send choosed number to MMS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_mms_pre_send_data_to_mms(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_mms_send_data_to_mms(pbName, (S8*) g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_send_data_to_mms
- * DESCRIPTION
- * send entry name and choosed number to MMS by sending primitives
- * PARAMETERS
- * name [IN] Name field to be sent
- * number [IN] Number field to be sent.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_mms_send_data_to_mms(S8 *name, S8 *number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/