📄 mmibookcalldetailswindow.c
字号:
(UBYTE) my->time.minute[0], (UBYTE) my->time.minute[1], "\n",
"Date: ", (UBYTE) my->date.day[0], (UBYTE) my->date.day[1], "/",
(UBYTE) my->date.month[0], (UBYTE) my->date.month[1], "/",
(UBYTE) my->date.year[0], (UBYTE) my->date.year[1], "\n");
#ifdef NO_ASCIIZ
#ifdef EASY_TEXT_ENABLED
/*MC SPR 1242, changed macros to function calls e.g FIRST_LINE_CHINESE->Mmi_layout_first_line()*/
if (my->name.data[0] ==0x80)//if unicode
{ //display name as unicode
dspl_TextOut(0,0, DSPL_TXTATTR_UNICODE, (char *)my->name.data);
if ((my->name.data[MAX_LINE+2] != 0) && (my->name.data[MAX_LINE+3] != 0))
dspl_TextOut(0, Mmi_layout_first_line(), 0, (char *) &my->name.data[MAX_LINE+2]);
//display number
dspl_TextOut(0, Mmi_layout_second_line(), 0, (char *) my->number);
if (strlen((char *) my->number) > MAX_LINE)
/*MC end*/ dspl_TextOut(0, Mmi_layout_second_line() + 8, 0, (char *) &my->number[MAX_LINE]);
}
else
#endif /* EASY_TEXT_ENABLED */
{
if (CphsPresent() == TRUE)
{
sprintf( (char *) data->edtBuf, "%s%s%s%s%d%s%s",
(char *) my->name.data, "\n",
(char *) my->number,"\n Line ", my->line,"\n",
TempBuffer );
}
else
sprintf( (char *) data->edtBuf, "%s%s%s%s%s",
(char *) my->name.data, "\n",
(char *) my->number,"\n",
TempBuffer );
/* show the editor and update the soft keys
*/
edtShow( data->edt );
}
#else /* NO_ASCIIZ */
if (CphsPresent() == TRUE)
{
sprintf( (char *) data->edtBuf, "%s%s%s%s%d%s%s",
(char *) my->name, "\n",
(char *) my->number,"\n Line ", my->line,"\n",
TempBuffer );
}
else
sprintf( (char *) data->edtBuf, "%s%s%s%s%s",
(char *) my->name, "\n",
(char *) my->number,"\n",
TempBuffer );
/* show the editor and update the soft keys
*/
edtShow( data->edt );
#endif /* NO_ASCIIZ */
#endif /* NEW_EDITOR */
displaySoftKeys( TxtNull, TxtSoftBack );
}
break;
default:
{
/* default processing, we return IGNORED here and let the
default handler pick up the ball
*/
return MFW_EVENT_PASSED;
}
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsKeyCB
$Description: normal keyboard handler
$Returns: MFW_EVENT_CONSUMED in all cases
$Arguments: e, event to be handled, k keyboard handle
*******************************************************************************/
static int bookCallDetailsKeyCB( 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;
/* make sure we handle null keyboards
*/
if ( k == NULL )
return MFW_EVENT_CONSUMED;
/* deal with the incoming key code
*/
switch( k->code )
{
case KCD_MNUDOWN:
{
/* scroll down event
*/
if ( data->phbk->current.selectedName == data->phbk->current.status.used_entries-1 )
{
data->phbk->current.selectedName = 0;
}
else
data->phbk->current.selectedName++;
}
break;
case KCD_MNUUP:
{
/* scroll up event
*/
if ( data->phbk->current.selectedName == 0 )
{
data->phbk->current.selectedName = data->phbk->current.status.used_entries-1;
}
else
data->phbk->current.selectedName--;
}
break;
case KCD_CALL:
{
/* left, implies make call
*/
callNumber( data->phbk->current.entry[data->phbk->current.selectedName].number );
bookPhonebookDestroy( data->phbk->win );
}
break;
case KCD_RIGHT:
{
bookCallDetailsDestroy(data->win);
}
break;
case KCD_HUP:
{
/* clear, destroy the window
*/
bookCallDetailsDestroy( data->win );
}
break;
default:
{
/* no default behaviour required
*/
}
break;
}
/* if we have scrolled then the behaviour needs to be to perform another
search to get the window updated correctly
*/
if ( ( k->code == KCD_MNUUP ) || ( k->code == KCD_MNUDOWN ) )
{
SEND_EVENT(data->win, 0, 0, 0);
winShow( win );
}
/* and always return consumed
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsKbdLongCB
$Description: Keyboard Long Press event handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookCallDetailsKeyLongCB( 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;
/* hand a long clear event only
*/
if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
bookCallDetailsDestroy( data->win );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallDetailsCreate
$Description: Creates the window and associates editors and keyboards
with it.
$Returns: handle of the newly created window, or NULL if failure
$Arguments: parent, handle of parent window
*******************************************************************************/
static T_MFW_HND bookCallDetailsCreate( MfwHnd parent )
{
T_MFW_WIN *win_data;
tBookStandard *data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) );
T_MFW_WIN *parent_win_data = ((T_MFW_HDR *)parent)->data;
T_phbk *phbk = (T_phbk *)parent_win_data->user;
TRACE_FUNCTION ("phbk_call_details_create()");
/* Deal with allocation failure on the data block
*/
if ( ! data )
return NULL;
/* create the window
*/
if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookCallDetailsWinCB ) ) == NULL )
return NULL;
/* Associate the dialog and user data areas
*/
data->mmi_control.dialog = (T_DIALOG_FUNC) bookCallDetails;
data->mmi_control.data = data;
win_data = ((T_MFW_HDR *)data->win)->data;
win_data->user = (void *) data;
data->parent_win = parent;
/* Create the keyboards and editor objects, and associate a phone book handler
*/
data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookCallDetailsKeyCB );
data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookCallDetailsKeyLongCB );
/* 1945 MZ Initialise the edtBuf */
memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE );
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
AUI_edit_SetAttr( &data->editor_attr, PHB_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT,
ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE*) data->edtBuf, STANDARD_EDITOR_SIZE);
data->editor = ATB_edit_Create(&data->editor_attr,0);
SEND_EVENT(data->win, 0, 0, 0);
ATB_edit_Init(data->editor);
#else/*NEW_EDITOR*/
bookSetEditAttributes( PHB_EDITOR, COLOUR_EDITOR_XX , 0, edtCurBar1, 0,
(char*) data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr );
data->edt = edtCreate( data->win, &data->attr, 0, 0 );
#endif /*NEW_EDITOR*/
data->phbk = phbk;
/* return the handle to the newly created window
*/
return data->win;
}
/*******************************************************************************
Public methods
*******************************************************************************/
/*******************************************************************************
$Function: bookCallDetailsStart
$Description: entry point for the call details window
$Returns: handle of newly created window, or NULL
$Arguments: parent, handle of the parent window
*******************************************************************************/
T_MFW_HND bookCallDetailsStart( MfwHnd parent )
{
T_MFW_HND win;
TRACE_FUNCTION( "bookCallDetailsStart()" );
/* create and initialise the window
*/
if ( ( win = bookCallDetailsCreate( parent ) ) != NULL )
SEND_EVENT( win, CALL_DETAILS_INIT, 0, 0 );
/* return the handle, or NULL if it failed to be created correctly
*/
return win;
}
/*******************************************************************************
$Function: bookCallDetailsDestroy
$Description: destroys the call details window
$Returns: None.
$Arguments: window, hande of the window to be destroyed
*******************************************************************************/
void bookCallDetailsDestroy( MfwHnd window )
{
T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
tBookStandard *data = (tBookStandard *)win->user;
TRACE_FUNCTION ("bookCallDetailsDestroy()");
if ( data )
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
/* New editor isn't automatically destroyed with winDelete,
* so we destroy it here */
if (data->editor)
{
ATB_edit_Destroy(data->editor);
}
#endif
winDelete( data->win );
FREE_MEMORY( (unsigned char *) data, sizeof( tBookStandard ) );
}
}
/*******************************************************************************
End of File
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -