📄 mmibookphonebook.c
字号:
l_startidx = 1;
l_idx =0;
ReadEntries(p_type,l_startidx,p_mode,PE_SIZE);
if( l_found==0 ) return 2;
return 0;
}
#endif
//yq added for show the phbnumber in calling
static void bookCallPhb_cb(T_MFW_HND * Parent, ListMenuData * ListData)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)Parent)->data;
tBookStandard * data = (tBookStandard *)win_data->user;
T_phbk * Phbk = data->phbk;
T_MFW_WIN * windata = ((T_MFW_HDR *)ListData->win)->data;
ListWinInfo * dataInfo = (ListWinInfo *)windata->user;
T_MFW_PHB_ENTRY l_phb_Shortentry;
PhbkDetailItem l_phb_NVMEntry;
int i;
UBYTE oldmode=dspl_Enable(0);
switch( ListData->Reason )
{
case LISTS_REASON_SEND:
case LISTS_REASON_SELECT:
if( Phbk->EntryType==PhbkFromCall )
{
memset(data->edtBuf,0,sizeof(data->edtBuf));
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
{
if( ReadNVMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_NVMEntry) )
{
timStop(showtimer);
timStop(edttimer);
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
data->menu_list_data=NULL;
bookCallPhbDestroy(Parent);
switch( CurrentType )
{
T_EasyName data;
memcpy(data.name,(char *)l_phb_NVMEntry.name,PHB_name_len+2);
memcpy(data.number,(char *)l_phb_NVMEntry.number,PHB_number_len);
SetCallData(data);
case B_NUMBER:
{
callNumber((UBYTE *)l_phb_NVMEntry.number);
}
break;
case B_HOME:
{
callNumber((UBYTE *)l_phb_NVMEntry.home);
}
break;
case B_OFFICE:
{
callNumber((UBYTE *)l_phb_NVMEntry.office);
}
break;
default:break;
}
}
}
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
{
if( ReadSIMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_Shortentry) )
{
T_EasyName data1;
timStop(showtimer);
timStop(edttimer);
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
data->menu_list_data=NULL;
bookCallPhbDestroy(Parent);
memcpy(data1.name,(char *)l_phb_Shortentry.name.data,PHB_name_len+2);
memcpy(data1.number,(char *)l_phb_Shortentry.number,PHB_number_len);
SetCallData(data1);
callNumber((UBYTE *) l_phb_Shortentry.number);
}
}
}
else if( Phbk->EntryType==PhbkFromSms )
{
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
{
if( ReadNVMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_NVMEntry) )
{
switch( CurrentType )
{
case B_NUMBER:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.number);
}
break;
case B_HOME:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.home);
}
break;
case B_OFFICE:
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *)l_phb_NVMEntry.office);
}
break;
default:break;
}
}
}
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
{
if( ReadSIMRecord(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,&l_phb_Shortentry) )
{
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,(UBYTE *) l_phb_Shortentry.number);
}
}
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
data->menu_list_data=NULL;
bookCallPhbDestroy(data->win);
}
break;
case LISTS_REASON_HANGUP:
{
//if(returntoidle())
// break;
memset(data->edtBuf,0,sizeof(data->edtBuf));
timStop(showtimer);
timStop(edttimer);
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
data->menu_list_data=NULL;
bookCallPhbDestroy(Parent);
}
break;
case LISTS_REASON_BACK:
{
if( wstrlen(data->edtBuf)==0 )
{
timStop(showtimer);
timStop(edttimer);
listsDestroy(ListData->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
FREE_MEMORY((void *)data->menu_list_data,sizeof(ListMenuData));
data->menu_list_data=NULL;
bookCallPhbDestroy(Parent);
}
else
edtChar(data->edt,ecBack);
}
break;
case LISTS_REASON_UPDATE:
{
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index;
refresh_flag=1;
#if(MAIN_LCD_SIZE==4)
dspl_Clear(0,108,SCREEN_SIZE_X,126);
/* 2004/06 sunsj modify for icon manage */
//dspl_BitBlt(0, 110, 14, 14, 0, (void *)abc_bmp, 0);
DRAW_ICON_LOCATION(ICON_TEXTINPUT_abc, 0, 110);
ShowPhoneBookNumber(show_index,NONE);
edtChar(data->edt,ecBottom);
#elif(MAIN_LCD_SIZE==3)//Knuth
//dspl_Clear(0,87,128,113);
DRAW_ICON_LOCATION(ICON_TEXTINPUT_abc, 0, 70);
DRAW_ICON(ICON_SOFTKEYBAR);
displaySoftKeys(TxtSoftSelect,TxtSoftBack);
ShowPhoneBookNumber(show_index,NONE);
edtChar(data->edt,ecBottom);
#endif
}
break;
case LISTS_REASON_UP:
{
if( (ListData->CursorPosition-1>=0) || (SearchTotal<=PHONEBOOK_RECORD_PERPAGE) )
{
dataInfo->MenuListsAttr.pageturnindex=((Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal)+1;
mnuUp(dataInfo->MenuLists);
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition-1+SearchTotal)%SearchTotal].index;
show_number();
}
else
{
Phbk->BufferIndex=(Phbk->BufferIndex-PHONEBOOK_RECORD_PERPAGE+SearchTotal)%SearchTotal;
dataInfo->MenuListsAttr.pageturnindex=(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE-1)%SearchTotal+1;
for( i=0;i<PHONEBOOK_RECORD_PERPAGE;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(Dynamic_menu[i].name,l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].name,PHB_name_len);
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
Dynamic_menu[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
Dynamic_menu[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
mnuChooseVisibleItem(dataInfo->MenuLists,PHONEBOOK_RECORD_PERPAGE-1);
show_index=l_phb_sort_index[(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE-1)%SearchTotal].index;
show_number();
}
}
break;
case LISTS_REASON_DOWN:
{
if( (ListData->CursorPosition+1<PHONEBOOK_RECORD_PERPAGE) || (SearchTotal<=PHONEBOOK_RECORD_PERPAGE) )
{
dataInfo->MenuListsAttr.pageturnindex=((Phbk->BufferIndex+ListData->CursorPosition+1)%SearchTotal)+1;
mnuDown(dataInfo->MenuLists);
show_index=l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition+1)%SearchTotal].index;
show_number();
}
else
{
Phbk->BufferIndex=(Phbk->BufferIndex+PHONEBOOK_RECORD_PERPAGE)%SearchTotal;
dataInfo->MenuListsAttr.pageturnindex=((Phbk->BufferIndex)%SearchTotal)+1;
for( i=0;i<PHONEBOOK_RECORD_PERPAGE;i++ )
{
/* 2004/06 sunsj modify for picture manage */
memcpy(Dynamic_menu[i].name,l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].name,PHB_name_len);
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
Dynamic_menu[i].bookicon = *GET_ICONATTR(ICON_NVMBOOK, 0);//nvmbookicon;
else if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+i)%SearchTotal].index].phonebook==SIM_BOOK_SEL )
Dynamic_menu[i].bookicon = *GET_ICONATTR(ICON_SIMBOOK, 0);//simbookicon;
}
mnuChooseVisibleItem(dataInfo->MenuLists,0);
show_index=l_phb_sort_index[(Phbk->BufferIndex)%SearchTotal].index;
show_number();
}
}
break;
case LISTS_REASON_LEFT:
{
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
ShowPhoneBookNumber(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,TOLEFT);
}
break;
case LISTS_REASON_RIGHT:
{
if( l_phb_index[l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index].phonebook==NVM_BOOK_SEL )
ShowPhoneBookNumber(l_phb_sort_index[(Phbk->BufferIndex+ListData->CursorPosition)%SearchTotal].index,TORIGHT);
}
break;
case LISTS_REASON_KCD2:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_2);
}
break;
case LISTS_REASON_KCD3:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_3);
}
break;
case LISTS_REASON_KCD4:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_4);
}
break;
case LISTS_REASON_KCD5:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_5);
}
break;
case LISTS_REASON_KCD6:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_6);
}
break;
case LISTS_REASON_KCD7:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_7);
}
break;
case LISTS_REASON_KCD8:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_8);
}
break;
case LISTS_REASON_KCD9:
{
if( wstrlen(data->edtBuf)<2||(cursor_correct==0&&wstrlen(data->edtBuf)==2) )
yq_edtchar(data->edt,KCD_9);
}
break;
default:break;
}
dspl_Enable(oldmode);
}
void bookCallPhbDestroy( MfwHnd window )
{
T_MFW_WIN *win = ((T_MFW_HDR *) window)->data;
tBookStandard *data = (tBookStandard *) win->user;
TRACE_FUNCTION( "bookCallPhbDestroy()" );
// Only destroy if the data is valid
if( data )
{
if( data->phbk->root_win == window )
{
bookPhonebookDestroy( data->phbk->win );
return;
}
if( showtimer )
{
timStop(showtimer);
timDelete(showtimer);
showtimer=0;
}
if( edttimer )
{
timStop(edttimer);
timDelete(edttimer);
edttimer=0;
}
if( data->menu_list_data!=NULL )
{
TRACE_EVENT("we have win");
listsDestroy(data->menu_list_data->win);
FREE_MEMORY((void *)data->menu_list_data->List,GetFree(SearchTotal)*sizeof(T_MFW_MNU_ITEM));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -