📄 mmibookservices.c
字号:
//TRACE_EVENT("CREATE_ENTRY!");
storeInFile( Phbk );
}
else if( Phbk->UpdateAction == MODIFY_EXISTING )
{
//TRACE_EVENT("MODIFY_EXISTING!");
NewIndex=changeInFile( Phbk );
sprintf(temp,"NewIndex:%d",NewIndex);
//TRACE_EVENT(temp);
}
if( data->edtname )
{
text_input_destroy(data->edtname); /* 2003/12/04 sunsj modify */
data->edtname=0;
}
if( data->edtnumber )
{
editor_destroy(data->edtnumber);
data->edtnumber=0;
}
if( (MmiBookCurrentText()==TxtEditSucceed)||(MmiBookCurrentText()==TxtAddSucceed) )
{
T_EasyName data;
memset(&data,0,sizeof(data));
memcpy(data.name,Phbk->edt_buf_name,PHB_name_len+2);
memcpy(data.number,Phbk->edt_buf_number,PHB_number_len);
ChangeFlashDCTbDataName(data);
}
SEND_EVENT( Phbk->input_win, INPUT_DESTROY, NULL, NULL);
Phbk->input_win = 0;
if( Phbk->UpdateAction == CREATE_ENTRY )
{
bookShowInformation( win, MmiBookCurrentText(), NULL,NULL );
}
else if( Phbk->UpdateAction == MODIFY_EXISTING )
{
/* 2003/12/04 sunsj the list parent win is search win, the win
need not to be displaied again so i turn off the flag */
MfwHdr * parent_win = (MfwHdr*) mfwParent(Dynamicwin);
MfwWin * parent_controlBlock = ((MfwHdr *) parent_win)->data;
parent_controlBlock->flags ^= MfwWinVisible;
SEND_EVENT(parentwin, E_MNU_ESCAPE, NULL, NULL);
listsDestroy(Dynamicwin);
parent_controlBlock->flags |= MfwWinVisible;
bookShowInformation(searchwin, MmiBookCurrentText(), NULL,(T_VOID_FUNC)book_edit_cb);
}
}
else if( (Phbk->BookType==NVM_BOOK_SEL) && (wstrlen((char *)Phbk->edt_buf_name)!=0) &&
((strlen((char *)Phbk->edt_buf_number)!=0) || (strlen((char *)Phbk->edt_buf_home)!=0) || (strlen((char *)Phbk->edt_buf_office)!=0)) )
{
/* 2004/05/18 sunsj remove */
dspl_ClearAll();
#if (MAIN_LCD_SIZE==3)//jhxu720
DRAW_ICON_SEL(ICON_POPUPICON,7);//jhxu720
#elif ( MAIN_LCD_SIZE==4 )
/* 2004/06 sunsj modify for picture manage */
DRAW_ICON_SEL(ICON_POPWAITING, 0);
//dspl_BitBlt(48, 52, 32, 32,0,(void*)waiting1,0);
#elif ( MAIN_LCD_SIZE==2 )
dspl_BitBlt(44,50,32,32,0,(void *)iconWaitting,0);
#endif
if( Phbk->UpdateAction==CREATE_ENTRY )
{
for( i=0;i<ALL_NVM_LIST;i++ )
{
//sprintf(temp,"CheckFlag(%d):%d",i,CheckFlag(i));
//TRACE_EVENT(temp);
//sprintf(temp,"check:%d",!CheckFlag(i));
//TRACE_EVENT(temp);
if( !CheckFlag(i) )
{
memcpy(l_phb_index[i].name,Phbk->edt_buf_name,PHB_name_len+2);
l_phb_index[i].phonebook=NVM_BOOK_SEL;
l_phb_index[i].number[0]=GetShortNumber((char *)Phbk->edt_buf_number);
l_phb_index[i].number[1]=GetShortNumber((char *)Phbk->edt_buf_home);
l_phb_index[i].number[2]=GetShortNumber((char *)Phbk->edt_buf_office);
l_phb_index[i].flag=SetAddFlag(i);
l_phb_index[i].flag|=0x0F;//yq modified 2003/3/6 set grouping=0x0f,it means no group;
switch( Phbk->FirstNumber )
{
case NUMBER:
l_phb_index[i].flag=SetFirstNumFlag(i, 1);
break;
case HOME:
l_phb_index[i].flag=SetFirstNumFlag(i, 2);
break;
case OFFICE:
l_phb_index[i].flag=SetFirstNumFlag(i, 3);
break;
}
//sprintf(temp,"CheckFlag(%d):%d",i,CheckFlag(i));
//TRACE_EVENT(temp);
if( CurrentTable!=(i/PHB_table_len) )
{
if( flash_PBread(PBTable[i/PHB_table_len])!=0 )
CurrentTable=i/PHB_table_len;
}
memcpy(FFS_PBData.NVMBook[i%PHB_table_len].name,Phbk->edt_buf_name,PHB_name_len+2);
CompressNum((char *)Phbk->edt_buf_number,FFS_PBData.NVMBook[i%PHB_table_len].number);
CompressNum((char *)Phbk->edt_buf_home,FFS_PBData.NVMBook[i%PHB_table_len].home);
CompressNum((char *)Phbk->edt_buf_office,FFS_PBData.NVMBook[i%PHB_table_len].office);
memcpy(FFS_PBData.NVMBook[i%PHB_table_len].memo,Phbk->edt_buf_memo,PHB_memo_len+3);
FFS_PBData.NVMBook[i%PHB_table_len].info=l_phb_index[i].flag;
flash_PBwrite(PBTable[CurrentTable]);
//sprintf(temp,"CurrentTable:%d",CurrentTable);
//TRACE_EVENT(temp);
NVMTotal=NVMTotal+1;
PHBKTotal=PHBKTotal+1;
Create_SORT_Table(l_phb_index,ALL_NUMBER_LIST);
break;
}
}
MmiBookSetCurrentText( TxtAddSucceed );
}
else if( Phbk->UpdateAction==MODIFY_EXISTING )
{
switch( Phbk->BufferTable )
{
case GlobalTable:
{
//sprintf(temp,"select_index:%d",Phbk->select_index);
//TRACE_EVENT(temp);
Index=l_phb_sort_index[Phbk->select_index].index;
if( Index/PHB_table_len!=CurrentTable )
{
if( flash_PBread(PBTable[Index/PHB_table_len])!=0 )
CurrentTable=Index/PHB_table_len;
}
memcpy(l_phb_index[Index].name,Phbk->edt_buf_name,PHB_name_len+2);
l_phb_index[Index].number[0]=GetShortNumber((char *)Phbk->edt_buf_number);
l_phb_index[Index].number[1]=GetShortNumber((char *)Phbk->edt_buf_home);
l_phb_index[Index].number[2]=GetShortNumber((char *)Phbk->edt_buf_office);
memcpy(FFS_PBData.NVMBook[Index%PHB_table_len].name,Phbk->edt_buf_name,PHB_name_len+2);
CompressNum((char *)Phbk->edt_buf_number,FFS_PBData.NVMBook[Index%PHB_table_len].number);
CompressNum((char *)Phbk->edt_buf_home,FFS_PBData.NVMBook[Index%PHB_table_len].home);
CompressNum((char *)Phbk->edt_buf_office,FFS_PBData.NVMBook[Index%PHB_table_len].office);
memcpy(FFS_PBData.NVMBook[Index%PHB_table_len].memo,Phbk->edt_buf_memo,PHB_memo_len+3);
FFS_PBData.NVMBook[Index%PHB_table_len].info=l_phb_index[Index].flag;
flash_PBwrite(PBTable[CurrentTable]);
l_phb_sort_index[Phbk->select_index].name=GetShortName(Phbk->edt_buf_name);
NewIndex=SetLocation(l_phb_sort_index,Phbk->select_index);//reset location
MmiBookSetCurrentText( TxtEditSucceed );
}
break;
case SearchTable:
{
//sprintf(temp,"select_index:%d",Phbk->select_index);
//TRACE_EVENT(temp);
Index=bookname[Phbk->select_index].index;
if( Index/PHB_table_len!=CurrentTable )
{
if( flash_PBread(PBTable[Index/PHB_table_len])!=0 )
CurrentTable=Index/PHB_table_len;
}
memcpy(l_phb_index[Index].name,Phbk->edt_buf_name,PHB_name_len+2);
l_phb_index[Index].number[0]=GetShortNumber((char *)Phbk->edt_buf_number);
l_phb_index[Index].number[1]=GetShortNumber((char *)Phbk->edt_buf_home);
l_phb_index[Index].number[2]=GetShortNumber((char *)Phbk->edt_buf_office);
memcpy(FFS_PBData.NVMBook[Index%PHB_table_len].name,Phbk->edt_buf_name,PHB_name_len+2);
CompressNum((char *)Phbk->edt_buf_number,FFS_PBData.NVMBook[Index%PHB_table_len].number);
CompressNum((char *)Phbk->edt_buf_home,FFS_PBData.NVMBook[Index%PHB_table_len].home);
CompressNum((char *)Phbk->edt_buf_office,FFS_PBData.NVMBook[Index%PHB_table_len].office);
memcpy(FFS_PBData.NVMBook[Index%PHB_table_len].memo,Phbk->edt_buf_memo,PHB_memo_len+3);
FFS_PBData.NVMBook[Index%PHB_table_len].info=l_phb_index[Index].flag;
flash_PBwrite(PBTable[CurrentTable]);
//bookname[Phbk->select_index].name=GetShortName(Phbk->edt_buf_name);
for( i=0;i<SearchTotal;i++ )
{
if( l_phb_sort_index[i].index==bookname[Phbk->select_index].index )
{
l_phb_sort_index[i].name=GetShortName(Phbk->edt_buf_name);
break;
}
}
NewIndex=SetSearchLocation(bookname,Phbk->select_index);//reset location
MmiBookSetCurrentText( TxtEditSucceed );
}
break;
default: break;
}
}
if( (MmiBookCurrentText()==TxtEditSucceed)||(MmiBookCurrentText()==TxtAddSucceed) )
{
T_EasyName data;
memset(&data,0,sizeof(data));
memcpy(data.name,Phbk->edt_buf_name,PHB_name_len+2);
if( (strlen((char *)Phbk->edt_buf_number)!=0) )
{
memcpy(data.number,Phbk->edt_buf_number,PHB_number_len);
ChangeFlashDCTbDataName(data);
}
if( (strlen((char *)Phbk->edt_buf_home)!=0) )
{
memcpy(data.number,Phbk->edt_buf_home,PHB_number_len);
ChangeFlashDCTbDataName(data);
}
if( (strlen((char *)Phbk->edt_buf_office)!=0) )
{
memcpy(data.number,Phbk->edt_buf_office,PHB_number_len);
ChangeFlashDCTbDataName(data);
}
}
if( data->edtname )
{
/* 2003/12/04 sunsj modify for new editor mode */
//editor_destroy(data->edtname);
text_input_destroy(data->edtname);
data->edtname=0;
}
if( data->edtnumber )
{
editor_destroy(data->edtnumber);
data->edtnumber=0;
} /*
if ( data->edthome )
{
editor_destroy(data->edthome);
data->edthome=0;
}
if ( data->edtoffice )
{
editor_destroy(data->edtoffice);
data->edtoffice=0;
}
*/
/* 2003/12/04 sunsj destroy memo editor */
if( data->edtmemo )
{
text_input_destroy(data->edtmemo);
data->edtmemo=0;
}
if( Phbk->UpdateAction == CREATE_ENTRY )
{
bookShowInformation( win, MmiBookCurrentText(), NULL,NULL );
}
SEND_EVENT( Phbk->input_win, INPUT_DESTROY, NULL, NULL);
Phbk->input_win = 0;
if( Phbk->UpdateAction == MODIFY_EXISTING )
{
/* 2003/12/04 sunsj the list parent win is search win, the win
need not to be displaied again so i turn off the flag */
MfwHdr * parent_win = (MfwHdr*) mfwParent(Dynamicwin);
MfwWin * parent_controlBlock = ((MfwHdr *) parent_win)->data;
parent_controlBlock->flags ^= MfwWinVisible;
SEND_EVENT(parentwin, E_MNU_ESCAPE, NULL, NULL);
listsDestroy(Dynamicwin);
parent_controlBlock->flags |= MfwWinVisible;
bookShowInformation(searchwin, MmiBookCurrentText(), NULL,(T_VOID_FUNC)book_edit_cb);
}
}
else
{
if( (Phbk->BookType==SIM_BOOK_SEL) && (Phbk->MODE==NAME) )
{
if( data->edtname )
{
/* 2003/12/04 sunsj modify for new editor mode */
//editor_destroy(data->edtname);
text_input_destroy(data->edtname);
data->edtname=0;
}
oldColor=dspl_SetBkgColor(0xDBF4FF);
dspl_Clear(6, 42, 114, 76);
dspl_SetBkgColor(oldColor);
if( strlen((char *)Phbk->edt_buf_name)!=0 )
{
oldFontColor=dspl_SetBkgColor(0xDBF4FF);
dspl_TextOut_Blk(6,42,114,0,(char *)Phbk->edt_buf_name);
dspl_SetBkgColor(oldFontColor);
}
SEND_EVENT( data->win, INPUT_NUMBER, NULL , NULL);
}
if( (Phbk->BookType==NVM_BOOK_SEL) && (Phbk->MODE==NAME) )
{
if( data->edtname )
{
/* 2003/12/04 sunsj modify for new editor mode */
//editor_destroy(data->edtname);
text_input_destroy(data->edtname);
data->edtname=0;
}
oldColor=dspl_SetBkgColor(0xDBF4FF);
dspl_Clear(6, 42, 114, 76);
dspl_SetBkgColor(oldColor);
if( strlen((char *)Phbk->edt_buf_name)!=0 )
{
oldFontColor=dspl_SetBkgColor(0xDBF4FF);
dspl_TextOut_Blk(6,42,114,0,(char *)Phbk->edt_buf_name);
dspl_SetBkgColor(oldFontColor);
}
SEND_EVENT( data->win, INPUT_NUMBER, NULL , NULL);
if( Phbk->FirstNumber==NUMBER )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -