PhoneBookOperateMass.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:158k
源码类别:
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:
- * ---------
- * PhoneBookOperateMass.C
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for phonebook mass operation.
- * Such as Copy All and Delete All.
- *
- * 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _PHONEBOOKOPERATEMASS_C
- #define _PHONEBOOKOPERATEMASS_C
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "GlobalMenuItems.h"
- #include "DebugInitDef.h"
- #include "CustDataRes.h"
- #include "PixtelDataTypes.h"
- #include "ProtocolEvents.h"
- #include "PhoneBookGprot.h"
- #include "GlobalDefs.h"
- #include "EventsGprot.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "wgui_categories_popup.h"
- #include "wgui_status_icons.h" /* for Missed Call*/
- #include "GSM7BitDefaultAlphabet.h"
- #include "PhonebookDef.h"
- #include "PhoneBookProt.h"
- #include "HistoryGprot.h"
- #include "Unicodexdcl.h"
- #include "TimerEvents.h"
- #include "CustMenuRes.h"
- #include "NVRAMProt.h"
- #include "NVRAMType.h"
- #include "NVRAMEnum.h"
- #include "SettingDefs.h"
- #include "SettingGprots.h"
- #include "SettingsGdcl.h"
- #include "CallSetUpEnum.h"
- #include "CallsDefs.h"
- #include "CallsStruct.h"
- #include "gpioInc.h"
- #include "CommonScreens.h"
- #ifdef __MMI_VCARD__
- #include "FileManagerGProt.h"
- #include "vObjects.h"
- #include "vCard.h"
- #endif /* __MMI_VCARD__ */
- #if defined(__MMI_VRSD_DIAL__)
- #include "VRSDDial.h"
- #endif
- #if defined(__MMI_VRSI__)
- #include "Mdi_datatype.h"
- #include "VRSIEnum.h"
- #include "VRSIType.h"
- #include "VRSIProt.h"
- #endif /* defined(__MMI_VRSI__) */
- #ifdef __J2ME__
- #include "j2me_custom_option.h"
- #endif
- #ifdef __SYNCML_SUPPORT__
- #include "SyncMLDef.h"
- #include "SyncMLGprot.h"
- #endif /* __SYNCML_SUPPORT__ */
- /*
- * Local Variable
- */
- static U16 g_phb_mass_op_index;
- static U16 g_phb_mass_op_lookup_count;
- static BOOL g_phb_mass_op_abort;
- #ifdef __MMI_VCARD__
- static S8 pbvCardHomeNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- static S8 pbvCardCompanyName[(MAX_PB_COMPANY_LENGTH + 1) * ENCODING_LENGTH];
- static S8 pbvCardEmailAddress[(MAX_PB_EMAIL_LENGTH + 1) * ENCODING_LENGTH];
- static S8 pbvCardOfficeNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- static S8 pbvCardFaxNumber[(MAX_PB_NUMBER_LENGTH + 1 + 1) * ENCODING_LENGTH];
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- static S8 pbvCardDay[3 * ENCODING_LENGTH];
- static S8 pbvCardMon[3 * ENCODING_LENGTH];
- static S8 pbvCardYear[6 * ENCODING_LENGTH];
- #endif /* defined(__MMI_PHB_BIRTHDAY_FIELD__) */
- #endif /* __MMI_VCARD__ */
- /*
- * Global Variable
- */
- BOOL g_phb_mass_op_success = TRUE;
- U16 g_phb_mass_op_count;
- extern U16 PhoneBookEntryCount;
- extern MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[MAX_PB_ENTRIES];
- #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];
- extern S8 pbNickName[];
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- extern PHB_OPTIONAL_FIELDS_STRUCT PhoneBookOptionalFields;
- #endif
- extern U8 gPhonePassword[];
- extern U16 g_phb_name_index[];
- extern MMI_PHB_LOOKUP_NODE_STRUCT LookUpTable[];
- extern S8 pbName[];
- extern S8 pbNumber[];
- extern S8 pbHomeNumber[];
- extern S8 pbCompanyName[];
- extern S8 pbEmailAddress[];
- extern S8 pbOfficeNumber[];
- extern S8 pbFaxNumber[];
- #if defined(__MMI_PHB_EMAIL_SORT__)
- extern U8 g_phb_email_sorted;
- #endif
- #if defined(__MMI_PHB_INFO_FIELD__)
- extern PHB_INFO_FIELDS_STRUCT PhoneBookInfoFields;
- #endif
- /*
- * Local Functions
- */
- static void mmi_phb_vcard_req(void *info);
- #ifdef __MMI_VCARD__
- static void mmi_phb_vcard_req_set_default_file(S8 *path);
- #endif
- #ifdef __MMI_PHB_USIM_FIELD__
- static void mmi_phb_op_copy_all_to_usim_one_after_one_req(void);
- #endif
- /*
- * Global Function
- */
- extern void SECSETVerifyPINReq(U8 pin_type, U8 *ucs2_pin, U8 *ucs2_new_pin, FuncPtr success_callback);
- #define MMI_PHB_MASS_INIT
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_operate_mass_init
- * DESCRIPTION
- * Initialization of "Copy All, Delete All" feature
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_operate_mass_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_operate_mass_init.>n", __FILE__,
- __LINE__));
- /* Copy All */
- SetHiliteHandler(MITEM104_PBOOK_COPY_ALL, mmi_phb_highlight_copy_all);
- SetHiliteHandler(MITEM_PBOOK_COPY_ALL_SIM, mmi_phb_highlight_copy_all_from_sim);
- SetHiliteHandler(MITEM_PBOOK_COPY_ALL_PHONE, mmi_phb_highlight_copy_all_from_phone);
- SetHintHandler(MITEM_PBOOK_COPY_ALL_SIM, mmi_phb_hint_copy_all_from_sim);
- SetHintHandler(MITEM_PBOOK_COPY_ALL_PHONE, mmi_phb_hint_copy_all_from_phone);
- /* Delete All */
- SetHiliteHandler(MITEM103_PBOOK_DELETE_ALL, mmi_phb_highlight_delete_all);
- SetHiliteHandler(MITEM_PBOOK_DELETE_ALL_SIM, mmi_phb_highlight_delete_all_from_sim);
- SetHiliteHandler(MITEM_PBOOK_DELETE_ALL_PHONE, mmi_phb_highlight_delete_all_from_phone);
- SetHintHandler(MITEM_PBOOK_DELETE_ALL_SIM, mmi_phb_hint_delete_all_from_sim);
- SetHintHandler(MITEM_PBOOK_DELETE_ALL_PHONE, mmi_phb_hint_delete_all_from_phone);
- SetHiliteHandler(MENU_ID_PHB_DELETE_ALL_ONE_BY_ONE, mmi_phb_highlight_delete_all_one_by_one);
- /* AT Command Update */
- SetProtocolEventHandler(mmi_phb_ind_update, PRT_PHB_UPDATE_IND);
- SetProtocolEventHandler(mmi_phb_vcard_req, PRT_PHB_VCARD_REQ_IND);
- }
- #define MMI_PHB_OP_COPY_ALL
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_copy_all
- * DESCRIPTION
- * Highlight handler for "Copy All" in PHB main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_copy_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_highlight_copy_all.>n", __FILE__,
- __LINE__));
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_phb_entry_copy_all, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_copy_all, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_copy_all_from_sim
- * DESCRIPTION
- * Highlight handler for "From SIM" in Copy All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_copy_all_from_sim(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- g_phb_cntx.selected_storage = MMI_SIM;
- if (g_phb_cntx.sim_used)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_phb_entry_op_copy_all_confirm, KEY_EVENT_UP);
- }
- else
- {
- ChangeLeftSoftkey(0, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_copy_all_from_phone
- * DESCRIPTION
- * Highlight handler for "From Phone" in Copy All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_copy_all_from_phone(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- g_phb_cntx.selected_storage = MMI_NVRAM;
- if (g_phb_cntx.phone_used)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_phb_entry_op_copy_all_confirm, KEY_EVENT_UP);
- }
- else
- {
- ChangeLeftSoftkey(0, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_hint_copy_all_from_sim
- * DESCRIPTION
- * Hint handler for "From SIM" in Copy All menu
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_hint_copy_all_from_sim(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 simStatus[40];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) hintData[index], 0, sizeof(hintData[index]));
- mmi_phb_memory_status_get_sim(simStatus);
- pfnUnicodeStrcpy((S8*) hintData[index], simStatus);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_hint_copy_all_from_phone
- * DESCRIPTION
- * Hint handler for "From Phone" in Copy All menu
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_hint_copy_all_from_phone(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 phoneStatus[40];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) hintData[index], 0, sizeof(hintData[index]));
- mmi_phb_memory_status_get_phone(phoneStatus);
- pfnUnicodeStrcpy((S8*) hintData[index], phoneStatus);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_copy_all
- * DESCRIPTION
- * Draws the Copy All menu.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_copy_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[2];
- U16 nImgIltemList[2];
- U8 *nHintList[2];
- U16 nNumofItem;
- U8 hilitedStorage;
- U8 hilight_sim, highlight_phone;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hilight_sim = GetIndexOfStringId(MITEM104_PBOOK_COPY_ALL, MITEM_PBOOK_COPY_ALL_SIM);
- highlight_phone = GetIndexOfStringId(MITEM104_PBOOK_COPY_ALL, MITEM_PBOOK_COPY_ALL_PHONE);
- if (g_phb_cntx.prefer_storage == MMI_SIM)
- {
- if ((g_phb_cntx.sim_used > 0) || (g_phb_cntx.phone_used == 0))
- {
- hilitedStorage = hilight_sim;
- }
- else
- {
- hilitedStorage = highlight_phone;
- }
- }
- else
- {
- if ((g_phb_cntx.phone_used > 0) || (g_phb_cntx.sim_used == 0))
- {
- hilitedStorage = highlight_phone;
- }
- else
- {
- hilitedStorage = hilight_sim;
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_entry_copy_all.>n", __FILE__, __LINE__));
- g_phb_mass_op_abort = FALSE;
- 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)
- {
- EntryNewScreen(SCR_COPY_ALL_MENU, mmi_phb_exit_copy_all, mmi_phb_entry_copy_all, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_COPY_ALL_MENU);
- nNumofItem = GetNumOfChild(MITEM104_PBOOK_COPY_ALL);
- GetSequenceStringIds(MITEM104_PBOOK_COPY_ALL, nStrItemList);
- GetSequenceImageIds(MITEM104_PBOOK_COPY_ALL, nImgIltemList);
- SetParentHandler(MITEM104_PBOOK_COPY_ALL);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ConstructHintsList(MITEM104_PBOOK_COPY_ALL, nHintList);
- ShowCategory52Screen(
- STR_SCR_COPY_ALL_MENU_CAPTION,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- nImgIltemList,
- nHintList,
- 0,
- hilitedStorage,
- guiBuffer);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_copy_all
- * DESCRIPTION
- * Exit function for mmi_phb_entry_copy_all()
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_copy_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_COPY_ALL_MENU;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_op_copy_all_confirm
- * DESCRIPTION
- * confirm copy all from sim or phone
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_op_copy_all_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_string_type message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_copy_all_confirm.>n", __FILE__,
- __LINE__));
- if (g_phb_cntx.selected_storage == MMI_SIM)
- {
- message = get_string(STR_COPY_ALL_SIM); /* STR_OVERWRITE_TARGET; */
- }
- else
- {
- message = get_string(STR_COPY_ALL_PHONE); /* STR_OVERWRITE_TARGET; */
- }
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- message,
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_phb_op_copy_all_pre_req, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_copy_all_pre_req
- * DESCRIPTION
- * pre-entry function of copy all. check storage first.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_copy_all_pre_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_copy_all_pre_req.>n", __FILE__,
- __LINE__));
- if ((g_phb_cntx.selected_storage == MMI_NVRAM) && (g_phb_cntx.sim_used == g_phb_cntx.sim_total))
- {
- DisplayPopup((PU8) GetString(STR_SIM_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- DeleteNScrId(SCR_COPY_ALL_MENU);
- }
- else if ((g_phb_cntx.selected_storage == MMI_SIM) && (g_phb_cntx.phone_used == g_phb_cntx.phone_total))
- {
- DisplayPopup((PU8) GetString(STR_PHONE_FULL_MSG), IMG_GLOBAL_ERROR, FALSE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- DeleteNScrId(SCR_COPY_ALL_MENU);
- }
- else /* Have free space, begin to copy all */
- {
- g_phb_mass_op_index = 0;
- g_phb_mass_op_count = 0;
- g_phb_cntx.processing = TRUE;
- g_phb_cntx.copy_all = TRUE; /* copy all flag for distinguish copy all or delete all if sim refresh */
- mmi_phb_show_mass_processing(STR_PHB_COPYING, IMG_COPIED);
- DeleteNScrId(SCR_COPY_ALL_MENU);
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_cntx.is_usim && g_phb_cntx.selected_storage == MMI_NVRAM)
- {
- mmi_phb_op_copy_all_to_usim_one_after_one_req();
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- mmi_phb_op_copy_all_one_after_one_req(g_phb_cntx.selected_storage);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_copy_all_one_after_one_req
- * DESCRIPTION
- * Copy all one entry after one.
- * PARAMETERS
- * from_storage [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_copy_all_one_after_one_req(U8 from_storage)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_SET_ENRTY_REQ_STRUCT *myMsgPtr;
- MYQUEUE Message;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_copy_all_one_after_one_req.>n",
- __FILE__, __LINE__));
- if (from_storage == MMI_SIM)
- while ((g_phb_name_index[g_phb_mass_op_index] < MAX_PB_PHONE_ENTRIES) && (g_phb_mass_op_index < PhoneBookEntryCount)) /* Not in SIM */
- {
- g_phb_mass_op_index++;
- }
- else
- while ((g_phb_name_index[g_phb_mass_op_index] >= MAX_PB_PHONE_ENTRIES) && (g_phb_mass_op_index < PhoneBookEntryCount)) /* Not in NVRAM */
- {
- g_phb_mass_op_index++;
- }
- if (g_phb_mass_op_index >= PhoneBookEntryCount)
- {
- mmi_phb_op_copy_all_done();
- return;
- }
- store_index = g_phb_name_index[g_phb_mass_op_index];
- #if defined(__MMI_PHB_PINYIN_SORT__) /* Make Pinyin cache for later sorting. */
- mmi_phb_util_make_pinyin_cache(store_index);
- #endif
- myMsgPtr = (MSG_PHB_SET_ENRTY_REQ_STRUCT*) OslConstructDataPtr(sizeof(MSG_PHB_SET_ENRTY_REQ_STRUCT));
- myMsgPtr->type = MMI_PHB_PHONEBOOK;
- myMsgPtr->no_data = 1;
- myMsgPtr->list.storage = (from_storage == MMI_SIM) ? MMI_NVRAM : MMI_SIM;
- myMsgPtr->list.index = 0xFFFF;
- myMsgPtr->list.record_index = 0xFFFF;
- mmi_phb_op_set_entry_prepare_name_number_by_index(&myMsgPtr->list, store_index);
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_PHB_SET_ENTRY_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- SetProtocolEventHandler(mmi_phb_op_copy_all_one_after_one_rsp, PRT_PHB_SET_ENTRY_RSP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_copy_all_one_after_one_rsp
- * DESCRIPTION
- * copy all one entry set response.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_copy_all_one_after_one_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_SET_ENRTY_RSP_STRUCT *localPtr;
- S16 pError;
- U8 copy_from, copy_to = 0;
- U16 store_index;
- U32 temp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_copy_all_one_after_one_rsp.>n",
- __FILE__, __LINE__));
- localPtr = (MSG_PHB_SET_ENRTY_RSP_STRUCT*) info;
- if (localPtr->result.flag == 0 /* OK */ )
- {
- if (localPtr->list[0].storage == MMI_SIM)
- {
- g_phb_cntx.sim_used++;
- store_index = localPtr->list[0].record_index + MAX_PB_PHONE_ENTRIES - 1; /* Storage Location in array. */
- copy_to = MMI_SIM;
- copy_from = MMI_NVRAM;
- }
- else
- {
- g_phb_cntx.phone_used++;
- store_index = localPtr->list[0].record_index - 1; /* Storage Location in array. */
- copy_to = MMI_NVRAM;
- copy_from = MMI_SIM;
- #ifdef __SYNCML_SUPPORT__
- mmi_syncml_phb_data_changed_notification(SYNCML_RECORD_ADD, store_index);
- #endif
- }
- if (copy_to == MMI_NVRAM)
- {
- /* Clear Optional Field */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- #ifdef __MMI_PHB_USIM_FIELD__
- U16 origin_index = g_phb_name_index[g_phb_mass_op_index];
- mmi_phb_op_set_option_data_by_usim_index(origin_index, &PhoneBookOptionalFields);
- #else /* __MMI_PHB_USIM_FIELD__ */
- memset(&PhoneBookOptionalFields, 0, sizeof(PhoneBookOptionalFields));
- #endif /* __MMI_PHB_USIM_FIELD__ */
- WriteRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- /* Clear Optional Id */
- mmi_phb_clear_optional_ids(store_index);
- /* Clear video field. */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- mmi_phb_video_delete_by_index(store_index);
- #endif
- /* Clear birthday field */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_phb_bday_delete_field(store_index);
- #endif
- #if defined(__MMI_PHB_INFO_FIELD__)
- mmi_phb_info_delete_field(store_index);
- #endif
- }
- #if defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- mmi_phb_copy_optional_ids(store_index, g_phb_name_index[g_phb_mass_op_index]);
- if (copy_to == MMI_SIM)
- {
- mmi_phb_clear_optional_ids_for_sim(store_index);
- }
- #endif /* defined(__MMI_PHB_CALLERGROUP_IN_SIM__) */
- /* Populate Number Field */
- temp = mmi_phb_util_convert_number_to_int(localPtr->list[0].tel.number);
- if (temp < INVALID_NUMBER)
- {
- LookUpTable[g_phb_cntx.lookup_table_count].store_index = store_index;
- LookUpTable[g_phb_cntx.lookup_table_count++].number = temp;
- }
- /* Add result to Phonebook Storage */
- mmi_phb_op_set_entry_rsp_name_number(&localPtr->list[0], store_index);
- /* Update field flag */
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_cntx.is_usim)
- {
- mmi_phb_op_update_field_flag(
- store_index,
- (S8*) localPtr->list[0].tel.number,
- (S8*) PhoneBookOptionalFields.homeNumber,
- (S8*) PhoneBookOptionalFields.officeNumber,
- (S8*) PhoneBookOptionalFields.faxNumber,
- (S8*) PhoneBookOptionalFields.emailAddress,
- TRUE);
- mmi_phb_op_increase_lookup_table(
- store_index,
- NULL,
- (S8*) PhoneBookOptionalFields.faxNumber,
- (S8*) PhoneBookOptionalFields.homeNumber,
- (S8*) PhoneBookOptionalFields.officeNumber);
- }
- else
- #endif /* __MMI_PHB_USIM_FIELD__ */
- mmi_phb_op_update_field_flag(
- store_index,
- (S8*) localPtr->list[0].tel.number,
- NULL,
- NULL,
- NULL,
- NULL,
- TRUE);
- #if defined(__MMI_PHB_PINYIN_SORT__) /* Make Pinyin cache for later sorting. */
- mmi_phb_util_make_pinyin_cache(store_index);
- #endif
- /* Append new entry in the end of sorted list. Sorting when copy all done. */
- g_phb_name_index[PhoneBookEntryCount] = store_index;
- PhoneBookEntryCount++;
- g_phb_mass_op_count++;
- /* Insert email to email mapping table, not like name field, it should sort here. */
- #if defined(__MMI_PHB_EMAIL_SORT__) /* USIM won't go this way */
- if ((copy_to == MMI_NVRAM) && (g_phb_email_sorted == 1))
- {
- mmi_phb_sort_email_insert_index(store_index);
- }
- #endif /* defined(__MMI_PHB_EMAIL_SORT__) */
- if (g_phb_mass_op_abort)
- {
- g_phb_mass_op_success = FALSE;
- mmi_phb_op_copy_all_done();
- }
- else
- {
- if ((copy_to == MMI_SIM && g_phb_mass_op_count < g_phb_cntx.phone_used) ||
- (copy_to == MMI_NVRAM && g_phb_mass_op_count < g_phb_cntx.sim_used))
- {
- ++g_phb_mass_op_index;
- mmi_phb_op_copy_all_one_after_one_req(copy_from);
- }
- else
- {
- mmi_phb_op_copy_all_done();
- }
- }
- }
- else
- {
- g_phb_mass_op_success = FALSE;
- copy_from = (g_phb_name_index[g_phb_mass_op_index] >= MAX_PB_PHONE_ENTRIES) ? MMI_SIM : MMI_NVRAM;
- /* Not copy fail due to capacity full. */
- if ((localPtr->result.cause != MMI_PHB_CAUSE_CAPACITY_EXCEEDED) &&
- ((copy_from == MMI_NVRAM && g_phb_mass_op_count < g_phb_cntx.phone_used) ||
- (copy_from == MMI_SIM && g_phb_mass_op_count < g_phb_cntx.sim_used)))
- {
- g_phb_mass_op_index++;
- mmi_phb_op_copy_all_one_after_one_req(copy_from);
- }
- else
- {
- mmi_phb_op_copy_all_done();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_copy_all_done
- * DESCRIPTION
- * Display copy result
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_copy_all_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 outBuf[100], count[10];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.processing = FALSE;
- g_phb_cntx.copy_all = FALSE;
- TurnOnBacklight(1); /* Turn On Back Light When done */
- DeleteScreenIfPresent(SCR_IN_PROGRESS_PHB);
- /* Sort name index */
- mmi_phb_sort_build_name_index();
- /* Sort Number index */
- mmi_phb_lookup_table_sort();
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
- if (g_phb_mass_op_success)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, TRUE, PHB_NOTIFY_TIMEOUT, SUCCESS_TONE);
- }
- else if (gSecuritySetupContext.FdlStatus) /* For FDN on Message */
- {
- DisplayPopup((PU8) GetString(STR_FDL_IS_ON), IMG_GLOBAL_UNFINISHED, TRUE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- g_phb_mass_op_success = TRUE;
- }
- else /* !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);
- /* add central command for vrsi. */
- #if defined(__MMI_VRSI__)
- mmi_vrsi_init_central_abort();
- /* mmi_vrsi_init_central_add_all(); */
- #endif /* defined(__MMI_VRSI__) */
- }
- #define MMI_PHB_OP_DELETE_ALL
- /*---------------------------------------------- Begin of PhoneBook Delete ALL -----------------------------------------*/
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_delete_all
- * DESCRIPTION
- * Highlight handler for "Delete All" in PHb main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_delete_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_highlight_delete_all.>n", __FILE__,
- __LINE__));
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_phb_entry_delete_all, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_delete_all, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_delete_all_from_sim
- * DESCRIPTION
- * Highlight handler for "From SIM" in Delete All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_delete_all_from_sim(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.selected_storage = MMI_SIM;
- if (g_phb_cntx.sim_used)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- #if defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P)
- SetLeftSoftkeyFunction(mmi_phb_entry_delete_all_phone_lock, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_delete_all_phone_lock, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #else /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- SetLeftSoftkeyFunction(mmi_phb_entry_delete_all_confirm, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #endif /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- }
- else
- {
- ChangeLeftSoftkey(0, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_delete_all_from_phone
- * DESCRIPTION
- * Highlight handler for "From Phone" in Delete All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_delete_all_from_phone(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.selected_storage = MMI_NVRAM;
- if (g_phb_cntx.phone_used)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- #if defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P)
- SetLeftSoftkeyFunction(mmi_phb_entry_delete_all_phone_lock, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_entry_delete_all_phone_lock, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #else /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- SetLeftSoftkeyFunction(mmi_phb_entry_delete_all_confirm, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- #endif /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- }
- else
- {
- ChangeLeftSoftkey(0, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_hint_delete_all_from_sim
- * DESCRIPTION
- * Hint handler for "From SIM" in Delete All menu
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_hint_delete_all_from_sim(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 simStatus[40];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) hintData[index], 0, sizeof(hintData[index]));
- mmi_phb_memory_status_get_sim(simStatus);
- pfnUnicodeStrcpy((S8*) hintData[index], simStatus);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_hint_delete_all_from_phone
- * DESCRIPTION
- * Hint handler for "From Phone" in Delete All menu
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_hint_delete_all_from_phone(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 phoneStatus[40];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) hintData[index], 0, sizeof(hintData[index]));
- mmi_phb_memory_status_get_phone(phoneStatus);
- pfnUnicodeStrcpy((S8*) hintData[index], phoneStatus);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_highlight_delete_all_one_by_one
- * DESCRIPTION
- * Highlight handler for "One By One" in Delete All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_highlight_delete_all_one_by_one(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetLeftSoftkeyFunction(mmi_phb_list_pre_delete_one_by_one, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_list_pre_delete_one_by_one, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_delete_all
- * DESCRIPTION
- * Draws the Delete All menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_delete_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[3];
- U16 nImgIltemList[3];
- U8 *nHintList[3];
- U16 nNumofItem;
- U8 hilitedStorage;
- U8 hilight_sim, highlight_phone;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hilight_sim = GetIndexOfStringId(MITEM103_PBOOK_DELETE_ALL, MITEM_PBOOK_DELETE_ALL_SIM);
- highlight_phone = GetIndexOfStringId(MITEM103_PBOOK_DELETE_ALL, MITEM_PBOOK_DELETE_ALL_PHONE);
- if (g_phb_cntx.prefer_storage == MMI_SIM)
- {
- if (g_phb_cntx.sim_used > 0 || g_phb_cntx.phone_used == 0)
- {
- hilitedStorage = hilight_sim;
- }
- else
- {
- hilitedStorage = highlight_phone;
- }
- }
- else
- {
- if (g_phb_cntx.phone_used > 0 || g_phb_cntx.sim_used == 0)
- {
- hilitedStorage = highlight_phone;
- }
- else
- {
- hilitedStorage = hilight_sim;
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_entry_delete_all.>n", __FILE__,
- __LINE__));
- if (!g_phb_cntx.phb_ready || g_phb_cntx.processing)
- {
- mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
- }
- #ifdef __MMI_PHB_USIM_FIELD__
- else if (g_phb_cntx.is_usim && g_phb_cntx.usim_ready_stage != MMI_PHB_USIM_READY)
- {
- mmi_phb_entry_not_ready(STR_ID_PHB_PROCESSING_USIM);
- }
- #endif /* __MMI_PHB_USIM_FIELD__ */
- #ifdef __SYNCML_SUPPORT__
- else if (mmi_syncml_is_phb_sync_now())
- {
- mmi_phb_entry_not_ready(STR_ID_SYNC_PLEASE_WAIT);
- }
- #endif /* __SYNCML_SUPPORT__ */
- else if (PhoneBookEntryCount)
- {
- EntryNewScreen(SCR_DELETE_ALL_MENU, mmi_phb_exit_delete_all, mmi_phb_entry_delete_all, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_DELETE_ALL_MENU);
- nNumofItem = GetNumOfChild(MITEM103_PBOOK_DELETE_ALL);
- GetSequenceStringIds(MITEM103_PBOOK_DELETE_ALL, nStrItemList);
- GetSequenceImageIds(MITEM103_PBOOK_DELETE_ALL, nImgIltemList);
- SetParentHandler(MITEM103_PBOOK_DELETE_ALL);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ConstructHintsList(MITEM103_PBOOK_DELETE_ALL, nHintList);
- ShowCategory52Screen(
- STR_GLOBAL_DELETE,
- IMG_SCR_PBOOK_CAPTION,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- nImgIltemList,
- nHintList,
- 0,
- hilitedStorage,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_NO_ENTRIES_MESSAGE),
- IMG_GLOBAL_EMPTY,
- TRUE,
- PHB_NOTIFY_TIMEOUT,
- EMPTY_LIST_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_delete_all
- * DESCRIPTION
- * Exit function for mmi_phb_entry_delete_all()
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_delete_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_DELETE_ALL_MENU;
- }
- #if defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P)
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_exit_delete_all_phone_lock
- * DESCRIPTION
- * Exit function for mmi_phb_entry_delete_all_phone_lock()
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_exit_delete_all_phone_lock(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.end_scr_id = SCR_ID_DELETE_ALL_CHECK_PHONE_LOCK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_delete_all_phone_lock
- * DESCRIPTION
- * check phone lock before delete all
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_delete_all_phone_lock(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(
- SCR_ID_DELETE_ALL_CHECK_PHONE_LOCK,
- mmi_phb_exit_delete_all_phone_lock,
- mmi_phb_entry_delete_all_phone_lock,
- NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_DELETE_ALL_CHECK_PHONE_LOCK);
- if (guiBuffer == NULL)
- {
- memset(gPhonePassword, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
- }
- RegisterInputBoxValidationFunction(RstrSettingPasswdScrSoftKeyFunc);
- ShowCategory111Screen(
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- STR_RESTORE_PHONE,
- INPUT_TYPE_NUMERIC_PASSWORD,
- gPhonePassword,
- (MAX_SIM_SETTING_PASSWD_LEN + 1),
- NULL,
- NULL);
- SetCategory111RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetLeftSoftkeyFunction(mmi_phb_delete_all_verify_phone_lock, KEY_EVENT_UP);
- SetKeyHandler(mmi_phb_delete_all_verify_phone_lock, KEY_POUND, KEY_EVENT_UP);
- /* micha0606 */
- gSecuritySetupContext.PasswdLenCheckCallBack = mmi_phb_delete_all_verify_phone_lock;
- if (pfnUnicodeStrlen((S8*) gPhonePassword) < MIN_PASSWORD_LENGTH)
- {
- ChangeLeftSoftkey(0, 0);
- ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_delete_all_verify_phone_lock
- * DESCRIPTION
- * Call security function to check phone lock. Also provide call back function.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_delete_all_verify_phone_lock(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tempBuffer[(MAX_SIM_SETTING_PASSWD_LEN + 1)];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(tempBuffer, 0, (MAX_SIM_SETTING_PASSWD_LEN + 1));
- SECSETVerifyPINReq(MMI_SETTING_TYPE_PHONELOCK, gPhonePassword, tempBuffer, mmi_phb_op_delete_all_pre_req);
- }
- #else /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_entry_delete_all_confirm
- * DESCRIPTION
- * Confirms before deleting all entries from the selected storage.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_entry_delete_all_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_phb_cntx.selected_storage == MMI_NVRAM)
- {
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_DELETEALL_QUERY_PHONE_MSG),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- }
- else
- {
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_DELETEALL_QUERY_SIM_MSG),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- }
- SetLeftSoftkeyFunction(mmi_phb_op_delete_all_pre_req, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- #endif /* defined(__MMI_PHB_DELETE_ALL_CHECK_PHONE_LOCK__) && defined(MMI_ON_HARDWARE_P) */
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_delete_all_pre_req
- * DESCRIPTION
- * ();
- * pre check before delete all.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_delete_all_pre_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_mass_op_index = 0;
- g_phb_cntx.processing = TRUE;
- g_phb_cntx.copy_all = FALSE;
- g_phb_mass_op_abort = FALSE;
- g_phb_mass_op_count = 0;
- g_phb_mass_op_lookup_count = 0;
- mmi_phb_show_mass_processing(STR_PHB_DELETING, IMG_GLOBAL_DELETED);
- DeleteNScrId(SCR_DELETE_ALL_MENU);
- mmi_phb_op_delete_all_one_after_one_req(g_phb_cntx.selected_storage);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_delete_all_one_after_one_req
- * DESCRIPTION
- * delete all one entry after one.
- * PARAMETERS
- * delete_storage [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_delete_all_one_after_one_req(U8 delete_storage)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_DELETE_ENTRY_REQ_STRUCT *myMsgPtr;
- MYQUEUE Message;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_delete_all_one_after_one_req.>n",
- __FILE__, __LINE__));
- if (delete_storage == MMI_SIM)
- while (g_phb_name_index[g_phb_mass_op_index] < MAX_PB_PHONE_ENTRIES) /* Not in SIM */
- {
- g_phb_mass_op_index++;
- }
- else
- while (g_phb_name_index[g_phb_mass_op_index] >= MAX_PB_PHONE_ENTRIES) /* Not in NVRAM */
- {
- g_phb_mass_op_index++;
- }
- store_index = g_phb_name_index[g_phb_mass_op_index];
- myMsgPtr = (MSG_PHB_DELETE_ENTRY_REQ_STRUCT*) OslConstructDataPtr(sizeof(MSG_PHB_DELETE_ENTRY_REQ_STRUCT));
- myMsgPtr->storage = delete_storage;
- myMsgPtr->del_all = MMI_FALSE;
- myMsgPtr->no_data = 1;
- myMsgPtr->type = MMI_PHB_PHONEBOOK;
- /*
- *The index means "record_index" here. This change only for MMI_PHB_PHONEBOOK(ADN) type
- * for other type( BDN ,FDN, MSISDN...) This field still need to use index as parameter.
- */
- myMsgPtr->index = (delete_storage == MMI_SIM) ? (store_index + 1) - MAX_PB_PHONE_ENTRIES : (store_index + 1);
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = PRT_PHB_DEL_ENTRY_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- SetProtocolEventHandler(mmi_phb_op_delete_all_one_after_one_rsp, PRT_PHB_DEL_ENTRY_RSP);
- OslMsgSendExtQueue(&Message);
- DeleteNScrId(SCR_DELETE_ALL_MENU);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_delete_all_one_after_one_rsp
- * DESCRIPTION
- * response message after delete one entry.
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_delete_all_one_after_one_rsp(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_DELETE_ENTRY_RSP_STRUCT *localPtr;
- U16 store_index;
- U16 record_index;
- U8 storage;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- localPtr = (MSG_PHB_DELETE_ENTRY_RSP_STRUCT*) info;
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_op_delete_all_one_after_one_rsp.>n",
- __FILE__, __LINE__));
- if (localPtr->result.flag == 0 /* OK */ )
- {
- store_index = g_phb_name_index[g_phb_mass_op_index];
- storage = (store_index >= MAX_PB_PHONE_ENTRIES) ? MMI_SIM : MMI_NVRAM;
- record_index = (storage == MMI_SIM) ? (store_index + 1) - MAX_PB_PHONE_ENTRIES : (store_index + 1);
- g_phb_mass_op_count++;
- PhbUpdateSpeedDial(storage, record_index, MMI_PHB_PHONEBOOK, NULL, NULL);
- if (store_index >= MAX_PB_PHONE_ENTRIES) /* Record store in SIM, SIM index is begin from "MAX_PB_PHONE_ENTRIES" */
- {
- g_phb_cntx.sim_used--;
- #if defined(__MMI_PHB_EMAIL_SORT__) && defined(__MMI_PHB_USIM_FIELD__)
- if (g_phb_email_sorted == 1)
- {
- mmi_phb_sort_email_delete_index(store_index);
- }
- #endif /* defined(__MMI_PHB_EMAIL_SORT__) && defined(__MMI_PHB_USIM_FIELD__) */
- }
- else
- {
- g_phb_cntx.phone_used--;
- /* Clear birthday field */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__) && defined(__MMI_BIRTHDAY_REMINDER__)
- mmi_phb_bday_delete_field(store_index);
- #endif
- /* Remove email entry from email sort mapping table */
- #if defined(__MMI_PHB_EMAIL_SORT__)
- if (g_phb_email_sorted == 1)
- {
- mmi_phb_sort_email_delete_index(store_index);
- }
- #endif /* defined(__MMI_PHB_EMAIL_SORT__) */
- #ifdef __SYNCML_SUPPORT__
- mmi_syncml_phb_data_changed_notification(SYNCML_RECORD_DELETE, store_index);
- #endif
- }
- /* Remove lookup table entry, and sort result when delete all done. */
- g_phb_mass_op_lookup_count += mmi_phb_op_clear_lookup_table_by_index(store_index);
- #if defined(__MMI_VRSD_DIAL__)
- /* remove voice dial tag if exists. */
- mmi_vrsddial_delete_tag_by_store_index(store_index);
- #endif /* defined(__MMI_VRSD_DIAL__) */
- /* clear phonebook entry and remove from index */
- mmi_phb_op_delete_update_index(store_index);
- if (g_phb_mass_op_abort)
- {
- g_phb_mass_op_success = FALSE;
- mmi_phb_op_delete_all_done();
- }
- else
- {
- if ((storage == MMI_SIM && g_phb_cntx.sim_used > 0) || (storage == MMI_NVRAM && g_phb_cntx.phone_used > 0))
- {
- /* g_phb_mass_op_index++; */
- mmi_phb_op_delete_all_one_after_one_req(storage);
- }
- else
- {
- mmi_phb_op_delete_all_done();
- }
- }
- }
- else
- {
- g_phb_mass_op_success = FALSE;
- mmi_phb_op_delete_all_done();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_op_delete_all_done
- * DESCRIPTION
- * delete all done. displays result.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_op_delete_all_done(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 outBuf[100], count[10];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_phb_cntx.processing = FALSE;
- TurnOnBacklight(1); /* Turn On Back Light When done */
- DeleteScreenIfPresent(SCR_IN_PROGRESS_PHB);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
- /* Sort lookup table */
- if (g_phb_mass_op_lookup_count)
- {
- mmi_phb_lookup_table_sort();
- g_phb_cntx.lookup_table_count -= g_phb_mass_op_lookup_count;
- }
- /* Clear up optional id field */
- if (g_phb_cntx.selected_storage == MMI_NVRAM)
- {
- mmi_phb_op_delete_all_update_optioal_id();
- }
- /* No need to clear video id, because it will reset when set new entry */
- /* Display result */
- if (g_phb_mass_op_success)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, TRUE, PHB_NOTIFY_TIMEOUT, SUCCESS_TONE);
- }
- else if (gSecuritySetupContext.FdlStatus) /* For FDN on Message */
- {
- DisplayPopup((PU8) GetString(STR_FDL_IS_ON), IMG_GLOBAL_UNFINISHED, TRUE, PHB_NOTIFY_TIMEOUT, ERROR_TONE);
- g_phb_mass_op_success = TRUE;
- }
- else if (!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
- /* mmi_vrsi_init_central_add_all(); */
- #endif /* defined(__MMI_VRSI__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_refresh_phb_list
- * DESCRIPTION
- * Refresh phonebook list screens
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_phb_refresh_phb_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 scr_id = GetExitScrnID();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (scr_id == SCR_PBOOK_LIST || scr_id == SCR_ID_PHB_QUICK_SEARCH_LIST)
- {
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- MMI_FALSE,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) SUCCESS_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_update_confirm
- * DESCRIPTION
- * After MMI update done, send back confirm message.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_update_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_at_general_res_req_struct *myMsgPtr;
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- myMsgPtr = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
- myMsgPtr->result = TRUE;
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = MSG_ID_MMI_AT_GENERAL_RES_REQ;
- Message.oslDataPtr = (oslParaType*) myMsgPtr;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_ind_update
- * DESCRIPTION
- * This function handles the update indication from stack, after the phonebook has been
- * updated through AT commands
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_ind_update(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_UPDATE_IND_STRUCT *localPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G4_PHB, "File: [%s] Line: [%d] <<mmi_phb_ind_update.>n", __FILE__, __LINE__));
- localPtr = (MSG_PHB_UPDATE_IND_STRUCT*) info;
- switch (localPtr->action)
- {
- case MMI_PHB_UPDATE:
- if ((g_phb_cntx.sim_used == localPtr->sim_used) && (g_phb_cntx.phone_used == localPtr->nvram_used))
- {
- mmi_phb_at_cmd_edit(info);
- }
- else
- {
- mmi_phb_at_cmd_add(info);
- }
- break;
- case MMI_PHB_DELETE:
- mmi_phb_at_cmd_delete(info);
- break;
- case MMI_PHB_DELETE_ALL:
- /* currently, AT didn't have DELETE ALL cmd */
- mmi_phb_at_cmd_delete_all(info);
- break;
- case MMI_WRITE_LND:
- #if (MAX_PHB_LN_ENTRY > 20)
- if (chis_p->nDialedCalls < TOT_SIZE_OF_DIALED_LIST)
- {
- chis_p->nDialedCalls++;
- }
- #else /* (MAX_PHB_LN_ENTRY > 20) */
- chis_p->nDialedCalls = (U8) localPtr->no_list;
- #endif /* (MAX_PHB_LN_ENTRY > 20) */
- break;
- case MMI_WRITE_LNM:
- #if (MAX_PHB_LN_ENTRY > 20)
- if (chis_p->nMissedCalls < TOT_SIZE_OF_DIALED_LIST)
- {
- chis_p->nMissedCalls++;
- }
- #else /* (MAX_PHB_LN_ENTRY > 20) */
- chis_p->nMissedCalls = (U8) localPtr->no_list;
- #endif /* (MAX_PHB_LN_ENTRY > 20) */
- break;
- case MMI_WRITE_LNR:
- #if (MAX_PHB_LN_ENTRY > 20)
- if (chis_p->nRecvdCalls < TOT_SIZE_OF_DIALED_LIST)
- {
- chis_p->nRecvdCalls++;
- }
- #else /* (MAX_PHB_LN_ENTRY > 20) */
- chis_p->nRecvdCalls = (U8) localPtr->no_list;
- #endif /* (MAX_PHB_LN_ENTRY > 20) */
- break;
- case MMI_DELETE_LND:
- if (localPtr->old_index < chis_p->nDialedCalls)
- {
- chis_p->nDialedCalls--;
- }
- break;
- case MMI_DELETE_LNM:
- if (localPtr->old_index < chis_p->nMissedCalls)
- {
- chis_p->nMissedCalls--;
- if (localPtr->old_index < chis_p->nMissedCallBeforeView)
- {
- chis_p->nMissedCallBeforeView--;
- }
- if (chis_p->nMissedCalls == 0)
- {
- HideStatusIcon(STATUS_ICON_MISSED_CALL);
- /* Add two statusicons on sublcd */
- #ifndef __MMI_SUBLCD_SHORT_STATUSICON_LIST__
- HideStatusIcon(STATUS_ICON_SUBLCD_MISSED_CALL);
- UpdateSubLCDStatusIcons();
- #endif /* __MMI_SUBLCD_SHORT_STATUSICON_LIST__ */
- }
- }
- break;
- case MMI_DELETE_LNR:
- if (localPtr->old_index < chis_p->nRecvdCalls)
- {
- chis_p->nRecvdCalls--;
- }
- break;
- }
- mmi_phb_ind_update_confirm();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_at_cmd_edit
- * DESCRIPTION
- * Handles the phonebook update indication after an entry is edited through AT command
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_at_cmd_edit(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_UPDATE_IND_STRUCT *localPtr;
- U16 deletedCnt = 0;
- U8 flag = 0;
- S16 pError;
- U16 store_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- localPtr = (MSG_PHB_UPDATE_IND_STRUCT*) info;
- if (localPtr->list[0].storage == MMI_SIM)
- {
- store_index = localPtr->list[0].record_index + MAX_PB_PHONE_ENTRIES - 1; /* Storage Location in array. */
- }
- else
- {
- store_index = localPtr->list[0].record_index - 1; /* Storage Location in array. */
- }
- /* Clear lookup table first, add later if exists. */
- deletedCnt = mmi_phb_op_clear_lookup_table_by_index(store_index);
- if (localPtr->list[0].storage == MMI_NVRAM)
- {
- /* Clear Optional Field */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- memset(&PhoneBookOptionalFields, 0, sizeof(PhoneBookOptionalFields));
- WriteRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- /* Clear birthday field */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_phb_bday_delete_field(store_index);
- #endif
- #if defined(__MMI_PHB_INFO_FIELD__)
- mmi_phb_info_delete_field(store_index);
- #endif
- #ifdef __SYNCML_SUPPORT__
- mmi_syncml_phb_data_changed_notification(SYNCML_RECORD_MODIFY, store_index);
- #endif
- }
- flag = mmi_phb_op_increase_lookup_table(store_index, (S8*) localPtr->list[0].tel.number, NULL, NULL, NULL);
- if (flag || deletedCnt)
- {
- mmi_phb_lookup_table_sort();
- g_phb_cntx.lookup_table_count -= deletedCnt;
- }
- PhoneBook[store_index].alpha_id.name_length = localPtr->list[0].alpha_id.name_length;
- PhoneBook[store_index].alpha_id.name_dcs = localPtr->list[0].alpha_id.name_dcs;
- InputboxConvertGSMToDeviceEncoding(
- localPtr->list[0].alpha_id.name,
- PhoneBook[store_index].alpha_id.name,
- localPtr->list[0].alpha_id.name_length,
- (MAX_PB_NAME_LENGTH + 1) * ENCODING_LENGTH,
- localPtr->list[0].alpha_id.name_dcs,
- 0,
- 1);
- PhoneBook[store_index].tel.type = localPtr->list[0].tel.type;
- PhoneBook[store_index].tel.length = localPtr->list[0].tel.length;
- mmi_phb_convert_to_bcd(
- PhoneBook[store_index].tel.number,
- localPtr->list[0].tel.number,
- (MAX_PB_NUMBER_LENGTH + 1) / 2);
- /* Update is column exists flag. */
- PhoneBook[store_index].field = 0;
- if (strlen((S8*) localPtr->list[0].tel.number))
- {
- PhoneBook[store_index].field |= MMI_PHB_ENTRY_FIELD_NUMBER;
- }
- /* Update Pinyin Cache for sort */
- #if defined(__MMI_PHB_PINYIN_SORT__)
- mmi_phb_util_make_pinyin_cache(store_index);
- #endif
- /* Name sorting mapping table should Re-Sort HERE, and get the new highlight position!!! */
- mmi_phb_op_delete_update_index(store_index);
- mmi_phb_sort_insert_name_index(store_index);
- g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
- /* Update email sorting mapping table */
- #if defined(__MMI_PHB_EMAIL_SORT__)
- #ifdef __MMI_PHB_USIM_FIELD__
- if (g_phb_email_sorted == 1)
- #else
- if ((localPtr->list[0].storage == MMI_NVRAM) && (g_phb_email_sorted == 1))
- #endif
- {
- mmi_phb_sort_email_delete_index(store_index);
- mmi_phb_sort_email_insert_index(store_index);
- }
- #endif /* defined(__MMI_PHB_EMAIL_SORT__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_phb_at_cmd_add
- * DESCRIPTION
- * Handles the phonebook update indication after an entry is added through AT command
- * PARAMETERS
- * info [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_phb_at_cmd_add(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PHB_UPDATE_IND_STRUCT *localPtr;
- S16 pError;
- U16 store_index;
- U8 flag = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- localPtr = (MSG_PHB_UPDATE_IND_STRUCT*) info;
- store_index = mmi_phb_op_get_store_index_and_increase_counter(localPtr->list[0].storage, localPtr->list[0].record_index);
- if (localPtr->list[0].storage == MMI_NVRAM)
- {
- /* Clear Optional Field */
- #if !defined(__MMI_PHB_NO_OPTIONAL_FIELD__)
- memset(&PhoneBookOptionalFields, 0, sizeof(PhoneBookOptionalFields));
- WriteRecord(
- NVRAM_EF_PHB_FIELDS_LID,
- (U16) (store_index + 1),
- (void*)&PhoneBookOptionalFields,
- OPTIONAL_FIELDS_RECORD_SIZE,
- &pError);
- #endif /* !defined(__MMI_PHB_NO_OPTIONAL_FIELD__) */
- /* Clear video field. */
- #if defined(__MMI_INCOMING_CALL_VIDEO__)
- mmi_phb_video_delete_by_index(store_index);
- #endif
- /* Clear birthday field */
- #if defined(__MMI_PHB_BIRTHDAY_FIELD__)
- mmi_phb_bday_delete_field(store_index);
- #endif
- #if defined(__MMI_PHB_INFO_FIELD__)
- mmi_phb_info_delete_field(store_index);
- #endif
- #ifdef __SYNCML_SUPPORT__
- mmi_syncml_phb_data_changed_notification(SYNCML_RECORD_ADD, store_index);
- #endif
- }
- #if !defined(__MMI_PHB_CALLERGROUP_IN_SIM__) /* Associate caller group in SIM card entry */
- if (localPtr->list[0].storage == MMI_NVRAM)
- #endif
- {
- mmi_phb_clear_optional_ids(store_index);