⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phonebookmain.c

📁 mtk 6225平台下电话本的主要实现
💻 C
📖 第 1 页 / 共 5 页
字号:
extern void mmi_phb_list_filter_vip(void);
extern mmi_VIP_phb_context_struct  g_vip_phb_context;
extern pwr_context_struct g_pwr_context;
#endif

#ifdef __MMI_PHB_USIM_FIELD__
static void mmi_phb_ind_startup_phase1_finish(void *info);
static void mmi_phb_startup_anr_read_rsp(void *info);
static void mmi_phb_startup_email_read_rsp(void *info);
static void mmi_phb_startup_gas_read_rsp(void *info);
static void mmi_phb_read_usim_field(U8 access_id);
static void mmi_phb_read_usim_anr_field(void *info);
static void mmi_phb_read_usim_email_field(void *info);
static void mmi_phb_read_usim_gas_field(void *info);
static void mmi_phb_read_usim_grp_field(void *info);
#endif /* __MMI_PHB_USIM_FIELD__ */ 
#if defined(__MMI_T_FLASH_STORE_SUPPORT__)
extern void mmi_phb_highlight_memory_card_entry(void);
#endif

BOOL multigsm_pb_trace_enable = FALSE;//for trace
void multigsm_pb_trace(char *fmt, ...) //for test
{
	if(multigsm_pb_trace_enable)
	{
		va_list pArg; 
		static char tempString[500];	
		module_type mod_id = MOD_MMI;	

		va_start(pArg, fmt);
	 	vsprintf(tempString, fmt, pArg);
		va_end(pArg);

		kal_prompt_trace(mod_id, tempString);
	}
}

#ifdef __SLT_MMI_MULTIGSM_PHONEBOOK_TWO_SEND_KEY__
#ifdef __SLT_MMI_GEMINI_ONE_SENDKEY__    //jean,080327,for n220
void HandleSendKeys(FuncPtr funcPtr)
{
	#ifdef __SLT_MMI_DUAL_SIM_MASTER__  //jean,080326,forbug2096
	if(isInCall())
	{
		if(MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD1_USABLE)
		{
				SetKeyHandler(funcPtr, KEY_SEND_MAIN, KEY_EVENT_UP );
		}
		else if(MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD2_USABLE)
		{
		              SetKeyHandler( funcPtr, KEY_SEND_MAIN, KEY_LONG_PRESS );
		}
	}
	else
	#endif
		{
			if(mmi_bootup_get_active_flight_mode1()==0)    
				SetKeyHandler(funcPtr, KEY_SEND_MAIN, KEY_EVENT_UP );
			if(mmi_bootup_get_active_flight_mode2()==0)    
		              SetKeyHandler( funcPtr, KEY_SEND_MAIN, KEY_LONG_PRESS );
		}
}
#else
void HandleSendKeys(FuncPtr funcPtr)
{
	#ifdef __SLT_MMI_DUAL_SIM_MASTER__  //jean,080326,forbug2096
	if(isInCall())
	{
		if(MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD1_USABLE)
		{
				SetKeyHandler(funcPtr, KEY_SEND_MAIN, KEY_EVENT_UP );
		}
		else if(MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD2_USABLE)
		{
		              SetKeyHandler( funcPtr, KEY_SEND_SUB, KEY_EVENT_UP );
		}
	}
	else
	#endif
		{
			if(mmi_bootup_get_active_flight_mode1()==0)    
				SetKeyHandler(funcPtr, KEY_SEND_MAIN, KEY_EVENT_UP );
			if(mmi_bootup_get_active_flight_mode2()==0)    
		              SetKeyHandler( funcPtr, KEY_SEND_SUB, KEY_EVENT_UP );
		}
}
#endif
void MakeCallWithTwoSendKey(PS8 strNumber) 
{
	U16 keyCode, keyType;
	GetkeyInfo(&keyCode, &keyType);
#ifdef __SLT_MMI_GEMINI_ONE_SENDKEY__  //jean,080327,for N220
	keyCode = GetOneSendkeyInfo(keyCode,keyType);
#endif
	if(keyCode == KEY_SEND_MAIN || keyCode == KEY_SEND_SUB)
	{
		#ifdef __SLT_MMI_DUAL_SIM_MASTER__  //jean,080327,forbug2096
		if(isInCall())
		{
			if(((MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD1_USABLE)&&(keyCode == KEY_SEND_MAIN))||
				((MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD2_USABLE)&&(keyCode == KEY_SEND_SUB)))
			{
				MakeCallWithKey((PS8)strNumber,keyCode);
			}
			else
			{
			DisplayPopup(
		            (PU8) GetString(STR_ID_UCM_NOT_ALLOW_TO_DIAL),   //080409
		            IMG_GLOBAL_EMPTY,
		            TRUE,
		            PHB_NOTIFY_TIMEOUT,
		            EMPTY_LIST_TONE);
				        return;

			}
		}
		else
		#endif
		{
			MakeCallWithKey((PS8)strNumber,keyCode);
		}
	}
	else //only two path enter here
	{
		GetSendKeyFromSelectMenu();
		if(sendkey== KEY_SEND_MAIN || sendkey == KEY_SEND_SUB)
		{
		#ifdef __SLT_MMI_DUAL_SIM_MASTER__  //jean,080327,forbug2096,for ip outgoing
		if(isInCall())
		{
			kal_prompt_trace(MOD_CC,"==IP===MakeCallWithTwoSendKey@isInCal@MTPNP_AD_Get_UsableSide=%d",MTPNP_AD_Get_UsableSide());

			if(((MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD1_USABLE)&&(sendkey == KEY_SEND_MAIN))||
				((MTPNP_AD_Get_UsableSide() ==MTPNP_AD_SIMCARD2_USABLE)&&(sendkey == KEY_SEND_SUB)))
			{
				MakeCallWithKey((PS8)strNumber,sendkey);
			}
			else
			{
			DisplayPopup(
		            (PU8) GetString(STR_ID_UCM_NOT_ALLOW_TO_DIAL),   //080409
		            IMG_GLOBAL_EMPTY,
		            TRUE,
		            PHB_NOTIFY_TIMEOUT,
		            EMPTY_LIST_TONE);
				        return;

			}
		}
		else
		#endif
			{
				MakeCallWithKey((PS8)strNumber,sendkey);
			}
		}//temp below must assert
		else
		{
		DisplayPopup(
	            (PU8) GetString(STR_GLOBAL_ERROR),
	            IMG_GLOBAL_EMPTY,
	            TRUE,
	            PHB_NOTIFY_TIMEOUT,
	            EMPTY_LIST_TONE);
	        return;
	    }
	}
	multigsm_pb_trace("MakeCallWithTwoSendKey");	
}
#endif

#ifdef __SLT_MMI_SMS_SEND_TO_MANY_STYLE2__//kangsc 20060412

U8 mmi_phb_get_phonebook_selected_number(S8* pString, U16 index)  //wyl12082
{
	U16 storageIndex = g_phb_name_index[index];
	S16 pError = 0;
	U8 retValue = TRUE;
	ASSERT(pString != NULL);
	switch (g_phb_isselected[storageIndex])
	{
		case 0:
			retValue = FALSE;
			break;
		case 1:
			if(PhoneBook[storageIndex].tel.type == MMI_CSMCC_INTERNATIONAL_ADDR) 
			{
				pString[0] = '+';
				mmi_phb_convert_to_digit((U8*)(pString + 1), PhoneBook[storageIndex].tel.number, MAX_PB_NUMBER_LENGTH + 1);
			}
			else 
			{
				mmi_phb_convert_to_digit((U8*)pString, PhoneBook[storageIndex].tel.number, MAX_PB_NUMBER_LENGTH + 1);
			}
			break;
		case 2:
			ReadRecord(NVRAM_EF_PHB_FIELDS_LID, (U16)(storageIndex+1), (void*)&PhoneBookOptionalFields, OPTIONAL_FIELDS_RECORD_SIZE, &pError);		
			strcpy(pString, (PS8)PhoneBookOptionalFields.homeNumber); 
			break;
		case 3:
			ReadRecord(NVRAM_EF_PHB_FIELDS_LID, (U16)(storageIndex+1), (void*)&PhoneBookOptionalFields, OPTIONAL_FIELDS_RECORD_SIZE, &pError);		
			strcpy(pString, (PS8)PhoneBookOptionalFields.officeNumber); 
			break;
		case 4:
			ReadRecord(NVRAM_EF_PHB_FIELDS_LID, (U16)(storageIndex+1), (void*)&PhoneBookOptionalFields, OPTIONAL_FIELDS_RECORD_SIZE, &pError);		
			strcpy(pString, (PS8)PhoneBookOptionalFields.faxNumber); 
			break;
		default:
			retValue = FALSE;
			break;
	}
	return retValue;
}

extern U8 g_phb_isselected[MAX_PB_ENTRIES];
U16  mmi_phb_get_select_entries_number()
{
	U16 i,num=0;
	for(i=0;i<PhoneBookEntryCount;i++)
	{
		if(g_phb_isselected[g_phb_name_index[i]]>0)
			num++;
	}
	return num;
}

void mmi_phb_v400_select_number_left_soft_redraw(void)
{
	if (mmi_phb_get_select_entries_number()>0)
	{
		ChangeLeftSoftkey(lskstr,lskimg);
		SetCategory200LeftSoftkeyFunction(lskfuncptr,KEY_EVENT_UP);
		SetLeftSoftkeyFunction(lskfuncptr,KEY_EVENT_UP);	
	}
	else
	{
		ChangeLeftSoftkey(0,0);
		SetCategory200LeftSoftkeyFunction(NULL,KEY_EVENT_UP);
		SetLeftSoftkeyFunction(NULL,KEY_EVENT_UP);
	}
}


void mmi_phb_reset_select_entries(void)
{
	U16 i;
	for(i=0;i<MAX_PB_ENTRIES;i++)
		g_phb_isselected[i]=0;	//not selected
}
void mmi_phb_go_back_from_select_screen(void)
{
	if(mmi_phb_get_select_entries_number()>0)
		mmi_phb_reset_select_entries();	

	GoBackHistory();
}

void mmi_phb_exit_select_number_screen()
{
	//ChangeCenterSoftkey(0, 0);   //wyltest
#ifdef __SLT_PHB_ADD_CALL_GROUP_ICON__
	mmi_phb_group_delete_group_id_cache();
#endif
	MMI_PHB_SELECTED_FLAG = FALSE;
}
#endif

#define MMI_PHB_INIT
/*****************************************************************************
 * FUNCTION
 *  mmi_phb_init_protocol
 * DESCRIPTION
 *  Initialize phonebook protocol handler. This should be call before L4 begin to read
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_phb_init_protocol(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2(MMI_TRACE_G4_PHB, "File: [%s]  Line: [%d] <<mmi_phb_init_protocol.>\n", __FILE__, __LINE__);
#ifdef __MMI_PHB_USIM_FIELD__
    SetProtocolEventHandler(mmi_phb_ind_startup_phase1_finish, PRT_PHB_STARTUP_PHASE1_FINISH_IND);
    SetProtocolEventHandler(mmi_phb_read_usim_anr_field, PRT_PHB_STARTUP_READ_ANR_IND);
    SetProtocolEventHandler(mmi_phb_read_usim_email_field, PRT_PHB_STARTUP_READ_EMAIL_IND);
    SetProtocolEventHandler(mmi_phb_read_usim_gas_field, PRT_PHB_STARTUP_READ_GAS_IND);
    SetProtocolEventHandler(mmi_phb_read_usim_grp_field, PRT_PHB_STARTUP_READ_GRP_IND);
#endif /* __MMI_PHB_USIM_FIELD__ */ 

    SetProtocolEventHandler(mmi_phb_ind_startup_finish, PRT_PHB_STARTUP_FINISH_IND);
    SetProtocolEventHandler(mmi_phb_ind_startup_begin, PRT_PHB_STARTUP_BEGIN_IND);
    SetProtocolEventHandler(mmi_phb_ind_startup_read, PRT_PHB_STARTUP_READ_IND);

#if defined(SUPPORT_JSR_75_PIM) || defined(SUPPORT_CMCC)
    mmi_phb_java_handler_init();
#endif 

    /* Initial Global Context. */
    g_phb_cntx.phb_ready = FALSE;
    g_phb_cntx.processing = FALSE;
    g_phb_cntx.nvram_data_init = FALSE;
    g_phb_cntx.optional_ids = &g_phb_optional_ids;
    g_phb_cntx.caller_group = &g_phb_caller_group[0];
#ifdef __MMI_PHB_USIM_FIELD__
    g_phb_cntx.usim_group = &g_phb_usim_group[0];
    g_phb_cntx.usim_ready_stage = MMI_PHB_USIM_NOT_READY;
    memset(g_phb_cntx.support_field, 0, MMI_PHB_USIM_FIELD_TOTAL);
#endif /* __MMI_PHB_USIM_FIELD__ */ 
    g_phb_cntx.list_filter = NULL;
    g_phb_cntx.start_scr_id = 0;
    g_phb_cntx.end_scr_id = 0;
    g_phb_cntx.refresh_list = MMI_PHB_ENTRY_REFRESH;
    g_phb_cntx.highlight_entry = 0;
    g_phb_cntx.new_highlight_entry = 0xffff;
    PhoneBookEntryCount = 0;
    g_phb_cntx.sim_used = 0;
    g_phb_cntx.phone_used = 0;
    g_phb_cntx.populate_count = 0;
    g_phb_cntx.lookup_table_count = 0;
    g_phb_cntx.current_op = MMI_PHB_OP_NONE;

    g_phb_cntx.selected_pic_index = 0;
    g_phb_cntx.selected_ring_index = 0;
    g_phb_cntx.selected_grp_index = 0;
    g_phb_cntx.selected_pattern_index = 0;
    g_phb_cntx.selected_alert_index = 0;
    g_phb_cntx.selected_pic_in_view = 0;
    g_phb_cntx.image_location = MMI_PHB_IMAGE_NO_SELECT;
    g_phb_cntx.set_done_flag = 0;
    g_phb_cntx.dial_from_list = MMI_PHB_NONE;
#if defined(__MMI_PHB_PINYIN_SORT__)
    g_phb_cntx.sort_type = MMI_PHB_SORT_PINYIN;
#else 
    g_phb_cntx.sort_type = MMI_PHB_SORT_ENCODING;
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_phb_init
 * DESCRIPTION
 *  Initialize phonebook applications.
 *  (This is used to initialize hilite/hint handlers and PS reponse callback functions)
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_phb_init(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2(MMI_TRACE_G4_PHB, "File: [%s]  Line: [%d] <<mmi_phb_init.>\n", __FILE__, __LINE__);

    mmi_phb_search_init();
    mmi_phb_operate_single_init();
    mmi_phb_operate_mass_init();
    mmi_phb_caller_group_init();
    mmi_phb_extra_number_init();
    mmi_phb_setting_init();
    PhbInitSpeedDial();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_phb_set_main_menu_highlight_handler
 * DESCRIPTION
 *  Set phonebook main menu highlight handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_phb_set_main_menu_highlight_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION_2(MMI_TRACE_G4_PHB, "File: [%s]  Line: [%d] <<mmi_phb_set_main_menu_highlight_handler.>\n",
                         __FILE__, __LINE__);

    SetHiliteHandler(MITEM101_PBOOK_SEARCH_ENTRY, mmi_phb_highlight_search_name);
#if defined(__MMI_PHB_QUICK_SEARCH__)
    SetHiliteHandler(MENU_ID_PHB_QUICK_SEARCH, mmi_phb_highlight_quick_search_list);
#endif 

#if defined(__MMI_PBOOK_SURNAME_PICKER__)
	SetHiliteHandler(MENU_ID_PHB_SURNAME_PICKER, mmi_phb_highlight_surname_picker_entry);
#endif/*__MMI_PBOOK_SURNAME_PICKER__*/
    /* Add Entry */
    SetHiliteHandler(MITEM102_PBOOK_NEW_ENTRY, mmi_phb_highlight_op_add_entry);

#ifdef __MMI_T_FLASH_STORE_SUPPORT__
	SetHiliteHandler(MENU_ID_PHB_MEMORY_CARD_CONTACTS, mmi_phb_highlight_memory_card_entry);
#endif
#if defined(__MMI_PHB_MULTI_OPERATION__)
    SetHiliteHandler(MENU_ID_PHB_MULTI_OP, mmi_phb_highlight_multi_operation);
#else
    /* Copy All */
    SetHiliteHandler(MITEM104_PBOOK_COPY_ALL, mmi_phb_highlight_copy_all);

    /* Delete All */
    SetHiliteHandler(MITEM103_PBOOK_DELETE_ALL, mmi_phb_highlight_delete_all);
	SetHiliteHandler(MENU_ID_PHB_MULTI_DELETE, mmi_phb_highlight_multi_operation);
#endif /* defined(__MMI_PHB_MULTI_OPERATION__) */
    SetHiliteHandler(MITEM109_PBOOK_CALLER_GROUPS, mmi_phb_highlight_callergroup);

    mmi_phb_extra_number_init();

    /* Settings */
    SetHiliteHandler(MITEM110_PBOOK_SETTINGS, mmi_phb_highlight_setting);
    SetHiliteHandler(MITEM1101_PBOOK_MEMORY_STATUS, mmi_phb_highlight_memory_status);
    SetHiliteHandler(MITEM1102_PBOOK_STORAGE_LOCATION, mmi_phb_highlight_storage_location);
    SetHiliteHandler(MITEM1103_PBOOK_VIEW_FIELDS, mmi_phb_highlight_view_field);

    SetHintHandler(MITEM1102_PBOOK_STORAGE_LOCATION, mmi_phb_hint_storage_location);
    SetHintHandler(MITEM_STORAGE_LOCATION_SIM, mmi_phb_hint_storage_location_in_sim);
    SetHintHandler(MITEM_STORAGE_LOCATION_PHONE, mmi_phb_hint_storage_location_in_phone);
    #ifdef __SLT_MMI_MULTIGSM_PHONEBOOK_PRE_STORAGE_LOCATION__
     SetHintHandler(MITEM_STORAGE_LOCATION_SIM2, mmi_phb_hint_storage_location_in_sim2);
    #endif

#if defined(__MMI_PHB_NAME_LIST_FILTER__)
    SetHiliteHandler(MENU_ID_PHB_NAME_LIST_FILTER, mmi_phb_highlight_name_list_filter);		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -