PhoneBookStubsToOthers.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:281k
源码类别:
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:
- * ---------
- * PhoneBookStubsToOthers.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * PhoneBook APIs for other applications
- *
- * 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!
- *
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _PHONEBOOKSTUBSTOOTHERS_C
- #define _PHONEBOOKSTUBSTOOTHERS_C
- #include "MMI_features.h"
- #include "StdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "kal_trace.h" /* Debug Info */
- #include "DebugInitDef.h" /* Debug Info */
- #include "mmi_trc.h" /* Debug Info */
- #include "ProtocolEvents.h"
- #include "Gui_data_types.h"
- #include "AllAppGprot.h"
- #include "PhonebookDef.h"
- #include "PhonebookGprot.h"
- #include "PhonebookProt.h"
- #include "Unicodexdcl.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "IdleAppDef.h"
- #include "IdleAppProt.h"
- #include "TimerEvents.h"
- #include "GlobalDefs.h"
- #include "SpeedDial.h"
- #include "CommonScreens.h"
- #include "SimDetectionGprot.h"
- #include "wgui_categories_multimedia.h" /* For ShowCategory225Screen */
- #include "CallManagementGProt.h" /* For isInCall */
- #include "ProfileGprots.h" /* For IsSilentModeActivated */
- #if defined(MMS_SUPPORT) /* For MMS */
- #include "NVRAMType.h"
- #include "wap_ps_struct.h"
- #endif /* defined(MMS_SUPPORT) */
- #if defined(__MOD_SMSAL__)
- #include "MessagesExDcl.h"
- #include "MessagesResourceData.h"
- #endif /* defined(__MOD_SMSAL__) */
- #if defined(__MMI_FILE_MANAGER__) /* Also for __MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__ */
- #include "FileSystemDef.h"
- #include "gdi_include.h" /* graphic library */
- #endif /* defined(__MMI_FILE_MANAGER__) */
- #include "SettingDefs.h"
- #include "SettingsGdcl.h"
- #include "SettingGenum.h"
- #include "SecuritySetup.h"
- #if defined(__MMI_EMAIL__)
- #include "EmailAppGProt.h" /* Email App List Screen */
- #endif
- #if defined(__MMI_VRSD_DIAL__)
- #include "mdi_datatype.h"
- #include "mdi_audio.h"
- #include "VRSD.h"
- #include "VRSDEnum.h"
- #include "VRSDDial.h" /* Voice dial application list screen */
- #endif /* defined(__MMI_VRSD_DIAL__) */
- #if defined(__MMI_VRSI__)
- #include "Mdi_datatype.h"
- #include "VRSIEnum.h"
- #include "VRSIType.h"
- #include "VRSIProt.h"
- #endif /* defined(__MMI_VRSI__) */
- #if defined(MMS_SUPPORT)
- #include "Wapadp.h"
- #endif
- #ifdef __MMI_PHB_BIRTHDAY_FIELD__
- #include "app_datetime.h"
- #endif
- #ifdef __J2ME__
- #include "j2me_custom_option.h"
- #endif
- #ifdef __SYNCML_SUPPORT__
- #include "vObjects.h"
- #include "vCard.h"
- #include "SyncMLDef.h"
- #include "SyncMLGprot.h"
- #endif /* __SYNCML_SUPPORT__ */
- #if defined(__MMI_PHB_QUICK_SEARCH__)
- #if defined(__MMI_T9__)
- #if defined(__MMI_T9_V7__)
- #include "t9ccapi.h"
- #include "T9Main.h"
- #else /* defined(__MMI_T9_V7__) */
- #include "T9api.h"
- #include "T9Main.h"
- #endif /* defined(__MMI_T9_V7__) */
- #endif /* defined(__MMI_T9__) */
- #if defined(__MMI_ZI__)
- #include "Zi8api.h"
- #ifndef ZI8_GETMODE_BOPOMOFO_NAME
- #define ZI8_GETMODE_BOPOMOFO_NAME ZI8_GETMODE_BOPOMOFO
- #endif
- #ifndef ZI8_GETMODE_PINYIN_NAME
- #define ZI8_GETMODE_PINYIN_NAME ZI8_GETMODE_PINYIN
- #endif
- #endif /* defined(__MMI_ZI__) */
- #if defined(__MMI_ITAP__)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* defined(__MMI_ITAP__) */
- #include "wgui_categories_inputs.h"
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) */
- /*
- * Define
- */
- #if defined(__MMI_PHB_QUICK_SEARCH__)
- #define MMI_PHB_GENERIC_QUICK_SEARCH_INPUT_LENGTH 6
- #define MMI_PHB_CONVERT_BUFF_ZI 32 /* ZI convert function need 32 bytes for buffer. */
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) */
- #define BYTE_SIZE 8 /* for g_phb_qsearch_bitmask */
- #define BYTE_SIZE_SHIFT_ARITHMETIC 3
- /*
- * Local Variable
- */
- static U8 phb_list_view_type;
- static mmi_phb_get_data_callback_type phb_list_view_call_back;
- #if defined(__MMI_MESSAGES_SEND_BY_GROUP__) || defined(__UNIFIED_COMPOSER_SUPPORT__)
- static mmi_phb_get_index_from_group_callback_type phb_group_view_call_back;
- #endif
- MMI_PHB_LIST_VIEW phbListView;
- U8 g_phb_enter_from; /* Identify Save number from idle screen */
- FuncPhbListCallback g_phb_list_callback = NULL; /* For generic list call back function */
- #if defined(__MMI_PHB_QUICK_SEARCH__)
- static U16 g_phb_generic_qsearch_cache[MAX_PB_ENTRIES];
- static U8 g_phb_generic_qsearch_bitmask[(MAX_PB_ENTRIES + 7) / 8];
- static U8 g_phb_generic_qsearch_input[(MMI_PHB_GENERIC_QUICK_SEARCH_INPUT_LENGTH + 1) * ENCODING_LENGTH];
- static U8 g_phb_generic_qsearch_is_cache = 0; /* Check if cache already build */
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) */
- /*
- * Global Variable
- */
- extern U16 PhoneBookEntryCount;
- extern MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[];
- #ifdef __MMI_PHB_USIM_FIELD__
- extern MMI_PHB_EMAIL_STRUCT phb_email[MAX_PB_SIM_ENTRIES];
- extern MMI_PHB_NUMBER_BCD_STRUCT phb_anr[MAX_PB_SIM_ENTRIES][3];
- #endif /* __MMI_PHB_USIM_FIELD__ */
- extern const U8 AsciiToDefaultArray[];
- extern const U8 DefaultToAsciiArray[];
- #ifndef __MMI_PHB_NO_OPTIONAL_FIELD__
- extern PHB_OPTIONAL_FIELDS_STRUCT PhoneBookOptionalFields;
- #endif
- extern U8 MMI_current_input_mode;
- extern S8 pbName[];
- extern S8 pbNumber[];
- extern S8 pbHomeNumber[];
- extern S8 pbCompanyName[];
- extern S8 pbEmailAddress[];
- extern S8 pbOfficeNumber[];
- extern S8 pbFaxNumber[];
- #ifdef __MMI_PHB_BIRTHDAY_FIELD__
- extern const kal_uint8 g_dt_day_per_mon[];
- extern S8 pbDay[];
- extern S8 pbMon[];
- extern S8 pbYear[];
- #endif /* __MMI_PHB_BIRTHDAY_FIELD__ */
- #if defined(__MMI_VOIP__)
- extern S8 pbVoip[(VOIP_URI_LEN) * ENCODING_LENGTH];
- #endif
- #if defined(__MMI_FILE_MANAGER__)
- extern S8 g_phb_file_path[]; /* Select file from file manager */
- static S8 phb_caller_pic_file_path[MMI_PHB_MAX_PATH_LENGTH];
- #endif /* defined(__MMI_FILE_MANAGER__) */
- extern U16 g_phb_name_index[];
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- extern S8 g_phb_video_file_path[]; /* Select video file from file manager */
- #endif
- //
- #if defined(__MMI_T9__)
- #if defined(__MMI_T9_V7__)
- extern T9CCAWFieldInfo FieldInfo;
- #else
- extern T9FieldInfo FieldInfo;
- #endif
- #endif /* defined(__MMI_T9__) */
- #if defined(__MMI_ITAP__)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* defined(__MMI_ITAP__) */
- //
- /*
- * Global Function
- */
- extern void IdleShowScrInvalidLocation(void);
- extern void IdleShowScrNoPhoneNumEntry(void);
- extern void SendPhbEntryForDivert(U8[], U8[]);
- extern void CBackCallDeflectNumberFromPB(PS8 CallDeflectBuffer);
- extern void mmi_msg_get_number_from_phb(U8 name[], U8 number[]);
- #if defined(__MMI_MESSAGES_CHAT__)
- extern void SetNameNumberForChatScreen(U8 name[], U8 number[]);
- #endif
- extern void mmi_msg_send_msg_to_group(U16, U16 *);
- extern void mmi_frm_sms_go_back_from_send(void);
- extern void mmi_frm_sms_end_key_from_send(void);
- extern MMI_PHB_ENTRY_STRUCT *mmi_phb_get_sim_entry(void);
- #ifdef __J2ME__
- extern void mmiapi_fullscreen_editor_set_number(S8* name, S8* number);
- #endif
- #if defined(__MMI_VRSI__) && defined(__MMI_VRSI_TRAIN_TAG__)
- static vrsi_sd_tag_struct* g_phb_vrsi_tag_list;
- #endif
- #if defined (JATAAYU_SUPPORT)
- extern void update_mms_number_from_phonebook(S8 *number);
- extern void update_mms_email_from_phonebook(S8 *email);
- #endif /* JATAAYU_SUPPORT */
- #define MMI_PHB_STUBS_TO_OTHERS_INIT
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_stubs_to_others_init
- * DESCRIPTION
- * Initial function for phonebook search and sort.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_stubs_to_others_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_PHB_QUICK_SEARCH__) && defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
- SetHiliteHandler(MENU_ID_PHB_SMS_QUICK_SEARCH_INPUT_METHOD, mmi_phb_generic_highlight_quick_search_input_method);
- SetHiliteHandler(MENU_ID_PHB_SMS_QUICK_SEARCH_DONE, mmi_phb_generic_highlight_quick_search_done);
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) && defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__) */
- }
- /*****************************************************************************
- * FUNCTION
- * lookUpName
- * DESCRIPTION
- * Search for the number entry for corresponding name input
- * PARAMETERS
- * name [IN] Input name to be serach
- * RETURNS
- * result number string if found
- *****************************************************************************/
- PS8 lookUpName(PS8 name)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- store_index = g_phb_name_index[i];
- if (pfnUnicodeStrcmp((PS8) name, (PS8) PhoneBook[store_index].alpha_id.name) == 0)
- {
- mmi_phb_convert_get_ucs2_number(pbNumber, i); /* BCD number format. */
- return (S8*) pbNumber;
- }
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * lookUpNumber
- * DESCRIPTION
- * Search for the name entry for corresponding number input
- * PARAMETERS
- * number [IN] Input number to be serach
- * RETURNS
- * result name string if found
- *****************************************************************************/
- PS8 lookUpNumber(PS8 number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U8 flag = 0;
- U32 num;
- U8 number_ASCII[MAX_PB_NUMBER_LENGTH + 1 + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_lookUpNumber));
- memset(number_ASCII, 0, ENCODING_LENGTH);
- UnicodeToAnsii((PS8) number_ASCII, (PS8) number);
- /* Lookup into table when (1) lookup table not empty (2)Not Processing (3)All Entries populated and sorted */
- if (g_phb_cntx.lookup_table_count && !g_phb_cntx.processing && (g_phb_cntx.populate_count == 0xffff)
- #ifdef __SYNCML_SUPPORT__
- && !(mmi_syncml_is_phb_sync_now())
- #endif /* __SYNCML_SUPPORT__ */
- )
- {
- num = mmi_phb_util_convert_number_to_int(number_ASCII);
- if (num < INVALID_NUMBER)
- {
- i = mmi_phb_lookup_table_search(num, 0, (U16) (g_phb_cntx.lookup_table_count - 1),
- (S8*) number_ASCII, MMI_STORAGE_BOTH);
- if (i < 0xffff) /* i is storage location in array, begin from 0. */
- {
- flag = 1;
- }
- }
- }
- if (flag)
- {
- return (PS8) PhoneBook[i].alpha_id.name;
- }
- else
- {
- return NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_enter_list
- * DESCRIPTION
- * Phonebook list interface for other application.
- * PARAMETERS
- * func_list [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_enter_list(FuncPhbListCallback func_list)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_ALL_SHARED;
- g_phb_list_callback = func_list;
- mmi_phb_list_pre_entry_second_level();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_enter_list_result
- * DESCRIPTION
- * choose entry result, send result back to caller app.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_enter_list_result(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 pError;
- U16 store_index;
- MMI_PHB_VCARD_STRUCT *result_entry = OslMalloc(sizeof(MMI_PHB_VCARD_STRUCT));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Clear buffer */
- memset(result_entry, 0, sizeof(MMI_PHB_VCARD_STRUCT));
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- /* Copy Name */
- pfnUnicodeStrcpy(result_entry->name, (S8*) PhoneBook[store_index].alpha_id.name);
- /* Copy Number - ASCII Type */
- if (PhoneBook[store_index].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR)
- {
- *result_entry->number = '+';
- mmi_phb_convert_to_digit((U8*) result_entry->number+1, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- else
- {
- mmi_phb_convert_to_digit((U8*) result_entry->number, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);
- }
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- if (store_index < MAX_PB_PHONE_ENTRIES) /* in NVRAM */
- {
- ReadRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- strcpy(result_entry->homeNumber, (PS8) PhoneBookOptionalFields.homeNumber);
- strcpy(result_entry->officeNumber, (PS8) PhoneBookOptionalFields.officeNumber);
- strcpy(result_entry->faxNumber, (PS8) PhoneBookOptionalFields.faxNumber);
- strcpy(result_entry->emailAddress, (S8*) PhoneBookOptionalFields.emailAddress);
- pfnUnicodeStrcpy(result_entry->companyName, (PS8) PhoneBookOptionalFields.companyName);
- }
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- /* Send back to email app. */
- if (g_phb_list_callback != NULL)
- {
- g_phb_list_callback(result_entry);
- }
- OslMfree(result_entry);
- g_phb_list_callback = NULL;
- DeleteScreenIfPresent(SCR_PBOOK_LIST);
- }
- #define MMI_PHB_IDLE_SCREEN
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_idle_enter_phb_list
- * DESCRIPTION
- * Displays PHB list from RSK of idle screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_idle_enter_phb_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_idle_context.ToNameScrFromIdleApp = 1;
- g_idle_context.RskPressedFromIdleApp = 1;
- phbListView = MMI_PHB_LIST_FOR_PHB;
- g_phb_cntx.highlight_entry = 0;
- #if defined(__MMI_PHB_RSK_QUICK_SEARCH__)
- mmi_phb_quick_search_list_pre_entry();
- #else
- #if defined(__MMI_PHB_NAME_LIST_FILTER__)
- mmi_phb_nlf_list_pre_entry();
- #else /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- mmi_phb_list_pre_entry();
- #endif /* defined(__MMI_PHB_NAME_LIST_FILTER__) */
- #endif /* defined(__MMI_PHB_RSK_QUICK_SEARCH__) */
- #if (!defined(__MMI_TOUCH_SCREEN__)) ||(defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) && !defined(__MMI_SLIDE__)) //KP Jerry add "defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
- #if (defined(__MMI_KEYPAD_LOCK_PATTERN_1__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
- if (g_idle_context.RskPressedFromIdleApp == 1)
- {
- StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
- SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_POUND, KEY_EVENT_UP);
- }
- #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_1__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */
- //KP Jerry add on 2007-3-26 start
- #if (defined(__MMI_KEYPAD_LOCK_PATTERN_3__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
- if (g_idle_context.RskPressedFromIdleApp == 1)
- {
- StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
- SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_STAR, KEY_EVENT_UP);
- }
- #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_3__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */
- //KP Jerry add on 2007-3-26 end
- //KP Jerry add on 2007-4-23 start
- #if (defined(__MMI_KEYPAD_LOCK_PATTERN_4__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__))
- if (g_idle_context.RskPressedFromIdleApp == 1)
- {
- StartTimer(KEYPAD_LOCK_TIMER, KEYPAD_LOCK_TIMEOUT, IdleHandleKeypadLockProcess);
- SetKeyHandler(IdleHandlePoundKeyForKeypadLock, KEY_CAMERA, KEY_EVENT_UP);
- }
- #endif /* (defined(__MMI_KEYPAD_LOCK_PATTERN_4__) && !defined(__MMI_DISABLE_KEYPAD_LOCK__)) */
- //KP Jerry add on 2007-4-23 end
- #endif /* __MMI_TOUCH_SCREEN__ */
- }
- /*****************************************************************************
- * FUNCTION
- * SaveNumberFromIdleScrn
- * DESCRIPTION
- * Saves number from idle screen
- * PARAMETERS
- * number [IN] Number string to be saved
- * enter [IN] Enter location
- * RETURNS
- * void
- *****************************************************************************/
- void SaveNumberFromIdleScrn(PS8 number, U8 enter)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<SaveNumberFromIdleScrn.>n", __FILE__, __LINE__));
- /* Check number length first */
- if (pfnUnicodeStrlen((PS8) number) > MAX_PB_NUMBER_LENGTH + 1)
- {
- DisplayPopup((PU8) GetString(STR_NUMBER_TOO_LONG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- /* Avoid add entry while copy all and delete all */
- else if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- else if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_phb_entry_not_ready(STR_ID_PHB_PROCESSING_USIM);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else
- {
- g_phb_cntx.set_done_flag = 1;
- pfnUnicodeStrcpy(pbNumber, number);
- g_phb_enter_from = enter;
- mmi_phb_clear_old_history();
- mmi_phb_op_add_pre_entry();
- }
- }
- #ifdef __MMI_PHB_BIRTHDAY_FIELD__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_retrieve_bday
- * DESCRIPTION
- * parse birthday field of a vcard object.s
- * PARAMETERS
- * b_string [?]
- * pb_year [?]
- * pb_mon [?]
- * pb_day [?]
- * change_flag [IN]
- * String(?) [IN] String read from file for one line
- * RETURNS
- * parse error cause(?)
- *****************************************************************************/
- void mmi_phb_retrieve_bday(S8 *b_string, S8 *pb_year, S8 *pb_mon, S8 *pb_day, BOOL change_flag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 temp_buf[10 + 1]; /* 19990101 or 1999-01-01 */
- S8 ascii_buff[6];
- U16 b_year;
- U8 b_month;
- U8 b_day;
- U8 is_valid = TRUE;
- U8 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* b_string; */
- memset(temp_buf, 0, sizeof(temp_buf));
- strncpy(temp_buf, b_string, 10);
- /* Year */
- strncpy(ascii_buff, temp_buf, 4);
- ascii_buff[4] = ' ';
- AnsiiToUnicodeString(pb_year, ascii_buff);
- b_year = (U16) gui_atoi((U16*) pb_year);
- i = 4;
- /* Month */
- if (*(temp_buf + i) == '-')
- {
- i++;
- }
- strncpy(ascii_buff, temp_buf + i, 2);
- ascii_buff[2] = ' ';
- AnsiiToUnicodeString(pb_mon, ascii_buff);
- b_month = (U8) gui_atoi((U16*) pb_mon);
- i += 2;
- /* Day */
- if (*(temp_buf + i) == '-')
- {
- i++;
- }
- strncpy(ascii_buff, temp_buf + i, 2);
- ascii_buff[2] = ' ';
- AnsiiToUnicodeString(pb_day, ascii_buff);
- b_day = (U8) gui_atoi((U16*) pb_day);
- if (b_year > MMI_PHB_BDAY_MAX_YEAR_INT || b_year < 1900)
- {
- is_valid = FALSE;
- }
- else if (b_month > 12)
- {
- is_valid = FALSE;
- }
- #if defined(MMI_ON_HARDWARE_P)
- if (b_month == 2)
- {
- if (b_day > (g_dt_day_per_mon[b_month - 1] + applib_dt_is_leap_year(b_year)))
- is_valid = FALSE;
- }
- else if (b_day > g_dt_day_per_mon[b_month - 1])
- {
- is_valid = FALSE;
- }
- #endif /* MMI_ON_HARDWARE_P */
- if (is_valid && change_flag)
- {
- mmi_phb_bday_set_changed();
- }
- else
- {
- mmi_phb_util_clear_bday_buffer();
- }
- }
- #endif /* __MMI_PHB_BIRTHDAY_FIELD__ */
- #ifdef __MMI_BARCODEREADER__ /* could extend in the future */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_save_entry_from_barcode
- * DESCRIPTION
- * Saves phonebook entry from barcode application
- * PARAMETERS
- * ucs2_name [IN] Name string to be saved. Max length is MAX_PB_NAME_LENGTH
- * number [IN] Number string to be saved(UCS2)
- * opt_fields [IN] Optional fields
- * b_day [IN] Birthday to be saved. Format: yyyymmdd. ex: 19750101
- * info_fields [IN] Information fields
- * nick_name [IN] Nick name string to be saved(UCS2). Max length is MAX_PB_NAME_LENGTH
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_save_entry_from_barcode(
- S8 *ucs2_name,
- S8 *number,
- PHB_OPTIONAL_FIELDS_STRUCT *opt_fields,
- S8 *b_day,
- PHB_INFO_FIELDS_STRUCT *info_fields,
- S8 *nick_name)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 name_extend_char_num = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_save_entry_from_barcode.>n", __FILE__,
- __LINE__));
- /* Check number length first */
- if ((pfnUnicodeStrlen(number) > MAX_PB_NUMBER_LENGTH + 1))
- {
- DisplayPopup((PU8) GetString(STR_NUMBER_TOO_LONG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- /* Avoid add entry while copy all and delete all */
- else if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- else if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_phb_entry_not_ready(STR_ID_PHB_PROCESSING_USIM);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (PhoneBookEntryCount == (g_phb_cntx.sim_total + g_phb_cntx.phone_total))
- {
- DisplayPopup((PU8) GetString(STR_PBOOK_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else
- {
- g_phb_cntx.set_done_flag = 1;
- g_phb_enter_from = MMI_PHB_ENTER_FROM_BARCODE;
- mmi_phb_clear_old_history();
- mmi_phb_util_clear_buffer(TRUE);
- if (ucs2_name)
- {
- if (GetUCS2Flag(ucs2_name) == 1) /* there is chinese character, length = 14 */
- {
- pfnUnicodeStrncpy(pbName, ucs2_name, (MAX_PB_NAME_LENGTH - 1) / 2);
- }
- else
- {
- name_extend_char_num = GetUCS2ExtendedNum((PS8)ucs2_name, MAX_PB_NAME_LENGTH);
- if ((pfnUnicodeStrlen(ucs2_name) + name_extend_char_num) > MAX_PB_NAME_LENGTH)
- {
- pfnUnicodeStrncpy(pbName, ucs2_name, MAX_PB_NAME_LENGTH - name_extend_char_num);
- }
- else
- {
- pfnUnicodeStrncpy(pbName, ucs2_name, MAX_PB_NAME_LENGTH);
- }
- }
- }
- if (number)
- {
- pfnUnicodeStrncpy(pbNumber, number, MAX_PB_NUMBER_LENGTH);
- }
- if (opt_fields)
- {
- AnsiiToUnicodeString(pbHomeNumber, (PS8) opt_fields->homeNumber);
- AnsiiToUnicodeString(pbEmailAddress, (PS8) opt_fields->emailAddress);
- AnsiiToUnicodeString(pbOfficeNumber, (PS8) opt_fields->officeNumber);
- pfnUnicodeStrcpy(pbCompanyName, (PS8) opt_fields->companyName);
- AnsiiToUnicodeString(pbFaxNumber, (PS8) opt_fields->faxNumber);
- }
- #ifdef __MMI_PHB_BIRTHDAY_FIELD__
- if (b_day)
- {
- mmi_phb_retrieve_bday(b_day, (S8*) pbYear, (S8*) pbMon, (S8*) pbDay, TRUE);
- }
- #endif /* __MMI_PHB_BIRTHDAY_FIELD__ */
- #ifdef __MMI_PHB_INFO_FIELD__
- if (info_fields)
- {
- pfnUnicodeStrcpy(pbTitle, (PS8) info_fields->title);
- pfnUnicodeStrcpy(pbUrl, (PS8) info_fields->url);
- AnsiiToUnicodeString(pbAddress, (PS8) info_fields->address);
- pfnUnicodeStrcpy(pbNote, (PS8) info_fields->note);
- }
- #endif /* __MMI_PHB_INFO_FIELD__ */
- #ifdef __MMI_PHB_USIM_FIELD__
- if (nick_name)
- {
- pfnUnicodeStrcpy(pbNickName, (PS8) info_fields->note);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- mmi_phb_entry_op_add_choose_storage();
- }
- }
- #endif /* __MMI_BARCODEREADER__ */
- #ifdef __MMI_VOIP__
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_get_data_for_voip
- * DESCRIPTION
- * Returns the names/ringtone/image tag/caller group details for the incoming
- * call number if it is present in PHB
- * PARAMETERS
- * uri [IN] uri string to be matched
- * is_mo_call [IN] dial_from_list only for mo call
- * RETURNS
- * PHB_CM_INTERFACE a interface structure
- *****************************************************************************/
- PHB_VOIP_INTERFACE mmi_phb_call_get_data_for_voip(PU8 uri, BOOL is_mo_call)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = 0xffff, grp_id;
- PHB_VOIP_INTERFACE phbDetails;
- U8 flag = 0;
- U8 uri_ASCII[VOIP_URI_LEN];
- U8 *uri_ptr;
- PHB_OPTIONAL_IDS_STRUCT *opt_ids = NULL;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- U16 video_id;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(uri_ASCII, 0, ENCODING_LENGTH);
- memset((void*)&phbDetails, 0, sizeof(phbDetails));
- phbDetails.pictureId = IMG_PHB_DEFAULT;
- phbDetails.dialInList = MMI_PHB_NONE;
- UnicodeToAnsii((PS8) uri_ASCII, (PS8) uri);
- PRINT_INFORMATION(("---[PhonebookStubsToOthers.c] mmi_phb_call_get_data_for_call_mgnt() => number: [%s] dial list:[%d] n", uri_ASCII, g_phb_cntx.dial_from_list));
- uri_ptr = uri_ASCII;
- /* Check if dial out from phonebook list */
- if (g_phb_cntx.dial_from_list == MMI_PHB_PHONEBOOK && is_mo_call)
- {
- g_phb_cntx.dial_from_list = MMI_PHB_NONE;
- flag = 1;
- store_index = g_phb_name_index[g_phb_cntx.active_index];
- phbDetails.dialInList = MMI_PHB_PHONEBOOK;
- }
- /* Map Number with one enrtry. */
- if (flag)
- {
- pfnUnicodeStrcpy((PS8) phbDetails.name, (PS8) PhoneBook[store_index].alpha_id.name);
- phbDetails.name_dcs = PhoneBook[store_index].alpha_id.name_dcs;
- /* Caller Group Setup */
- #if !defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- #endif
- {
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- mmi_phb_read_optional_ids(store_index); /* i is store index */
- opt_ids = (PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids;
- grp_id = opt_ids->callerGroupID;
- if (grp_id)
- {
- #if defined(__MMI_CALLERGROUP_NO_ALERT__)
- phbDetails.alertType = MMI_ALERT_NONE;
- #else
- phbDetails.alertType = callerGroups[grp_id - 1].alertType;
- #endif
- phbDetails.backlightId = callerGroups[grp_id - 1].LEDPatternId;
- phbDetails.ringtoneId = callerGroups[grp_id - 1].ringToneID;
- if (callerGroups[grp_id - 1].pictureTagID == 1) /* Associate Picture is in the file system. */
- {
- #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
- phbDetails.pictureId = 1;
- phbDetails.record_index = 5000 + grp_id;
- #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */
- }
- else if (callerGroups[grp_id - 1].pictureTagID != 0) /* 0 means default image */
- {
- phbDetails.pictureId = callerGroups[grp_id - 1].pictureTagID;
- }
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- if (callerGroups[grp_id - 1].VideoID)
- {
- phbDetails.videoId = callerGroups[grp_id - 1].VideoID;
- phbDetails.video_record_index = (U16) (MAX_PB_PHONE_ENTRIES + grp_id); /* MAX_PB_PHONE_ENTRIES for group 1 and so on. */
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- }
- }
- /* Personal Entry Setup, these will overwrite caller group setting. */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- /* Associate Pictures */
- if (opt_ids->pictureTagID == 1)
- {
- #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
- phbDetails.pictureId = 1;
- phbDetails.record_index = store_index + 1; /* Record Must in NVRAM, so the record index is store_index + 1 */
- #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- phbDetails.videoId = 0; /* If Image Selected, should not play caller group's video */
- #endif
- }
- else if ((opt_ids->pictureTagID != IMG_PHB_DEFAULT) && (opt_ids->pictureTagID != 0x0000))
- {
- phbDetails.pictureId = opt_ids->pictureTagID;
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- phbDetails.videoId = 0; /* If Image Selected, should not play caller group's video */
- #endif
- }
- /* Associate Ring Tone */
- if (opt_ids->ringToneID)
- {
- phbDetails.ringtoneId = opt_ids->ringToneID;
- }
- /* For Incoming Call Video */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- if ((video_id = mmi_phb_video_get_id_by_index(store_index)) != 0)
- {
- phbDetails.videoId = video_id;
- phbDetails.video_record_index = store_index + 1; /* Record Must in NVRAM, so the record index is store_index + 1 */
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- }
- }
- return phbDetails;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_save_entry_for_service_field
- * DESCRIPTION
- * Saves number from idle screen
- * PARAMETERS
- * uri [IN] uri to be saved
- * enter [IN] Enter location
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_save_entry_for_service_field(PS8 uri, U8 enter)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_save_entry_for_service_field.>n", __FILE__, __LINE__));
- /* Check uri length first */
- if (enter == MMI_PHB_ENTER_FROM_VOIP && pfnUnicodeStrlen((PS8)uri) >= VOIP_URI_LEN)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- /* Avoid add entry while copy all and delete all */
- else if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- else if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_phb_entry_not_ready(STR_ID_PHB_PROCESSING_USIM);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (g_phb_cntx.phone_total == g_phb_cntx.phone_used)
- {
- DisplayPopup((PU8) GetString(STR_PHONE_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- }
- else
- {
- g_phb_cntx.set_done_flag = 1;
- g_phb_enter_from = MMI_PHB_ENTER_FROM_VOIP;
- mmi_phb_clear_old_history();
- mmi_phb_util_clear_buffer(TRUE);
- if (uri)
- {
- pfnUnicodeStrcpy(pbVoip, uri);
- }
- //mmi_phb_entry_op_add_choose_storage();
- g_phb_cntx.selected_storage = MMI_NVRAM;
- mmi_phb_entry_op_add_entry();
- }
- }
- #endif /* __MMI_VOIP__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_get_sim_entry_by_location
- * DESCRIPTION
- * Return the number to idle screen for quick access
- * PARAMETERS
- * entryNum [IN] Location to be search
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_get_sim_entry_by_location(U16 entryNum)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 record_index;
- U8 hasEntry = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (entryNum == 0 || entryNum > g_phb_cntx.sim_total)
- {
- IdleShowScrInvalidLocation();
- }
- else
- {
- for (i = 0; i < PhoneBookEntryCount; i++)
- {
- record_index = g_phb_name_index[i] - MAX_PB_PHONE_ENTRIES + 1;
- if (record_index == entryNum)
- {
- g_phb_cntx.active_index = i;
- hasEntry = 1;
- mmi_phb_entry_op_view_entry();
- }
- }
- if (!hasEntry)
- {
- IdleShowScrNoPhoneNumEntry();
- }
- }
- }
- #define MMI_PHB_INTERFACE_FOR_CALL
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_get_data_for_call_mgnt
- * DESCRIPTION
- * Returns the names/ringtone/image tag/caller group details for the incoming
- * call number if it is present in PHB
- * PARAMETERS
- * number [IN] Number string to be matched
- * is_mo_call [IN] dial_from_list only for mo call
- * RETURNS
- * PHB_CM_INTERFACE a interface structure
- *****************************************************************************/
- PHB_CM_INTERFACE mmi_phb_call_get_data_for_call_mgnt(PU8 number, BOOL is_mo_call)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = 0xffff, grp_id;
- PHB_CM_INTERFACE phbDetails;
- U8 flag = 0;
- U32 num;
- U8 number_ASCII[MAX_PB_NUMBER_LENGTH + 1 + 1];
- U8 *number_ptr;
- PHB_OPTIONAL_IDS_STRUCT *opt_ids = NULL;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- S8 *str_P = NULL;
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- U16 video_id;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_FUNC_GetPHBDataForCM)); */
- memset(number_ASCII, 0, ENCODING_LENGTH);
- memset((void*)&phbDetails, 0, sizeof(phbDetails));
- phbDetails.pictureId = IMG_PHB_DEFAULT;
- phbDetails.dialInList = MMI_PHB_NONE;
- UnicodeToAnsii((PS8) number_ASCII, (PS8) number);
- PRINT_INFORMATION(("---[PhonebookStubsToOthers.c] mmi_phb_call_get_data_for_call_mgnt() => number: [%s] dial list:[%d] n", number_ASCII, g_phb_cntx.dial_from_list));
- /* convert P to p */
- str_P = strstr((S8*)number_ASCII, "P");
- if (str_P)
- {
- str_P[0] = 'p';
- }
- number_ptr = number_ASCII;
- /* Ignore *31# and #31# case */
- while (((number_ptr[0] == '*') && (number_ptr[1] == '3') && (number_ptr[2] == '1') && (number_ptr[3] == '#')) ||
- ((number_ptr[0] == '#') && (number_ptr[1] == '3') && (number_ptr[2] == '1') && (number_ptr[3] == '#')))
- {
- number_ptr += 4;
- }
- /* Display as Emergency Number */
- if (CheckValidEmergencyNo1((S8*) number))
- {
- AnsiiToUnicodeString((PS8) phbDetails.number, (S8*) number_ptr);
- g_phb_cntx.dial_from_list = MMI_PHB_NONE; /* Clear dial from list flag */
- pfnUnicodeStrncpy((PS8) phbDetails.name, GetString(STR_EMERGENCY_NUMBER), MAX_PB_NAME_LENGTH);
- if (GetUCS2Flag((PS8) phbDetails.name))
- {
- phbDetails.name_dcs = MMI_PHB_UCS2;
- }
- else
- {
- phbDetails.name_dcs = MMI_PHB_ASCII;
- }
- return phbDetails;
- }
- /* Check if dial out from phonebook list */
- if (g_phb_cntx.dial_from_list == MMI_PHB_PHONEBOOK && is_mo_call)
- {
- g_phb_cntx.dial_from_list = MMI_PHB_NONE;
- flag = 1;
- store_index = g_phb_name_index[g_phb_cntx.active_index];
- phbDetails.dialInList = MMI_PHB_PHONEBOOK;
- }
- /*
- * Check if dial out from FDN list,
- * note that should enter here only from FDN list screen
- */
- else if (g_phb_cntx.dial_from_list == MMI_PHB_FDN && is_mo_call)
- {
- g_phb_cntx.dial_from_list = MMI_PHB_NONE;
- /* Fill up structure and return FDN data directly here */
- pfnUnicodeStrcpy(
- (S8*) phbDetails.name,
- (S8*) gFDLBDLContext.FDLBDLEntries[gFDLBDLContext.HighlightedFDN].alpha_id.name);
- phbDetails.name_dcs = gFDLBDLContext.FDLBDLEntries[gFDLBDLContext.HighlightedFDN].alpha_id.name_dcs;
- pfnUnicodeStrcpy(
- (S8*) phbDetails.number,
- (S8*) gFDLBDLContext.FDLBDLEntries[gFDLBDLContext.HighlightedFDN].tel.number);
- phbDetails.dialInList = MMI_PHB_FDN;
- return phbDetails;
- }
- /*
- * Check if dial out from SDN list,
- * note that should enter here only from SDN list screen
- */
- else if (g_phb_cntx.dial_from_list == MMI_PHB_SDN && is_mo_call)
- {
- MMI_PHB_ENTRY_STRUCT *sdn_entry = mmi_phb_get_sim_entry();
- g_phb_cntx.dial_from_list = MMI_PHB_NONE;
- /* Fill up structure and return SDN data directly here */
- pfnUnicodeStrcpy((S8*) phbDetails.name, (S8*) sdn_entry->alpha_id.name);
- phbDetails.name_dcs = sdn_entry->alpha_id.name_dcs;
- pfnUnicodeStrcpy((S8*) phbDetails.number, (S8*) sdn_entry->tel.number);
- phbDetails.dialInList = MMI_PHB_SDN;
- return phbDetails;
- }
- else /* Not dial from list. */
- {
- /* Lookup into table when (1) lookup table not empty (2) Not Processing (3) All Entries populated and sorted */
- if (g_phb_cntx.lookup_table_count && !g_phb_cntx.processing && (g_phb_cntx.populate_count == 0xffff)
- #ifdef __SYNCML_SUPPORT__
- && !(mmi_syncml_is_phb_sync_now())
- #endif /* __SYNCML_SUPPORT__ */
- )
- {
- num = mmi_phb_util_convert_number_to_int(number_ASCII);
- if (num < INVALID_NUMBER)
- {
- g_phb_cntx.searched_number_type = 0;
- store_index = mmi_phb_lookup_table_search(num, 0, (U16)(g_phb_cntx.lookup_table_count - 1),
- (S8*) number_ptr, MMI_STORAGE_BOTH);
- if (store_index < 0xffff) /* i is storage location in array, begin from 0. */
- {
- flag = 1;
- }
- }
- }
- }
- /* Map Number with one enrtry. */
- if (flag)
- {
- pfnUnicodeStrcpy((PS8) phbDetails.name, (PS8) PhoneBook[store_index].alpha_id.name);
- phbDetails.name_dcs = PhoneBook[store_index].alpha_id.name_dcs;
- if (phbDetails.dialInList != MMI_PHB_PHONEBOOK) /* CM should use its number if dial from Phonebook list */
- {
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- if ((store_index < MAX_PB_PHONE_ENTRIES) && g_phb_cntx.searched_number_type != 0)
- {
- switch (g_phb_cntx.searched_number_type)
- {
- case MMI_PHB_ENTRY_FIELD_HOME:
- AnsiiToUnicodeString((PS8) phbDetails.number, (S8*) PhoneBookOptionalFields.homeNumber);
- break;
- case MMI_PHB_ENTRY_FIELD_OFFICE:
- AnsiiToUnicodeString((PS8) phbDetails.number, (S8*) PhoneBookOptionalFields.officeNumber);
- break;
- case MMI_PHB_ENTRY_FIELD_FAX:
- AnsiiToUnicodeString((PS8) phbDetails.number, (S8*) PhoneBookOptionalFields.faxNumber);
- break;
- default:
- MMI_ASSERT(0);
- break;
- }
- }
- else
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- {
- mmi_phb_convert_get_ucs2_number((S8*) phbDetails.number, store_index);
- }
- }
- /* Caller Group Setup */
- #if !defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- #endif
- {
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- mmi_phb_read_optional_ids(store_index); /* i is store index */
- opt_ids = (PHB_OPTIONAL_IDS_STRUCT*) g_phb_cntx.optional_ids;
- grp_id = opt_ids->callerGroupID;
- if (grp_id)
- {
- #if defined(__MMI_CALLERGROUP_NO_ALERT__)
- phbDetails.alertType = MMI_ALERT_NONE;
- #else
- phbDetails.alertType = callerGroups[grp_id - 1].alertType;
- #endif
- phbDetails.backlightId = callerGroups[grp_id - 1].LEDPatternId;
- phbDetails.ringtoneId = callerGroups[grp_id - 1].ringToneID;
- if (callerGroups[grp_id - 1].pictureTagID == 1) /* Associate Picture is in the file system. */
- {
- #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
- phbDetails.pictureId = 1;
- phbDetails.record_index = 5000 + grp_id;
- #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */
- }
- else if (callerGroups[grp_id - 1].pictureTagID != 0) /* 0 means default image */
- {
- phbDetails.pictureId = callerGroups[grp_id - 1].pictureTagID;
- }
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- if (callerGroups[grp_id - 1].VideoID)
- {
- phbDetails.videoId = callerGroups[grp_id - 1].VideoID;
- phbDetails.video_record_index = (U16) (MAX_PB_PHONE_ENTRIES + grp_id); /* MAX_PB_PHONE_ENTRIES for group 1 and so on. */
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- }
- }
- /* Personal Entry Setup, these will overwrite caller group setting. */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- /* Associate Pictures */
- if (opt_ids->pictureTagID == 1)
- {
- #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
- phbDetails.pictureId = 1;
- phbDetails.record_index = store_index + 1; /* Record Must in NVRAM, so the record index is store_index + 1 */
- #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- phbDetails.videoId = 0; /* If Image Selected, should not play caller group's video */
- #endif
- }
- else if ((opt_ids->pictureTagID != IMG_PHB_DEFAULT) && (opt_ids->pictureTagID != 0x0000))
- {
- phbDetails.pictureId = opt_ids->pictureTagID;
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- phbDetails.videoId = 0; /* If Image Selected, should not play caller group's video */
- #endif
- }
- /* Associate Ring Tone */
- if (opt_ids->ringToneID)
- {
- phbDetails.ringtoneId = opt_ids->ringToneID;
- }
- /* For Incoming Call Video */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- if ((video_id = mmi_phb_video_get_id_by_index(store_index)) != 0)
- {
- phbDetails.videoId = video_id;
- phbDetails.video_record_index = store_index + 1; /* Record Must in NVRAM, so the record index is store_index + 1 */
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- }
- }
- /*
- * If entry is not found, try to search in FDN list to see if number can be match and dial out.
- * This should be search when FDN is enable.
- * Note: FDN list is stored in ADN storage when FDN is enable.
- */
- else if (gSecuritySetupContext.FdlStatus)
- {
- UnicodeToAnsii((PS8) number_ASCII, (PS8) number);
- store_index = mmi_phb_fdn_search_by_number((S8*) number_ASCII);
- if (store_index < 0xffff)
- {
- pfnUnicodeStrcpy((PS8) phbDetails.name, (PS8) PhoneBook[store_index].alpha_id.name);
- phbDetails.name_dcs = PhoneBook[store_index].alpha_id.name_dcs;
- mmi_phb_convert_get_ucs2_number((S8*) phbDetails.number, store_index);
- }
- }
- return phbDetails;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_set_dial_from_list
- * DESCRIPTION
- * Let call management to set dial from list flag.
- * PARAMETERS
- * value [IN] TRUE/FALSE value
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_set_dial_from_list(U8 value)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.dial_from_list = value;
- }
- #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) || defined(__MMI_FILE_MANAGER__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_image_get_path_from_id
- * DESCRIPTION
- * This function returns the phonebook associate picture image path by index.
- * PARAMETERS
- * record_index [IN] Index of a phonebook record. (if >5000, it is a caller group image)
- * RETURNS
- * full path of image
- *****************************************************************************/
- S8 *mmi_phb_image_get_path_from_id(U16 record_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 drive;
- S8 *path;
- FS_HANDLE fh;
- S32 width, height;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_IMAGE_GET_PATH_FROM_ID_1, record_index));
- drive = MMI_PHB_DRV;
- if (drive > 0)
- {
- path = (S8*) phb_caller_pic_file_path; /* Use global static buffer to store path */
- mmi_phb_image_get_full_path_by_index(record_index, path);
- /* Try to open file and check image format. If can't open, use default picture to display. */
- if (pfnUnicodeStrlen(path) > 0)
- {
- fh = FS_Open((U16*) path, FS_READ_ONLY);
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_IMAGE_GET_PATH_FROM_ID_2, fh));
- if (fh)
- {
- FS_Close(fh);
- if (gdi_image_get_dimension_file((S8*) path, &width, &height) >= 0)
- {
- MMI_TRACE((MMI_TRACE_G4_PHB, MMI_PHB_IMAGE_GET_PATH_FROM_ID_3));
- return path;
- }
- }
- }
- }
- return NULL;
- }
- #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) || defined(__MMI_FILE_MANAGER__) */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_video_get_path_from_id
- * DESCRIPTION
- * This function returns the phonebook associate video path by index.
- * PARAMETERS
- * record_index [IN] Index of a phonebook record.
- * RETURNS
- * full path of image
- *****************************************************************************/
- S8 *mmi_phb_video_get_path_from_id(U16 record_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index = record_index - 1;
- U16 video_id = 0;
- PHB_CALLER_GROUP_STRUCT *callerGroups;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* In phonebook entry */
- if (store_index < MAX_PB_PHONE_ENTRIES)
- {
- video_id = mmi_phb_video_get_id_by_index(store_index);
- }
- /* In caller group */
- else if ((store_index < (MAX_PB_PHONE_ENTRIES + MAX_PB_CALLER_GROUPS)) && (store_index >= MAX_PB_PHONE_ENTRIES))
- {
- callerGroups = (PHB_CALLER_GROUP_STRUCT*) g_phb_cntx.caller_group;
- video_id = callerGroups[(store_index - MAX_PB_PHONE_ENTRIES)].VideoID;
- }
- return mmi_phb_caller_video_get_path_by_index(video_id);
- }
- #endif /* defined(__MMI_INCOMING_CALL_VIDEO__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_enter_from_divert
- * DESCRIPTION
- * Displays the PHB list for call divert
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_enter_from_divert(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phbListView = MMI_PHB_LIST_FOR_SETTINGS;
- /* mmi_phb_list_pre_entry_second_level(); */
- g_phb_cntx.highlight_entry = 0;
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_second_level, /* Highlight Callback */
- mmi_phb_call_send_data_for_divert, /* LSK Callback */
- mmi_phb_call_send_data_for_divert, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_call_enter_from_divert, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_send_data_for_divert
- * DESCRIPTION
- * Sends the names & numbers info of the selected
- * PHB entry to call divert
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_send_data_for_divert(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- store_index = g_phb_name_index[g_phb_cntx.active_index_second];
- mmi_phb_convert_get_ucs2_number(pbNumber, store_index); /* BCD number format. */
- SendPhbEntryForDivert(PhoneBook[store_index].alpha_id.name, (U8*) pbNumber);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_enter_from_active_call
- * DESCRIPTION
- * Displays PHB main menu from active call options
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_enter_from_active_call(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else
- {
- g_phb_enter_from = MMI_PHB_ENTER_NONE;
- mmi_phb_clear_old_history();
- mmi_phb_util_clear_buffer(TRUE);
- mmi_phb_entry_main_menu();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_enter_from_deflect_option
- * DESCRIPTION
- * Displays PHB list from incoming call deflect option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_enter_from_deflect_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else
- {
- phbListView = MMI_PHB_LIST_FOR_CM;
- /* mmi_phb_list_pre_entry_second_level(); */
- g_phb_cntx.highlight_entry = 0;
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_second_level, /* Highlight Callback */
- mmi_phb_call_send_data_for_deflect, /* LSK Callback */
- mmi_phb_call_send_data_for_deflect, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_call_enter_from_deflect_option, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_call_send_data_for_deflect
- * DESCRIPTION
- * Sends the numbers info of the selected
- * entry for Call deflect
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_call_send_data_for_deflect(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8* phb_deflect_num;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- phb_deflect_num = OslMalloc((MAX_PB_NUMBER_LENGTH+1+1)*ENCODING_LENGTH);
- mmi_phb_convert_get_ucs2_number(phb_deflect_num, g_phb_name_index[g_phb_cntx.active_index_second]); /* BCD number format. */
- CBackCallDeflectNumberFromPB(phb_deflect_num);
- OslMfree(phb_deflect_num);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_enter_first_from_active_call
- * DESCRIPTION
- * Enter phonebook list from active call to first item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_enter_first_from_active_call(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_list_enter_from_active_call(0);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_enter_last_from_active_call
- * DESCRIPTION
- * Enter phonebook list from active call to last item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_enter_last_from_active_call(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_list_enter_from_active_call((U16) (PhoneBookEntryCount - 1));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_list_enter_from_active_call
- * DESCRIPTION
- * enter phonebook list from active call, highlight on specific entry.
- * (Note this function call will clear all phonebook history if exists)
- * PARAMETERS
- * highlight_pos [IN] Highlight entry position.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_list_enter_from_active_call(U16 highlight_pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __SYNCML_SUPPORT__
- if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- else
- #endif /* __SYNCML_SUPPORT__ */
- if (g_phb_cntx.phb_ready && !g_phb_cntx.processing)
- {
- if (PhoneBookEntryCount)
- {
- phbListView = MMI_PHB_LIST_FOR_PHB;
- g_phb_cntx.highlight_entry = highlight_pos;
- mmi_phb_clear_old_history(); /* Clear old phb history */
- mmi_phb_list_pre_entry();
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- }
- }
- else
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- }
- #define MMI_PHB_INTERFACE_FOR_SMS
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_sms_enter_send_entry
- * DESCRIPTION
- * Displays the PHB list for SMS to send SMS
- * to one or many numbers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_sms_enter_send_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_sms_enter_send_entry.>n", __FILE__,
- __LINE__));
- phbListView = MMI_PHB_LIST_FOR_SMS;
- /* mmi_phb_list_pre_entry_second_level(); */
- g_phb_cntx.highlight_entry = 0;
- mmi_phb_entry_list(
- PhoneBookEntryCount, /* Total Entry */
- STR_SCR_PBOOK_VIEW_CAPTION, /* Title String */
- IMG_SCR_PBOOK_CAPTION, /* Title Image */
- STR_GLOBAL_OK, /* LSK */
- IMG_GLOBAL_OK, /* LSK */
- mmi_phb_get_index_second_level, /* Highlight Callback */
- mmi_phb_sms_send_data_choose_entry, /* LSK Callback */
- mmi_phb_sms_send_data_choose_entry, /* SEND Key Callback */
- mmi_phb_list_get_item, /* List Callback */
- mmi_phb_list_get_hint, /* Hint Callback */
- mmi_phb_sms_enter_send_entry, /* Re-Entry Callback */
- TRUE, /* Alpha Index */
- TRUE); /* Right Arrow Key */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_sms_choose_number
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_sms_choose_number(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_phb_entry_list_choose_number(
- #if defined(__MMI_PHB_QUICK_SEARCH__)
- g_phb_cntx.active_index_fourth,
- #else
- g_phb_cntx.active_index_second,
- #endif /* defined(__MMI_PHB_QUICK_SEARCH__) */
- mmi_phb_entry_sms_choose_number,
- mmi_phb_sms_send_data_for_entry_list,
- mmi_phb_sms_send_data_for_entry,
- STR_SMS_NUM_CANNOT_BE_EMPTY,
- FALSE);
- }
- //quick search start
- #if defined(__MMI_PHB_QUICK_SEARCH__)
- #if defined(__MMI_T9__) && (defined(__MMI_LANG_TR_CHINESE__) || defined(__MMI_LANG_SM_CHINESE__))
- #if defined(__MMI_T9_V7__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_to_spelling
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * input_string [?]
- * output_string [?]
- * out_len [?]
- * a(?) [IN/OUT] First variable, used as returns
- * b(?) [IN] Second variable
- * RETURNS
- * the description of return value, if any.
- *****************************************************************************/
- BOOL mmi_phb_generic_quick_search_convert_to_spelling(U8 *input_string, U8 *output_string, U8 *out_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 out = 0;
- U8 i = 0;
- T9STATUS t9ReturnCodes;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Should already switch to the proper input language in "mmi_phb_quick_search_convert_cache()". */
- if (input_string[0] != 0 || input_string[1] != 0)
- {
- if (MMI_current_input_mode == INPUT_MODE_MMI_SM_STROKE || MMI_current_input_mode == INPUT_MODE_MMI_TR_STROKE)
- {
- t9ReturnCodes = T9CCGetCharStrokes(&FieldInfo.CCFieldInfo, (U16*) input_string, 0);
- }
- else
- {
- t9ReturnCodes = T9CCGetCharSpell(&FieldInfo.CCFieldInfo, (U16*) input_string, 0);
- }
- if (t9ReturnCodes == 0)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- while ((FieldInfo.CCFieldInfo.pbSpellBuf[i] != 0x00) && (i <= 7))
- {
- *((U16*) (output_string + out)) = BPMFInternalToUnicode(FieldInfo.CCFieldInfo.pbSpellBuf[i]);
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- while ((FieldInfo.CCFieldInfo.pbSpellBuf[i] != 0x00) && (i <= 7))
- {
- output_string[out] = FieldInfo.CCFieldInfo.pbSpellBuf[i];
- output_string[out + 1] = 0;
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- while ((FieldInfo.CCFieldInfo.pbKeyBuf[i] != 0x00) &&
- (i < FieldInfo.CCFieldInfo.nKeyBufLen) && (i <= 7))
- {
- *((U16*) (output_string + out)) = StrokeInternalToUnicode(FieldInfo.CCFieldInfo.pbKeyBuf[i]);
- out = out + 2;
- i = i + 1;
- }
- break;
- default:
- break;
- }
- *out_len = i;
- return TRUE;
- }
- /* Input String Does not Converted. */
- memcpy(output_string, input_string, 2);
- *out_len = 1;
- return TRUE;
- }
- *out_len = 0;
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_cache
- * DESCRIPTION
- * This function convert first character of name field into cache.
- * PARAMETERS
- * index [IN] Phonebook entry index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_convert_cache(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- T9STATUS t9ReturnCodes;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* move change language function out from loop to speed up */
- if (MMI_current_input_mode == INPUT_MODE_MMI_SM_STROKE || MMI_current_input_mode == INPUT_MODE_MMI_TR_STROKE)
- {
- t9ReturnCodes = T9CCGetCharStrokes(&FieldInfo.CCFieldInfo, (U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name, 0);
- }
- else
- {
- t9ReturnCodes = T9CCGetCharSpell(&FieldInfo.CCFieldInfo, (U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name, 0);
- }
- if (t9ReturnCodes == 0)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- g_phb_generic_qsearch_cache[index] = BPMFInternalToUnicode(FieldInfo.CCFieldInfo.pbSpellBuf[0]);
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- g_phb_generic_qsearch_cache[index] = FieldInfo.CCFieldInfo.pbSpellBuf[0];
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- g_phb_generic_qsearch_cache[index] = StrokeInternalToUnicode(FieldInfo.CCFieldInfo.pbKeyBuf[0]);
- break;
- default:
- g_phb_generic_qsearch_cache[index] = *((U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name);
- break;
- }
- }
- else
- {
- g_phb_generic_qsearch_cache[index] = *((U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name);
- }
- }
- #else /* defined(__MMI_T9_V7__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_to_spelling
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * input_string [?]
- * output_string [?]
- * out_len [?]
- * a(?) [IN/OUT] First variable, used as returns
- * b(?) [IN] Second variable
- * RETURNS
- * the description of return value, if any.
- *****************************************************************************/
- BOOL mmi_phb_generic_quick_search_convert_to_spelling(U8 *input_string, U8 *output_string, U8 *out_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 out = 0;
- U8 i = 0;
- T9Event t9EventInput;
- T9STATUS t9ReturnCodes;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Should already switch to the proper input language in "mmi_phb_quick_search_convert_cache()". */
- if (input_string[0] != 0 || input_string[1] != 0)
- {
- if (MMI_current_input_mode == INPUT_MODE_MMI_SM_STROKE || MMI_current_input_mode == INPUT_MODE_MMI_TR_STROKE)
- {
- t9EventInput.mType = T9EVTSTROKES;
- }
- else
- {
- t9EventInput.mType = T9EVTSPELLING;
- }
- t9EventInput.data.sLDBData.psBuf = (U16*) input_string;
- t9EventInput.data.sLDBData.mCtrlID = 0;
- t9ReturnCodes = T9HandleEvent(&FieldInfo, &t9EventInput);
- if (t9ReturnCodes == 0)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- while ((FieldInfo.uLangData.pAuxChinese->pbSpellBuf[i] != 0x00) && (i <= 7))
- {
- *((U16*) (output_string + out)) = BPMFInternalToUnicode(FieldInfo.uLangData.pAuxChinese->pbSpellBuf[i]);
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- while ((FieldInfo.uLangData.pAuxChinese->pbSpellBuf[i] != 0x00) && (i <= 7))
- {
- output_string[out] = FieldInfo.uLangData.pAuxChinese->pbSpellBuf[i];
- output_string[out + 1] = 0;
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- while ((FieldInfo.uLangData.pAuxChinese->pbKeyBuf[i] != 0x00) &&
- (i < FieldInfo.uLangData.pAuxChinese->nKeyBufLen) && (i <= 7))
- {
- *((U16*) (output_string + out)) = StrokeInternalToUnicode(FieldInfo.uLangData.pAuxChinese->pbKeyBuf[i]);
- out = out + 2;
- i = i + 1;
- }
- break;
- default:
- break;
- }
- *out_len = i;
- return TRUE;
- }
- /* Input String Does not Converted. */
- memcpy(output_string, input_string, 2);
- *out_len = 1;
- return TRUE;
- }
- *out_len = 0;
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_cache
- * DESCRIPTION
- * This function convert first character of name field into cache.
- * PARAMETERS
- * index [IN] Phonebook entry index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_generic_quick_search_convert_cache(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- T9Event t9EventInput;
- T9STATUS t9ReturnCodes;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* move change language function out from loop to speed up */
- if (MMI_current_input_mode == INPUT_MODE_MMI_SM_STROKE || MMI_current_input_mode == INPUT_MODE_MMI_TR_STROKE)
- {
- t9EventInput.mType = T9EVTSTROKES;
- }
- else
- {
- t9EventInput.mType = T9EVTSPELLING;
- }
- t9EventInput.data.sLDBData.psBuf = (U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name;
- t9EventInput.data.sLDBData.mCtrlID = 0;
- t9ReturnCodes = T9HandleEvent(&FieldInfo, &t9EventInput);
- if (t9ReturnCodes == 0)
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- g_phb_generic_qsearch_cache[index] = BPMFInternalToUnicode(FieldInfo.uLangData.pAuxChinese->pbSpellBuf[0]);
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- g_phb_generic_qsearch_cache[index] = FieldInfo.uLangData.pAuxChinese->pbSpellBuf[0];
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- g_phb_generic_qsearch_cache[index] = StrokeInternalToUnicode(FieldInfo.uLangData.pAuxChinese->pbKeyBuf[0]);
- break;
- default:
- g_phb_generic_qsearch_cache[index] = *((U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name);
- break;
- }
- }
- else
- {
- g_phb_generic_qsearch_cache[index] = *((U16*) PhoneBook[g_phb_name_index[index]].alpha_id.name);
- }
- }
- #endif /* defined(__MMI_T9_V7__) */
- #elif defined(__MMI_ZI__)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_generic_quick_search_convert_to_spelling
- * DESCRIPTION
- * This function is just for template.
- * PARAMETERS
- * input_string [?]
- * output_string [?]
- * out_len [?]
- * a(?) [IN/OUT] First variable, used as returns
- * b(?) [IN] Second variable
- * RETURNS
- * the description of return value, if any.
- *****************************************************************************/
- BOOL mmi_phb_generic_quick_search_convert_to_spelling(U8 *input_string, U8 *output_string, U8 *out_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 out = 0;
- U8 i = 0;
- U16 code;
- U16 mode;
- U16 pCharInfoBuffer[MMI_PHB_CONVERT_BUFF_ZI];
- U16 CharInfo;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Change convert mode according to input method. */
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- /* mode = ZI8_GETMODE_BOPOMOFO; */
- mode = ZI8_GETMODE_BOPOMOFO_NAME;
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- /* mode = ZI8_GETMODE_PINYIN; */
- mode = ZI8_GETMODE_PINYIN_NAME;
- break;
- case INPUT_MODE_MMI_SM_STROKE:
- case INPUT_MODE_MMI_TR_STROKE:
- mode = ZI8_GETMODE_STROKES;
- break;
- default:
- return FALSE;
- break;
- }
- if (input_string[0] != 0 || input_string[1] != 0)
- {
- memcpy(&code, input_string, 2);
- if ((code >= 0x4e00) && (code <= 0x9fa5) &&
- Zi8GetCharInfo(code, (U16*) pCharInfoBuffer, MMI_PHB_CONVERT_BUFF_ZI, mode))
- {
- switch (MMI_current_input_mode)
- {
- case INPUT_MODE_MMI_MULTITAP_BPMF:
- /* Do not convert tone */
- while ((pCharInfoBuffer[i] != 0x0000) &&
- ((pCharInfoBuffer[i] < 0xf431) || (pCharInfoBuffer[i] > 0xf435)))
- {
- CharInfo = pCharInfoBuffer[i] - ZI8_BASE_BPMF + 0x3105;
- memcpy(output_string + out, &CharInfo, 2);
- out = out + 2;
- i = i + 1;
- }
- break;
- case INPUT_MODE_MMI_MULTITAP_PINYIN:
- /* Do not convert tone */
- while ((pCharInfoBuffer[i] != 0x0000) &&
- ((pCharInfoBuffer[i] < 0xf431) || (pCharInfoBuffer[i] > 0xf435)))