PhoneBookMain.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:216k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * PhoneBookMain.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for phonebook main function.
- * Including initialize procedure, main menu, common utilities, etc.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- * removed!
- * removed!
- *
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _PHONEBOOKMAIN_C
- #define _PHONEBOOKMAIN_C
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "GlobalConstants.h"
- #include "kal_trace.h" /* Debug Info */
- #include "DebugInitDef.h" /* Debug Info */
- #include "mmi_trc.h" /* Debug Info */
- #include "ProtocolEvents.h"
- #include "HistoryGprot.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "wgui_status_icons.h"
- #include "AllAppGprot.h"
- #include "PhonebookDef.h"
- #include "PhoneBookTypes.h"
- #include "PhonebookProt.h"
- #include "PhonebookGprot.h"
- #include "QueueGProt.h"
- #include "mainmenudef.h"
- #include "Unicodexdcl.h"
- #include "GlobalDefs.h"
- #include "TimerEvents.h"
- #include "IdleAppDef.h"
- #include "SpeedDial.h"
- #include "NVRAMProt.h"
- #include "NVRAMType.h"
- #include "NVRAMEnum.h"
- #include "IdleAppDef.h"
- #include "IdleAppProt.h"
- #include "CommonScreens.h"
- #include "SettingGprots.h"
- #include "gpioInc.h"
- #include "CommonScreens.h"
- #include "SettingDefs.h" /* For FDN on Message */
- #include "SettingsGdcl.h"
- #ifdef MMI_ON_HARDWARE_P
- #include "nvram_data_items.h"
- #endif
- #include "GSM7BitDefaultAlphabet.h"
- #include "statusiconres.h"
- #if defined(__MMI_PHB_UPDATE_CALL_LOG_AFTER_SAVE__) /* Update Call Log after save number */
- #include "CallHistoryGProts.h"
- #endif
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P)
- #include "wgui_categories_fmgr.h" /* For image list */
- #endif
- #ifdef __J2ME__
- #include "j2me_custom_option.h"
- #endif
- #if defined(SUPPORT_JSR_75_PIM) || defined(SUPPORT_CMCC)
- #include "PhoneBookJavaHandler.h"
- #endif
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- #include "ProfileGprots.h"
- #endif
- #include "CallManagementGprot.h"
- #if defined(__MMI_VRSI__)
- #include "Mdi_datatype.h"
- #include "VRSIEnum.h"
- #include "VRSIType.h"
- #include "VRSIProt.h"
- #endif /* defined(__MMI_VRSI__) */
- #if !defined(__MMI_KEYPADLOCK_WITH_KEYTONE__)
- #include "KeyBrd.h"
- #endif
- #include "PictureEditorDefs.h"
- #include "SimDetectionGprot.h"
- #ifdef __MMI_VOIP__
- #include "VoIPGProt.h"
- #endif
- #ifdef __SYNCML_SUPPORT__
- #include "SyncMLDef.h"
- #include "SyncMLGprot.h"
- #endif /* __SYNCML_SUPPORT__ */
- #ifdef __USB_IN_NORMAL_MODE__
- #include "USBDeviceGprot.h"
- #endif /* __USB_IN_NORMAL_MODE__ */
- /*
- * Local Variable
- */
- static PHB_OPTIONAL_IDS_STRUCT g_phb_optional_ids;
- static PHB_CALLER_GROUP_STRUCT g_phb_caller_group[MAX_PB_CALLER_GROUPS];
- #ifdef __MMI_PHB_USIM_FIELD__
- static MMI_PHB_NAME_STRUCT g_phb_usim_group[MAX_PB_USIM_GROUPS];
- #endif
- static U16 g_phb_message;
- static U16 g_phb_message_icon;
- static U16 g_phb_alpha_index_list[ALPHA_LIST_LENGTH];
- static U16 g_phb_highlight_alpha;
- #if defined(__MMI_VOIP__)
- static U8 phb_voip_number_index = 0xff;
- #endif
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- static U32 g_phb_list_index_total;
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- mmi_phb_context_struct g_phb_cntx;
- U16 PhoneBookEntryCount;
- #if (MAX_PB_ENTRIES)
- U16 g_phb_name_index[MAX_PB_ENTRIES]; /* Sorting Order by Name Field. */
- MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[MAX_PB_ENTRIES];
- #if (MAX_PB_ENTRIES >= 1000)
- U16 g_phb_list_filter[MAX_PB_ENTRIES];
- #endif /* MAX_PB_ENTRIES >= 1000 */
- #else /* (MAX_PB_ENTRIES) */
- U16 g_phb_name_index[1]; /* Sorting Order by Name Field. */
- MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[1];
- #endif /* (MAX_PB_ENTRIES) */
- #ifdef __MMI_PHB_USIM_FIELD__
- MMI_PHB_EMAIL_STRUCT phb_email[MAX_PB_SIM_ENTRIES];
- MMI_PHB_NUMBER_BCD_STRUCT phb_anr[MAX_PB_SIM_ENTRIES][3];
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) || defined(__MMI_PHB_USIM_FIELD__)
- PHB_OPTIONAL_FIELDS_STRUCT PhoneBookOptionalFields;
- #endif
- MMI_PHB_LOOKUP_NODE_STRUCT LookUpTable[MAX_LOOKUP_TABLE_COUNT];
- #ifdef __MTK_TARGET__
- __align(2)
- #endif
- S8 pbName[(MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH];
- #ifdef __MTK_TARGET__
- __align(2)
- #endif
- S8 pbNumber[(MAX_PB_NUMBER_LENGTH+1+1)*ENCODING_LENGTH];
- S8 pbHomeNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH]; /* ANRA */
- S8 pbCompanyName[(MAX_PB_COMPANY_LENGTH + 1) * ENCODING_LENGTH]; /* ANRB */
- S8 pbEmailAddress[(MAX_PB_EMAIL_LENGTH + 1) * ENCODING_LENGTH];
- S8 pbOfficeNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- S8 pbFaxNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH]; /* ANRC */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- S8 pbBday[12 * ENCODING_LENGTH]; /* Use for display total sstring, Format: xxxx/xx/xx */
- S8 pbDay[3 * ENCODING_LENGTH];
- S8 pbMon[3 * ENCODING_LENGTH];
- S8 pbYear[6 * ENCODING_LENGTH];
- #endif /* defined(__MMI_PHB_BIRTHDAY_FIELD__) */
- #if defined(__MMI_PHB_INFO_FIELD__)
- PHB_INFO_FIELDS_STRUCT PhoneBookInfoFields;
- S8 pbTitle[(MAX_PB_TITLE_LENGTH + 1) * ENCODING_LENGTH];
- S8 pbUrl[(MAX_PB_URL_LENGTH + 1) * ENCODING_LENGTH];
- S8 pbAddress[(MAX_PB_ADDRESS_LENGTH + 1) * ENCODING_LENGTH];
- S8 pbNote[(MAX_PB_NOTE_LENGTH + 1) * ENCODING_LENGTH];
- #endif /* defined(__MMI_PHB_INFO_FIELD__) */
- #if defined(__MMI_VOIP__)
- S8 PhoneBookVoipField[VOIP_URI_LEN];
- S8 pbVoip[(VOIP_URI_LEN) * ENCODING_LENGTH];
- #endif /* defined(__MMI_VOIP__) */
- #ifdef __MMI_PHB_USIM_FIELD__
- S8 pbNickName[(MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH];
- #endif
- U8 gPictureItemIndex = 10;
- U16 TitleStrings[MAX_PB_FIELDS];
- #ifdef __MMI_INTELLIGENT_CALL_ALERT__
- U8 g_phb_is_speaking_name = 0;
- #endif
- /*
- * Global Variable
- */
- extern MMI_PHB_LIST_VIEW phbListView;
- extern wgui_inline_item wgui_inline_items[];
- extern BOOL r2lMMIFlag; /* For right to left language */
- extern U8 gInsertSimAppFlag;
- extern U16 g_phb_read_index;
- extern BOOL g_phb_mass_op_success; /* for sim refresh */
- extern U16 g_phb_mass_op_count;
- extern U8 g_phb_enter_from;
- /*
- * Global Function
- */
- extern void MakeCall(PS8);
- extern void set_wgui_inline_list_menu_changed(void);
- #if defined(__IP_NUMBER__)
- extern void SetTempUseIPNumber(pBOOL flag);
- #endif
- #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__)
- static U8 g_phb_sim_check;
- extern kal_bool is_sim_replaced(void);
- #endif /* defined(__MMI_PHB_CALLERGROUP_IN_SIM__) */
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P)
- extern void Cat212ShortCutHdlr(S32 item_index); /* For Image List Fast Jump */
- #endif
- /*
- * Static Function
- */
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- static void mmi_phb_two_line_send_key_handler(void);
- #endif
- #ifdef __MMI_PHB_USIM_FIELD__
- static void mmi_phb_ind_startup_phase1_finish(void *info);
- static void mmi_phb_startup_anr_read_rsp(void *info);
- static void mmi_phb_startup_email_read_rsp(void *info);
- static void mmi_phb_startup_gas_read_rsp(void *info);
- static void mmi_phb_read_usim_field(U8 access_id);
- static void mmi_phb_read_usim_anr_field(void *info);
- static void mmi_phb_read_usim_email_field(void *info);
- static void mmi_phb_read_usim_gas_field(void *info);
- static void mmi_phb_read_usim_grp_field(void *info);
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #define MMI_PHB_INIT
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_protocol
- * DESCRIPTION
- * Initialize phonebook protocol handler. This should be call before L4 begin to read
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_protocol(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_init_protocol.>n", __FILE__, __LINE__));
- #ifdef __MMI_PHB_USIM_FIELD__
- SetProtocolEventHandler(mmi_phb_ind_startup_phase1_finish, PRT_PHB_STARTUP_PHASE1_FINISH_IND);
- SetProtocolEventHandler(mmi_phb_read_usim_anr_field, PRT_PHB_STARTUP_READ_ANR_IND);
- SetProtocolEventHandler(mmi_phb_read_usim_email_field, PRT_PHB_STARTUP_READ_EMAIL_IND);
- SetProtocolEventHandler(mmi_phb_read_usim_gas_field, PRT_PHB_STARTUP_READ_GAS_IND);
- SetProtocolEventHandler(mmi_phb_read_usim_grp_field, PRT_PHB_STARTUP_READ_GRP_IND);
- #endif /* __MMI_PHB_USIM_FIELD__ */
- SetProtocolEventHandler(mmi_phb_ind_startup_finish, PRT_PHB_STARTUP_FINISH_IND);
- #if defined(MMI_ON_HARDWARE_P)
- SetProtocolEventHandler(mmi_phb_ind_startup_begin, PRT_PHB_STARTUP_BEGIN_IND);
- SetProtocolEventHandler(mmi_phb_ind_startup_read, PRT_PHB_STARTUP_READ_IND);
- #endif /* defined(MMI_ON_HARDWARE_P) */
- #if defined(SUPPORT_JSR_75_PIM) || defined(SUPPORT_CMCC)
- mmi_phb_java_handler_init();
- #endif
- /* Initial Global Context. */
- g_phb_cntx.phb_ready = FALSE;
- g_phb_cntx.processing = FALSE;
- g_phb_cntx.nvram_data_init = FALSE;
- g_phb_cntx.optional_ids = &g_phb_optional_ids;
- g_phb_cntx.caller_group = &g_phb_caller_group[0];
- #ifdef __MMI_PHB_USIM_FIELD__
- g_phb_cntx.usim_group = &g_phb_usim_group[0];
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_NOT_READY;
- memset(g_phb_cntx.support_field, 0, MMI_PHB_USIM_FIELD_TOTAL);
- #endif /* __MMI_PHB_USIM_FIELD__ */
- g_phb_cntx.list_filter = NULL;
- g_phb_cntx.start_scr_id = 0;
- g_phb_cntx.end_scr_id = 0;
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
- g_phb_cntx.highlight_entry = 0;
- g_phb_cntx.new_highlight_entry = 0xffff;
- g_phb_cntx.populate_count = 0;
- g_phb_cntx.lookup_table_count = 0;
- g_phb_cntx.current_op = MMI_PHB_OP_NONE;
- g_phb_cntx.selected_pic_index = 0;
- g_phb_cntx.selected_ring_index = 0;
- g_phb_cntx.selected_grp_index = 0;
- g_phb_cntx.selected_pattern_index = 0;
- g_phb_cntx.selected_alert_index = 0;
- g_phb_cntx.selected_pic_in_view = 0;
- g_phb_cntx.image_location = MMI_PHB_IMAGE_NO_SELECT;
- g_phb_cntx.set_done_flag = 0;
- g_phb_cntx.dial_from_list = MMI_PHB_NONE;
- #if defined(__MMI_PHB_PINYIN_SORT__)
- g_phb_cntx.sort_type = MMI_PHB_SORT_PINYIN;
- #else
- g_phb_cntx.sort_type = MMI_PHB_SORT_ENCODING;
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init
- * DESCRIPTION
- * Initialize phonebook applications.
- * (This is used to initialize hilite/hint handlers and PS reponse callback functions)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_init.>n", __FILE__, __LINE__));
- mmi_phb_search_init();
- mmi_phb_operate_single_init();
- mmi_phb_operate_mass_init();
- mmi_phb_caller_group_init();
- mmi_phb_extra_number_init();
- mmi_phb_setting_init();
- PhbInitSpeedDial();
- mmi_phb_stubs_to_others_init();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_set_main_menu_highlight_handler
- * DESCRIPTION
- * Set phonebook main menu highlight handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_set_main_menu_highlight_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_set_main_menu_highlight_handler.>n",
- __FILE__, __LINE__));
- SetHiliteHandler(MITEM101_PBOOK_SEARCH_ENTRY, mmi_phb_highlight_search_name);
- #if defined(__MMI_PHB_QUICK_SEARCH__) || defined(MMI_ON_WIN32)
- SetHiliteHandler(MENU_ID_PHB_QUICK_SEARCH, mmi_phb_highlight_quick_search_list);
- #endif
- /* Add Entry */
- SetHiliteHandler(MITEM102_PBOOK_NEW_ENTRY, mmi_phb_highlight_op_add_entry);
- /* Copy All */
- SetHiliteHandler(MITEM104_PBOOK_COPY_ALL, mmi_phb_highlight_copy_all);
- /* Delete All */
- SetHiliteHandler(MITEM103_PBOOK_DELETE_ALL, mmi_phb_highlight_delete_all);
- SetHiliteHandler(MITEM109_PBOOK_CALLER_GROUPS, mmi_phb_highlight_callergroup);
- mmi_phb_extra_number_init();
- /* Settings */
- SetHiliteHandler(MITEM110_PBOOK_SETTINGS, mmi_phb_highlight_setting);
- SetHiliteHandler(MITEM1101_PBOOK_MEMORY_STATUS, mmi_phb_highlight_memory_status);
- SetHiliteHandler(MITEM1102_PBOOK_STORAGE_LOCATION, mmi_phb_highlight_storage_location);
- SetHiliteHandler(MITEM1103_PBOOK_VIEW_FIELDS, mmi_phb_highlight_view_field);
- SetHintHandler(MITEM1102_PBOOK_STORAGE_LOCATION, mmi_phb_hint_storage_location);
- SetHintHandler(MITEM_STORAGE_LOCATION_SIM, mmi_phb_hint_storage_location_in_sim);
- SetHintHandler(MITEM_STORAGE_LOCATION_PHONE, mmi_phb_hint_storage_location_in_phone);
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- SetHiliteHandler(MENU_ID_PHB_NAME_LIST_FILTER, mmi_phb_highlight_name_list_filter);
- SetHintHandler(MENU_ID_PHB_NAME_LIST_FILTER, mmi_phb_hint_name_list_filter);
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- /* My vCard */
- SetHiliteHandler(MENU_ID_PHB_VCARD_MYCARD, mmi_phb_highlight_vcard_mycard);
- SetHiliteHandler(MENU_ID_PHB_VCARD_EDIT_MYCARD, mmi_phb_highlight_vcard_edit_mycard);
- SetHiliteHandler(MENU_ID_PHB_VCARD_SEND_MYCARD, mmi_phb_highlight_vcard_send_mycard);
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- SetHiliteHandler(MENU_ID_PHB_SPEAK_NAME, mmi_phb_highlight_speak_name);
- SetHintHandler(MENU_ID_PHB_SPEAK_NAME, mmi_phb_hint_speak_name);
- #endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */
- /* Forward resource to phonebook entry */
- #if defined(__MMI_PHB_CALLER_RES_SETTING__)
- /* For submenu in phonebook */
- SetHiliteHandler(MENU_ID_PHB_CALLER_PIC, mmi_phb_highlight_caller_pic);
- SetHiliteHandler(MENU_ID_PHB_CALLER_RING, mmi_phb_highlight_caller_ring);
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- SetHiliteHandler(MENU_ID_PHB_CALLER_VIDEO, mmi_phb_highlight_caller_video);
- #endif
- #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */
- #if defined(__MMI_FILE_MANAGER__) && !defined(__MMI_FILE_MANAGER_HIDE_MENU__)
- /* Save Image From File Manager */
- SetHiliteHandler(MENU_ID_PHB_FMGR_SAVE_NEW, mmi_phb_highlight_fmgr_add_entry);
- SetHiliteHandler(MENU_ID_PHB_FMGR_SAVE_LIST, mmi_phb_highlight_fmgr_edit_entry);
- SetHiliteHandler(MENU_ID_PHB_FMGR_SAVE_CALLGRP, mmi_phb_highlight_edit_callergroup);
- #endif /* defined(__MMI_FILE_MANAGER__) && !defined(__MMI_FILE_MANAGER_HIDE_MENU__) */
- /* Done and Input Method */
- mmi_frm_set_highlight_handler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_startup_begin
- * DESCRIPTION
- * Initialize variables before L4 Phb start to read
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_startup_begin(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.phb_ready = FALSE;
- #ifdef __MMI_PHB_USIM_FIELD__
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_NOT_READY;
- #endif
- g_phb_cntx.sim_used = 0;
- g_phb_cntx.phone_used = 0;
- PhoneBookEntryCount = 0;
- g_phb_cntx.lookup_table_count = 0;
- g_phb_cntx.populate_count = 0;
- g_phb_cntx.current_op = MMI_PHB_OP_NONE;
- #if defined(__MMI_VRSI__)
- /* Phonebook reload so need reset VR. After sorting done, add phonebook entry again. */
- mmi_vrsi_init_central_reset();
- #endif /* defined(__MMI_VRSI__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sat_handler
- * DESCRIPTION
- * Handler sim refresh cmd
- * PARAMETERS
- * reset_adn [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sat_handler(BOOL reset_adn)
- {
- g_phb_cntx.phb_ready = FALSE;
- #ifdef __MMI_PHB_USIM_FIELD__
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_NOT_READY;
- #endif
- if (reset_adn)
- {
- g_phb_cntx.sim_used = 0;
- g_phb_cntx.phone_used = 0;
- PhoneBookEntryCount = 0;
- }
- g_phb_cntx.lookup_table_count = 0;
- g_phb_cntx.populate_count = 0;
- #if defined(__MMI_VRSI__)
- /* Phonebook reload so need reset VR. After sorting done, add phonebook entry again. */
- mmi_vrsi_init_central_reset();
- #endif /* defined(__MMI_VRSI__) */
- if (g_phb_cntx.processing)
- {
- S8 outBuf[100], count[10];
- g_phb_cntx.processing = FALSE;
- TurnOnBacklight(1); /* Turn On Back Light When done */
- DeleteScreenIfPresent(SCR_IN_PROGRESS_PHB);
- if (g_phb_cntx.copy_all)
- {
- g_phb_cntx.copy_all = FALSE;
- /* Display result for !g_phb_mass_op_success */
- g_phb_mass_op_success = TRUE;
- sprintf(count, "%d ", g_phb_mass_op_count);
- AnsiiToUnicodeString(outBuf, count);
- pfnUnicodeStrcat(outBuf, GetString(STR_ENTRIES_COPIED));
- DisplayPopup((PU8) outBuf, IMG_GLOBAL_UNFINISHED, TRUE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- /* Solve Copying Screen Hang Problem */
- DeleteScreenIfPresent(SCR_COPY_ALL_PROGRESS);
- }
- else
- {
- /* Display result for !g_phb_mass_op_success */
- g_phb_mass_op_success = TRUE;
- sprintf(count, "%d ", g_phb_mass_op_count);
- AnsiiToUnicodeString(outBuf, count);
- pfnUnicodeStrcat(outBuf, GetString(STR_ID_PHB_ENTRIES_DELETED));
- DisplayPopup((U8*) outBuf, IMG_GLOBAL_UNFINISHED, TRUE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- /* Solve Copying Screen Hang Problem */
- DeleteScreenIfPresent(SCR_COPY_ALL_PROGRESS);
- /* Re-add all central command for vrsi. */
- #if defined(__MMI_VRSI__)
- mmi_vrsi_init_central_abort();
- /* Also remove SD tag if entry is deleted. */
- #if defined(__MMI_VRSI_TRAIN_TAG__)
- mmi_vrsi_ndial_central_update_sd_mapping();
- #endif
- #endif /* defined(__MMI_VRSI__) */
- }
- }
- else if (g_phb_cntx.current_op == MMI_PHB_OP_ADD)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- mmi_phb_clear_old_add_history();
- }
- else if (g_phb_cntx.current_op == MMI_PHB_OP_EDIT)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- ERROR_TONE);
- mmi_phb_clear_old_edit_history();
- }
- g_phb_enter_from = MMI_PHB_ENTER_NONE;
- /* copyEntry = duplicateEntry = moveEntry = FALSE;*/
- g_phb_cntx.current_op = MMI_PHB_NONE;
- }
- #ifdef __MMI_INTELLIGENT_CALL_ALERT__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_speak_name_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_speak_name_handler(mdi_result result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_is_speaking_name = 0;
- }
- #endif /* __MMI_INTELLIGENT_CALL_ALERT__ */
- #if defined(MMI_ON_HARDWARE_P)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_startup_read_entry
- * DESCRIPTION
- * This function set the read indication data from L4 Phb at bootup time.
- * Stores each indication to the global phonebook list.
- * PARAMETERS
- * phb_entry [IN]
- * store_index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_startup_read_entry(l4c_phb_bcd_entry_struct phb_entry, U16 store_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 num_ascii[MAX_PB_NUMBER_LENGTH + 1 + 1];
- U8 bcd_length = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Name Field */
- PhoneBook[store_index].alpha_id.name_length = phb_entry.alpha_id.name_length;
- PhoneBook[store_index].alpha_id.name_dcs = phb_entry.alpha_id.name_dcs;
- if (PhoneBook[store_index].alpha_id.name_length == 0
- || (phb_entry.alpha_id.name[0] == 0xff && phb_entry.alpha_id.name[1] == 0xff))
- {
- memset(PhoneBook[store_index].alpha_id.name, 0, 2);
- }
- else
- {
- InputboxConvertGSMToDeviceEncoding(
- phb_entry.alpha_id.name,
- PhoneBook[store_index].alpha_id.name,
- phb_entry.alpha_id.name_length,
- (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH,
- phb_entry.alpha_id.name_dcs,
- 0,
- 1);
- }
- #if defined(__PHB_0x81_SUPPORT__) /* Support maximum length of 0x81 UCS2 */
- if (PhoneBook[store_index].alpha_id.name_dcs == MMI_PHB_UCS2_81 ||
- PhoneBook[store_index].alpha_id.name_dcs == MMI_PHB_UCS2_82)
- {
- PhoneBook[store_index].alpha_id.name_dcs = MMI_PHB_UCS2;
- }
- #endif /* defined(__PHB_0x81_SUPPORT__) */
- #if defined(__MMI_PHB_PINYIN_SORT__)
- mmi_phb_util_make_pinyin_cache(store_index);
- #endif
- /* Number Field
- For L4 phb struct, the first byte of addr_bcd is TON, and the rest are BCD numbers.
- And the length is the total byte of TON + BCD numbers. */
- PhoneBook[store_index].tel.type = phb_entry.tel.addr_bcd[0];
- if (phb_entry.tel.addr_length > 0)
- {
- bcd_length =
- ((phb_entry.tel.addr_length - 1) <
- ((MAX_PB_NUMBER_LENGTH + 1) / 2)) ? (phb_entry.tel.addr_length - 1) : ((MAX_PB_NUMBER_LENGTH + 1) / 2);
- }
- if (bcd_length > 0)
- {
- /* strncpy((S8*)PhoneBook[store_index].tel.number, (S8*)(LocalPtr->phb_entry.tel.addr_bcd+1), (MAX_PB_NUMBER_LENGTH + 1) / 2); */
- memset(PhoneBook[store_index].tel.number, 0xff, ((MAX_PB_NUMBER_LENGTH + 1) / 2));
- memcpy(PhoneBook[store_index].tel.number, (phb_entry.tel.addr_bcd + 1), bcd_length);
- }
- else
- {
- PhoneBook[store_index].tel.number[0] = 0xff;
- }
- mmi_phb_convert_to_digit(num_ascii, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- PhoneBook[store_index].tel.length = strlen((S8*) num_ascii);
- /* Update flag for number exists entry, Clear it first. */
- PhoneBook[store_index].field = 0;
- if ((PhoneBook[store_index].tel.number[0] & 0x0f) != 0x0f)
- {
- PhoneBook[store_index].field |= MMI_PHB_ENTRY_FIELD_NUMBER;
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* No matter sim or usim */
- {
- phb_anr[store_index - MAX_PB_PHONE_ENTRIES][0].number[0] = 0xff;
- phb_anr[store_index - MAX_PB_PHONE_ENTRIES][1].number[0] = 0xff;
- phb_anr[store_index - MAX_PB_PHONE_ENTRIES][2].number[0] = 0xff;
- memset(phb_email[store_index - MAX_PB_PHONE_ENTRIES].email_address, 0, 2);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- g_phb_name_index[PhoneBookEntryCount] = store_index;
- PhoneBookEntryCount++;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_startup_read
- * DESCRIPTION
- * This function receives the read indication from L4 Phb at bootup time.
- * Stores each indication to the global phonebook list.
- * PARAMETERS
- * info [IN] Indication from L4 PHB
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_startup_read(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_IND_STRUCT *LocalPtr;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- LocalPtr = (MSG_PHB_STARTUP_READ_IND_STRUCT*) info;
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "record_index: [%d] storage: [%d] n",
- LocalPtr->phb_entries[0].phb_entry[0].record_index,
- LocalPtr->phb_entries[0].phb_entry[0].storage));
- /* Send read confirm messaeg back to L4 */
- mmi_phb_ind_startup_read_next_req(LocalPtr->access_id);
- /* Parse and save data from indication */
- if (LocalPtr->phb_entries[0].phb_entry[0].storage == MMI_SIM)
- {
- g_phb_cntx.sim_used++;
- store_index = LocalPtr->phb_entries[0].phb_entry[0].record_index + MAX_PB_PHONE_ENTRIES - 1; /* Storage Location in array. */
- MMI_ASSERT((g_phb_cntx.sim_used <= MAX_PB_SIM_ENTRIES) && (store_index < MAX_PB_ENTRIES));
- mmi_phb_startup_read_entry(LocalPtr->phb_entries[0].phb_entry[0], store_index);
- }
- else /* NVRAM has multiple-read */
- {
- int i;
- for (i = 0; i < LocalPtr->phb_entries[0].num_of_entry; i++)
- {
- g_phb_cntx.phone_used++;
- store_index = LocalPtr->phb_entries[0].phb_entry[i].record_index - 1; /* Storage Location in array. */
- MMI_ASSERT((g_phb_cntx.phone_used <= MAX_PB_PHONE_ENTRIES) && (store_index < MAX_PB_PHONE_ENTRIES));
- mmi_phb_startup_read_entry(LocalPtr->phb_entries[0].phb_entry[i], store_index);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_startup_read_next_req
- * DESCRIPTION
- * This function receives the read indication from L4 Phb at bootup time.
- * and send confirm to L4 to read next entry.
- * PARAMETERS
- * access_id [IN]
- * info(?) [IN] Indication from L4 PHB
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_startup_read_next_req(U8 access_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_NEXT_REQ_STRUCT *myMsgPtr;
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr =
- (MSG_PHB_STARTUP_READ_NEXT_REQ_STRUCT*) OslConstructDataPtr(sizeof(MSG_PHB_STARTUP_READ_NEXT_REQ_STRUCT));
- myMsgPtr->access_id = access_id;
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_PHB_STARTUP_READ_NEXT_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- #endif /* defined(MMI_ON_HARDWARE_P) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_startup_finish
- * DESCRIPTION
- * Reads the Phonebook ready indication from PS and prepare to sort.
- * PARAMETERS
- * info [IN] Finish indication
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_startup_finish(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_FINISH_IND_STRUCT *localPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_ind_startup_finish.>n", __FILE__,
- __LINE__));
- localPtr = (MSG_PHB_STARTUP_FINISH_IND_STRUCT*) info;
- #ifdef __MMI_PHB_USIM_FIELD__
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_READY;
- if (!g_phb_cntx.is_usim)
- #endif /* __MMI_PHB_USIM_FIELD__ */
- {
- g_phb_cntx.sim_name_len = localPtr->phb_len;
- g_phb_cntx.fdn_name_len = localPtr->fdn_len;
- g_phb_cntx.bdn_name_len = localPtr->bdn_len;
- g_phb_cntx.owner_name_len = localPtr->owner_len;
- g_phb_cntx.sim_total = localPtr->sim_max_num;
- g_phb_cntx.phone_total = localPtr->phb_max_num;
- if (g_phb_cntx.sim_total > MAX_PB_SIM_ENTRIES)
- {
- g_phb_cntx.sim_total = MAX_PB_SIM_ENTRIES;
- }
- if (g_phb_cntx.phone_total > MAX_PB_PHONE_ENTRIES)
- {
- g_phb_cntx.phone_total = MAX_PB_PHONE_ENTRIES; /* This two values should be the same */
- }
- if (!g_phb_cntx.nvram_data_init)
- {
- mmi_phb_init_get_data_from_nvram();
- g_phb_cntx.nvram_data_init = TRUE;
- }
- #if defined(MMI_ON_HARDWARE_P)
- /* Sort name list */
- mmi_phb_sort_build_name_index();
- /*
- * Use SIM storage buffer to store FDN list when FDN is enable.
- * Because when FDN is enable, the ADN entry cannot be retrieved from SIM card.
- * This list is for incoming call lookup name usage.
- *
- * Note: Be sure to retrieve speed dial number after retrieve FDN list.
- */
- if (gSecuritySetupContext.FdlStatus)
- {
- mmi_phb_fdn_get_list_to_ram();
- }
- /*
- * Get Speed Dial Info. If FDN on, get speed dial info after FDN list retrieved.
- * Because they all use same message.
- */
- else
- {
- if (gInsertSimAppFlag == 1)
- {
- g_phb_cntx.phb_ready = TRUE;
- mmi_phb_init_build_lookup_table();
- }
- else
- {
- PhbGetSpeedDialInfo();
- }
- }
- #else /* defined(MMI_ON_HARDWARE_P) */
- mmi_phb_init_refresh_phonebook();
- #endif /* defined(MMI_ON_HARDWARE_P) */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_get_data_from_nvram
- * DESCRIPTION
- * Retrieves the phonebook data like, Caller Group details, view fields,
- * preferred storage, etc from NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_get_data_from_nvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i;
- S16 pError;
- U16 tempStorageLocation; /* Temp Solution For Read/Write 2 bytes NVRAM_PHB_STORAGE_LOCATION */
- U16 tempNameListFilter;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- U8 viewField[NVRAM_PHB_SETTINGS_SIZE];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- ReadRecord(NVRAM_EF_PHB_SETTINGS_LID, 1, viewField, NVRAM_PHB_SETTINGS_SIZE, &pError);
- memcpy(g_phb_cntx.view_field, viewField, MAX_PB_VIEW_FIELDS);
- ReadValue(NVRAM_PHB_STORAGE_LOCATION, &tempStorageLocation, DS_SHORT, &pError); /* 2 bytes for DS_SHORT */
- g_phb_cntx.prefer_storage = (U8) tempStorageLocation;
- ReadValue(NVRAM_PHB_NAME_LIST_FILTER, &tempNameListFilter, DS_SHORT, &pError); /* 2 bytes for DS_SHORT */
- g_phb_cntx.name_list_filter = (U8) tempNameListFilter;
- ReadRecord(NVRAM_EF_PHB_CALLER_GROUPS_LID, 1, callerGroups, CALLER_GROUPS_RECORD_SIZE, &pError);
- if (g_phb_cntx.prefer_storage != MMI_SIM && g_phb_cntx.prefer_storage != MMI_NVRAM)
- {
- g_phb_cntx.prefer_storage = MMI_SIM;
- tempStorageLocation = g_phb_cntx.prefer_storage;
- WriteValue(NVRAM_PHB_STORAGE_LOCATION, &tempStorageLocation, DS_SHORT, &pError); /* 2 bytes for DS_SHORT */
- }
- if ((g_phb_cntx.name_list_filter != MMI_SIM) && (g_phb_cntx.name_list_filter != MMI_NVRAM) && (g_phb_cntx.name_list_filter != MMI_STORAGE_BOTH))
- {
- g_phb_cntx.name_list_filter = MMI_STORAGE_BOTH;
- tempNameListFilter = g_phb_cntx.name_list_filter;
- WriteValue(NVRAM_PHB_NAME_LIST_FILTER, &tempNameListFilter, DS_SHORT, &pError); /* 2 bytes for DS_SHORT */
- }
- /* No alert or LED seting in caller group. */
- for (i = 0; i < MAX_PB_CALLER_GROUPS; ++i)
- {
- #if defined(__MMI_CALLERGROUP_NO_ALERT__)
- callerGroups[i].alertType = MMI_ALERT_NONE;
- #endif
- #if !defined(__MMI_STATUS_LED__)
- callerGroups[i].LEDPatternId = 0;
- #endif
- }
- /* Should never go into this section in normal situation */
- #if !defined(MMI_ON_HARDWARE_P)
- if (callerGroups[0].ringToneID == 0xFFFF)
- {
- mmi_phb_callergroup_restore_default();
- }
- #endif /* !defined(MMI_ON_HARDWARE_P) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_build_lookup_table
- * DESCRIPTION
- * This function builds the lookup table for cross-referencing during MO/MT calls.
- * This table contains the home/mobile/fax/office number(s) of a phonebook entry.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_build_lookup_table(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count, store_index;
- U8 num_ascii[MAX_PB_NUMBER_LENGTH + 1 + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- count = 0;
- /* Read compare length from NVRAM */
- mmi_phb_util_read_compare_length();
- while (count < PhoneBookEntryCount)
- {
- store_index = g_phb_name_index[count];
- /* Populate Mobile Number Field. Either in SIM or in NVRAM */
- mmi_phb_convert_to_digit(num_ascii, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- mmi_phb_op_increase_lookup_table(store_index, (S8*) num_ascii, NULL, NULL, NULL);
- count++;
- }
- #if defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- mmi_phb_lookup_table_sort();
- #else /* defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- /* Start a timer to avoid extensive NVRAM access which may cause MMI hang shortly */
- /* mmi_phb_init_populate_lookup_table(); */
- StartTimer(PHB_READ_OPT_FILED_TIMER, 500, mmi_phb_init_populate_lookup_table);
- #endif /* defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- }
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_the_nearest_index
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- *
- *****************************************************************************/
- static U16 mmi_phb_get_the_nearest_index(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nearest_index = MAX_PB_PHONE_ENTRIES;
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (count < PhoneBookEntryCount)
- {
- if ((g_phb_name_index[count] < nearest_index) && (g_phb_name_index[count] >= index))
- {
- nearest_index = g_phb_name_index[count];
- }
- count++;
- }
- return nearest_index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_field_need_populate
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- *
- *****************************************************************************/
- static BOOL mmi_phb_field_need_populate(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* U16 nearest_index = MAX_PB_PHONE_ENTRIES; */
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (count < PhoneBookEntryCount)
- {
- if (g_phb_name_index[count] == index)
- {
- return TRUE;
- }
- count++;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_populate_lookup_table
- * DESCRIPTION
- * This function populates the lookup table with home/fax/mobile/office numbers after
- * converting the last 7(or 9) characters of the phone number into digits.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_populate_lookup_table(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count = 0;
- S16 pError;
- U16 max_rec_amount = 2000 / OPTIONAL_FIELDS_RECORD_SIZE; /* 8 */
- void *p_data = OslMalloc((U16) (OPTIONAL_FIELDS_RECORD_SIZE * max_rec_amount));
- U16 processed_index = g_phb_cntx.populate_count;
- U16 read_rec_amount = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_PopulateLookUpTable_BEGIN, g_phb_cntx.populate_count));
- if (!p_data)
- {
- max_rec_amount = max_rec_amount / 2;
- p_data = OslMalloc((U16) (OPTIONAL_FIELDS_RECORD_SIZE * max_rec_amount));
- }
- /* Populate Optional Number Field. Only Populate record in NVRAM */
- while ((processed_index = mmi_phb_get_the_nearest_index(processed_index)) < MAX_PB_PHONE_ENTRIES)
- {
- U8 multi_record_index;
- #ifdef MMI_ON_HARDWARE_P
- if ((MAX_PB_PHONE_ENTRIES - processed_index) < max_rec_amount)
- {
- read_rec_amount = (MAX_PB_PHONE_ENTRIES - processed_index);
- }
- else
- {
- read_rec_amount = max_rec_amount;
- }
- ReadMultiRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (processed_index + 1),
- p_data,
- (U16) (OPTIONAL_FIELDS_RECORD_SIZE * read_rec_amount),
- read_rec_amount,
- &pError);
- #else /* MMI_ON_HARDWARE_P */
- read_rec_amount = 1;
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (processed_index + 1),
- p_data,
- (U16) (OPTIONAL_FIELDS_RECORD_SIZE * max_rec_amount),
- &pError);
- #endif /* MMI_ON_HARDWARE_P */
- count++;
- for (multi_record_index = 0; multi_record_index < read_rec_amount; multi_record_index++)
- {
- if (multi_record_index == 0 || mmi_phb_field_need_populate(processed_index))
- {
- memcpy(
- &PhoneBookOptionalFields,
- ((U8*) p_data) + (multi_record_index * OPTIONAL_FIELDS_RECORD_SIZE),
- OPTIONAL_FIELDS_RECORD_SIZE);
- mmi_phb_op_increase_lookup_table(
- processed_index,
- NULL,
- (S8*) PhoneBookOptionalFields.faxNumber,
- (S8*) PhoneBookOptionalFields.homeNumber,
- (S8*) PhoneBookOptionalFields.officeNumber);
- /* Update if phonebook column exists flag. */
- mmi_phb_op_update_field_flag(
- processed_index,
- NULL,
- (S8*) PhoneBookOptionalFields.homeNumber,
- (S8*) PhoneBookOptionalFields.officeNumber,
- (S8*) PhoneBookOptionalFields.faxNumber,
- (S8*) PhoneBookOptionalFields.emailAddress,
- FALSE);
- }
- processed_index++;
- }
- if ((count % 10) == 0) /* Populate at least 10 entries each time */
- {
- break;
- }
- }
- OslMfree(p_data);
- g_phb_cntx.populate_count = processed_index;
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_PopulateLookUpTable_END, g_phb_cntx.populate_count));
- if (processed_index < MAX_PB_PHONE_ENTRIES) /* More entries to populate */
- {
- StopTimer(PHB_READ_OPT_FILED_TIMER);
- StartTimer(PHB_READ_OPT_FILED_TIMER, 250, mmi_phb_init_populate_lookup_table);
- }
- else /* All entries populated, begin to sort it. */
- {
- mmi_phb_lookup_table_sort();
- }
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- #ifdef __MMI_PHB_USIM_FIELD__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_startup_phase1_finish
- * DESCRIPTION
- * Reads the Phonebook ready indication from PS and prepare to sort.
- * PARAMETERS
- * info [IN] Finish indication
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_ind_startup_phase1_finish(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_FINISH_PHASE1_IND_STRUCT *localPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_ind_startup_phase1_finish.>n", __FILE__,
- __LINE__));
- localPtr = (MSG_PHB_STARTUP_FINISH_PHASE1_IND_STRUCT*) info;
- g_phb_cntx.is_usim = TRUE; /* since only usim have this indicator */
- g_phb_cntx.sim_name_len = localPtr->phb_len;
- g_phb_cntx.fdn_name_len = localPtr->fdn_len;
- g_phb_cntx.bdn_name_len = localPtr->bdn_len;
- g_phb_cntx.owner_name_len = localPtr->owner_len;
- g_phb_cntx.sim_total = localPtr->sim_max_num;
- g_phb_cntx.phone_total = localPtr->phb_max_num;
- if (g_phb_cntx.sim_total > MAX_PB_SIM_ENTRIES)
- {
- g_phb_cntx.sim_total = MAX_PB_SIM_ENTRIES;
- }
- if (g_phb_cntx.phone_total > MAX_PB_PHONE_ENTRIES)
- {
- g_phb_cntx.phone_total = MAX_PB_PHONE_ENTRIES; /* This two values should be the same */
- }
- if (localPtr->is_group_support)
- {
- g_phb_cntx.support_field[MMI_PHB_USIM_FIELD_GROUP] = 1;
- if (localPtr->group_max_num > MAX_PB_USIM_GROUPS)
- {
- g_phb_cntx.gas_total = MAX_PB_USIM_GROUPS;
- }
- else
- {
- g_phb_cntx.gas_total = localPtr->group_max_num;
- }
- if (localPtr->group_len > MAX_GRP_NAME_LENGTH)
- {
- g_phb_cntx.group_name_len = MAX_GRP_NAME_LENGTH;
- }
- else
- {
- g_phb_cntx.group_name_len = localPtr->group_len;
- }
- }
- if (localPtr->anra_support_type > 0)
- {
- g_phb_cntx.support_field[MMI_PHB_USIM_FIELD_ANRA] = 1;
- }
- if (localPtr->anrb_support_type > 0)
- {
- }
- if (localPtr->anrc_support_type > 0)
- {
- }
- if (localPtr->email_support_type > 0)
- {
- g_phb_cntx.support_field[MMI_PHB_USIM_FIELD_EMAIL] = 1;
- g_phb_cntx.email_total = localPtr->email_max_num;
- g_phb_cntx.email_length = localPtr->email_len;
- }
- if (!g_phb_cntx.nvram_data_init)
- {
- mmi_phb_init_get_data_from_nvram();
- g_phb_cntx.nvram_data_init = TRUE;
- }
- #if defined(MMI_ON_HARDWARE_P)
- /* Sort name list */
- mmi_phb_sort_build_name_index();
- /*
- * Use SIM storage buffer to store FDN list when FDN is enable.
- * Because when FDN is enable, the ADN entry cannot be retrieved from SIM card.
- * This list is for incoming call lookup name usage.
- *
- * Note: Be sure to retrieve speed dial number after retrieve FDN list.
- */
- if (gSecuritySetupContext.FdlStatus)
- {
- mmi_phb_fdn_get_list_to_ram();
- }
- /*
- * Get Speed Dial Info. If FDN on, get speed dial info after FDN list retrieved.
- * Because they all use same message.
- */
- else
- {
- if (gInsertSimAppFlag == 1 || mmi_bootup_get_active_flight_mode() == 1)
- {
- g_phb_cntx.phb_ready = TRUE;
- mmi_phb_init_build_lookup_table();
- }
- else
- {
- PhbGetSpeedDialInfo();
- }
- /* After sorting done, init vrsi engine to add phonebook data. */
- #if defined(__MMI_VRSI__)
- mmi_vrsi_init_central_reset();
- /* mmi_vrsi_init_central_add_all(); */
- #endif /* defined(__MMI_VRSI__) */
- }
- #else /* defined(MMI_ON_HARDWARE_P) */
- mmi_phb_init_refresh_phonebook();
- #endif /* defined(MMI_ON_HARDWARE_P) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_read_usim_anr_field
- * DESCRIPTION
- * This function reads the anr field in usim card.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_read_usim_anr_field(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_phb_cntx.is_usim)
- {
- ASSERT(0);
- return;
- }
- if (g_phb_cntx.usim_ready_stage < MMI_PHB_USIM_READY_ANR)
- {
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_READY_ANR;
- }
- SetProtocolEventHandler(mmi_phb_startup_anr_read_rsp, PRT_PHB_STARTUP_READ_ANR_IND);
- mmi_phb_startup_anr_read_rsp(info);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_read_usim_email_field
- * DESCRIPTION
- * This function reads the email field in usim card.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_read_usim_email_field(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_phb_cntx.is_usim)
- {
- ASSERT(0);
- return;
- }
- if (g_phb_cntx.usim_ready_stage < MMI_PHB_USIM_READY_EMAIL)
- {
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_READY_EMAIL;
- }
- SetProtocolEventHandler(mmi_phb_startup_email_read_rsp, PRT_PHB_STARTUP_READ_EMAIL_IND);
- mmi_phb_startup_email_read_rsp(info);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_read_usim_gas_field
- * DESCRIPTION
- * This function reads the gas field in usim card.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_read_usim_gas_field(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_phb_cntx.is_usim)
- {
- ASSERT(0);
- return;
- }
- if (g_phb_cntx.usim_ready_stage < MMI_PHB_USIM_READY_GAS)
- {
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_READY_GAS;
- }
- SetProtocolEventHandler(mmi_phb_startup_gas_read_rsp, PRT_PHB_STARTUP_READ_GAS_IND);
- mmi_phb_startup_gas_read_rsp(info);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_read_usim_grp_field
- * DESCRIPTION
- * This function reads the gas field in usim card.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_read_usim_grp_field(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_GRP_IND_STRUCT *localPtr;
- U8 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_read_usim_grp_field.>n", __FILE__,
- __LINE__));
- if (!g_phb_cntx.is_usim)
- {
- ASSERT(0);
- return;
- }
- if (g_phb_cntx.usim_ready_stage < MMI_PHB_USIM_READY_GRP)
- {
- g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_READY_GRP;
- }
- localPtr = (MSG_PHB_STARTUP_READ_GRP_IND_STRUCT*) info;
- for (i = 0; i < g_phb_cntx.sim_total; i++)
- {
- if (localPtr->grp[i] > MAX_PB_USIM_GROUPS)
- {
- g_phb_cntx.group_type[i] = 0;
- }
- else
- {
- g_phb_cntx.group_type[i] = localPtr->grp[i];
- }
- }
- //memcpy(g_phb_cntx.group_type, (localPtr->grp), MAX_PB_SIM_ENTRIES);
- //read next usim field or finish;
- mmi_phb_read_usim_field(localPtr->access_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_read_usim_field
- * DESCRIPTION
- * Sends the L4 request to read usim email field
- * PARAMETERS
- * access_id [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_read_usim_field(U8 access_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_NEXT_USIM_FIELD_REQ_STRUCT *myMsgPtr;
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_read_email_req.>n", __FILE__, __LINE__));
- myMsgPtr = (MSG_PHB_STARTUP_READ_NEXT_USIM_FIELD_REQ_STRUCT*)
- OslConstructDataPtr(sizeof(MSG_PHB_STARTUP_READ_NEXT_USIM_FIELD_REQ_STRUCT));
- myMsgPtr->access_id = access_id;
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_PHB_STARTUP_READ_NEXT_USIM_FIELD_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_startup_gas_read_rsp
- * DESCRIPTION
- * Handle the L4 response for reading the usim gas field
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_startup_gas_read_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_GAS_IND_STRUCT *localPtr;
- U8 i;
- MMI_PHB_NAME_STRUCT *usim_group = (MMI_PHB_NAME_STRUCT*) g_phb_cntx.usim_group;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_startup_read_gas_rsp.>n", __FILE__,
- __LINE__));
- localPtr = (MSG_PHB_STARTUP_READ_GAS_IND_STRUCT*) info;
- for (i = 0; i < localPtr->num_of_entry; ++i)
- {
- if (g_phb_read_index <= MAX_PB_USIM_GROUPS)
- {
- g_phb_read_index = localPtr->gas_entry[i].record_index;
- usim_group[g_phb_read_index - 1].name_length = localPtr->gas_entry[i].alpha_id.name_length;
- usim_group[g_phb_read_index - 1].name_dcs = localPtr->gas_entry[i].alpha_id.name_dcs;
- InputboxConvertGSMToDeviceEncoding(
- localPtr->gas_entry[i].alpha_id.name,
- usim_group[g_phb_read_index - 1].name,
- localPtr->gas_entry[i].alpha_id.name_length,
- (MAX_GRP_NAME_LENGTH + 1) * ENCODING_LENGTH,
- localPtr->gas_entry[i].alpha_id.name_dcs,
- 0,
- 1);
- }
- }
- /* read next usim field or finish */
- mmi_phb_read_usim_field(localPtr->access_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_startup_email_read_rsp
- * DESCRIPTION
- * Handle the L4 response for reading the usim email field
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_startup_email_read_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_EMAIL_IND_STRUCT *localPtr;
- U16 i;
- U16 store_index;
- U16 index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_startup_email_read_rsp.>n", __FILE__,
- __LINE__));
- localPtr = (MSG_PHB_STARTUP_READ_EMAIL_IND_STRUCT*) info;
- for (i = 0; i < localPtr->num_of_entry; ++i)
- {
- //if (g_phb_cntx.email_used < g_phb_cntx.email_total)
- //{
- store_index = localPtr->email_entry[i].adn_record_index + MAX_PB_PHONE_ENTRIES - 1;
- index = localPtr->email_entry[i].adn_record_index - 1;
- /* PhoneBook[store_index].usim_field |= MMI_PHB_ENTRY_FIELD_EMAIL; */
- PhoneBook[store_index].field |= MMI_PHB_ENTRY_FIELD_EMAIL;
- g_phb_cntx.email_used++;
- /* Email Field */
- phb_email[index].email_length = localPtr->email_entry[i].email_length;
- if (phb_email[index].email_length == 0)
- {
- memset(phb_email[index].email_address, 0, 2);
- }
- else
- {
- ConvertGSM7BitDefaultEncodingToAscii(
- phb_email[index].email_address,
- localPtr->email_entry[i].email_address,
- localPtr->email_entry[i].email_length,
- (U16*) & (localPtr->email_entry[i].email_length));
- }
- //}
- //else
- //{
- // break;
- //}
- }
- /* read next usim field or finish */
- mmi_phb_read_usim_field(localPtr->access_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_startup_anr_read_rsp
- * DESCRIPTION
- * Handle the L4 response for reading the usim anr field
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_startup_anr_read_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_STARTUP_READ_ANR_IND_STRUCT *local_ptr;
- U16 i = 0;
- U16 store_index;
- U8 num_ascii[MAX_PB_NUMBER_LENGTH + 1 + 1];
- U8 bcd_length = 0;
- U8 type_of_anr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_startup_email_read_rsp.>n", __FILE__,
- __LINE__));
- local_ptr = (MSG_PHB_STARTUP_READ_ANR_IND_STRUCT*) info;
- type_of_anr = local_ptr->anr_entry[i].anr_type;
- for (i = 0; i < local_ptr->num_of_entry; ++i)
- {
- /* if (g_phb_cntx.anra_used < g_phb_cntx.anra_total && type_of_anr == 0) // ANRA */
- if (type_of_anr == 0) /* ANRA */
- {
- store_index = local_ptr->anr_entry[i].adn_record_index;
- /* PhoneBook[store_index + MAX_PB_PHONE_ENTRIES - 1].usim_field |= MMI_PHB_ENTRY_FIELD_ANRA; */
- PhoneBook[store_index + MAX_PB_PHONE_ENTRIES - 1].field |= MMI_PHB_ENTRY_FIELD_ANRA;
- g_phb_cntx.anra_used++;
- /* Number Field
- For L4 anr struct, the first byte of addr_bcd is TON, and the rest are BCD numbers.
- And the length is the total byte of TON + BCD numbers. */
- phb_anr[store_index - 1][type_of_anr].type = local_ptr->anr_entry[i].tel_number.addr_bcd[0];
- if (local_ptr->anr_entry[i].tel_number.addr_length > 0)
- {
- bcd_length = ((local_ptr->anr_entry[i].tel_number.addr_length - 1) < ((MAX_PB_NUMBER_LENGTH + 1) / 2))
- ? (local_ptr->anr_entry[i].tel_number.addr_length - 1) : ((MAX_PB_NUMBER_LENGTH + 1) / 2);
- }
- if (bcd_length > 0)
- {
- // TODO:
- //strncpy((S8*)PhoneBook[store_index].tel.number, (S8*)(LocalPtr->phb_entry.tel.addr_bcd+1), (MAX_PB_NUMBER_LENGTH + 1) / 2);
- memset(phb_anr[store_index - 1][type_of_anr].number, 0xff, ((MAX_PB_NUMBER_LENGTH + 1) / 2));
- memcpy(
- phb_anr[store_index - 1][type_of_anr].number,
- (local_ptr->anr_entry[i].tel_number.addr_bcd + 1),
- bcd_length);
- }
- else
- {
- phb_anr[store_index - 1][type_of_anr].number[0] = 0xff;
- }
- mmi_phb_convert_to_digit(num_ascii, phb_anr[store_index - 1][type_of_anr].number, MAX_PB_NUMBER_LENGTH + 1);
- phb_anr[store_index - 1][type_of_anr].length = strlen((S8*) num_ascii);
- mmi_phb_op_increase_lookup_table(
- (U16) (store_index + MAX_PB_PHONE_ENTRIES - 1),
- (S8*) num_ascii,
- NULL,
- NULL,
- NULL);
- /* Update flag for number exists entry, Clear it first. */
- // TODO: what is the field flag for anr?
- //PhoneBook[store_index].field = 0;
- if (phb_anr[store_index - 1][type_of_anr].number[0] != 0xff)
- {
- PhoneBook[store_index - 1].field |= MMI_PHB_ENTRY_FIELD_ANRA;
- }
- }
- else
- {
- break;
- }
- }
- //if ((localPtr->num_of_entry == MAX_EMAIL_ENTRIES_IN_LIST) && (g_phb_cntx.email_used < g_phb_cntx.email_total) &&
- // g_phb_read_index < g_phb_cntx.email_total)
- {
- /* mmi_phb_email_read_req(g_phb_name_index[++g_phb_cntx.usim_field_read_count]); */
- }
- /* else */
- {
- /* read next usim field or finish; */
- mmi_phb_read_usim_field(local_ptr->access_id);
- }
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #if !defined(MMI_ON_HARDWARE_P) /* For PC Simulater Load Entry */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_refresh_phonebook
- * DESCRIPTION
- * Syncs the MMI phonebook with the protocol stack phonebook
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_refresh_phonebook(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.phone_used = 0;
- g_phb_cntx.sim_used = 0;
- PhoneBookEntryCount = 0;
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
- mmi_phb_get_entry_by_index_req();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_entry_by_index_req
- * DESCRIPTION
- * Requests the stack to return the phonebook entries
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_entry_by_index_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT *myMsgPtr;
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_get_entry_by_index_req.>n", __FILE__,
- __LINE__));
- if (!PhoneBookEntryCount)
- {
- g_phb_read_index = 1;
- }
- else
- {
- g_phb_read_index += MAX_ENTRIES_IN_LIST;
- }
- myMsgPtr =
- (MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT*) OslConstructDataPtr(sizeof(MSG_PHB_GET_ENTRY_BY_INDEX_REQ_STRUCT));
- myMsgPtr->index = g_phb_read_index;
- myMsgPtr->record_index = 0xFFFF;
- myMsgPtr->storage = MMI_STORAGE_NONE;
- myMsgPtr->type = MMI_PHB_PHONEBOOK;
- myMsgPtr->no_data = MAX_ENTRIES_IN_LIST;
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_PHB_GET_ENTRY_BY_INDEX_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- SetProtocolEventHandler(mmi_phb_get_entry_by_index_rsp, PRT_PHB_GET_ENTRY_BY_INDEX_RSP);
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_entry_by_index_rsp
- * DESCRIPTION
- * Handles response from stack, which returns phonebook entries
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_entry_by_index_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT *localPtr;
- U8 i;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_get_entry_by_index_rsp.>n", __FILE__,
- __LINE__));
- localPtr = (MSG_PHB_GET_ENTRY_BY_INDEX_RSP_STRUCT*) info;
- if (localPtr->result.flag == 0 /* OK */ )
- {
- for (i = 0; i < localPtr->no_list; ++i)
- {
- if (localPtr->list[i].storage == MMI_SIM)
- {
- if (g_phb_cntx.sim_used < g_phb_cntx.sim_total)
- {
- ++g_phb_cntx.sim_used;
- store_index = localPtr->list[i].record_index + MAX_PB_PHONE_ENTRIES - 1; /* Storage Location in array. */
- }
- else
- {
- continue;
- }
- }
- else
- {
- if (g_phb_cntx.phone_used < g_phb_cntx.phone_total)
- {
- ++g_phb_cntx.phone_used;
- store_index = localPtr->list[i].record_index - 1; /* Storage Location in array. */
- }
- else
- {
- continue;
- }
- }
- PhoneBook[store_index].alpha_id.name_length = localPtr->list[i].alpha_id.name_length; /* *ENCODING_LENGTH; */
- PhoneBook[store_index].alpha_id.name_dcs = localPtr->list[i].alpha_id.name_dcs;
- InputboxConvertGSMToDeviceEncoding(
- localPtr->list[i].alpha_id.name,
- PhoneBook[store_index].alpha_id.name,
- localPtr->list[i].alpha_id.name_length,
- (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH,
- localPtr->list[i].alpha_id.name_dcs,
- 0,
- 1);
- #if defined(__PHB_0x81_SUPPORT__) /* Support maximum length of 0x81 UCS2 */
- if (PhoneBook[store_index].alpha_id.name_dcs == MMI_PHB_UCS2_81 ||
- PhoneBook[store_index].alpha_id.name_dcs == MMI_PHB_UCS2_82)
- {
- PhoneBook[store_index].alpha_id.name_dcs = MMI_PHB_UCS2;
- }
- #endif /* defined(__PHB_0x81_SUPPORT__) */
- PhoneBook[store_index].tel.type = localPtr->list[i].tel.type;
- PhoneBook[store_index].tel.length = localPtr->list[i].tel.length;
- mmi_phb_convert_to_bcd(
- PhoneBook[store_index].tel.number,
- localPtr->list[i].tel.number,
- (MAX_PB_NUMBER_LENGTH + 1) / 2);
- /* Update flag for number exists entry, Clear it first. */
- PhoneBook[store_index].field = 0;
- if (PhoneBook[store_index].tel.number[0] != 0xff)
- {
- PhoneBook[store_index].field |= MMI_PHB_ENTRY_FIELD_NUMBER;
- }
- g_phb_name_index[PhoneBookEntryCount] = store_index;
- ++PhoneBookEntryCount;
- }
- if ((localPtr->no_list == MAX_ENTRIES_IN_LIST) &&
- (PhoneBookEntryCount < (g_phb_cntx.sim_total + g_phb_cntx.phone_total)))
- {
- mmi_phb_get_entry_by_index_req();
- }
- else
- {
- mmi_phb_sort_build_name_index();
- PhbGetSpeedDialInfo();
- }
- }
- else
- {
- mmi_phb_sort_build_name_index();
- PhbGetSpeedDialInfo();
- }
- }
- #endif /* !defined(MMI_ON_HARDWARE_P) */
- #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_check_sim_change
- * DESCRIPTION
- * This function checks if sim changes for phonebook.
- * PARAMETERS
- * void
- * RETURNS
- * TRUE if updated. FALSE if not.
- *****************************************************************************/
- BOOL mmi_phb_init_check_sim_change(void)
- {
- #if defined(MMI_ON_HARDWARE_P) /* Check SIM change only on hardware */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count = 0;
- U16 i;
- S16 pError;
- U8 optid_record, optid_index, current_record = 0;
- PHB_OPTIONAL_IDS_STRUCT PhbOptIDs[OPTIONAL_IDS_RECORD_TOTAL];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_sim_check == 0)
- {
- g_phb_sim_check = 1;
- if (is_sim_replaced())
- {
- /* Count entry number first */
- for (i = MAX_PB_PHONE_ENTRIES; i < MAX_PB_ENTRIES; ++i)
- {
- /* Get optional IDs record. */
- optid_record = (i / OPTIONAL_IDS_RECORD_TOTAL) + 1;
- optid_index = i - (optid_record - 1) * OPTIONAL_IDS_RECORD_TOTAL;
- if (optid_record != current_record)
- {
- ReadRecord(
- NVRAM_EF_PHB_IDS_LID,
- optid_record,
- (void*)PhbOptIDs,
- OPTIONAL_IDS_RECORD_SIZE,
- &pError);
- current_record = optid_record;
- }
- if (PhbOptIDs[optid_index].callerGroupID != 0)
- {
- count++;
- }
- }
- /* If id exists, prompt user to delete. */
- if (count)
- {
- mmi_phb_init_entry_sim_refresh_confirm();
- return TRUE;
- }
- }
- }
- #endif /* defined(MMI_ON_HARDWARE_P) */
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_entry_sim_refresh_confirm
- * DESCRIPTION
- * This function is the confirmation screen for SIM changed.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_entry_sim_refresh_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* U8* guiBuffer; */
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_ID_PHB_REFRESH_SIM),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- //EntryNewScreen(SCR_ID_PHB_REFRESH_SIM_CONFIRM, NULL, mmi_phb_init_entry_sim_refresh_confirm, NULL);
- //guiBuffer = GetCurrGuiBuffer(SCR_ID_PHB_REFRESH_SIM_CONFIRM);
- //ShowCategory164Screen(STR_GLOBAL_YES, IMG_GLOBAL_YES, STR_GLOBAL_NO,IMG_GLOBAL_NO,
- // STR_ID_PHB_REFRESH_SIM, IMG_GLOBAL_QUESTION, guiBuffer);
- SetLeftSoftkeyFunction(mmi_phb_init_delete_caller_group_in_sim, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- /* playRequestedTone(WARNING_TONE); */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_init_delete_caller_group_in_sim
- * DESCRIPTION
- * This function clears all caller group associate to SIM card.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_init_delete_caller_group_in_sim(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- S16 pError;
- U8 optid_record, optid_index, current_record = 0;
- PHB_OPTIONAL_IDS_STRUCT PhbOptIDs[OPTIONAL_IDS_RECORD_TOTAL];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = MAX_PB_PHONE_ENTRIES; i < MAX_PB_ENTRIES; ++i)
- {
- /* Get optional IDs record. */
- optid_record = (i / OPTIONAL_IDS_RECORD_TOTAL) + 1;
- optid_index = i - (optid_record - 1) * OPTIONAL_IDS_RECORD_TOTAL;
- if (optid_record != current_record)
- {
- if (current_record != 0) /* Write result back for previous optional ID record. */
- {
- WriteRecord(NVRAM_EF_PHB_IDS_LID, current_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- }
- /* Read out next record. */
- ReadRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- current_record = optid_record;
- }
- memset(&PhbOptIDs[optid_index], 0, sizeof(PHB_OPTIONAL_IDS_STRUCT));
- }
- /* Write back for last record. */
- WriteRecord(NVRAM_EF_PHB_IDS_LID, optid_record, (void*)PhbOptIDs, OPTIONAL_IDS_RECORD_SIZE, &pError);
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteNScrId(SCR_ID_PHB_REFRESH_SIM_CONFIRM);
- }
- #endif /* defined(__MMI_PHB_CALLERGROUP_IN_SIM__) */
- #define MMI_PHB_MAIN_MENU
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_main_menu
- * DESCRIPTION
- * Shows the Phonebook main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_main_menu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[MAX_SUB_MENUS];
- U16 nImgIltemList[MAX_SUB_MENUS];
- U16 nNumofItem;
- U8 *hintList[MAX_SUB_MENUS]; /* Array for hint */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_entry_main_menu.>n", __FILE__, __LINE__));
- /* g_phb_cntx.selected_pic_in_view = 0; */
- /* if sync now, user cannot enter phonebook */
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- return;
- }
- #endif /* __SYNCML_SUPPORT__ */
- g_phb_enter_from = MMI_PHB_ENTER_NONE;
- EntryNewScreen(SCR_PBOOK_MAIN_MENU, mmi_phb_exit_main_menu, mmi_phb_entry_main_menu, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_PBOOK_MAIN_MENU); /* Getting the Index from history */
- if (gInsertSimAppFlag != 1)
- {
- nNumofItem = GetNumOfChild(MAIN_MENU_PHONEBOOK_MENUID);
- GetSequenceStringIds(MAIN_MENU_PHONEBOOK_MENUID, nStrItemList);
- GetSequenceImageIds(MAIN_MENU_PHONEBOOK_MENUID, nImgIltemList);
- SetParentHandler(MAIN_MENU_PHONEBOOK_MENUID);
- /* Construct List To Show Hint */
- ConstructHintsList(MAIN_MENU_PHONEBOOK_MENUID, hintList);
- }
- else
- {
- nNumofItem = GetNumOfChild(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID);
- GetSequenceStringIds(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID, nStrItemList);
- GetSequenceImageIds(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID, nImgIltemList);
- SetParentHandler(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID);
- /* Construct List To Show Hint */
- ConstructHintsList(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID, hintList);
- }
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- /* Call option menu may invoke before mmi_phb_init is executed */
- mmi_phb_set_main_menu_highlight_handler();
- /* MTK Leo add, mini_tab_bar */
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- if (gInsertSimAppFlag != 1)
- {
- wgui_enable_mini_tab_bar(MAIN_MENU_PHONEBOOK_MENUID);
- }
- else
- {
- wgui_enable_mini_tab_bar(MAIN_MENU_PHONEBOOK_NO_SIM_MENUID);
- }
- #endif /* __MMI_WGUI_MINI_TAB_BAR__ */
- /* MTK Leo end */
- /* Screen with hint, if no hint needed, can change to Screen 15 */
- ShowCategory52Screen(
- STR_SCR_PBOOK_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- nImgIltemList,
- hintList,
- 0,
- 0,
- guiBuffer);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_main_menu
- * DESCRIPTION
- * Exit function for mmi_phb_entry_main_menu()
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_main_menu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.start_scr_id = SCR_PBOOK_MAIN_MENU;
- g_phb_cntx.end_scr_id = SCR_PBOOK_MAIN_MENU;
- /* MTK Leo add, mini_tab_bar */
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- wgui_disable_mini_tab_bar();
- #endif
- /* MTK Leo end */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_not_ready
- * DESCRIPTION
- * Displays Phobebook not ready screen
- * PARAMETERS
- * str_id [IN] String id for display
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_not_ready(U16 str_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_PHB_DUMMY, mmi_phb_exit_not_ready, NULL, NULL);
- StartTimer(PHB_NOTIFYDURATION_TIMER, PHB_NOTIFY_TIMEOUT, mmi_phb_wait_and_go_back);
- ShowCategory66Screen(
- STR_SCR_PBOOK_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (PU8) GetString(str_id),
- IMG_PROCESSING_PHONEBOOK,
- NULL);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_not_ready
- * DESCRIPTION
- * Exit function for mmi_phb_entry_not_ready.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_not_ready(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- StopTimer(PHB_NOTIFYDURATION_TIMER);
- g_idle_context.ToNameScrFromIdleApp = 0;
- g_idle_context.RskPressedFromIdleApp = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_wait_and_go_back
- * DESCRIPTION
- * Goes back to history after timer expires
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_wait_and_go_back(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- StopTimer(PHB_NOTIFYDURATION_TIMER);
- GoBackHistory();
- g_idle_context.ToNameScrFromIdleApp = 0;
- g_idle_context.RskPressedFromIdleApp = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_show_in_progress
- * DESCRIPTION
- * To display work-in-progress status
- * PARAMETERS
- * msg [IN]
- * msgIcon [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_show_in_progress(U16 msg, U16 msgIcon)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_message = msg;
- g_phb_message_icon = msgIcon;
- mmi_phb_entry_in_progress();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_in_progress
- * DESCRIPTION
- * Draws the in-progress screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_in_progress(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* EntryNewScreen(SCR_IN_PROGRESS_PHB, mmi_phb_exit_in_progress, NULL,NULL); */
- EntryNewScreen(SCR_IN_PROGRESS_PHB, NULL, NULL, NULL);
- /* PMT HIMANSHU START 20050920 */
- #ifdef __MMI_MAINLCD_240X320__
- /* passing 0xffff for Title string and Title icon for the disbling the status bar and title display. */
- ShowCategory8Screen(0xffff, 0xffff, 0, 0, 0, 0, g_phb_message, g_phb_message_icon, NULL);
- #else /* __MMI_MAINLCD_240X320__ */
- ShowCategory8Screen(
- STR_SCR_PBOOK_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- 0,
- 0,
- 0,
- 0,
- g_phb_message,
- g_phb_message_icon,
- NULL);
- #endif /* __MMI_MAINLCD_240X320__ */
- ClearInputEventHandler(MMI_DEVICE_ALL);
- ClearKeyHandler(KEY_END, KEY_EVENT_UP);
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
- ClearKeyHandler(KEY_END, KEY_REPEAT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_show_mass_processing
- * DESCRIPTION
- * To display work-in-progress status for mass operation. (Copy All, Delete All)
- * PARAMETERS
- * msg [IN]
- * msgIcon [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_show_mass_processing(U16 msg, U16 msgIcon)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_message = msg;
- g_phb_message_icon = msgIcon;
- mmi_phb_entry_mass_processing();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_mass_processing_scr_del_callback
- * DESCRIPTION
- * Call back function when the screen is deleted
- * PARAMETERS
- * p [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_phb_mass_processing_scr_del_callback(void *p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.processing) /* if phonebook still copying or deleting, do not deleted this screen */
- {
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_mass_processing
- * DESCRIPTION
- * Draws the in-progress screen for mass operation. (This screen has abort function.)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_mass_processing(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_COPY_ALL_PROGRESS, mmi_phb_exit_mass_processing, NULL, NULL);
- #ifdef __MMI_MAINLCD_240X320__
- /* passing 0xffff for Title string and Title icon for the disbling the status bar and title display. */
- ShowCategory8Screen(
- 0xffff,
- 0xffff,
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_COPY_ALL_ABORT,
- g_phb_message,
- g_phb_message_icon,
- NULL);
- #else /* __MMI_MAINLCD_240X320__ */
- ShowCategory8Screen(
- STR_SCR_PBOOK_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_COPY_ALL_ABORT,
- g_phb_message,
- g_phb_message_icon,
- NULL);
- #endif /* __MMI_MAINLCD_240X320__ */
- /* If this screen is deleted, call back function. */
- SetDelScrnIDCallbackHandler(SCR_COPY_ALL_PROGRESS, (HistoryDelCBPtr) mmi_phb_mass_processing_scr_del_callback);
- ClearInputEventHandler(MMI_DEVICE_KEY);
- ClearKeyHandler(KEY_END, KEY_EVENT_UP);
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
- ClearKeyHandler(KEY_END, KEY_REPEAT);
- SetRightSoftkeyFunction(mmi_phb_mass_processing_abort, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_mass_processing
- * DESCRIPTION
- * Exit function to mmi_phb_entry_mass_processing()
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_mass_processing(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.processing)
- {
- g_phb_cntx.end_scr_id = SCR_COPY_ALL_PROGRESS;
- h.scrnID = SCR_COPY_ALL_PROGRESS;
- h.entryFuncPtr = mmi_phb_entry_mass_processing;
- pfnUnicodeStrcpy((PS8) h.inputBuffer, (PS8) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- }
- }
- #define MMI_PHB_LIST
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_allocate_filter
- * DESCRIPTION
- * allocate memory phonebook list filter buffer. The filter is used for display phonebook list
- * with certain conditions.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_allocate_filter(void)
- {
- #if (MAX_PB_ENTRIES >= 1000)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.list_filter = (U16*) g_phb_list_filter;
- #else /* (MAX_PB_ENTRIES >= 1000) */
- if (g_phb_cntx.list_filter == NULL)
- {
- g_phb_cntx.list_filter = OslMalloc(MAX_PB_ENTRIES * 2);
- }
- #endif /* (MAX_PB_ENTRIES >= 1000) */ /* MAX_PB_ENTRIES >= 1000 */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_free_filter
- * DESCRIPTION
- * free memory phonebook list filter buffer.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_free_filter(void)
- {
- #if (MAX_PB_ENTRIES < 1000)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.list_filter)
- {
- OslMfree(g_phb_cntx.list_filter);
- g_phb_cntx.list_filter = NULL;
- }
- #endif /* (MAX_PB_ENTRIES < 1000) */ /* MAX_PB_ENTRIES < 1000 */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_pre_entry
- * DESCRIPTION
- * This function provide call back function before enter phonebook list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_pre_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_list_pre_entry.>n", __FILE__, __LINE__));
- g_phb_highlight_alpha = 0;
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) && (!defined __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__)
- if (UI_device_height == 220 && UI_device_width == 176)
- {
- mmi_phb_entry_image_list1();
- }
- else
- #endif /* defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) && (!defined __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__) */
- {
- FunctionPtr send_key_ptr;
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- send_key_ptr = mmi_phb_two_line_send_key_handler;
- }
- else
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- send_key_ptr = mmi_phb_choose_number_normal;
- }
- mmi_phb_entry_list(PhoneBookEntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OPTIONS, /* LSK */
- IMG_GLOBAL_OPTIONS, /* LSK */
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- mmi_phb_get_index_speak_name,
- #else
- mmi_phb_get_index, /* Highlight Callback */
- #endif
- mmi_phb_entry_op_option, /* LSK Callback */
- send_key_ptr, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_list_pre_entry, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- }
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_nlf_list_pre_entry
- * DESCRIPTION
- * This function provide call back function before enter phonebook list with
- * name list filter feature
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_nlf_list_pre_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_nlf_list_pre_entry.>n", __FILE__, __LINE__));
- g_phb_highlight_alpha = 0;
- #if defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) && (!defined __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__)
- if (UI_device_height == 220 && UI_device_width == 176)
- {
- mmi_phb_nlf_entry_image_list1();
- }
- else
- #endif /* defined(__MMI_FILE_MANAGER__) && defined(MMI_ON_HARDWARE_P) && (!defined __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__) */
- {
- FunctionPtr send_key_ptr;
- #ifdef __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__
- if (phbListView == MMI_PHB_LIST_FOR_PHB)
- {
- send_key_ptr = mmi_phb_two_line_send_key_handler;
- }
- else
- #endif /* __MMI_PHB_TWO_LINE_MENUITEM_DISPLAY__ */
- {
- send_key_ptr = mmi_phb_choose_number_normal;
- }
- 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;
- }
- mmi_phb_nlf_entry_list(g_phb_list_index_total, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OPTIONS, /* LSK */
- IMG_GLOBAL_OPTIONS, /* LSK */
- #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
- mmi_phb_get_index_speak_name_nlf,
- #else
- mmi_phb_get_index_nlf, /* Highlight Callback */
- #endif
- mmi_phb_entry_op_option, /* LSK Callback */
- send_key_ptr, /* SEND Key Callback */
- mmi_phb_nlf_list_get_item, /* List Callback */
- mmi_phb_nlf_list_get_hint, /* Hint Callback */
- mmi_phb_nlf_list_pre_entry, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- }