📄 mmibooksearchwindow.c
字号:
{
/* Deal with the window visible event
*/
MmiBookShowDefault();
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
ATB_edit_Show( data->editor );
#else /* NEW_EDITOR */
edtShow( data->edt );
#endif /* NEW_EDITOR */
}
/* SPR#1428 - SH - New Editor: Only update the list if we're not in multi-tap */
#ifdef NEW_EDITOR
if (!data->editor->multitap)
{
#endif /* NEW_EDITOR */
for ( index = 0; index < MAX_SEARCH_NAME; index++ )
{
TIME_TRACE_EVENT( "bookSearchWindowCB()-loopstart" );
pchr = (char *) MmiBookCallList( index );
memset( pchr, '\0', NAME_SCREEN_MAX );
/* SPR#1428 - SH - remove extraneous call to edtShow*/
#ifdef NO_ASCIIZ
/*if current language chinese*/
if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
{
if ( Current->entry[ index ].name.len NEQ 0) //if name not empty
{
if (Current->entry[ index ].name.data[0] != 0x80)//if not unicode
{/*we have to convert to unicode*/
pchr2[0]= 0x80;/*SPR 1442, add unicode tag*/
pchr2[1]= 0x7f;
SmsRead_convertSMSmsg((char*)Current->entry[ index ].name.data, MFW_ASCII,
(UBYTE)strlen((char*)Current->entry[ index ].name.data), &pchr2[2], MFW_DCS_UCS2, NAME_SCREEN_MAX*3, FALSE);
/*SPR 1442 and now truncate the string*/
resources_truncate_to_screen_width((char *) pchr2, Current->entry[ index ].name.len*2+2, pchr,NAME_SCREEN_MAX*3 , SCREEN_SIZE_X, TRUE);
}
else /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
{
/*SPR 1442 truncate the string*/
resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, MAX_ALPHA_LEN, SCREEN_SIZE_X, TRUE);
}
}
else /*we convert number string into unicode*/
{ pchr2[0]= 0x80;/*SPR 1442, add unicode tag*/
pchr2[1]= 0x7f;
SmsRead_convertSMSmsg((char*)Current->entry[ index ].number, MFW_ASCII,
(UBYTE)strlen((char*)Current->entry[ index ].number), &pchr2[2], MFW_DCS_UCS2, NAME_SCREEN_MAX*3, FALSE);
/*SPR 1442 and now truncate the string*/
resources_truncate_to_screen_width((char *) pchr2, strlen((char*)Current->entry[ index ].number)*2+2, pchr, NAME_SCREEN_MAX*3, SCREEN_SIZE_X, TRUE);
}
}
else
{ /*if current language a latin language*/
#ifdef WIN32
// EF check for null pointer first
if (!Current->list.entry == NULL)
#endif
if (Current->list.entry[MAX_SEARCHED-1].name.data[0] != 0x80 && Mmi_getCurrentLanguage() != CHINESE_LANGUAGE)
if ( Current->entry[ index ].name.len NEQ 0&&Current->entry[ index ].name.data[0] != 0x80/*mc*/) //Should check to see if null name
{ /*mc, SPR 1442, replaced old truncation function with new one*/
resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, PHB_MAX_LEN, SCREEN_SIZE_X, FALSE);
}
else
{/*mc, SPR 1442, replaced old truncation function with new one*/
resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHB_MAX_LEN, SCREEN_SIZE_X,FALSE);
}
#else
if ( Current->entry[ index ].name[ 0 ] != NULL) //Should check to see if null name
{ /*mc, SPR 1442, replaced old truncation function with new one*/
resources_truncate_to_screen_width((char *) Current->entry[index].name, 0, pchr, PHB_MAX_LEN, SCREEN_SIZE_X, FALSE);
}
else
{ /*mc, SPR 1442, replaced old truncation function with new one*/
resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHB_MAX_LEN, SCREEN_SIZE_X,FALSE);
}
#endif
#ifdef NO_ASCIIZ/*MC SPR 975, opening bracket only exists when NO_ASCIIZ defined*/
}
#endif
}
TIME_TRACE_EVENT( "bookSearchWindowCB()-end of loop" );
mnuShow(data->menu);
/* SPR#1428 - SH - End of condition to check if we're in multi-tap */
#ifdef NEW_EDITOR
}
#endif
/* special case if invoked from SMS or using SDN book
*/
if ( ( data->phbk->fromSMS )||
( data->phbk->fromSMSSC ) || /* SPR#1428 - SH - New event for service centre editor */
( data->phbk->fromDivert ) ||
( data->phbk->fromDeflect )||
( Current->status.book == PHB_SDN ) )
displaySoftKeys( TxtSoftSelect, TxtSoftBack );
else
{
displaySoftKeys( TxtSoftOptions, TxtSoftBack );
}
}
TIME_TRACE_EVENT( "bookSearchWindowCB()-sk display end" );
break;
default:
{
/* default is to pass event back for further handling
*/
return MFW_EVENT_PASSED;
}
break;
}
/* consume the event
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookSearchKbdCB
$Description: Keyboard handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, key handle
*******************************************************************************/
static int bookSearchKbdCB( MfwEvt e, MfwKbd *k )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
tBookStandard *data = (tBookStandard *) win_data->user;
tMmiPhbData *Current = &data->phbk->current;
TRACE_FUNCTION ("bookSearchKbdCB()");
/* SPR#1428 - SH - New editor doesn't require editActivate */
#ifndef NEW_EDITOR
/* Set our editor active if it isn't already
*/
if ( activeEditor() != data->edt )
editActivate( data->edt, TRUE);
#endif
/* Deal with the key and event combinatino
*/
switch( k->code )
{
case KCD_MNUUP:
{
/* scroll up
*/
SEND_EVENT( data->win, SEARCH_SCROLL_UP, 0, 0 );
winShow( data->win );
}
break;
case KCD_MNUDOWN:
{
/* scroll down
*/
SEND_EVENT( data->win, SEARCH_SCROLL_DOWN, 0, 0 );
winShow( data->win );
}
break;
case KCD_CALL:
if ( data->phbk->fromSMS )
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
(UBYTE *) Current->entry[ Current->selectedName ].number );
else if ( data->phbk->fromSMSSC )
SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID,
(UBYTE *) Current->entry[ Current->selectedName ].number );
else
{ if (data->phbk->fromDeflect /*SPR 1392, select number don't call it*/ )
SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,
(UBYTE *) Current->entry[ Current->selectedName ].number );
else
callNumber( Current->entry[ Current->selectedName ].number );
}
bookPhonebookDestroy(data->phbk->win);
break;
/* JVJ #1743 Right key deletes the characters, HUP destroys the window */
#ifdef NEW_EDITOR
case KCD_HUP:
#else /* NEW_EDITOR */
case KCD_HUP:
#endif /* NEW_EDITOR */
{
if ( data->phbk->fromSMS ){ /* Send empty string so that ptr can be set 0*/
SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
"" );
bookPhonebookDestroy(data->phbk->win);
}
else if ( data->phbk->fromSMSSC ){
SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID,
NULL );
bookPhonebookDestroy(data->phbk->win);
}
/* Marcus (mk): Issue 1010: 2002-08-22: Start */
else if (data->phbk->fromDivert)
{
bookPhonebookDestroy(data->phbk->win);
}
else if (data->phbk->fromDeflect)/*MC SPR 1392*/
{ /*Send empty string so that pointer to this window can be set to 0*/
SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,"");
bookPhonebookDestroy(data->phbk->win);
}
/* Marcus (mk): Issue 1010: 2002-08-22: End */
else
bookSearchDestroy(data->win);
}
break;
case KCD_MNUSELECT:
case KCD_LEFT:
{
/* if in SMS send the event to it
*/
if ( data->phbk->fromSMS )
{ SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */,
(UBYTE *) Current->entry[ Current->selectedName ].number );
bookPhonebookDestroy(data->phbk->win);
}
else if ( data->phbk->fromSMSSC )
{ SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */,
(UBYTE *) Current->entry[ Current->selectedName ].number );
bookPhonebookDestroy(data->phbk->win);
}
else if(data->phbk->fromDivert ) //MZ 26/02/01 check for divert If in Divert send event.
{
SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, PHBK_ID /*MZ 28/2/01 */,
(UBYTE *) Current->entry[ Current->selectedName ].number );
bookPhonebookDestroy(data->phbk->win);
}
else if(data->phbk->fromDeflect ) /*SPR 1392*/
{
SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,
(UBYTE *) Current->entry[ Current->selectedName ].number );
bookPhonebookDestroy(data->phbk->win);
}
else
/* Start a new options menu
*/
/*check for UPN SPR 1327*/
if (Current->status.book != PHB_UPN)
data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookNameMenuAttributes(),0);
else
data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookUPNMenuAttributes(),0);
}
break;
/* JVJ #1743 Right key deletes search character*/
#ifdef NEW_EDITOR
case KCD_RIGHT:
#else /* NEW_EDITOR */
case KCD_HUP:
#endif /* NEW_EDITOR */
{
/* If we have any characters in the buffer, step back, otherwise
destroy the window
*/
if ( data->edtBuf[0])
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
ATB_edit_DeleteLeft( data->editor );
#else /* NEW_EDITOR */
edtChar( data->edt,ecBack );
#endif /* NEW_EDITOR */
SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
winShow( data->win );
}
else
bookSearchDestroy(data->win);
}
break;
case KCD_HASH:
{
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
ATB_edit_DeleteLeft( data->editor );
#else /* NEW_EDITOR */
edtChar( data->edt,ecBack );
#endif /* NEW_EDITOR */
}
/*NM, p016
even updating when deleting characters
*/
SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
winShow( data->win );
}
break;
default:
{
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
AUI_entry_EventKey( data->entry_data, e, k );
/* send the search event to ourselves,
* but only when a character is finished in multi-tap
*/
if (!data->editor->multitap)
{
SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
}
#else /* NEW_EDITOR */
editEventKey( e, k );
/* send the search event to ourselves,
*/
SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
#endif /* NEW_EDITOR */
winShow( data->win );
}
}
break;
}
/* always consume the event
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookSearchKbdLongCB
$Description: long keypress event handler, handles long clear event only
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, key handle
*******************************************************************************/
static int bookSearchKbdLongCB( MfwEvt e, MfwKbd *k )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -