📄 mmibookcontroller.c
字号:
*******************************************************************************/
PROTECTED_MENU_HANDLER( bookEnterLRN )
{
T_MFW_HND win = mfwParent( mfw_header() );
bookPhonebookStart(win,PhbkReplyListNormal);
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookShowDetails
$Description:
show the details of current number
$Returns: Refer Menu Handlers Definition Block Above
$Arguments: Refer Menu Handlers Definition Block Above
*******************************************************************************/
PROTECTED_MENU_HANDLER( bookShowDetails )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
char temp[100];
bookShowDetailStart(win);
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookEnterLMN
$Description:
Enters de LMN List
$Returns: Refer Menu Handlers Definition Block Above
$Arguments: Refer Menu Handlers Definition Block Above
*******************************************************************************/
PROTECTED_MENU_HANDLER( bookEnterLMN )
{
T_MFW_HND win = mfwParent( mfw_header() );
bookPhonebookStart(win,PhbkMissedCallsListNormal);
return MFW_EVENT_CONSUMED;
}
//yq add for voice dial
PROTECTED_MENU_HANDLER( bookVoiceCall )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
int modify_index;
T_MFW_PHB_ENTRY l_phb_Shortentry;
T_MFW_PHB_LIST l_phb_list; /* phonebook list */
T_MFW ret;
Phbk->UpdateAction = MODIFY_EXISTING;
data->phbk->current.status.book = bookActiveBook(WRITE);
memset( Phbk->phbk->edt_buf_name,'\0', PHB_name_len+5);
memset( Phbk->phbk->edt_buf_number,'\0', PHB_number_len+3);
memset( Phbk->phbk->edt_buf_home,'\0',PHB_number_len+3);
memset( Phbk->phbk->edt_buf_office,'\0',PHB_number_len+3);
memset( Phbk->phbk->edt_buf_memo,'\0',PHB_memo_len+3);
//first we get the number an name of current selected index
switch ( Phbk->BufferTable )
{
case GlobalTable:
{
memcpy(Phbk->phbk->edt_buf_name,l_phb_index[l_phb_sort_index[Phbk->phbk->select_index].index].name,PHB_name_len);
if (l_phb_index[l_phb_sort_index[Phbk->phbk->select_index].index].phonebook==SIM_BOOK_SEL)
{
memset(&l_phb_Shortentry,0,sizeof(l_phb_Shortentry));
memset(&l_phb_list,0,sizeof(l_phb_list));
l_phb_list.entry=&l_phb_Shortentry;
l_phb_list.num_entries=1;
ret=phb_read_entries(PHB_ADN,l_phb_index[l_phb_sort_index[Phbk->phbk->select_index].index].index,MFW_PHB_PHYSICAL,1,&l_phb_list);//l_phb_index[l_phb_sort_index[Phbk->phbk->select_index].index].index
if (ret==MFW_PHB_OK)
{
memcpy(Phbk->phbk->edt_buf_number,l_phb_Shortentry.number,PHB_number_len);
}
}
else if (l_phb_index[l_phb_sort_index[Phbk->phbk->select_index].index].phonebook==NVM_BOOK_SEL)
{
if (CurrentTable != l_phb_sort_index[Phbk->phbk->select_index].index/PHB_table_len)
{
if (flash_PBread(PBTable[l_phb_sort_index[Phbk->phbk->select_index].index/PHB_table_len])!=0)
CurrentTable=l_phb_sort_index[Phbk->phbk->select_index].index/PHB_table_len;
}
UnCompressNum((char *)FFS_PBData.NVMBook[l_phb_sort_index[Phbk->phbk->select_index].index%PHB_table_len].number,Phbk->phbk->edt_buf_number);
UnCompressNum((char *)FFS_PBData.NVMBook[l_phb_sort_index[Phbk->phbk->select_index].index%PHB_table_len].home,Phbk->phbk->edt_buf_home);
UnCompressNum((char *)FFS_PBData.NVMBook[l_phb_sort_index[Phbk->phbk->select_index].index%PHB_table_len].office,Phbk->phbk->edt_buf_office);
}
}
break;
case SearchTable:
{
memcpy(Phbk->phbk->edt_buf_name,l_phb_index[bookname[Phbk->phbk->select_index].index].name,PHB_name_len);
if (l_phb_index[bookname[Phbk->phbk->select_index].index].phonebook==SIM_BOOK_SEL)
{
memset(&l_phb_Shortentry,0,sizeof(l_phb_Shortentry));
memset(&l_phb_list,0,sizeof(l_phb_list));
l_phb_list.entry=&l_phb_Shortentry;
l_phb_list.num_entries=1;
ret=phb_read_entries(PHB_ADN,l_phb_index[bookname[Phbk->phbk->select_index].index].index,MFW_PHB_PHYSICAL,1,&l_phb_list);//l_phb_index[bookname[Phbk->phbk->select_index].index].index
if (ret==MFW_PHB_OK)
{
memcpy(Phbk->phbk->edt_buf_number,l_phb_Shortentry.number,PHB_number_len);
}
}
else if (l_phb_index[bookname[Phbk->phbk->select_index].index].phonebook==NVM_BOOK_SEL)
{
if (CurrentTable != bookname[Phbk->phbk->select_index].index/PHB_table_len)
{
if (flash_PBread(PBTable[bookname[Phbk->phbk->select_index].index/PHB_table_len])!=0)
CurrentTable=bookname[Phbk->phbk->select_index].index/PHB_table_len;
}
UnCompressNum((char *)FFS_PBData.NVMBook[bookname[Phbk->phbk->select_index].index%PHB_table_len].number,Phbk->phbk->edt_buf_number);
UnCompressNum((char *)FFS_PBData.NVMBook[bookname[Phbk->phbk->select_index].index%PHB_table_len].home,Phbk->phbk->edt_buf_home);
UnCompressNum((char *)FFS_PBData.NVMBook[bookname[Phbk->phbk->select_index].index%PHB_table_len].office,Phbk->phbk->edt_buf_office);
}
}
break;
default: break;
}
//now we start the window to modify or add voice
if(strlen((char *)Phbk->phbk->edt_buf_number)!=0)
{
modify_index=IsNumberIn((char *)Phbk->phbk->edt_buf_number);
bookVoiceModifyStart(win,modify_index,(char *)Phbk->phbk->edt_buf_name,(char *)Phbk->phbk->edt_buf_number);
}
else if(strlen((char *)Phbk->edt_buf_office)!=0)
{
modify_index=IsNumberIn((char *)Phbk->phbk->edt_buf_office);
bookVoiceModifyStart(win,modify_index,(char *)Phbk->phbk->edt_buf_name,(char *)Phbk->phbk->edt_buf_office);
}
else if(strlen((char *)Phbk->phbk->edt_buf_home)!=0)
{
modify_index=IsNumberIn((char *)Phbk->phbk->edt_buf_home);
bookVoiceModifyStart(win,modify_index,(char *)Phbk->phbk->edt_buf_name,(char *)Phbk->phbk->edt_buf_home);
}
return MFW_EVENT_CONSUMED;
}
PROTECTED_MENU_HANDLER( bookVoiceList )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
TRACE_EVENT("bookvoiceList");
data->phbk->search_win = bookVoiceListStart(data->phbk->win);
return MFW_EVENT_CONSUMED;
}
PROTECTED_MENU_HANDLER( bookVoiceModify )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
if(wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].number)!=0
&&wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].name)!=0)
bookVoiceModifyStart(win,voice_index[Phbk->phbk->select_index]+1,
voice_dial[voice_index[Phbk->phbk->select_index]].name,voice_dial[voice_index[Phbk->phbk->select_index]].number);
return MFW_EVENT_CONSUMED;
}
PROTECTED_MENU_HANDLER( bookVoiceDelete )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
char delete_file[20];
if(wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].number)!=0
&&wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].name)!=0)
{
bookDeleteRecordStart(win);
}
return MFW_EVENT_CONSUMED;
}
PROTECTED_MENU_HANDLER( bookVoiceCalling )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
if(wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].number)!=0
&&wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].name)!=0)
callNumber((UBYTE *)voice_dial[voice_index[Phbk->phbk->select_index]].number);
return MFW_EVENT_CONSUMED;
}
PROTECTED_MENU_HANDLER( bookVoicePlay )
{
T_MFW_HND win = (T_MFW_HND)Menu;
T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
char play_file[20];
if(wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].number)!=0
&&wstrlen(voice_dial[voice_index[Phbk->phbk->select_index]].name)!=0)
{
wstrcpy(play_file,"/voiceD/");
wstrcat(play_file,(char *)voice_filename[voice_index[Phbk->phbk->select_index]]);
StartPlayVmRecord((callback_func)PlayVmRecord_cb,(char *)play_file);
}
return MFW_EVENT_CONSUMED;
}
//end yq added
//begin xzy add 2002/10/28 for phonebook grouping icon
#if 0
/*******************************************************************************
$Function: SetIconClassmate
$Description:
$Returns:
$Arguments:
*******************************************************************************/
/*
PROTECTED_MENU_HANDLER (SetIconClassmate)
{
T_MFW_HND win = mfwParent( mfw_header() );
bookGroupingIconSet(win, classmate);
return MFW_EVENT_CONSUMED;
}
*/
/*******************************************************************************
$Function: SetIconFriend
$Description:
$Returns:
$Arguments:
*******************************************************************************/
/*
PROTECTED_MENU_HANDLER (SetIconFriend)
{
T_MFW_HND win = mfwParent( mfw_header() );
bookGroupingIconSet(win, friends);
return MFW_EVENT_CONSUMED;
}
*/
/*******************************************************************************
$Function: SetIconFamily
$Description:
$Returns:
$Arguments:
*******************************************************************************/
/*
PROTECTED_MENU_HANDLER (SetIconFamily)
{
T_MFW_HND win = mfwParent( mfw_header() );
bookGroupingIconSet(win, family);
return MFW_EVENT_CONSUMED;
}
*/
/*******************************************************************************
$Function: SetIconWorkmate
$Description:
$Returns:
$Arguments:
*******************************************************************************/
/*
PROTECTED_MENU_HANDLER (SetIconWorkmate)
{
T_MFW_HND win = mfwParent( mfw_header() );
bookGroupingIconSet(win, workmate);
return MFW_EVENT_CONSUMED;
}
*/
#endif
PROTECTED_MENU_HANDLER(SetGroupingIcon)
{
T_MFW_HND parent_win = mfwParent( mfw_header() );
T_MFW_HND iconwin; /* 2004/04/22 sunsj modify */
T_MFW_WIN *win_data = ( (T_MFW_HDR *) parent_win )->data;
tBookStandard *data = (tBookStandard *) win_data->user;
T_phbk *Phbk = data->phbk;
T_DISPLAY_DATA display_info;
if (Phbk->select_index == 9)
{
dialog_info_init(&display_info);//gdy add
display_info.KeyEvents = KEY_CLEAR;
display_info.TextId = 0;
display_info.TextId2 = TxtChangeIconForbidden; /* 2004/04/16 sunsj modify */
display_info.TextString = '\0';
display_info.TextString2 = '\0';
display_info.LeftSoftKey = TxtNull;
display_info.RightSoftKey = TxtNull;
display_info.Time =ONE_SECS;
display_info.Callback = NULL;
display_info.iconindex=REMIND_FAILURE;
info_dialog( parent_win, &display_info );
}
else
{
/* 2004/04/22 sunsj modify */
iconwin = iconSelect_create(parent_win);
if(iconwin NEQ NULL)
{
SEND_EVENT(iconwin, ICONSELECT_INIT, 0, 0);
}
}
return MFW_EVENT_CONSUMED;
}
//end xzy add 2002/10/28 for phonebook grouping icon
/*******************************************************************************
End of File
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -