📄 mmibookcalllistwindow.c
字号:
/* api introduction to display withheld numbers in recent calls list
03-04-02
*/
switch( e )
{
case MfwWinVisible:
{
/* Handle the window visible event, show default screen,
populate the call list menu and put up default soft keys
*/
TRACE_EVENT_P1("<<<<idCounter Value is %d", idCounter);
MmiBookShowDefault();
if(idCounter > 0)
{
missedOutput = TRUE;
displayStart = 1;
strcpy(missedCalls,MmiRsrcGetText(TxtUnknown));
strcat(missedCalls,": ");
sprintf(calls,"%d",idCounter);
strcat(missedCalls,calls);
data->phbk->current.missedCallsOffset = 1;
strcpy( (char*)MmiBookCallList( 0 ), (char*)missedCalls);
}
else
displayStart = 0;
index = 0;
for ( i = displayStart; i < NAME_LIST_SIZE; i++ )
{
#ifdef NO_ASCIIZ
if ( data->phbk->current.entry[index].name.len > 0 )
ptr = (char *) data->phbk->current.entry[index].name.data;
else if(strlen((char *) data->phbk->current.entry[index].number) > 0)
ptr = (char *) data->phbk->current.entry[index].number;
else
ptr = "";
#else
if ( strlen( (char *) data->phbk->current.entry[index].name ) > 0 )
ptr = (char *) data->phbk->current.entry[index].name;
else if (strlen((char *) data->phbk->current.entry[index].number) > 0)
ptr = (char *) data->phbk->current.entry[index].number;
else
ptr = "";
#endif
//JVJE memcpy( MmiBookCallList( index ), ptr, MmiBookCallListSize( index ) );
strcpy( (char*)MmiBookCallList( i ), ptr);
TRACE_FUNCTION((char*)MmiBookCallList( i ));
index ++;
strcpy( (char*)MmiBookCallList( index ), (char*)ptr);
TRACE_EVENT((char*)MmiBookCallList( index ));
}
mnuUnhide(data->menu);
if((idCounter > 0) && (Current->status.used_entries == 0))
displaySoftKeys( TxtNull, TxtSoftBack );
else if((idCounter > 0) && (Current->status.used_entries > 0))
displaySoftKeys( TxtSoftOptions, TxtSoftBack );
else
displaySoftKeys( TxtSoftOptions, TxtSoftBack );
}
break;
default:
{
/* If it's not a window visible event we ignore it and
pass it back up the tree to be handled
*/
return MFW_EVENT_PASSED;
}
break;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallListKbdCB
$Description: Keyboard event handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookCallListKbdCB( 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;
/* Handle the events provided by the key
*/
switch (k->code)
{
case KCD_MNUUP:
{
SEND_EVENT( data->win, SEARCH_SCROLL_UP, 0, 0 );
winShow(win);
}
break;
case KCD_MNUDOWN:
{
SEND_EVENT( data->win, SEARCH_SCROLL_DOWN, 0, 0 );
winShow(win);
}
break;
case KCD_RIGHT:
bookPhonebookDestroy( data->phbk->win );
break;
case KCD_CALL:
{
/* selected to call the number
*/
mnuHide( data->menu );
callNumber( data->phbk->current.entry[data->phbk->current.selectedName - data->phbk->current.missedCallsOffset].number );
bookPhonebookDestroy( data->phbk->win );
}
break;
case KCD_LEFT:
{
/* Selected the options menu so display them
*/
if(Current->status.used_entries > 0)
data->phbk->menu_call_options_win = bookMenuStart( data->phbk->win, bookRepRedOptionsMenuAttributes(),0 );
else
break;
}
break;
case KCD_HUP:
{
/* Selected to get out of here, so destroy the window
*/
bookCallListDestroy( data->win );
}
break;
default:
{
/* No other handling required here
*/
}
break;
}
/* Always consume the event
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallListKbdLongCB
$Description: Keyboard Long Press event handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookCallListKbdLongCB( 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 ) )
bookCallListDestroy( data->win );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookCallListCreate
$Description: Create the call list window
$Returns: Handle of the window, or NULL if there is an error
$Arguments: parent, handle of the parent window
*******************************************************************************/
static T_MFW_HND bookCallListCreate( MfwHnd parent )
{
T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data;
T_phbk *phbk = (T_phbk *)parent_win_data->user;
T_MFW_WIN *win_data;
tBookStandard *data;
MfwMnu *mnu;
TRACE_FUNCTION ("bookCallListCreate()");
/* allocate memory for our control block
*/
if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
return NULL;
/* Create the window if we can
*/
if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookCallListWinCB ) ) == NULL )
{
FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
return NULL;
}
/* Okay, we have created the control block and the window, so
we now need to configure the dialog and data pointers
*/
data->mmi_control.dialog = (T_DIALOG_FUNC) bookCallListDialog;
data->mmi_control.data = data;
win_data = ((T_MFW_HDR *)data->win)->data;
win_data->user = (void *) data;
data->phbk = phbk;
data->phbk->root_win = data->win;
data->phbk->calls_list_win = data->win;
data->parent_win = parent;
/* create keyboards and menus for our window
*/
data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookCallListKbdCB );
data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookCallListKbdLongCB );
data->menu = mnuCreate( data->win, (MfwMnuAttr *)MmiBookMenuDetailsList(), 0, 0 );
mnu = (MfwMnu *) mfwControl( data->menu );
/* api 19-04-02 - path to move cursor down one
in missed calls list. */
if(idCounter > 0)
mnu->lCursor[mnu->level] = 1;
else
mnu->lCursor[mnu->level] = 0;
mnuScrollMode(data->menu,0);
/* allow the window and menu to be created
*/
mnuUnhide(data->menu);
winShow(data->win);
/* And return the handle of the newly created window
*/
return data->win;
}
/*******************************************************************************
Public Methods
*******************************************************************************/
/*******************************************************************************
$Function: bookCallListStart
$Description: Entry point for the call list window
$Returns: Handle of window
$Arguments: parent, handle of parent window
*******************************************************************************/
T_MFW_HND bookCallListStart( MfwHnd parent,int parameter )
{
T_MFW_HND win;
/* create and initialise the window
*/
if ( ( win = bookCallListCreate( parent ) ) != NULL )
SEND_EVENT( win, CALLS_LIST_INIT, 0, (void*)parameter );
/* return the handle, or NULL if we have had an error
*/
return win;
}
/*******************************************************************************
$Function: bookCallListDestroy
$Description: destroys the call list window
$Returns: None
$Arguments: window, the window to be killed
*******************************************************************************/
void bookCallListDestroy( MfwHnd window )
{
T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
tBookStandard *data = (tBookStandard *)win->user;
TRACE_FUNCTION ("bookCallListDestroy()");
/*
{
char temp[256];
sprintf(temp,
"window %X data->window %X phbk->root_win %X phbk->call_list_wi %X",
window,data->phbk->root_win,data->phbk->calls_list_win);
TRACE_EVENT (temp);
}
*/
/* Remove the Withheld counter from the list
*/
idCounter = 0;
memset (missedCalls, '\0', 40);
memset(calls, '\0', 10);
/* Only actually do something if the data pointer is valid
*/
if ( ! data )
return;
/* If we are the root window then we need to deal with the
phonebook destruction
*/
if ( data->phbk->root_win == window )
bookPhonebookDestroy(data->phbk->win);
else
{
/* delete our window and free the allocated memory
*/
data->phbk->calls_list_win = 0;
winDelete ( data->win );
FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
}
}
/*******************************************************************************
End of File
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -