PhoneBookMain.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:216k
源码类别:
MTK
开发平台:
C/C++
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_entry_second_level
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_pre_entry_second_level(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- void (*LSKEntryPtr) (void) = NULL;
- void (*SendKeyPtr) (void) = NULL;
- if ((phbListView == MMI_PHB_LIST_FOR_SMS) || (phbListView == MMI_PHB_LIST_FOR_CHAT) ||
- (phbListView == MMI_PHB_LIST_FOR_SMS_SEARCH_NAME))
- {
- LSKEntryPtr = mmi_phb_sms_send_data_choose_entry;
- SendKeyPtr = mmi_phb_sms_send_data_choose_entry;
- }
- else if (phbListView == MMI_PHB_LIST_FOR_CHAT_NO_CHECK)
- {
- LSKEntryPtr = mmi_phb_sms_send_data_for_entry_name_only;
- SendKeyPtr = mmi_phb_sms_send_data_for_entry_name_only;
- }
- else if (phbListView == MMI_PHB_LIST_FOR_SPEED_DIAL)
- {
- LSKEntryPtr = PhbSetSpeedDialFormList;
- }
- #if defined(OBIGO_SUPPORT) && defined(MMS_SUPPORT)
- else if (phbListView == MMI_PHB_LIST_FOR_MMS_ALL)
- {
- LSKEntryPtr = mmi_phb_entry_mms_choose_number;
- }
- #endif /* defined(OBIGO_SUPPORT) && defined(MMS_SUPPORT) */
- else if (phbListView == MMI_PHB_LIST_FOR_ALL_SHARED)
- {
- LSKEntryPtr = mmi_phb_generic_enter_list_result;
- }
- if (phbListView != MMI_PHB_LIST_FOR_SMS_SEARCH_NAME)
- {
- g_phb_cntx.highlight_entry = 0;
- }
- #if defined(__MMI_EMAIL__)
- if (phbListView == MMI_PHB_LIST_FOR_EMAIL_APP)
- {
- U16 i;
- U16 EntryCount = 0;
- U16 store_index;
- /* 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 & MMI_PHB_ENTRY_FIELD_EMAIL)
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- }
- }
- if (EntryCount)
- {
- 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_email_choose_entry, /* LSK Callback */
- mmi_phb_email_choose_entry, /* SEND Key Callback */
- mmi_phb_filter_list_get_item, /* List Callback */
- mmi_phb_filter_list_get_hint, /* Hint Callback */
- mmi_phb_list_pre_entry_second_level, /* 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
- #endif /* defined(__MMI_EMAIL__) */
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* 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_second_level, /* Highlight Callback */
- LSKEntryPtr, /* LSK Callback */
- SendKeyPtr, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_list_pre_entry_second_level, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_entry_for_fmgr_in_nvram
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__MMI_FILE_MANAGER__)
- void mmi_phb_list_pre_entry_for_fmgr_in_nvram(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_pre_entry_for_fmgr_in_nvram.>n",
- __FILE__, __LINE__));
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #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
- {
- /* Allocate buffer for phonebook memeber list filter */
- mmi_phb_list_allocate_filter();
- /* Find out entry in NVRAM and put it into filter list */
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- g_phb_cntx.list_filter[EntryCount] = store_index;
- EntryCount++;
- }
- }
- if (EntryCount)
- {
- g_phb_cntx.highlight_entry = 0;
- 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, /* Highlight Callback */
- mmi_phb_fmgr_pre_edit_entry, /* LSK Callback */
- NULL, /* SEND Key Callback */
- mmi_phb_filter_list_get_item, /* List Callback */
- mmi_phb_filter_list_get_hint, /* Hint Callback */
- mmi_phb_list_pre_entry_for_fmgr_in_nvram, /* Re-Entry Callback */
- FALSE, /* 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();
- }
- }
- }
- #endif /* defined(__MMI_FILE_MANAGER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_delete_one_by_one
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_pre_delete_one_by_one(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_DELETE_ONE_BY_ONE;
- g_phb_cntx.highlight_entry = 0;
- g_phb_highlight_alpha = 0;
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_DELETE, /* LSK */
- 0, /* IMAGE LSK */
- mmi_phb_get_index, /* Highlight Callback */
- mmi_phb_entry_op_delete_confirm, /* LSK Callback */
- NULL, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_list_pre_delete_one_by_one, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- FALSE); /* Right Arrow Key */
- }
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- static S32 phb_numbers[MMI_PHB_MAX_NUMBER_COUNT];
- static S32 phb_total_number_present;
- static U8 current_highligted_item = 0;
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_inline_display_style
- * DESCRIPTION
- * Returns the display style for the phonebook list(will return INLINE SELECT style always)
- * PARAMETERS
- * item_index [IN] Actual index of the menuitem in the list
- * RETURNS
- * U8 display style TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT
- *****************************************************************************/
- U8 mmi_phb_inline_display_style(S32 item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- U16 store_index;
- U8 entries_present = 0;
- U8 pic_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[item_index];
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index);
- if (store_index < MAX_PB_PHONE_ENTRIES) /* in NVRAM */
- {
- /*
- * The view field array doesn't have two mandatory fields
- * * #define MAX_PB_MANDATORY_FIELDS 2
- * * #define MAX_PB_VIEW_FIELDS (MMI_PHB_FIELD_TOTAL - MAX_PB_MANDATORY_FIELDS)
- * * View Fields Array [MAX_PB_VIEW_FIELDS]
- * * MMI_PHB_FIELD_ORDER_ENUM has those 2 mandatory fields
- * * so have to deduct MAX_PB_MANDATORY_FIELDS to arrive at the right index.
- */
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- mmi_phb_read_optional_ids(store_index);
- if (*pbNumber)
- {
- ++entries_present;
- }
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_HOME - MAX_PB_MANDATORY_FIELDS] && *PhoneBookOptionalFields.homeNumber)
- {
- ++entries_present;
- }
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_OFFICE - MAX_PB_MANDATORY_FIELDS] &&
- *PhoneBookOptionalFields.officeNumber)
- {
- ++entries_present;
- }
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_FAX - MAX_PB_MANDATORY_FIELDS] && *PhoneBookOptionalFields.faxNumber)
- {
- ++entries_present;
- }
- pic_index = mmi_phb_get_image_index(((PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids)->pictureTagID);
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_PIC - MAX_PB_MANDATORY_FIELDS] && pic_index != 0)
- {
- if ((entries_present >= 1) || (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name)))
- {
- return TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT;
- }
- }
- else
- {
- if ((entries_present > 1) ||
- (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name) && (entries_present >= 1)))
- {
- return TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT;
- }
- }
- }
- else
- {
- if (*pbNumber && (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name)))
- {
- return TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT;
- }
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_inline_default_value
- * DESCRIPTION
- * Returns the default inline item to be shown with the entry(Only phone
- * numbers to be considered)
- * PARAMETERS
- * item_index [IN] Actual index of the menuitem in the list
- * RETURNS
- * S32
- *****************************************************************************/
- S32 mmi_phb_inline_default_value(S32 item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return current_highligted_item;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_two_line_send_key_handler
- * DESCRIPTION
- * This is the send key handler in case of two line menu item in phone book
- * PARAMETERS
- * void
- * Input: NONE(?)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_two_line_send_key_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- U8 number_to_dial = 0;
- UI_string_type dialing_number[MAX_PB_NUMBER_LENGTH + 1 + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[g_phb_cntx.active_index];
- while (phb_numbers[number_to_dial] != current_highligted_item + 1 && number_to_dial <= MMI_PHB_MAX_NUMBER_COUNT)
- {
- ++number_to_dial;
- }
- #if defined(__IP_NUMBER__)
- SetTempUseIPNumber(FALSE);
- #endif
- switch (number_to_dial)
- {
- case MMI_PHB_MOBILE_NUMBER:
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index);
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- MakeCall((PS8) pbNumber);
- break;
- case MMI_PHB_HOME_NUMBER:
- AnsiiToUnicodeString((S8*) dialing_number, (S8*) PhoneBookOptionalFields.homeNumber);
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- MakeCall((PS8) dialing_number);
- break;
- case MMI_PHB_OFFICE_NUMBER:
- AnsiiToUnicodeString((S8*) dialing_number, (PS8) PhoneBookOptionalFields.officeNumber);
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- MakeCall((PS8) dialing_number);
- break;
- case MMI_PHB_FAX_NUMBER:
- AnsiiToUnicodeString((S8*) dialing_number, (PS8) PhoneBookOptionalFields.faxNumber);
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- MakeCall((PS8) dialing_number);
- break;
- default:
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* Entry in SIM */
- {
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index); /* BCD number format. */
- if (pfnUnicodeStrlen(pbNumber))
- {
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- MakeCall((PS8) pbNumber);
- break;
- }
- }
- DisplayPopup(
- (PU8) GetString(STR_NO_NUMBER_TO_DIAL),
- IMG_GLOBAL_ERROR,
- FALSE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_inline_select_data
- * DESCRIPTION
- * This function sets the relevant data for the phonebook entry
- * PARAMETERS
- * item_index [IN] Menuitem index
- * inline_item_index [IN] Inline item index
- * str_buff [IN] Inline Item String to be shown
- * img_buff_p [?] Image to be shown with the inline item
- * thumbnail [?] Thumbnail picture to be shown with the inline item
- * RETURNS
- * S32
- *****************************************************************************/
- pBOOL mmi_phb_inline_select_data(
- S32 item_index,
- S32 inline_item_index,
- UI_string_type str_buff,
- PU8 *img_buff_p,
- wgui_thumbnail_image_union *thumbnail)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- S16 next_phb_number_index = 0;
- pBOOL val = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[item_index];
- current_highligted_item = inline_item_index;
- while (phb_numbers[next_phb_number_index] != (inline_item_index + 1) &&
- next_phb_number_index <= MMI_PHB_MAX_NUMBER_COUNT)
- {
- next_phb_number_index++;
- }
- if (!phb_total_number_present)
- {
- next_phb_number_index = -1;
- }
- switch (next_phb_number_index)
- {
- case MMI_PHB_MOBILE_NUMBER:
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index);
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) & pbNumber);
- *img_buff_p = get_image((U16) (IMG_MOBILE_NUMBER));
- val = TRUE;
- break;
- case MMI_PHB_HOME_NUMBER:
- AnsiiToUnicodeString((S8*) str_buff, (S8*) PhoneBookOptionalFields.homeNumber);
- *img_buff_p = get_image((U16) (IMG_HOME_NUMBER));
- val = TRUE;
- break;
- case MMI_PHB_OFFICE_NUMBER:
- AnsiiToUnicodeString((S8*) str_buff, (PS8) PhoneBookOptionalFields.officeNumber);
- *img_buff_p = get_image((U16) (IMG_OFFICE_NUMBER));
- val = TRUE;
- break;
- case MMI_PHB_FAX_NUMBER:
- AnsiiToUnicodeString((S8*) str_buff, (PS8) PhoneBookOptionalFields.faxNumber);
- *img_buff_p = get_image((U16) (IMG_FAX_NUMBER));
- val = TRUE;
- break;
- default:
- *img_buff_p = get_image((U16) UI_NULL_IMAGE);
- AnsiiToUnicodeString((S8*) str_buff, (PS8) "");
- val = TRUE;
- break;
- }
- if (((PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids)->pictureTagID == 1)
- {
- thumbnail->path = mmi_phb_image_get_path_from_id((U16) (store_index + 1));
- }
- else
- {
- thumbnail->id = ((PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids)->pictureTagID;
- }
- return val;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_inline_select_done
- * DESCRIPTION
- * Sets highlighted item to zero always
- * PARAMETERS
- * menuitem_index [IN] Actual index of the menuitem in the list
- * selected_index [IN] Inline item currently selected
- *****************************************************************************/
- void mmi_phb_inline_select_done(S32 menuitem_index, S32 selected_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_highligted_item = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_inline_menuitem_properties
- * DESCRIPTION
- * This function is used to get the properties of the selected menu item
- * PARAMETERS
- * index [IN] Menu item index
- * current_menuitem_properties [?] Structure to be filled for menuitem properties
- * RETURNS
- * U8(?)
- *****************************************************************************/
- void mmi_phb_inline_menuitem_properties(int index, wgui_two_line_menuitem_struct *current_menuitem_properties)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- S16 number_count = 0;
- S16 entry_count = 0;
- U8 pic_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[index];
- current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
- if (store_index < MAX_PB_PHONE_ENTRIES) /* in NVRAM */
- {
- pic_index = mmi_phb_get_image_index(((PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids)->pictureTagID);
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_PIC - MAX_PB_MANDATORY_FIELDS])
- {
- current_menuitem_properties->image_flags |= UI_TWO_LINE_MENUITEM_LEFT_ALIGN_THUMBNAIL;
- if (((PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids)->pictureTagID == 1)
- {
- current_menuitem_properties->image_flags |= UI_TWO_LINE_MENUITEM_THUMBNAIL_IS_FILE;
- }
- else if (pic_index)
- {
- current_menuitem_properties->image_flags |= UI_TWO_LINE_MENUITEM_THUMBNAIL_IS_ID;
- }
- else
- {
- current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
- }
- }
- else
- {
- current_menuitem_properties->image_flags |= UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
- }
- }
- memset(phb_numbers, 0, sizeof(phb_numbers));
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index);
- /* entry_count signifies the array entry,number_count corresponds to the index of the phone number */
- if (*pbNumber)
- {
- number_count++;
- phb_numbers[entry_count] = number_count;
- }
- /*
- * The view field array doesn't have two mandatory fields
- * * #define MAX_PB_MANDATORY_FIELDS 2
- * * #define MAX_PB_VIEW_FIELDS (MMI_PHB_FIELD_TOTAL - MAX_PB_MANDATORY_FIELDS)
- * * View Fields Array [MAX_PB_VIEW_FIELDS]
- * * MMI_PHB_FIELD_ORDER_ENUM has those 2 mandatory fields
- * * so have to deduct MAX_PB_MANDATORY_FIELDS to arrive at the right index.
- */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- entry_count++;
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_HOME - MAX_PB_MANDATORY_FIELDS] && *PhoneBookOptionalFields.homeNumber)
- {
- number_count++;
- phb_numbers[entry_count] = number_count;
- }
- entry_count++;
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_OFFICE - MAX_PB_MANDATORY_FIELDS] &&
- *PhoneBookOptionalFields.officeNumber)
- {
- number_count++;
- phb_numbers[entry_count] = number_count;
- }
- entry_count++;
- if (g_phb_cntx.view_field[MMI_PHB_FIELD_FAX - MAX_PB_MANDATORY_FIELDS] && *PhoneBookOptionalFields.faxNumber)
- {
- number_count++;
- phb_numbers[entry_count] = number_count;
- }
- }
- phb_total_number_present = number_count;
- current_menuitem_properties->num_of_items = phb_total_number_present;
- current_menuitem_properties->defualt_value_callback = mmi_phb_inline_default_value;
- current_menuitem_properties->complete_callback = mmi_phb_inline_select_done;
- current_menuitem_properties->two_line_data_callback.get_data_for_horizontal_select = mmi_phb_inline_select_data;
- }
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_list
- * DESCRIPTION
- * This function is for entering phonebook entry List
- * PARAMETERS
- * EntryCount [IN]
- * STR_TITLE [IN]
- * IMG_TITLE [IN]
- * STR_LSK [IN]
- * IMG_LSK [IN]
- * HighlightPtr [IN]
- * LSKPtr [IN]
- * SendKeyPtr [IN]
- * ItemPtr [IN]
- * HintPtr [IN]
- * EntryPtr [IN]
- * alpha_index [IN]
- * right_arrow [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_list(
- U16 EntryCount,
- U16 STR_TITLE,
- U16 IMG_TITLE,
- U16 STR_LSK,
- U16 IMG_LSK,
- void (*HighlightPtr) (S32),
- FunctionPtr LSKPtr,
- FunctionPtr SendKeyPtr,
- GetItemPtr ItemPtr,
- GetHintPtr HintPtr,
- FunctionPtr EntryPtr,
- BOOL alpha_index,
- BOOL right_arrow)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check if it can be list first */
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_list_free_filter();
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- return;
- }
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_list_free_filter();
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- return;
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (PhoneBookEntryCount == 0)
- {
- mmi_phb_list_free_filter();
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- return;
- }
- /* Check if phonebook entry has been updated, and if need to use alpha_index function. */
- if (g_phb_cntx.refresh_list && alpha_index)
- {
- mmi_phb_list_build_alpha_index(NULL, 0, TRUE, MMI_STORAGE_NONE);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_NO_CHANGE;
- }
- EntryNewScreen(SCR_PBOOK_LIST, mmi_phb_exit_list, EntryPtr, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_LIST);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (!guiBuffer)
- {
- current_highligted_item = 0;
- }
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- if (g_phb_cntx.new_highlight_entry < 0xffff)
- {
- change_list_menu_category_history(guiBuffer, g_phb_cntx.new_highlight_entry, EntryCount, 0);
- g_phb_cntx.new_highlight_entry = 0xffff;
- }
- #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__)
- if (phbListView == MMI_PHB_LIST_FOR_PHB && gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
- }
- #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__) */
- RegisterHighlightHandler(HighlightPtr);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- ShowCategory273Screen(
- STR_TITLE,
- IMG_TITLE,
- STR_LSK,
- IMG_LSK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- EntryCount,
- ItemPtr,
- mmi_phb_inline_display_style,
- mmi_phb_inline_menuitem_properties,
- g_phb_cntx.highlight_entry,
- guiBuffer);
- wgui_register_list_item_selected_callback_all(UI_dummy_function);
- }
- else
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- ShowCategory184Screen(
- STR_TITLE,
- IMG_TITLE,
- STR_LSK,
- IMG_LSK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- EntryCount,
- ItemPtr,
- HintPtr,
- g_phb_cntx.highlight_entry,
- guiBuffer);
- }
- /* register multi-tap function for fast jump, for full list only */
- if (alpha_index)
- {
- register_multitap_no_draw_key_handlers();
- set_multitap_functions(mmi_phb_list_alpha_index, mmi_phb_list_alpha_index_input_callback);
- change_multitap_mode(0);
- }
- SetLeftSoftkeyFunction(LSKPtr, KEY_EVENT_UP);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView != MMI_PHB_LIST_FOR_PHB)
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- if (right_arrow)
- {
- SetKeyHandler(LSKPtr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- SetKeyHandler(SendKeyPtr, KEY_SEND, KEY_EVENT_UP);
- #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__)
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- SetCenterSoftkeyFunction(SendKeyPtr, KEY_EVENT_UP);
- }
- #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__) */
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView != MMI_PHB_LIST_FOR_PHB)
- #endif
- {
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- #if defined(__IP_NUMBER__) && defined(__MMI_IP_KEY__) /* For IP Dial Key */
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* defined(__IP_NUMBER__) && defined(__MMI_IP_KEY__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_list
- * DESCRIPTION
- * This function is for existing entering phonebook entry List
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_idle_context.ToNameScrFromIdleApp)
- {
- g_phb_cntx.start_scr_id = SCR_PBOOK_LIST;
- }
- /* Avoid: Entry from Name List and re-entry from MT-> Deflect */
- if (!(phbListView == MMI_PHB_LIST_FOR_CM &&
- g_phb_cntx.start_scr_id == SCR_PBOOK_LIST))
- {
- g_phb_cntx.end_scr_id = SCR_PBOOK_LIST;
- }
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- StopTimer(PHB_LIST_SPEAK_NAME_TIMER);
- if (g_phb_is_speaking_name)
- {
- mdi_audio_stop_string();
- }
- #endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */
- reset_multitaps();
- StopTimer(KEYPAD_LOCK_TIMER);
- #if defined(__MMI_VRSD_DIAL__)
- StopTimer(VRSD_DIAL_PLAYBACK_TIMER);
- #endif
- #if defined(__MMI_VRSI__) && defined(__MMI_VRSI_TRAIN_TAG__)
- mmi_phb_vrsi_exit_entry_list();
- #endif
- g_idle_context.ToNameScrFromIdleApp = 0;
- g_idle_context.RskPressedFromIdleApp = 0;
- /* Free Member List Filter if exists */
- mmi_phb_list_free_filter();
- #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__)
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- ResetCenterSoftkey();
- }
- #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_get_item
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_phb_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);
- }
- 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_list_get_hint
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_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_name_index[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. */
- }
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_nlf_entry_list
- * DESCRIPTION
- * This function is for entering phonebook entry list with name list filter
- * PARAMETERS
- * EntryCount [IN]
- * STR_TITLE [IN]
- * IMG_TITLE [IN]
- * STR_LSK [IN]
- * IMG_LSK [IN]
- * HighlightPtr [IN]
- * LSKPtr [IN]
- * SendKeyPtr [IN]
- * ItemPtr [IN]
- * HintPtr [IN]
- * EntryPtr [IN]
- * alpha_index [IN]
- * right_arrow [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_nlf_entry_list(
- U16 EntryCount,
- U16 STR_TITLE,
- U16 IMG_TITLE,
- U16 STR_LSK,
- U16 IMG_LSK,
- void (*HighlightPtr) (S32),
- FunctionPtr LSKPtr,
- FunctionPtr SendKeyPtr,
- GetItemPtr ItemPtr,
- GetHintPtr HintPtr,
- FunctionPtr EntryPtr,
- BOOL alpha_index,
- BOOL right_arrow)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check if it can be list first */
- if(g_phb_cntx.name_list_filter == MMI_SIM)
- {
- g_phb_list_index_total = g_phb_cntx.sim_used;
- }
- else if(g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- g_phb_list_index_total = g_phb_cntx.phone_used;
- }
- else
- {
- g_phb_list_index_total = PhoneBookEntryCount;
- }
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_list_free_filter();
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- return;
- }
- else if (g_phb_list_index_total == 0)
- {
- mmi_phb_list_free_filter();
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- return;
- }
- /* Check if phonebook entry has been updated, and if need to use alpha_index function. */
- if (g_phb_cntx.refresh_list && alpha_index)
- {
- mmi_phb_list_build_alpha_index(NULL, 0, TRUE, MMI_STORAGE_NONE);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_NO_CHANGE;
- }
- EntryNewScreen(SCR_PBOOK_LIST, mmi_phb_exit_list, EntryPtr, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_LIST);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (!guiBuffer)
- {
- current_highligted_item = 0;
- }
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- if (g_phb_cntx.new_highlight_entry < 0xffff)
- {
- change_list_menu_category_history(guiBuffer, g_phb_cntx.new_highlight_entry, EntryCount, 0);
- g_phb_cntx.new_highlight_entry = 0xffff;
- }
- #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__)
- if (phbListView == MMI_PHB_LIST_FOR_PHB && gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
- }
- #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__) */
- RegisterHighlightHandler(HighlightPtr);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- ShowCategory273Screen(
- STR_TITLE,
- IMG_TITLE,
- STR_LSK,
- IMG_LSK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- EntryCount,
- ItemPtr,
- mmi_phb_inline_display_style,
- mmi_phb_inline_menuitem_properties,
- g_phb_cntx.highlight_entry,
- guiBuffer);
- }
- else
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- ShowCategory184Screen(
- STR_TITLE,
- IMG_TITLE,
- STR_LSK,
- IMG_LSK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- EntryCount,
- ItemPtr,
- HintPtr,
- g_phb_cntx.highlight_entry,
- guiBuffer);
- }
- /* register multi-tap function for fast jump, for full list only */
- if (alpha_index)
- {
- register_multitap_no_draw_key_handlers();
- set_multitap_functions(mmi_phb_list_alpha_index, mmi_phb_list_alpha_index_input_callback);
- change_multitap_mode(0);
- }
- SetLeftSoftkeyFunction(LSKPtr, KEY_EVENT_UP);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView != MMI_PHB_LIST_FOR_PHB)
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- if (right_arrow)
- {
- SetKeyHandler(LSKPtr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- SetKeyHandler(SendKeyPtr, KEY_SEND, KEY_EVENT_UP);
- #if (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__)
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- SetCenterSoftkeyFunction(SendKeyPtr, KEY_EVENT_UP);
- }
- #endif /* (defined __MMI_TOUCH_SCREEN__) && (defined __MMI_WGUI_CSK_ENABLE__) */
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView != MMI_PHB_LIST_FOR_PHB)
- #endif
- {
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- #if defined(__IP_NUMBER__) && defined(__MMI_IP_KEY__) /* For IP Dial Key */
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* defined(__IP_NUMBER__) && defined(__MMI_IP_KEY__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_nlf_list_get_item
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_phb_nlf_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 */
- /*----------------------------------------------------------------*/
- if ((item_index < 0) || (item_index >= PhoneBookEntryCount))
- {
- return FALSE;
- }
- while (i < item_index)
- {
- store_index = g_phb_name_index[inner_index];
- if (g_phb_cntx.name_list_filter == MMI_SIM)
- {
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else if (g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- if(store_index < MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else
- {
- 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_nlf_list_get_hint
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_nlf_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_cntx.name_list_filter == MMI_SIM)
- {
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else if (g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- if(store_index < MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else
- {
- 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; /* No Hint Data */
- }
- return 1; /* One hint data only, can be more hints. */
- }
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_filter_list_get_item
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * str_buff [IN]
- * img_buff_p [?]
- * str_img_mask [IN]
- * RETURNS
- *
- *****************************************************************************/
- pBOOL mmi_phb_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;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_cntx.list_filter[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);
- }
- 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_filter_list_get_hint
- * DESCRIPTION
- *
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- *
- *****************************************************************************/
- S32 mmi_phb_filter_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;
- }
- return 1; /* One hint data only, can be more hints. */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_get_null_hint
- * DESCRIPTION
- * No hint needed in the dynamic list.
- * PARAMETERS
- * item_index [IN]
- * hint_array [?]
- * RETURNS
- * void
- *****************************************************************************/
- S32 mmi_phb_list_get_null_hint(S32 item_index, UI_string_type *hint_array)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_choose_number_normal
- * DESCRIPTION
- * choose normal phonebook entry number if has many(Only when IP number on)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_choose_number_normal(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__IP_NUMBER__)
- SetTempUseIPNumber(FALSE);
- #endif
- mmi_phb_list_pre_choose_number();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_choose_number_ip_number
- * DESCRIPTION
- * choose IP Dial phonebook entry number if has many(Only when IP number on)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_choose_number_ip_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__IP_NUMBER__)
- SetTempUseIPNumber(TRUE);
- #endif
- mmi_phb_list_pre_choose_number();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_alpha_index
- * DESCRIPTION
- * This function calculates the index of the entry to be highlighted, if the user jumps to some
- * entry using multi-tap on PHB list screen.
- * PARAMETERS
- * input [IN] Input character
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_alpha_index(U16 input)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (input >= 'A' && input <= 'Z')
- {
- g_phb_highlight_alpha = g_phb_alpha_index_list[input - 'A'];
- g_phb_highlight_alpha--;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_alpha_index_input_callback
- * DESCRIPTION
- * Jumps to the hilited entry
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_alpha_index_input_callback(void)
- {
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (UI_device_height == 220 && UI_device_width == 176)
- {
- Cat212ShortCutHdlr(g_phb_highlight_alpha); /* For image list fast jump */
- }
- else
- #endif /* defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) */
- dynamic_list_goto_item(g_phb_highlight_alpha); /* Use Dynamic List */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_build_alpha_index
- * DESCRIPTION
- * Build up alpha index for each characters
- * PARAMETERS
- * filter_list [?]
- * filter_value [IN]
- * is_equal [IN]
- * storage [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_build_alpha_index(U16 *filter_list, U16 filter_value, BOOL is_equal, U8 storage)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i, j, count = 0;
- BOOL valid_ch;
- U8 index = 0xff;
- U16 store_index;
- MMI_PHB_NAME_STRUCT *name_ptr;
- #if defined(__MMI_PHB_PINYIN_SORT__)
- U8 *pinyin_ptr;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Clear First */
- for (i = 0; i < ALPHA_LIST_LENGTH; i++)
- {
- g_phb_alpha_index_list[i] = 0;
- }
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- U16 filter_index;
- store_index = g_phb_name_index[i];
- /* exclude storage location */
- if (storage == MMI_SIM && store_index < MAX_PB_PHONE_ENTRIES)
- {
- continue;
- }
- else if (storage == MMI_NVRAM && store_index >= MAX_PB_PHONE_ENTRIES)
- {
- continue;
- }
- if (storage == MMI_SIM)
- {
- filter_index = store_index - MAX_PB_PHONE_ENTRIES;
- }
- else
- {
- filter_index = store_index;
- }
- /* Filter List */
- if (filter_list != NULL && is_equal) /* Exclude item not in the filter list. */
- {
- if (filter_list[filter_index] != filter_value)
- {
- continue;
- }
- }
- else if (filter_list != NULL && !is_equal) /* Exclude item in the filter list. */
- {
- if (filter_list[filter_index] == filter_value)
- {
- continue;
- }
- }
- /* All character store in MMI by using UCS2(two-bytes) format */
- name_ptr = &PhoneBook[store_index].alpha_id;
- if ((name_ptr->name[1] == 0x00) && (name_ptr->name[0] >= 'a') && (name_ptr->name[0] <= 'z')) /* lower case */
- {
- index = name_ptr->name[0] - 'a';
- valid_ch = TRUE;
- }
- else if ((name_ptr->name[1] == 0x00) && (name_ptr->name[0] >= 'A') && (name_ptr->name[0] <= 'Z')) /* upper case */
- {
- index = name_ptr->name[0] - 'A';
- valid_ch = TRUE;
- }
- #if defined(__MMI_PHB_PINYIN_SORT__)
- else if ((name_ptr->name[0] != 0x00) && (name_ptr->name[1] != 0x00)) /* A 2-bytes character */
- {
- mmi_phb_util_get_pinyin_cache(store_index, &pinyin_ptr);
- if (pinyin_ptr[0] >= 'a' && pinyin_ptr[0] <= 'z')
- {
- index = pinyin_ptr[0] - 'a';
- valid_ch = TRUE;
- }
- else
- {
- valid_ch = FALSE;
- }
- }
- #endif /* defined(__MMI_PHB_PINYIN_SORT__) */
- else
- {
- valid_ch = FALSE;
- }
- /* Assign alpha index */
- if (index < ALPHA_LIST_LENGTH && g_phb_alpha_index_list[index] == 0 && valid_ch)
- {
- for (j = 0; j < index; j++)
- if (g_phb_alpha_index_list[j] == 0)
- {
- g_phb_alpha_index_list[j] = count + 1;
- }
- g_phb_alpha_index_list[index] = count + 1;
- }
- count++;
- }
- /* Handle unassigned index */
- count = 1;
- for (j = 0; j < ALPHA_LIST_LENGTH; j++)
- {
- if (g_phb_alpha_index_list[j] == 0)
- {
- g_phb_alpha_index_list[j] = count;
- }
- else
- {
- count = g_phb_alpha_index_list[j];
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_choose_number
- * DESCRIPTION
- * Allows the user to choose one number to dial if the entry has more than one number
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_pre_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_entry_list_choose_number(
- g_phb_name_index[g_phb_cntx.active_index],
- mmi_phb_list_pre_choose_number,
- mmi_phb_list_make_call,
- MakeCall,
- STR_NO_NUMBER_TO_DIAL,
- TRUE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_list_choose_number
- * DESCRIPTION
- * Allows the user to choose one number to some action if the entry has more than one number
- * PARAMETERS
- * store_index [IN]
- * EntryFunc [IN]
- * RSKFunc [IN]
- * ActionFunc [IN]
- * empty_str_id [IN]
- * dial_list [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_list_choose_number(
- U16 store_index,
- void (*EntryFunc) (void),
- void (*RSKFunc) (void),
- void (*ActionFunc) (S8*),
- U16 empty_str_id,
- BOOL dial_list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 *guiBuffer;
- U16 numberTypeImageList[4];
- S16 pError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_VOIP__
- phb_voip_number_index= 0xff;
- #endif
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index); /* BCD number format. */
- if (pfnUnicodeStrlen(pbNumber))
- {
- g_phb_cntx.number_to_dial[i] = (U8*) pbNumber;
- numberTypeImageList[i++] = IMG_MOBILE_NUMBER;
- }
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* Entry in SIM */
- {
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_cntx.is_usim)
- {
- mmi_phb_convert_get_ucs2_anr(pbHomeNumber, pbOfficeNumber, pbFaxNumber, store_index);
- if (pfnUnicodeStrlen(pbHomeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbHomeNumber;
- numberTypeImageList[i++] = IMG_ID_PHB_ANR;
- }
- AnsiiToUnicodeString(pbOfficeNumber, (PS8) PhoneBookOptionalFields.officeNumber);
- if (pfnUnicodeStrlen(pbOfficeNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbOfficeNumber;
- numberTypeImageList[i++] = IMG_ID_PHB_ANR;
- }
- AnsiiToUnicodeString(pbFaxNumber, (PS8) PhoneBookOptionalFields.faxNumber);
- if (pfnUnicodeStrlen(pbFaxNumber))
- {
- g_phb_cntx.number_to_dial[i] = (PU8) pbFaxNumber;
- numberTypeImageList[i++] = IMG_ID_PHB_ANR;
- }
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- }
- else
- {
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- /* Read Optional Number Fields */
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- 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;
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- }
- #ifdef __MMI_VOIP__
- if (dial_list && store_index < MAX_PB_PHONE_ENTRIES) /* make call */
- {
- ReadRecord(
- NVRAM_EF_PHB_VOIP_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookVoipField,
- VOIP_URI_LEN,
- &pError);
- AnsiiToUnicodeString(pbVoip, (PS8) PhoneBookVoipField);
- if (pfnUnicodeStrlen(pbVoip))
- {
- phb_voip_number_index = i;
- g_phb_cntx.number_to_dial[i] = (PU8) pbVoip;
- numberTypeImageList[i++] = IMG_ID_PHB_VOIP;
- }
- }
- #endif /* __MMI_VOIP__ */
- if (!i)
- {
- #if defined(__IP_NUMBER__)
- SetTempUseIPNumber(FALSE);
- #endif
- DisplayPopup((PU8) GetString(empty_str_id), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else if (i == 1)
- {
- if (dial_list) /* Will dial from list after select entry */
- {
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- #ifdef __MMI_VOIP__
- if (phb_voip_number_index != 0xff)
- {
- mmi_voip_app_make_call((PU8)pbVoip);
- return;
- }
- #endif /* __MMI_VOIP__ */
- }
- ActionFunc((PS8) g_phb_cntx.number_to_dial[0]);
- }
- else
- {
- #if defined(__IP_NUMBER__) /* Do not keep choose number screen in history when IP dial enable */
- EntryNewScreen(SCR_CHOOSE_NUMBER, mmi_phb_exit_list_choose_number, NULL, NULL);
- #else
- EntryNewScreen(SCR_CHOOSE_NUMBER, mmi_phb_exit_list_choose_number, EntryFunc, NULL);
- #endif
- guiBuffer = GetCurrGuiBuffer(SCR_CHOOSE_NUMBER);
- 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(RSKFunc, KEY_EVENT_UP);
- SetKeyHandler(RSKFunc, KEY_SEND, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_list_choose_number
- * DESCRIPTION
- * exit function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_list_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_CHOOSE_NUMBER;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_make_call
- * DESCRIPTION
- * Makes call to a number
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_make_call(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_list_make_call.>n", __FILE__, __LINE__));
- g_phb_cntx.dial_from_list = MMI_PHB_PHONEBOOK;
- #ifdef __MMI_VOIP__
- if (phb_voip_number_index == g_phb_cntx.active_index_third)
- {
- mmi_voip_app_make_call(g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- else
- #endif
- {
- MakeCall((PS8) g_phb_cntx.number_to_dial[g_phb_cntx.active_index_third]);
- }
- }
- #define MMI_PHB_UTIL_FUNC
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_speak_name
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_speak_name(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index = (U16) nIndex;
- StopTimer(PHB_LIST_SPEAK_NAME_TIMER);
- if (g_phb_is_speaking_name)
- {
- mdi_audio_stop_string();
- }
- if (g_phb_cntx.speak_name)
- {
- StartTimer(PHB_LIST_SPEAK_NAME_TIMER, UI_POPUP_NOTIFYDURATION_TIME, mmi_phb_list_speak_name);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_speak_name_nlf
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list
- * when name_list_filter opening.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_speak_name_nlf(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_cntx.name_list_filter == MMI_SIM)
- {
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else if (g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- if(store_index < MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else
- {
- i++;
- }
- inner_index++;
- }
- g_phb_cntx.active_index = (U16) (inner_index - 1);
- StopTimer(PHB_LIST_SPEAK_NAME_TIMER);
- if (g_phb_is_speaking_name)
- {
- mdi_audio_stop_string();
- }
- if (g_phb_cntx.speak_name)
- {
- StartTimer(PHB_LIST_SPEAK_NAME_TIMER, UI_POPUP_NOTIFYDURATION_TIME, mmi_phb_list_speak_name);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_speak_name
- * DESCRIPTION
- * Speak name or number for a phonebook entry.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_speak_name(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- U8 text[(MAX_PB_NAME_LENGTH + MAX_PB_NUMBER_LENGTH + 10) * ENCODING_LENGTH];
- U16 length = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* g_phb_cntx.active_index = (U16)nIndex; */
- #ifdef __MMI_SILENT_MEETING_PROFILE__
- if (IsMeetingModeActivated())
- {
- /* not to play sound */
- }
- else
- #endif /* __MMI_SILENT_MEETING_PROFILE__ */
- /* Flag is on and not in call */
- if (g_phb_cntx.speak_name && !isInCall() && !IsSilentModeActivated())
- {
- store_index = g_phb_name_index[g_phb_cntx.active_index];
- #if defined(SIMPLE_TTS) || defined(DIGIT_TONE_SUPPORT)
- /* Name */
- pfnUnicodeStrcpy((S8*) text, (S8*) PhoneBook[store_index].alpha_id.name);
- length = pfnUnicodeStrlen((S8*) text);
- #endif /* defined(SIMPLE_TTS) || defined(DIGIT_TONE_SUPPORT) */
- /* Append Number */
- #ifdef DIGIT_TONE_SUPPORT
- mmi_phb_convert_get_ucs2_number((S8*) (text + length * ENCODING_LENGTH), store_index);
- length += pfnUnicodeStrlen((S8*) (text + length * ENCODING_LENGTH));
- #endif /* DIGIT_TONE_SUPPORT */
- if (length > 0)
- {
- mdi_result result = mdi_audio_play_text_with_vol_path(
- (U8*) text,
- length,
- 100,
- NULL,
- mmi_phb_speak_name_handler,
- GetRingVolumeLevel(),
- MDI_DEVICE_SPEAKER2);
- if (result == MDI_AUDIO_SUCCESS)
- {
- g_phb_is_speaking_name = 1;
- }
- else
- {
- g_phb_is_speaking_name = 0;
- }
- }
- }
- }
- #endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index = (U16) nIndex;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_nlf
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list
- * when name_list_filter opening
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_nlf(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_cntx.name_list_filter == MMI_SIM)
- {
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else if (g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- if(store_index < MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else
- {
- i++;
- }
- inner_index++;
- }
- g_phb_cntx.active_index = (U16) (inner_index - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_second_level
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_second_level(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index_second = (U16) nIndex;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_third_level
- * DESCRIPTION
- * Gets the index of the currently highlighted item in Phonebook menu list.
- * PARAMETERS
- * nIndex [IN] Highlight index position
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_index_third_level(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index_third = (U16) nIndex;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_by_store_location
- * 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(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index = g_phb_cntx.list_filter[nIndex];
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_index_by_store_location_second
- * 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_second(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.active_index_second = g_phb_cntx.list_filter[nIndex];
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_util_clear_buffer
- * DESCRIPTION
- * Clears buffers used for adding/editing entry
- * PARAMETERS
- * clear_number [IN]
- * flag_number(?) [IN] TRUE: clear number buffer. FALSE: Keep number buffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_util_clear_buffer(BOOL clear_number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(pbName, 0, ENCODING_LENGTH);
- if (clear_number)
- {
- memset(pbNumber, 0, ENCODING_LENGTH);
- }
- memset(pbHomeNumber, 0, ENCODING_LENGTH);
- memset(pbCompanyName, 0, ENCODING_LENGTH);
- memset(pbEmailAddress, 0, ENCODING_LENGTH);
- memset(pbOfficeNumber, 0, ENCODING_LENGTH);
- memset(pbFaxNumber, 0, ENCODING_LENGTH);
- g_phb_cntx.selected_pic_index = 0;
- g_phb_cntx.selected_ring_index = 0;
- g_phb_cntx.selected_grp_index = 0;
- g_phb_cntx.image_location = MMI_PHB_IMAGE_NO_SELECT;
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- g_phb_cntx.selected_video_index = 0;
- g_phb_cntx.video_location = MMI_PHB_IMAGE_NO_SELECT;
- #endif
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_phb_util_clear_bday_buffer();
- #endif
- #if defined(__MMI_PHB_IMPS_FIELD__)
- memset(pbImps, 0, ENCODING_LENGTH);
- #endif
- #if defined(__MMI_VOIP__)
- memset(pbVoip, 0, ENCODING_LENGTH);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_go_back_2_history
- * DESCRIPTION
- * Goes back two screens in history
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_go_back_2_history(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBacknHistory(1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_go_back_3_history_and_clear
- * DESCRIPTION
- * Goes back three screens in history
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_go_back_3_history_and_clear(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_util_clear_buffer(TRUE);
- GoBacknHistory(2);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_set_full_scr_lsk
- * DESCRIPTION
- * Sets the LSK for Full-Screen editor
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_set_full_scr_lsk(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
- SetInputMethodAndDoneCaptionIcon(IMG_SCR_PBOOK_CAPTION);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_clear_old_history
- * DESCRIPTION
- * Deletes old PHB screens from history if Phonebook is re-entered thru some other application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_clear_old_history(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.start_scr_id && g_phb_cntx.end_scr_id &&
- IsScreenPresent(g_phb_cntx.start_scr_id))
- {
- if (g_phb_cntx.start_scr_id == g_phb_cntx.end_scr_id)
- {
- DeleteScreenIfPresent(g_phb_cntx.start_scr_id);
- }
- else
- {
- U16 end_scr_id = 0;
- GetPreviousScrnIdOf(GetCmMarkerScrnID(), &end_scr_id);
- if (end_scr_id) /* since editor common screen won't be save to g_phb_cntx.end_scr_id */
- {
- g_phb_cntx.end_scr_id = end_scr_id;
- }
- DeleteBetweenScreen(g_phb_cntx.start_scr_id, g_phb_cntx.end_scr_id);
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- mmi_phb_video_free_buf();
- #endif
- }
- }
- else if (g_phb_cntx.end_scr_id)
- {
- DeleteScreenIfPresent(g_phb_cntx.end_scr_id);
- }
- g_phb_cntx.start_scr_id = g_phb_cntx.end_scr_id = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_reset_scr_id
- * DESCRIPTION
- * Resets the start and end screen ids on main-menu and idle screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_reset_scr_id(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.start_scr_id = g_phb_cntx.end_scr_id = 0;
- }
- #define MMI_PHB_IMAGE_LIST
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_image_list1_draw_title_info
- * DESCRIPTION
- * Draw image list 1 title info. It will draw image, name and number here.
- * PARAMETERS
- * item_idx [IN]
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_image_list1_draw_title_info(S32 item_idx, S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 char_height;
- S32 box_width, box_height;
- S32 img_box_width = 40, img_box_height = 40;
- S32 img_width, img_height;
- S32 img_draw_width, img_draw_height;
- S32 img_draw_offset_x, img_draw_offset_y;
- S32 spacing;
- S32 offset_x; /* For name and image offset x */
- S32 offset_y; /* For name and image offset y */
- S32 num_offset_y;
- S32 name_width;
- U16 store_index;
- S8 *image_path = NULL;
- PHB_OPTIONAL_IDS_STRUCT *opt_ids;
- S8 buffer_UCS2[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- *lock and push clip
- */
- gui_lock_double_buffer();
- gui_push_text_clip();
- gui_push_clip();
- gui_reset_clip();
- gui_reset_text_clip();
- /*
- * Get hint text info
- */
- store_index = g_phb_name_index[item_idx];
- mmi_phb_convert_get_ucs2_number((S8*) buffer_UCS2, store_index);
- /*
- * Calcuate text position
- */
- box_height = y2 - y1 + 1;
- box_width = x2 - x1 + 1;
- gui_set_font(&MMI_medium_font);
- char_height = gui_get_string_height((UI_string_type) GetString(STR_ID_PHB_MOBILE_NUMBER));
- spacing = (box_height - char_height * 2) / 3;
- offset_y = spacing + MMI_title_height + MMI_title_y;
- num_offset_y = spacing * 2 + char_height + MMI_title_height + MMI_title_y;
- if (r2lMMIFlag) /* For right to left language */
- {
- offset_x = x2 - img_box_width - 6;
- }
- else
- {
- offset_x = x1 + img_box_width + 6;
- }
- name_width = box_width - img_box_width - 12;
- /*
- * Draw Hint Text
- */
- gui_set_font(&MMI_medium_font);
- gui_reset_text_clip();
- gui_set_text_color(gui_color(0, 0, 0));
- /*
- * Draw name/number if not empty
- */
- if (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name))
- {
- gui_print_truncated_text(offset_x, offset_y, name_width, (UI_string_type) PhoneBook[store_index].alpha_id.name);
- if (pfnUnicodeStrlen((S8*) buffer_UCS2))
- {
- gui_print_truncated_text(offset_x, num_offset_y, name_width, (UI_string_type) buffer_UCS2);
- }
- }
- else
- {
- gui_print_truncated_text(offset_x, offset_y, name_width, (UI_string_type) buffer_UCS2);
- }
- /*
- * Get Associate Picture path from file
- */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- mmi_phb_read_optional_ids(store_index); /* i is store index */
- opt_ids = (PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids;
- if (opt_ids->pictureTagID == 1)
- {
- image_path = mmi_phb_image_get_path_from_id((U16) (store_index + 1));
- }
- }
- /*
- * Draw Associate Picture thumb image
- */
- gui_push_clip();
- if (r2lMMIFlag) /* For right to left language */
- {
- offset_x = x2 - img_box_width - 2;
- }
- else
- {
- offset_x = x1 + 2;
- }
- offset_y = y1 + 2;
- gui_set_clip(offset_x, offset_y, offset_x + img_box_width, offset_y + img_box_height);
- /* Get image from file */
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- gdi_image_draw_resized_id(offset_x, offset_y, img_box_width, img_box_height, IMG_ID_PHB_LIST_ICON1);
- }
- else
- #endif /* __USB_IN_NORMAL_MODE */
- {
- if ((image_path != NULL) && (gdi_image_get_dimension_file(image_path, &img_width, &img_height) >= 0))
- {
- gdi_util_fit_box(
- GDI_UTIL_MODE_NO_RESIZE_OR_LONG_SIDE_FIT,
- img_box_width,
- img_box_height,
- img_width,
- img_height,
- &img_draw_offset_x,
- &img_draw_offset_y,
- &img_draw_width,
- &img_draw_height);
- gdi_image_draw_resized_file(
- offset_x + img_draw_offset_x,
- offset_y + img_draw_offset_y,
- img_draw_width,
- img_draw_height,
- image_path);
- }
- else /* Use default image */
- {
- gdi_image_draw_resized_id(offset_x, offset_y, img_box_width, img_box_height, IMG_ID_PHB_LIST_ICON1);
- }
- }
- gui_pop_clip();
- /*
- * pop clip , unlock and blt
- */
- gui_pop_clip();
- gui_pop_text_clip();
- gui_unlock_double_buffer();
- gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_image_list1
- * DESCRIPTION
- * This function list all phonebook entry with picture info on the top.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_image_list1(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- * Check if it can be list in advance
- */
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- return;
- }
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- return;
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (PhoneBookEntryCount == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- return;
- }
- /*
- *Check if phonebook entry has been updated, and if need to use alpha_index function.
- */
- if (g_phb_cntx.refresh_list)
- {
- mmi_phb_list_build_alpha_index(NULL, 0, TRUE, MMI_STORAGE_NONE);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_NO_CHANGE;
- }
- EntryNewScreen(SCR_PBOOK_LIST, mmi_phb_exit_list, mmi_phb_entry_image_list1, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_LIST);
- #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__)
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
- }
- #endif /* defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__) */
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- RegisterHighlightHandler(mmi_phb_get_index_speak_name);
- #else
- RegisterHighlightHandler(mmi_phb_get_index);
- #endif
- ShowCategory212Screen(
- STR_SCR_PBOOK_VIEW_CAPTION,
- IMG_SCR_PBOOK_CAPTION, /* Title */
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS, /* LSK */
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK, /* RSK */
- PhoneBookEntryCount,
- mmi_phb_list_get_item,
- mmi_phb_list_get_null_hint,
- mmi_phb_image_list1_draw_title_info,
- NULL, /* No call back needed when change highlight */
- 2, /* Info box row count */
- 0, /* info bg image id */
- g_phb_cntx.highlight_entry, /* Highlight item index */
- (U8*) guiBuffer);
- register_multitap_no_draw_key_handlers();
- set_multitap_functions(mmi_phb_list_alpha_index, mmi_phb_list_alpha_index_input_callback);
- change_multitap_mode(0);
- SetLeftSoftkeyFunction(mmi_phb_entry_op_option, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_op_option, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- SetKeyHandler(mmi_phb_choose_number_normal, KEY_SEND, KEY_EVENT_UP);
- #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__)
- SetCenterSoftkeyFunction(mmi_phb_choose_number_normal, KEY_EVENT_UP);
- #endif
- }
- }
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_nlf_image_list1_draw_title_info
- * DESCRIPTION
- * Draw image list 1 title info. It will draw image, name and number here.
- * PARAMETERS
- * item_idx [IN]
- * x1 [IN]
- * y1 [IN]
- * x2 [IN]
- * y2 [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_nlf_image_list1_draw_title_info(S32 item_idx, S32 x1, S32 y1, S32 x2, S32 y2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 char_height;
- S32 box_width, box_height;
- S32 img_box_width = 40, img_box_height = 40;
- S32 img_width, img_height;
- S32 img_draw_width, img_draw_height;
- S32 img_draw_offset_x, img_draw_offset_y;
- S32 spacing;
- S32 offset_x; /* For name and image offset x */
- S32 offset_y; /* For name and image offset y */
- S32 num_offset_y;
- S32 name_width;
- U16 store_index = 0;
- S8 *image_path = NULL;
- PHB_OPTIONAL_IDS_STRUCT *opt_ids;
- S8 buffer_UCS2[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- S32 i = -1;
- S32 inner_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- *lock and push clip
- */
- gui_lock_double_buffer();
- gui_push_text_clip();
- gui_push_clip();
- gui_reset_clip();
- gui_reset_text_clip();
- while (i < item_idx)
- {
- store_index = g_phb_name_index[inner_index];
- if (g_phb_cntx.name_list_filter == MMI_SIM)
- {
- if (store_index >= MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else if (g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- if(store_index < MAX_PB_PHONE_ENTRIES)
- {
- i++;
- }
- }
- else
- {
- i++;
- }
- inner_index++;
- }
- /*
- * Get hint text info
- */
- mmi_phb_convert_get_ucs2_number((S8*) buffer_UCS2, store_index);
- /*
- * Calcuate text position
- */
- box_height = y2 - y1 + 1;
- box_width = x2 - x1 + 1;
- gui_set_font(&MMI_medium_font);
- char_height = gui_get_string_height((UI_string_type) GetString(STR_ID_PHB_MOBILE_NUMBER));
- spacing = (box_height - char_height * 2) / 3;
- offset_y = spacing + MMI_title_height + MMI_title_y;
- num_offset_y = spacing * 2 + char_height + MMI_title_height + MMI_title_y;
- if (r2lMMIFlag) /* For right to left language */
- {
- offset_x = x2 - img_box_width - 6;
- }
- else
- {
- offset_x = x1 + img_box_width + 6;
- }
- name_width = box_width - img_box_width - 12;
- /*
- * Draw Hint Text
- */
- gui_set_font(&MMI_medium_font);
- gui_reset_text_clip();
- gui_set_text_color(gui_color(0, 0, 0));
- /*
- * Draw name/number if not empty
- */
- if (pfnUnicodeStrlen((S8*) PhoneBook[store_index].alpha_id.name))
- {
- gui_print_truncated_text(offset_x, offset_y, name_width, (UI_string_type) PhoneBook[store_index].alpha_id.name);
- if (pfnUnicodeStrlen((S8*) buffer_UCS2))
- {
- gui_print_truncated_text(offset_x, num_offset_y, name_width, (UI_string_type) buffer_UCS2);
- }
- }
- else
- {
- gui_print_truncated_text(offset_x, offset_y, name_width, (UI_string_type) buffer_UCS2);
- }
- /*
- * Get Associate Picture path from file
- */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- mmi_phb_read_optional_ids(store_index); /* i is store index */
- opt_ids = (PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids;
- if (opt_ids->pictureTagID == 1)
- {
- image_path = mmi_phb_image_get_path_from_id((U16) (store_index + 1));
- }
- }
- /*
- * Draw Associate Picture thumb image
- */
- gui_push_clip();
- if (r2lMMIFlag) /* For right to left language */
- {
- offset_x = x2 - img_box_width - 2;
- }
- else
- {
- offset_x = x1 + 2;
- }
- offset_y = y1 + 2;
- gui_set_clip(offset_x, offset_y, offset_x + img_box_width, offset_y + img_box_height);
- /* Get image from file */
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- gdi_image_draw_resized_id(offset_x, offset_y, img_box_width, img_box_height, IMG_ID_PHB_LIST_ICON1);
- }
- else
- #endif /* __USB_IN_NORMAL_MODE */
- {
- if ((image_path != NULL) && (gdi_image_get_dimension_file(image_path, &img_width, &img_height) >= 0))
- {
- gdi_util_fit_box(
- GDI_UTIL_MODE_NO_RESIZE_OR_LONG_SIDE_FIT,
- img_box_width,
- img_box_height,
- img_width,
- img_height,
- &img_draw_offset_x,
- &img_draw_offset_y,
- &img_draw_width,
- &img_draw_height);
- gdi_image_draw_resized_file(
- offset_x + img_draw_offset_x,
- offset_y + img_draw_offset_y,
- img_draw_width,
- img_draw_height,
- image_path);
- }
- else /* Use default image */
- {
- gdi_image_draw_resized_id(offset_x, offset_y, img_box_width, img_box_height, IMG_ID_PHB_LIST_ICON1);
- }
- }
- gui_pop_clip();
- /*
- * pop clip , unlock and blt
- */
- gui_pop_clip();
- gui_pop_text_clip();
- gui_unlock_double_buffer();
- gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_nlf_entry_image_list1
- * DESCRIPTION
- * This function list all phonebook entry with picture info on the top with
- * name list filter feature.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_nlf_entry_image_list1(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- * Check if it can be list in advance
- */
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- return;
- }
- else if (((g_phb_cntx.sim_used == 0) && (g_phb_cntx.name_list_filter == MMI_SIM)) || ((g_phb_cntx.phone_used == 0) && (g_phb_cntx.name_list_filter == MMI_NVRAM)) ||((PhoneBookEntryCount == 0) && (g_phb_cntx.name_list_filter == MMI_STORAGE_BOTH)))
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- return;
- }
- /*
- *Check if phonebook entry has been updated, and if need to use alpha_index function.
- */
- if (g_phb_cntx.refresh_list)
- {
- mmi_phb_list_build_alpha_index(NULL, 0, TRUE, MMI_STORAGE_NONE);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_NO_CHANGE;
- }
- EntryNewScreen(SCR_PBOOK_LIST, mmi_phb_exit_list, mmi_phb_nlf_entry_image_list1, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_LIST);
- #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__)
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
- }
- #endif /* defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__) */
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- RegisterHighlightHandler(mmi_phb_get_index_speak_name_nlf);
- #else
- RegisterHighlightHandler(mmi_phb_get_index_nlf);
- #endif
- if(g_phb_cntx.name_list_filter == MMI_SIM)
- {
- g_phb_list_index_total = g_phb_cntx.sim_used;
- }
- else if(g_phb_cntx.name_list_filter == MMI_NVRAM)
- {
- g_phb_list_index_total = g_phb_cntx.phone_used;
- }
- else
- {
- g_phb_list_index_total = PhoneBookEntryCount;
- }
- ShowCategory212Screen(
- STR_SCR_PBOOK_VIEW_CAPTION,
- IMG_SCR_PBOOK_CAPTION, /* Title */
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS, /* LSK */
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK, /* RSK */
- g_phb_list_index_total,
- mmi_phb_nlf_list_get_item,
- mmi_phb_list_get_null_hint,
- mmi_phb_nlf_image_list1_draw_title_info,
- NULL, /* No call back needed when change highlight */
- 2, /* Info box row count */
- 0, /* info bg image id */
- g_phb_cntx.highlight_entry, /* Highlight item index */
- (U8*) guiBuffer);
- register_multitap_no_draw_key_handlers();
- set_multitap_functions(mmi_phb_list_alpha_index, mmi_phb_list_alpha_index_input_callback);
- change_multitap_mode(0);
- SetLeftSoftkeyFunction(mmi_phb_entry_op_option, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_op_option, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- if (gInsertSimAppFlag != 1 && mmi_bootup_get_active_flight_mode() != 1)
- {
- SetKeyHandler(mmi_phb_choose_number_normal, KEY_SEND, KEY_EVENT_UP);
- #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WGUI_CSK_ENABLE__)
- SetCenterSoftkeyFunction(mmi_phb_choose_number_normal, KEY_EVENT_UP);
- #endif
- }
- }
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- #endif /* defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) */
- #define MMI_PHB_UTIL_OBSELETE
- U8 inPinyinSearchScreen = FALSE; /* For PinYin Search, Obselete Now */
- /*****************************************************************************
- * FUNCTION
- * PbookListSearchEntryReq
- * DESCRIPTION
- * Sends the request to stack to search for an entry based on the name entered by the user
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void PbookListSearchEntryReq(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- #endif /* _PHONEBOOKMAIN_C */