PhoneBookStubsToOthers.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:281k
源码类别:
MTK
开发平台:
C/C++
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<SendDataForMMS>n", __FILE__, __LINE__));
- ClearInputEventHandler(MMI_DEVICE_ALL); /* Clear Key Handler to avoid resend message. */
- #if defined(OBIGO_SUPPORT) && !defined(MMI_ON_WIN32)
- widget_MMI_fullscreen_editor_update_from_phonebook((kal_uint8*) number);
- #endif
- #if defined (JATAAYU_SUPPORT)
- if (phb_list_view_type == MMI_PHB_ENTRY_FIELD_ALL_NUMBER)
- {
- update_mms_number_from_phonebook(number);
- }
- else if (phb_list_view_type == MMI_PHB_ENTRY_FIELD_EMAIL)
- {
- update_mms_email_from_phonebook(number);
- }
- #endif /* JATAAYU_SUPPORT */
- }
- #endif /* ((defined(OBIGO_SUPPORT) || defined (JATAAYU_SUPPORT)) && defined(MMS_SUPPORT)) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_mms_choose_number
- * DESCRIPTION
- * exit function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_mms_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_ID_PHB_MMS_CHOOSE_ENTRY;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mms_email_list_get_item
- * DESCRIPTION
- * dynamic list call back function
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_phb_mms_email_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- i = g_phb_cntx.list_filter[item_index];
- if (pfnUnicodeStrlen((S8*) PhoneBook[i].alpha_id.name))
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) PhoneBook[i].alpha_id.name);
- }
- else
- {
- mmi_phb_convert_get_ucs2_number((S8*) str_buff, i);
- }
- if (i >= 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_mms_email_list_get_hint
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_mms_email_list_get_hint(S32 item_index, UI_string_type *hint_array)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- S8 temp_number[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_cntx.list_filter[item_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; /* No Hint Data */
- }
- return 1; /* One hint data only, can be more hints. */
- }
- /*--------------------------------------------------END Interface for MMS ------------------------------------------------------*/
- /*------------------------------------------------------ Interface for File Manager Image---------------------------------------------------*/
- #define MMI_PHB_INTERFACE_FOR_FMGR
- #if defined(__MMI_FILE_MANAGER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_select_image_done
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_fmgr_select_image_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Clear Previous PHB screen, and set phb new entry point here. */
- mmi_phb_clear_old_history();
- g_phb_cntx.start_scr_id = SCR_ID_PHB_FMGR_SAVE_OPTION;
- mmi_phb_entry_fmgr_save_option();
- DeleteScreenIfPresent(SCR_ID_PHB_IMAGE_VIEW_IMAGE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_image_preview
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_fmgr_image_preview(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_PHB_IMAGE_VIEW_IMAGE, NULL, mmi_phb_fmgr_image_preview, NULL);
- /* entry cat222 to decode and display a image from file */
- ShowCategory222Screen(
- STR_ASSOCIATE_PICTURE,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- GDI_COLOR_BLACK,
- (PS8) NULL,
- (PS8) g_phb_file_path,
- FALSE,
- mmi_phb_image_preview_callback);
- SetLeftSoftkeyFunction(mmi_phb_fmgr_select_image_done, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_select_video_done
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_fmgr_select_video_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Clear Previous PHB screen, and set phb new entry point here. */
- mmi_phb_clear_old_history();
- g_phb_cntx.start_scr_id = SCR_ID_PHB_FMGR_SAVE_OPTION;
- mmi_phb_entry_fmgr_save_option();
- DeleteScreenIfPresent(SCR_ID_PHB_VIDEO_PREVIEW);
- }
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_video_preview
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_fmgr_video_preview(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PU8 gui_buffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (isInCall()) /* Can not preview video during call. */
- {
- #ifdef __MMI_SWFLASH__
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_SWFLASH)
- {
- DisplayPopup((U8*)GetString(STR_ID_PHB_CANT_VIEW_SWFLASH_IN_CALL), IMG_GLOBAL_WARNING, FALSE, PHB_NOTIFY_TIMEOUT, WARNING_TONE);
- }
- else
- #endif /* __MMI_SWFLASH__ */
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_PHB_CANT_VIEW_VIDEO_IN_CALL),
- IMG_GLOBAL_WARNING,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- WARNING_TONE);
- }
- return;
- }
- EntryNewScreen(SCR_ID_PHB_VIDEO_PREVIEW, NULL, mmi_phb_fmgr_video_preview, NULL);
- gui_buffer = GetCurrGuiBuffer(SCR_ID_PHB_VIDEO_PREVIEW);
- ShowCategory225Screen(
- STR_GLOBAL_VIEW, /* title_str */
- IMG_SCR_PBOOK_CAPTION, /* title_icon */
- STR_GLOBAL_OK, /* lsk_str */
- IMG_GLOBAL_OK, /* lsk_icon */
- STR_GLOBAL_BACK, /* rsk_str */
- IMG_GLOBAL_BACK, /* rsk_icon */
- 0, /* video_id */
- (S8*) g_phb_video_file_path, /* video_filename */
- 1, /* repeat_count */
- TRUE, /* is_visual_update */
- (BOOL) ! IsSilentModeActivated(), /* is_play_audio */
- TRUE, /* is_lcd_no_sleep */
- GDI_COLOR_WHITE, /* bg_color */
- mmi_phb_video_view_callback,
- gui_buffer);
- SetLeftSoftkeyFunction(mmi_phb_fmgr_select_video_done, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- #endif /* __MMI_INCOMING_CALL_VIDEO__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_from_file_mgr
- * DESCRIPTION
- * forward function for file manager application
- * PARAMETERS
- * path [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_fmgr_from_file_mgr(S8 *path)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- PS8 ext_ptr;
- S8 ext_name[20];
- S32 i;
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (path == NULL)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_PHB_FMGR_IMAGE_NO_SELECT),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- return;
- }
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- /* Check video content */
- ext_ptr = mmi_fmgr_extract_ext_file_name(path);
- memset(ext_name, 0, sizeof(ext_name));
- UnicodeNToAnsii(ext_name, ext_ptr, 5 * ENCODING_LENGTH);
- /* make upper */
- for (i = 0; i < 12; i++)
- {
- if (ext_name[i] != 0)
- {
- if (ext_name[i] >= 'a')
- {
- ext_name[i] -= 'a' - 'A';
- }
- }
- }
- if (strcmp(ext_name, "3GP") == 0 || strcmp(ext_name, "MP4") == 0 || strcmp(ext_name, "AVI") == 0)
- {
- if (mmi_phb_video_check_data_space(path))
- {
- pfnUnicodeStrcpy(g_phb_video_file_path, path);
- g_phb_cntx.recv_res_from = MMI_PHB_RECV_RES_VIDEO;
- mmi_phb_fmgr_video_preview();
- }
- }
- #if defined(__MMI_SWFLASH__) && defined(SWFLASH_CHAOTEX)
- else if (strcmp(ext_name, "CMP") == 0)
- {
- if (mmi_phb_video_check_data_space(path))
- {
- pfnUnicodeStrcpy(g_phb_video_file_path, path);
- g_phb_cntx.recv_res_from = MMI_PHB_RECV_RES_SWFLASH;
- mmi_phb_fmgr_video_preview();
- }
- }
- #endif /* defined(__MMI_SWFLASH__) && defined(SWFLASH_CHAOTEX) */
- /* Check image content */
- else if (mmi_phb_image_check_valid_image(path))
- #else /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- /* Check image content */
- if (mmi_phb_image_check_valid_image(path))
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- {
- pfnUnicodeStrcpy(g_phb_file_path, path);
- /* Clear Previous PHB screen, and set phb new entry point here. */
- mmi_phb_clear_old_history();
- g_phb_cntx.start_scr_id = SCR_ID_PHB_FMGR_SAVE_OPTION;
- g_phb_cntx.recv_res_from = MMI_PHB_RECV_RES_IMAGE;
- mmi_phb_fmgr_image_preview();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_fmgr_add_entry
- * DESCRIPTION
- * Highlight function to associate image from file manager to a new phonebook entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_fmgr_add_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_phb_fmgr_pre_add_entry, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_fmgr_pre_add_entry, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_fmgr_edit_entry
- * DESCRIPTION
- * Highlight function for associate image to a existing phonebook entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_fmgr_edit_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_phb_list_pre_entry_for_fmgr_in_nvram, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_list_pre_entry_for_fmgr_in_nvram, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- phbListView = MMI_PHB_LIST_FOR_SAVE_FROM_FILE_MGR;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_edit_callergroup
- * DESCRIPTION
- * Highlight function for associate image to a existing phonebook caller group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_edit_callergroup(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_phb_entry_callergroup, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_callergroup, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- phbListView = MMI_PHB_LIST_FOR_SAVE_FROM_FILE_MGR;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_fmgr_save_option
- * DESCRIPTION
- * Entry function for save image from file manager option menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_fmgr_save_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[3];
- U16 nNumofItem;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_PHB_FMGR_SAVE_OPTION, mmi_phb_exit_fmgr_save_option, mmi_phb_entry_fmgr_save_option, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_PHB_FMGR_SAVE_OPTION);
- nNumofItem = GetNumOfChild(MENU_ID_PHB_FMGR_SAVE_OPTION);
- GetSequenceStringIds(MENU_ID_PHB_FMGR_SAVE_OPTION, nStrItemList);
- SetParentHandler(MENU_ID_PHB_FMGR_SAVE_OPTION);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_SCR_VIEW_OPTIONS_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_fmgr_save_option
- * DESCRIPTION
- * Exit function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_fmgr_save_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_ID_PHB_FMGR_SAVE_OPTION;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_pre_add_entry
- * DESCRIPTION
- * pre check for associate image from file manager to a new phonebook entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_fmgr_pre_add_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* 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 (g_phb_cntx.phone_used >= g_phb_cntx.phone_total) /* No spcace in NVRAM */
- {
- DisplayPopup((PU8) GetString(STR_PBOOK_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else
- {
- mmi_phb_util_clear_buffer(TRUE);
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_IMAGE)
- {
- mmi_phb_build_image_list();
- g_phb_cntx.selected_pic_index = g_phb_cntx.total_image_id - 1;
- g_phb_cntx.image_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- else if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_AUDIO)
- {
- mmi_phb_build_ring_tone_list();
- g_phb_cntx.selected_ring_index = mmi_phb_get_ring_tone_index(g_phb_cntx.recv_res_id);
- }
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- else if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_VIDEO)
- {
- mmi_phb_build_video_list();
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 1;
- g_phb_cntx.video_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- #ifdef __MMI_SWFLASH__
- else if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_SWFLASH)
- {
- mmi_phb_build_video_list();
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 2;
- g_phb_cntx.video_location = MMI_PHB_SWFLASH_SELECT_PATH;
- }
- #endif /* __MMI_SWFLASH__ */
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- g_phb_cntx.set_done_flag = 2;
- g_phb_cntx.selected_storage = MMI_NVRAM;
- mmi_phb_entry_op_add_entry();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_pre_edit_entry
- * DESCRIPTION
- * pre check for associate image to a existing phonebook entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_fmgr_pre_edit_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- U16 i, store_index;
- PHB_OPTIONAL_IDS_STRUCT *opt_ids;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_cntx.active_index;
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* ERROR!, Record in NVRAM only */
- {
- /* Print Error Log Here. */
- GoBackHistory();
- return;
- }
- /* set active index for edit entry */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- if (g_phb_name_index[i] == store_index)
- {
- g_phb_cntx.active_index = i;
- break;
- }
- }
- /* Clear All Buffer First. */
- mmi_phb_util_clear_buffer(TRUE);
- /* Assign value for each field for update */
- pfnUnicodeStrcpy(pbName, (S8*) PhoneBook[store_index].alpha_id.name);
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index);
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- AnsiiToUnicodeString(pbHomeNumber, (PS8) PhoneBookOptionalFields.homeNumber);
- pfnUnicodeStrcpy(pbCompanyName, (PS8) PhoneBookOptionalFields.companyName);
- AnsiiToUnicodeString(pbEmailAddress, (PS8) PhoneBookOptionalFields.emailAddress);
- AnsiiToUnicodeString(pbOfficeNumber, (PS8) PhoneBookOptionalFields.officeNumber);
- AnsiiToUnicodeString(pbFaxNumber, (PS8) PhoneBookOptionalFields.faxNumber);
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_phb_bday_read_data_to_buff(store_index);
- #endif
- mmi_phb_build_image_list();
- mmi_phb_build_ring_tone_list();
- mmi_phb_read_optional_ids(store_index);
- opt_ids = (PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids;
- /* Image setting */
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_IMAGE)
- {
- g_phb_cntx.selected_pic_index = g_phb_cntx.total_image_id - 1;
- g_phb_cntx.image_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- else /* Keep original image */
- {
- g_phb_cntx.selected_pic_index = mmi_phb_get_image_index(opt_ids->pictureTagID);
- if (opt_ids->pictureTagID == 1)
- {
- g_phb_cntx.image_location = MMI_PHB_IMAGE_FOR_ENTRY;
- }
- else
- {
- g_phb_cntx.image_location = MMI_PHB_IMAGE_NO_SELECT;
- }
- }
- /* Audio Setting */
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_AUDIO)
- {
- g_phb_cntx.selected_ring_index = mmi_phb_get_ring_tone_index(g_phb_cntx.recv_res_id);
- }
- else /* Keep original audio */
- {
- g_phb_cntx.selected_ring_index = mmi_phb_get_ring_tone_index(opt_ids->ringToneID);
- }
- /* Video Setting */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- mmi_phb_build_video_list();
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_VIDEO)
- {
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 1;
- g_phb_cntx.video_location = MMI_PHB_IMAGE_SELECT_PATH;
- g_phb_cntx.video_audio = 1; /* Turn on video's audio by default */
- }
- #ifdef __MMI_SWFLASH__
- else if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_SWFLASH)
- {
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 2;
- g_phb_cntx.video_location = MMI_PHB_SWFLASH_SELECT_PATH;
- g_phb_cntx.video_audio = 1; /* Turn on video's audio by default */
- }
- #endif /* __MMI_SWFLASH__ */
- else /* Keep original video */
- {
- U16 video_id = mmi_phb_video_get_id_by_index(store_index);
- g_phb_cntx.selected_video_index = mmi_phb_get_video_index(video_id);
- g_phb_cntx.video_audio = ((video_id == 0) || (video_id & 0x4000)) ? 1 : 0;
- if ((video_id & 0x8000) && mmi_phb_video_get_path_by_index(video_id)) /* Check if the video is a file */
- {
- #ifdef __MMI_SWFLASH__
- if(video_id & 0x2000)
- {
- g_phb_cntx.video_location = MMI_PHB_SWFLASH_SELECT_PATH;
- }
- else
- #endif /* __MMI_SWFLASH__ */
- {
- g_phb_cntx.video_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- }
- else
- {
- g_phb_cntx.video_location = MMI_PHB_IMAGE_NO_SELECT;
- }
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- /* Caller Group Setting, keep original caller group */
- g_phb_cntx.selected_grp_index = opt_ids->callerGroupID;
- mmi_phb_entry_op_edit_save_confirm();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_fmgr_pre_edit_callergrp
- * DESCRIPTION
- * pre check for associate image to a existing phonebook caller group
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_fmgr_pre_edit_callergrp(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- pfnUnicodeStrcpy(pbName, (PS8) callerGroups[g_phb_cntx.active_index].groupName);
- mmi_phb_build_led_and_alert_list();
- mmi_phb_build_ring_tone_list();
- mmi_phb_build_image_list();
- /* Image Setting */
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_IMAGE)
- {
- g_phb_cntx.selected_pic_index = g_phb_cntx.total_image_id - 1;
- g_phb_cntx.image_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- else /* Keep original image */
- {
- g_phb_cntx.selected_pic_index = mmi_phb_get_image_index(callerGroups[g_phb_cntx.active_index].pictureTagID);
- if (callerGroups[g_phb_cntx.active_index].pictureTagID == 1)
- {
- g_phb_cntx.image_location = MMI_PHB_IMAGE_FOR_ENTRY;
- }
- else
- {
- g_phb_cntx.image_location = MMI_PHB_IMAGE_NO_SELECT;
- }
- }
- /* Audio Setting */
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_AUDIO)
- {
- g_phb_cntx.selected_ring_index = mmi_phb_get_ring_tone_index(g_phb_cntx.recv_res_id);
- }
- else /* Keep original audio */
- {
- g_phb_cntx.selected_ring_index = mmi_phb_get_ring_tone_index(callerGroups[g_phb_cntx.active_index].ringToneID);
- }
- /* Video Setting */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- mmi_phb_build_video_list();
- if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_VIDEO)
- {
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 1;
- g_phb_cntx.video_location = MMI_PHB_IMAGE_SELECT_PATH;
- g_phb_cntx.video_audio = 1; /* Turn on video's audio by default */
- }
- #ifdef __MMI_SWFLASH__
- else if (g_phb_cntx.recv_res_from == MMI_PHB_RECV_RES_SWFLASH)
- {
- g_phb_cntx.selected_video_index = g_phb_cntx.total_video_id - 2;
- g_phb_cntx.video_location = MMI_PHB_SWFLASH_SELECT_PATH;
- g_phb_cntx.video_audio = 1; /* Turn on video's audio by default */
- }
- #endif /* __MMI_SWFLASH__ */
- else /* Keep original video */
- {
- U16 video_id = callerGroups[g_phb_cntx.active_index].VideoID;
- g_phb_cntx.selected_video_index = mmi_phb_get_video_index(video_id);
- g_phb_cntx.video_audio = ((video_id == 0) || (video_id & 0x4000)) ? 1 : 0;
- if ((video_id & 0x8000) &&
- mmi_phb_video_get_path_by_index((U16) (g_phb_cntx.active_index + MAX_PB_PHONE_ENTRIES)))
- {
- #ifdef __MMI_SWFLASH__
- if(video_id & 0x2000)
- {
- g_phb_cntx.video_location = MMI_PHB_SWFLASH_SELECT_PATH;
- }
- else
- #endif /* __MMI_SWFLASH__ */
- {
- g_phb_cntx.video_location = MMI_PHB_IMAGE_SELECT_PATH;
- }
- }
- else
- {
- g_phb_cntx.video_location = MMI_PHB_IMAGE_NO_SELECT;
- }
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- /* Keep other settings */
- g_phb_cntx.selected_alert_index = callerGroups[g_phb_cntx.active_index].alertType;
- g_phb_cntx.selected_pattern_index = callerGroups[g_phb_cntx.active_index].LEDPatternId;
- mmi_phb_callergroup_detail_pre_save();
- }
- /*------------------------------------------------------ END Interface for File Manager Image------------------------------------------------*/
- #endif /* defined(__MMI_FILE_MANAGER__) */
- #define MMI_PHB_INTERFACE_FOR_EMAIL
- #if defined(__MMI_EMAIL__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_email_enter_list
- * DESCRIPTION
- * Phonebook list interface for email application.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_email_enter_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_EMAIL_APP;
- mmi_phb_list_pre_entry_second_level();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_email_choose_entry
- * DESCRIPTION
- * choose entry result, send result back to email app.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_email_choose_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_cntx.active_index_second;
- /* Clear buffer */
- memset(pbEmailAddress, 0, 2);
- #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);
- AnsiiToUnicodeString(pbEmailAddress, (S8*) PhoneBookOptionalFields.emailAddress);
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- #ifdef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* in USIM */
- {
- AnsiiToUnicodeString((S8*) pbEmailAddress, (S8*) phb_email[store_index - MAX_PB_PHONE_ENTRIES].email_address);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- /* Send back to email app. */
- mmi_email_phb_get_addr_callback((S8*) PhoneBook[store_index].alpha_id.name, (S8*) pbEmailAddress);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_email_save_entry_to_phb
- * DESCRIPTION
- * save name and email to phonebook as a new entry
- * PARAMETERS
- * ucs2_name [IN] Input email string pointer
- * ucs2_email [IN] Input name string pointer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_email_save_entry_to_phb(S8 *ucs2_name, S8 *ucs2_email)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_email_save_entry_to_phb.>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)
- {
- if (PhoneBookEntryCount == g_phb_cntx.sim_total + g_phb_cntx.phone_total)
- {
- DisplayPopup((PU8) GetString(STR_PBOOK_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else
- {
- /* Ensure the length will not exceed max length and phonebook buffer. */
- memset((ucs2_email + MAX_PB_EMAIL_LENGTH * ENCODING_LENGTH), 0, 2);
- /* Clear other field */
- mmi_phb_util_clear_buffer(TRUE);
- /* Bring in data and enter save entry screen. */
- g_phb_cntx.set_done_flag = 1;
- pfnUnicodeStrcpy(pbName, ucs2_name);
- if (GetUCS2Flag(pbName))
- {
- memset(pbName + (((MAX_PB_NAME_LENGTH - 1) / 2) * 2), 0, 2);
- }
- else
- {
- memset((pbName + MAX_PB_NAME_LENGTH * ENCODING_LENGTH), 0, 2);
- }
- pfnUnicodeStrcpy(pbEmailAddress, ucs2_email);
- mmi_phb_clear_old_history();
- mmi_phb_entry_op_add_choose_storage();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- #endif /* defined(__MMI_EMAIL__) */
- #if defined(MMS_SUPPORT)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_dummy_screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_dummy_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_email_save_entry_to_phb_from_jmms
- * DESCRIPTION
- * save the email entry from JMMS
- * PARAMETERS
- * ucs2_email [IN] Input email string pointer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_email_save_entry_to_phb_from_jmms(S8 *ucs2_email)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_email_save_entry_to_phb.>n", __FILE__,
- __LINE__));
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- else if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_phb_entry_not_ready(STR_ID_PHB_PROCESSING_USIM);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else
- {
- if (PhoneBookEntryCount == g_phb_cntx.sim_total + g_phb_cntx.phone_total)
- {
- DisplayPopup((PU8) GetString(STR_PBOOK_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else
- {
- /* Ensure the length will not exceed phonebook buffer. */
- if(pfnUnicodeStrlen((S8*)ucs2_email) > MAX_PB_EMAIL_LENGTH)
- {
- memset((ucs2_email + MAX_PB_EMAIL_LENGTH * ENCODING_LENGTH), 0, 2);
- }
- /* Clear other field */
- mmi_phb_util_clear_buffer(TRUE);
- /* Bring in data and enter save entry screen. */
- g_phb_cntx.set_done_flag = 1;
- pfnUnicodeStrcpy(pbEmailAddress, ucs2_email);
- mmi_phb_clear_old_history();
- /* adding here */
- g_phb_cntx.selected_storage = MMI_NVRAM;
- if (g_phb_cntx.phone_used >= g_phb_cntx.phone_total)
- {
- DisplayPopup(
- (PU8) GetString(STR_PBOOK_FULL_MSG),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- }
- else
- {
- EntryNewScreen(SCR_STORAGE_LOCATION_MENU, NULL, mmi_phb_entry_dummy_screen, NULL);
- mmi_phb_entry_op_add_entry();
- }
- }
- }
- }
- #endif /* defined(MMS_SUPPORT) */
- #define MMI_PHB_INTERFACE_FOR_VRSD_DIAL
- #if defined(__MMI_VRSD_DIAL__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsddial_enter_tag_list
- * DESCRIPTION
- * Phonebook list interface for voice dial application.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsddial_enter_tag_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i, j;
- U16 EntryCount = 0;
- U16 store_index;
- vrsd_tag_struct tag_list[MMI_VRSD_MAX_TAG];
- S16 pError;
- /*----------------------------------------------------------------*/
- /* 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)
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Read voice tag list from NVRAM */
- ReadRecord(
- NVRAM_EF_VRSD_TAG_LID,
- MMI_VRSD_GROUP_ALL,
- (void*)tag_list,
- MMI_VRSD_MAX_TAG * sizeof(vrsd_tag_struct),
- &pError);
- /* Find out entry with tag and put it into filter list */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- for (j = 0; j < MMI_VRSD_MAX_TAG; j++)
- {
- if ((tag_list[j].appref_id < 0xffff) && (tag_list[j].app_id == MMI_VRSD_APP_DIAL) &&
- (tag_list[j].appref_id == store_index))
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- break;
- }
- }
- }
- /* If voice tag exists, enter phonebook list */
- if (EntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_VR;
- mmi_phb_entry_list(
- EntryCount, /* Total Entry */
- STR_ID_VRSD_DIAL, /* Title String */
- IMG_ID_VRSD_APP, /* Title Image */
- STR_GLOBAL_OPTIONS, /* LSK */
- IMG_GLOBAL_OPTIONS, /* LSK */
- mmi_phb_vrsddial_get_tag_list_index, /* Highlight Callback */
- mmi_vrsddial_main_menu_all_option, /* LSK Callback */
- NULL, /* SEND Key Callback */
- mmi_phb_filter_list_get_item, /* List Callback */
- mmi_phb_filter_list_get_hint, /* Hint Callback */
- mmi_phb_vrsddial_enter_tag_list, /* Re-Entry Callback */
- FALSE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- else /* No voice Tag exists, Go to menu directly. */
- {
- mmi_vrsddial_entry_empty_list();
- mmi_phb_list_free_filter();
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsddial_get_tag_list_index
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsddial_get_tag_list_index(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index = g_phb_cntx.list_filter[nIndex]; /* This is store_index in filter list */
- StopTimer(VRSD_DIAL_PLAYBACK_TIMER);
- StartTimer(VRSD_DIAL_PLAYBACK_TIMER, MMI_VRSD_PLAY_TAG_DELAY, mmi_phb_vrsddial_playback_by_store_index);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsddial_playback_by_store_index
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsddial_playback_by_store_index(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 tag_id;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- tag_id = mmi_vrsd_util_get_tag_id(MMI_VRSD_APP_DIAL, g_phb_cntx.active_index);
- mmi_vrsd_playback_req(tag_id, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsddial_enter_no_tag_list
- * DESCRIPTION
- * Phonebook list interface for voice dial application.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsddial_enter_no_tag_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i, j;
- U16 EntryCount = 0;
- U16 store_index;
- vrsd_tag_struct tag_list[MMI_VRSD_MAX_TAG];
- S16 pError;
- BOOL has_tag;
- /*----------------------------------------------------------------*/
- /* 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)
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Read voice tag list from NVRAM */
- ReadRecord(
- NVRAM_EF_VRSD_TAG_LID,
- MMI_VRSD_GROUP_ALL,
- (void*)tag_list,
- MMI_VRSD_MAX_TAG * sizeof(vrsd_tag_struct),
- &pError);
- /* Find out entry without voice tag and put it into filter list */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- has_tag = FALSE;
- for (j = 0; j < MMI_VRSD_MAX_TAG; j++)
- {
- if ((tag_list[j].app_id == MMI_VRSD_APP_DIAL) && (tag_list[j].appref_id == store_index))
- {
- has_tag = TRUE;
- break;
- }
- }
- /* Add to list if the entry has no tag. */
- if (!has_tag)
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- }
- }
- /* If voice tag exists, enter phonebook list */
- if (EntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_VR;
- mmi_phb_entry_list(
- EntryCount, /* Total Entry */
- STR_ID_VRSD_DIAL, /* Title String */
- IMG_ID_VRSD_APP, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_by_store_location_second, /* Highlight Callback */
- mmi_vrsddial_add_tag_from_list, /* LSK Callback */
- NULL, /* SEND Key Callback */
- mmi_phb_filter_list_get_item, /* List Callback */
- mmi_phb_filter_list_get_hint, /* Hint Callback */
- mmi_phb_vrsddial_enter_no_tag_list, /* Re-Entry Callback */
- FALSE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- else /* All Entries has voice tag. */
- {
- 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_highlight_op_voice_dial
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * void
- * RETURNS
- * viod
- *****************************************************************************/
- void mmi_phb_highlight_op_voice_dial(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(mmi_vrsddial_phb_main_menu_pre_entry, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_vrsddial_phb_main_menu_pre_entry, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsddial_auto_dial
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * store_index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsddial_auto_dial(U16 store_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index = 0;
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- if (g_phb_name_index[i] == store_index)
- {
- g_phb_cntx.active_index = i;
- break;
- }
- }
- mmi_phb_choose_number_normal();
- }
- #endif /* defined(__MMI_VRSD_DIAL__) */
- #define MMI_PHB_INTERFACE_FOR_VRSI
- #if defined(__MMI_VRSI__) && defined(__MMI_VRSI_TRAIN_TAG__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsi_list_get_item
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL mmi_phb_vrsi_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((item_index < 0) || (item_index >= PhoneBookEntryCount))
- {
- return FALSE;
- }
- store_index = g_phb_name_index[item_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);
- }
- /* Check if phonebook item has VRSD tag */
- if (mmi_vrsi_train_util_get_loc_in_list(MMI_VRSI_APP_DIAL, store_index, g_phb_vrsi_tag_list) != 0xff)
- {
- *img_buff_p = get_image(IMG_ID_VRSI_APP);
- }
- else
- {
- 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_vrsi_pre_entry_list
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsi_pre_entry_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.highlight_entry = 0;
- phbListView = MMI_PHB_LIST_FOR_VR;
- /* Allocate memory for list to temporarily store vrsi tag list */
- g_phb_vrsi_tag_list = OslMalloc(MMI_VRSI_MAX_SD_TAG * sizeof(vrsi_sd_tag_struct));
- ReadRecord(NVRAM_EF_VRSI_TAG_LID, 1, (void*)g_phb_vrsi_tag_list, MMI_VRSI_MAX_SD_TAG * sizeof(vrsi_sd_tag_struct), &pError);
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* Total Entry */
- STR_ID_VRSI_APP, /* Title String */
- IMG_ID_VRSI_APP, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_second_level, /* Highlight Callback */
- mmi_phb_vrsi_entry_list_callback, /* LSK Callback */
- NULL, /* SEND Key Callback */
- mmi_phb_vrsi_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_vrsi_pre_entry_list, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsi_exit_entry_list
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsi_exit_entry_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(g_phb_vrsi_tag_list)
- {
- OslMfree(g_phb_vrsi_tag_list);
- g_phb_vrsi_tag_list = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_vrsi_entry_list_callback
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_vrsi_entry_list_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- mmi_vrsi_ndial_train_list_callback(store_index);
- }
- #endif /* defined(__MMI_VRSI__) && defined(__MMI_VRSI_TRAIN_TAG__) */
- #ifdef __SYNCML_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_phone_index_arrary
- * DESCRIPTION
- *
- * PARAMETERS
- * index_array [OUT]
- * RETURNS
- * U16
- *****************************************************************************/
- U16 mmi_phb_get_phone_index_arrary(U16* index_array)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 array_count = 0;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- return 0xFFFF;
- }
- if (index_array != NULL)
- {
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- index_array[array_count] = store_index;
- array_count++;
- }
- }
- }
- return g_phb_cntx.phone_used;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sync_vcard
- * DESCRIPTION
- *
- * PARAMETERS
- * path [IN]
- * index [IN]
- * RETURNS
- *
- *****************************************************************************/
- void mmi_phb_sync_vcard(U8 action, S8 *path, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FS_HANDLE fh;
- U8 error_code = VCARD_PARSE_NO_ERROR;
- S16 pError;
- S8 number_buff[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- S8 b_day[9]; /* Format: yyyymmdd */
- S32 get_result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (action != MMI_PHB_VCARD_DELETE && path == NULL)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_ERROR, index);
- return;
- }
- if ((action != MMI_PHB_VCARD_ADD) && index >= MAX_PB_PHONE_ENTRIES)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_OUT_OF_INDEX, index);
- return;
- }
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_NOT_READY, index);
- return;
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_NOT_READY, index);
- return;
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- if (action == MMI_PHB_VCARD_READ)
- {
- /* Mobile Number */
- if (PhoneBook[index].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- number_buff[0] = '+';
- mmi_phb_convert_to_digit((U8*) number_buff + 1, PhoneBook[index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) number_buff, PhoneBook[index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_vcard_get_bday_to_buff(index, (S8*) b_day);
- #endif /* defined(__MMI_PHB_BIRTHDAY_FIELD__) */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- get_result = mmi_vcard_writer_v21_to_file(path, (S8*) PhoneBook[index].alpha_id.name, (S8*) number_buff,
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- (S8*) PhoneBookOptionalFields.homeNumber,
- (S8*) PhoneBookOptionalFields.officeNumber,
- (S8*) PhoneBookOptionalFields.faxNumber,
- (S8*) PhoneBookOptionalFields.emailAddress,
- (S8*) PhoneBookOptionalFields.companyName,
- #else /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- NULL, NULL, NULL, NULL, NULL,
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- b_day,
- #else
- NULL,
- #endif
- NULL, NULL, NULL);
- if (get_result != VOBJ_ERR_NO_ERROR)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_ERROR, index);
- }
- else
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_SUCCESS, index);
- }
- return;
- }
- else if (action == MMI_PHB_VCARD_ADD || action == MMI_PHB_VCARD_UPDATE)
- {
- if (action == MMI_PHB_VCARD_ADD)
- {
- if (g_phb_cntx.phone_used >= g_phb_cntx.phone_total) /* NVRAM Only */
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_STORAGE_FULL, index);
- return;
- }
- g_phb_cntx.selected_storage = MMI_NVRAM;
- }
- fh = FS_Open((U16*) path, FS_READ_ONLY);
- if (fh <= 0)
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_OPEN_FILE_ERROR, index);
- return;
- }
- mmi_phb_util_clear_buffer(TRUE); /* Clear all phonebook vcard temp buffer before parsing */
- error_code = mmi_vcard_reader_parse_line(fh);
- FS_Close(fh);
- }
- if (action == MMI_PHB_VCARD_DELETE)
- {
- if (mmi_phb_util_check_entry_exist(index))
- {
- g_phb_enter_from = MMI_PHB_ENTER_FROM_SYNCML;
- g_phb_cntx.active_index = index;
- mmi_phb_op_delete_entry_req();
- }
- else /* Entry already deleted by handset user (Client) */
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_SUCCESS, index);
- }
- return;
- }
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_sync_vcard. error_code: %d>n",
- __FILE__, __LINE__, error_code));
- /* Check if parse and validation ok. */
- if (error_code != VCARD_PARSE_NO_ERROR || !mmi_phb_op_check_pre_save(FALSE))
- {
- mmi_syncml_phb_sync_rsp(MMI_PHB_SYNC_ERROR, index);
- return;
- }
- if (action == MMI_PHB_VCARD_ADD)
- {
- g_phb_enter_from = MMI_PHB_ENTER_FROM_SYNCML;
- mmi_phb_op_add_entry_req();
- }
- else if (action == MMI_PHB_VCARD_UPDATE)
- {
- g_phb_enter_from = MMI_PHB_ENTER_FROM_SYNCML;
- g_phb_cntx.active_index = index;
- mmi_phb_op_edit_entry_req();
- }
- }
- #endif /* __SYNCML_SUPPORT__ */
- #ifdef __MMI_BIRTHDAY_REMINDER__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_name_number
- * DESCRIPTION
- * check if an entry exists
- * PARAMETERS
- * store_index [IN] The store location id of the entry
- * out_name [OUT] The name of the phonebook entry (UCS2)
- * out_number [OUT] The default mobile number of the entry (ASCII)
- * RETURNS
- * TRUE if the location has the entry, else FALSE
- *****************************************************************************/
- void mmi_phb_get_name_number(U16 store_index, U8* out_name, U8* out_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pfnUnicodeStrcpy((S8*)out_name, (S8*) PhoneBook[store_index].alpha_id.name);
- if (PhoneBook[store_index].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- out_number[0] = '+';
- mmi_phb_convert_to_digit((U8*) (out_number + 1), PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit(out_number, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- }
- #endif /* __MMI_BIRTHDAY_REMINDER__ */
- /* Convert function for phonebook numbers between BCD and ASCII format. */
- #define MMI_PHB_GENERAL_UTIL
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_util_check_entry_exist
- * DESCRIPTION
- * check if an entry exists
- * PARAMETERS
- * store_index [IN] The store location id of the entry
- * RETURNS
- * TRUE if the location has the entry, else FALSE
- *****************************************************************************/
- BOOL mmi_phb_util_check_entry_exist(U16 store_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- if (g_phb_name_index[i] == store_index)
- {
- return TRUE;
- }
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_util_check_additional_number_exist
- * DESCRIPTION
- * check if any additional number exists
- * PARAMETERS
- * store_index [IN] The store location id of the entry
- * RETURNS
- * TRUE if the location has any additional number, else FALSE
- *****************************************************************************/
- BOOL mmi_phb_util_check_additional_number_exist(U16 store_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return ((PhoneBook[store_index].field & MMI_PHB_ENTRY_FIELD_HOME) ||
- (PhoneBook[store_index].field & MMI_PHB_ENTRY_FIELD_OFFICE) ||
- (PhoneBook[store_index].field & MMI_PHB_ENTRY_FIELD_FAX));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_bcd_get_byte
- * DESCRIPTION
- * convert ASCII character to BCD
- * PARAMETERS
- * digit [IN] Ascii character
- * RETURNS
- * bcd character
- *****************************************************************************/
- U8 mmi_phb_convert_to_bcd_get_byte(U8 digit)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 half_byte;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (digit <= '9' && digit >= '0')
- {
- half_byte = digit - '0';
- }
- else
- {
- switch (digit)
- {
- case '*':
- half_byte = 0x0a;
- break;
- case '#':
- half_byte = 0x0b;
- break;
- case 'p':
- case 'P':
- half_byte = 0x0c;
- break;
- case 'w':
- case 'W':
- half_byte = 0x0d;
- break;
- case '+':
- half_byte = 0x0e;
- break;
- default:
- half_byte = 0x0f;
- break;
- }
- }
- return half_byte;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_bcd
- * DESCRIPTION
- * convert ASCII string to BCD. (If reaches max length, there will be no terminate '0x0f')
- * PARAMETERS
- * dest [IN/OUT] An BCD encoding string.
- * source [IN] An ASCII encoding string.
- * max_dest_len [IN] The byte size of dest array.
- * RETURNS
- * byte number after convert.
- *****************************************************************************/
- U8 mmi_phb_convert_to_bcd(U8 *dest, U8 *source, U8 max_dest_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 lower_byte, upper_byte;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (source[i] != ' ')
- {
- lower_byte = mmi_phb_convert_to_bcd_get_byte(source[i]);
- upper_byte = mmi_phb_convert_to_bcd_get_byte(source[i + 1]);
- if ((i >> 1) >= max_dest_len)
- {
- return (i >> 1);
- }
- *((U8*) dest + (i >> 1)) = (upper_byte << 4) + lower_byte;
- if (source[i + 1] == ' ')
- {
- if ((i >> 1) >= max_dest_len)
- {
- return (i >> 1) + 1;
- }
- *((U8*) dest + (i >> 1)) |= 0xf0;
- return (i >> 1) + 1;
- }
- i += 2;
- }
- if ((i >> 1) >= max_dest_len)
- {
- return (i >> 1);
- }
- *((U8*) dest + (i >> 1)) = 0xff;
- return (i >> 1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_digit_get_byte
- * DESCRIPTION
- * convert BCD character to ASCII
- * PARAMETERS
- * bcd [IN] Bcd character
- * RETURNS
- * ascii character
- *****************************************************************************/
- U8 mmi_phb_convert_to_digit_get_byte(U8 bcd)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 digit;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (bcd <= 9)
- {
- digit = bcd + '0';
- }
- else
- {
- switch (bcd)
- {
- case 0x0a:
- digit = '*';
- break;
- case 0x0b:
- digit = '#';
- break;
- case 0x0c:
- digit = 'p';
- break;
- case 0x0d:
- digit = 'w';
- break;
- case 0x0e:
- digit = '+';
- break;
- default:
- digit = ' ';
- break;
- }
- }
- return digit;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_digit
- * DESCRIPTION
- * convert BCD string to ASCII
- * PARAMETERS
- * dest [IN/OUT] An ASCII encoding string.
- * source [IN] An BCD encoding string.
- * max_dest_len [IN] The byte size of dest array.(include null terminate ' ')
- * RETURNS
- * byte number after convert.
- *****************************************************************************/
- U8 mmi_phb_convert_to_digit(U8 *dest, U8 *source, U8 max_dest_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 ch1, ch2;
- U8 i = 0, j = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while ((source[i] != 0xff) && (j < max_dest_len - 1))
- {
- ch1 = source[i] & 0x0f;
- ch2 = (source[i] & 0xf0) >> 4;
- *((U8*) dest + j) = mmi_phb_convert_to_digit_get_byte(ch1);
- if (ch2 == 0x0f)
- {
- *((U8*) dest + j + 1) = ' ';
- return j + 1;
- }
- else
- {
- *((U8*) dest + j + 1) = mmi_phb_convert_to_digit_get_byte(ch2);
- }
- i++;
- j += 2;
- }
- *((U8*) dest + j) = ' ';
- return j;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_get_ucs2_number
- * DESCRIPTION
- * This function returns the UCS2 number string by specifying store_index
- * PARAMETERS
- * pString [IN/OUT] Buffter to store convert result
- * index [IN] Store index of the phonebook entry to be converted.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_convert_get_ucs2_number(S8 *pString, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tempNumber[MAX_PB_NUMBER_LENGTH + 1 + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PhoneBook[index].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- tempNumber[0] = '+';
- mmi_phb_convert_to_digit((U8*) (tempNumber + 1), PhoneBook[index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit(tempNumber, PhoneBook[index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- AnsiiToUnicodeString(pString, (S8*) tempNumber);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_get_ucs2_anr
- * DESCRIPTION
- * This function returns the UCS2 number string by specifying store_index
- * PARAMETERS
- * anra [?]
- * anrb [?]
- * anrc [?]
- * index [IN] Store index of the phonebook entry to be converted.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_convert_get_ucs2_anr(S8 *anra, S8 *anrb, S8 *anrc, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tempNumber[MAX_PB_NUMBER_LENGTH + 1 + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ASSERT(index >= MAX_PB_PHONE_ENTRIES);
- index -= MAX_PB_PHONE_ENTRIES;
- if (phb_anr[index][0].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- tempNumber[0] = '+';
- mmi_phb_convert_to_digit((U8*) (tempNumber + 1), phb_anr[index][0].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) tempNumber, phb_anr[index][0].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- AnsiiToUnicodeString(anra, (S8*) tempNumber);
- if (phb_anr[index][1].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- tempNumber[0] = '+';
- mmi_phb_convert_to_digit((U8*) (tempNumber + 1), phb_anr[index][1].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) tempNumber, phb_anr[index][1].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- AnsiiToUnicodeString(anrb, (S8*) tempNumber);
- if (phb_anr[index][2].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- tempNumber[0] = '+';
- mmi_phb_convert_to_digit((U8*) (tempNumber + 1), phb_anr[index][2].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) tempNumber, phb_anr[index][2].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- AnsiiToUnicodeString(anrb, (S8*) tempNumber);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_get_ansii_anr
- * DESCRIPTION
- * This function returns the ansii number string by specifying store_index
- * PARAMETERS
- * anra [?]
- * anrb [?]
- * anrc [?]
- * index [IN] Store index of the phonebook entry to be converted.
- * pString(?) [IN/OUT] Buffter to store convert result
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_convert_get_ansii_anr(S8 *anra, S8 *anrb, S8 *anrc, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ASSERT(index >= MAX_PB_PHONE_ENTRIES);
- index -= MAX_PB_PHONE_ENTRIES;
- if (phb_anr[index][0].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- anra[0] = '+';
- mmi_phb_convert_to_digit((U8*) (anra + 1), phb_anr[index][0].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) anra, phb_anr[index][0].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- if (phb_anr[index][1].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- anrb[0] = '+';
- mmi_phb_convert_to_digit((U8*) (anrb + 1), phb_anr[index][1].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) anrb, phb_anr[index][1].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- if (phb_anr[index][2].type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- anrc[0] = '+';
- mmi_phb_convert_to_digit((U8*) (anrc + 1), phb_anr[index][2].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) anrc, phb_anr[index][2].number, MAX_PB_NUMBER_LENGTH + 1);
- }
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_0x81_get_offset
- * DESCRIPTION
- * This function get the offset according to the base for a two bytes UCS2 character.
- * PARAMETERS
- * base [IN] Base of the character.
- * code [IN] Character for getting offset
- * RETURNS
- * offset
- *****************************************************************************/
- U8 mmi_phb_convert_to_0x81_get_offset(U16 base, U16 code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (code < 0x80)
- {
- return (U8) code;
- }
- else
- {
- return (U8) (code - base + 0x80);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_0x81_get_base
- * DESCRIPTION
- * This function get the base for a two bytes UCS2 chatacters.(For Thai only now.)
- * PARAMETERS
- * code [IN] Input character
- * RETURNS
- * the offset base
- *****************************************************************************/
- U16 mmi_phb_convert_to_0x81_get_base(U16 code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((code >= 0x0E00) && (code <= 0x0E5F)) /* Thai 0E00 ~ 0E5F */
- {
- return 0x0E00;
- }
- if ((code >= 0x0080) && (code <= 0x00FF)) /* C1 Controls and Latin-1 Supplement */
- {
- return 0x0080;
- }
- if ((code >= 0x0100) && (code <= 0x017F)) /* Latin Extended - A */
- {
- return 0x0100;
- }
- if ((code >= 0x0180) && (code <= 0x01FF)) /* Latin Extended - B (Partial) */
- {
- return 0x0180;
- }
- if ((code >= 0x0400) && (code <= 0x04FF)) /* Russian 0400 ~ 04FF */
- {
- return 0x0400;
- }
- if ((code >= 0x0600) && (code <= 0x06FF)) /* Arabic 0600 ~ 06FF */
- {
- return 0x0600;
- }
- return 0x0000;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_convert_to_0x81
- * DESCRIPTION
- * This convert a 0x80 UCS2 string to 0x81 format. (Only for Thai Language right now.)
- * PARAMETERS
- * input_name [IN] The input string.(Assume the input name is in high byte - low byte order)
- * is_convert [IN]
- * RETURNS
- * converted result length(in byte) for input string.
- *****************************************************************************/
- U8 mmi_phb_convert_to_0x81(S8 *input_name, BOOL is_convert)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 code;
- U16 base = 0;
- BOOL flag = TRUE;
- S8 result_name[(MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH];
- S8 *temp_name;
- U8 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- temp_name = input_name;
- /* Find first UCS2 character as base */
- while (!((*temp_name == 0) && (*(temp_name + 1) == 0)))
- {
- memcpy(&code, temp_name, 2);
- /* Already GSM Encoding, need to exchange byte order */
- /*
- * if(is_convert)
- * {
- * code = (code << 8) | (code >> 8);
- * }
- */
- if (code >= 0x80 && !UI_TEST_8895_1_CHAR_IN_GSM_DEF_CHAR(code))
- {
- base = mmi_phb_convert_to_0x81_get_base(code);
- break;
- }
- temp_name += 2;
- }
- /* Check if whole string can be encoded as 0x81. */
- temp_name = input_name;
- if (base > 0)
- {
- memset(result_name, 0xFF, (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH);
- result_name[0] = (U8) 0x81;
- result_name[1] = (U8) pfnUnicodeStrlen(input_name);
- result_name[2] = (U8) (base >> 7);
- i = 3;
- while (!((*temp_name == 0) && (*(temp_name + 1) == 0)))
- {
- memcpy(&code, temp_name, 2);
- /* Already GSM Encoding, need to exchange byte order */
- /*
- * if(is_convert)
- * {
- * code = (code << 8) | (code >> 8);
- * }
- */
- if ((code >= 0x80) && (mmi_phb_convert_to_0x81_get_base(code) != base))
- {
- flag = FALSE;
- break;
- }
- result_name[i] = mmi_phb_convert_to_0x81_get_offset(base, code);
- temp_name += 2;
- i++;
- }
- if (flag)
- {
- /* Wrtie result to the same buffer */
- if (is_convert)
- {
- memcpy(input_name, result_name, (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH);
- }
- return i;
- }
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * PhbAsciiToGSM7Bit
- * DESCRIPTION
- * Converts Ascii to GSM 7-Bit encoding
- * PARAMETERS
- * buffer [IN/OUT] Result buffer
- * RETURNS
- * void
- *****************************************************************************/
- void PhbAsciiToGSM7Bit(PU8 buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i, length;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- length = strlen((PS8) buffer);
- for (i = 0; i < length; ++i)
- {
- buffer[i] = AsciiToDefaultArray[buffer[i]];
- }
- }
- /*****************************************************************************
- * FUNCTION
- * PhbGSM7BitToAscii
- * DESCRIPTION
- * Converts GSM 7-Bit to Ascii encoding
- * PARAMETERS
- * buffer [IN/OUT] Result buffer
- * length [IN] Result buffer size
- * RETURNS
- * void
- *****************************************************************************/
- void PhbGSM7BitToAscii(PU8 buffer, U8 length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < length; ++i)
- {
- if (buffer[i] == 27) /* treat escape char as a space */
- {
- buffer[i] = 32;
- }
- else
- {
- buffer[i] = DefaultToAsciiArray[buffer[i]];
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetUCS2Flag
- * DESCRIPTION
- * Checks if the buffer contains Chinese character
- * PARAMETERS
- * buffer [IN] String to be checked
- * RETURNS
- * TRUE is a UCS2 two bytes string
- *****************************************************************************/
- pBOOL GetUCS2Flag(PS8 buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL UCS2Flag = FALSE;
- U8 i, bufferLen;
- UI_character_type ch;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- bufferLen = pfnUnicodeStrlen(buffer) * ENCODING_LENGTH;
- for (i = 1; i < bufferLen; i += 2)
- {
- if (buffer[i] || (buffer[i - 1] & 0x80))
- {
- ch = ((UI_character_type) buffer[i] << 8) | ((UI_character_type) buffer[i - 1]);
- if (!UI_TEST_8895_1_CHAR_IN_GSM_DEF_CHAR(ch))
- {
- UCS2Flag = TRUE;
- break;
- }
- }
- }
- return UCS2Flag;
- }
- /*****************************************************************************
- * FUNCTION
- * GetUCS2ExtendedNum
- * DESCRIPTION
- * Checks if the buffer contains Chinese character
- * PARAMETERS
- * buffer [IN] String to be checked
- * RETURNS
- * TRUE is a UCS2 two bytes string
- *****************************************************************************/
- U8 GetUCS2ExtendedNum(PS8 buffer, U8 max_buffer_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 extend_num = 0;
- UI_character_type ch;
- U8 ex_count = 0;
- U8 ex_len = 1; /* need second bytes */
- U8 buffer_len = pfnUnicodeStrlen(buffer) * ENCODING_LENGTH;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (ex_count < max_buffer_len && ex_len < buffer_len)
- {
- ch = ((UI_character_type) buffer[ex_len] << 8) | ((UI_character_type) buffer[ex_len - 1]);
- if (UI_TEST_GSM_EXTENDED(ch))
- {
- ex_count++;
- extend_num++;
- }
- ex_count++;
- ex_len += 2;
- }
- return extend_num;
- }
- /*****************************************************************************
- * FUNCTION
- * BigEndianToLittleEndian
- * DESCRIPTION
- * Changes big endian to be little endian and vice versa
- * PARAMETERS
- * dstBuffer [IN] Destination buffer
- * srcBuffer [IN] Source buffer
- * RETURNS
- * result string
- *****************************************************************************/
- PS8 BigEndianToLittleEndian(PS8 dstBuffer, PS8 srcBuffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 len;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- len = pfnUnicodeStrlen(srcBuffer) * ENCODING_LENGTH;
- while (i != len)
- {
- dstBuffer[i] = srcBuffer[i + 1];
- dstBuffer[i + 1] = srcBuffer[i];
- i += 2;
- }
- dstBuffer[i] = ' ';
- dstBuffer[i + 1] = ' ';
- return dstBuffer;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_check_is_phonebook_full
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- U8 mmi_phb_check_is_phonebook_full(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(PhoneBookEntryCount == (g_phb_cntx.sim_total + g_phb_cntx.phone_total))
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- #endif /* _PHONEBOOKSTUBSTOOTHERS_C */