📄 mmibookdetailswindow.c
字号:
/*******************************************************************************
CONDAT (UK)
********************************************************************************
This software product is the property of Condat (UK) Ltd and may not be
disclosed to any third party without the express permission of the owner.
********************************************************************************
$Project name: Basic MMI
$Project code: BMI (6349)
$Module: PhoneBook
$File: MmiBookDetailsWindow.h
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
Provides the details handlig for the phone book
********************************************************************************
$History: MmiBookDetailsWindow.h
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "mfw_sys.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"
#include "mfw_sim.h"
#include "mfw_cm.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "mfw_mme.h"
#include "mfw_sat.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "ksd.h"
#include "psa.h"
#include "MmiMain.h"
#include "MmiBookController.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSat_i.h"
#include "MmiAoc.h"
#include "gdi.h"
#include "audio.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"
#include "MmiBookShared.h"
/*******************************************************************************
Private Methods
*******************************************************************************/
/*******************************************************************************
$Function: bookDetailsDialog
$Description: Dialog function for the details window, doesn't currently do
anything
$Returns: None
$Arguments: win, window handle
event, event to be handled
value, not used
parameter, not used
*******************************************************************************/
static void bookDetailsDialog ( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
{
}
/*******************************************************************************
$Function: bookDetailsWindowCB
$Description: Window event handler
$Returns: MFW_EVENT_CONSUMED for the window visible event,
MFW_EVENT_PASSED otherwise
$Arguments: e, event, w, window handle
*******************************************************************************/
static int bookDetailsWindowCB ( MfwEvt e, MfwWin *w )
{
tBookStandard *data = (tBookStandard *)w->user;
T_MFW_PHB_ENTRY *ptr; // dat;
char debug[50];
TRACE_FUNCTION("bookDetailsWindowCB");
switch( e )
{
case MfwWinVisible:
{
/* handle the visible event, start by shoing the default information
*/
MmiBookShowDefault();
/* Build and show the editor
*/
ptr = &data->phbk->current.entry[ data->phbk->current.selectedName ];
#ifdef NO_ASCIIZ
//memset(dat.name.data, 0, PHB_MAX_LEN);
{TRACE_EVENT("Name string");
TRACE_EVENT((char*)ptr->name.data);
#ifdef EASY_TEXT_ENABLED
if ( ptr->name.data[0] ==0x80)//if unicode
{ dspl_TextOut(0,0,DSPL_TXTATTR_UNICODE,(char *)&ptr->name.data[0]);// 2zhonghz
if ((ptr->name.data[MAX_LINE+2] != 0) && ptr->name.data[MAX_LINE+3] != 0)
dspl_TextOut(0,FIRST_LINE_CHINESE,DSPL_TXTATTR_UNICODE,(char *)&(ptr->name.data[MAX_LINE+2]));
dspl_TextOut(0,SECOND_LINE_CHINESE,0,(char *)ptr->number);
if (strlen((char*)ptr->number) > MAX_LINE)
dspl_TextOut(0,SECOND_LINE_CHINESE+LINE_HEIGHT,0, (char*)&ptr->number[MAX_LINE]);
}
else
#endif
{
// convert from GSM to Alpha characters
bookGsm2Alpha( (UBYTE *) ptr->name.data );
sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name.data, "\n", (char *) ptr->number);
edtShow(data->edt);
}
}
/*else
{
// convert from GSM to Alpha characters
bookGsm2Alpha( (UBYTE *) ptr->name.data );
sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name.data, "\n", (char *) ptr->number);
edtShow(data->edt);
}*/
#else
{
sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name, "\n", (char *) ptr->number);
edtShow(data->edt);
}
#endif
/* pop up the soft keys
*/
displaySoftKeys('\0', '\0');
displaySoftKeys( TxtSoftCall, /* TxtSoftOptions */ TxtSoftBack );
}
break;
default:
{
/* default handler just indicate event not handled
*/
return MFW_EVENT_PASSED;
}
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookDetailsKbdCB
$Description: Keyboard handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, key handle
*******************************************************************************/
static int bookDetailsKbdCB ( 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("bookDetailsKbdCB()");
/* Handle the key events
*/
switch (k->code)
{
case KCD_MNUUP:
//{
/* get previous
*/
// if ( ( Current->index == 1 ) && ( Current->selectedName == 0 ) )
// {
/* start with new value
*/
// if ( Current->status.used_entries < MAX_SEARCH_NAME )
// Current->selectedName = Current->status.used_entries - 1;
// else
// Current->selectedName = MAX_SEARCH_NAME - 1;
// Current->index = Current->status.used_entries - Current->selectedName;
// }
// else
// {
// if ( Current->selectedName == 0 )
// Current->index--;
// else
// Current->selectedName--;
// }
/* find this selection
*/
// bookFindName( MAX_SEARCH_NAME, Current );
/* And show the window
*/
// winShow(data->win);
//}
break;
case KCD_MNUDOWN:
// {
/* get next
*/
// if ( ( Current->index + Current->selectedName ) == Current->status.used_entries )
// {
// Current->index = 1;
// Current->selectedName = 0;
// }
// else
// {
// if ( Current->selectedName == MAX_SEARCH_NAME - 1 )
// Current->index++;
// else
// Current->selectedName++;
// }
/* find this selection
*/
// bookFindName( MAX_SEARCH_NAME, Current );
/* And show the window
*/
// winShow(data->win);
// }
break;
case KCD_CALL:
case KCD_LEFT:
{
/* select to make the call
*/
callNumber( Current->entry[ Current->selectedName ].number );
bookPhonebookDestroy( data->phbk->win );
}
break;
case KCD_RIGHT:
{
/* start up the options menu
*/
// data->phbk->menu_options_win_2 = bookMenuStart( data->phbk->win, bookRepRedOptionsMenuAttributes(),0 );
//Cancel this screen
bookDetailsDestroy( data->win );
}
break;
case KCD_HUP:
{
/* Cancel this menu
*/
bookDetailsDestroy( data->win );
}
break;
default:
{
/* default handling is to get us out of here
*/
memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
sprintf( data->edtBuf, "%s%c", (char *) Current->entry[ Current->selectedName ].number, editControls[ k->code ] );
idleDialBuffer( data->edtBuf );
bookPhonebookDestroy( data->phbk->win );
}
break;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookDetailsKbdLongCB
$Description: Keyboard Long Press event handler
$Returns: MFW_EVENT_CONSUMED always
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookDetailsKbdLongCB( 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 ) )
bookDetailsDestroy( data->win );
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookDetailsCreate
$Description: create an instance of the details window
$Returns: handle of newly created window, or NULL if we fail to create
$Arguments: parent, handle of parent window
*******************************************************************************/
static T_MFW_HND bookDetailsCreate(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;
TRACE_FUNCTION ("bookDetailsCreate()");
/* 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) bookDetailsWindowCB ) ) == 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) bookDetailsDialog;
data->mmi_control.data = data;
win_data = ((T_MFW_HDR *)data->win)->data;
win_data->user = (void *) data;
data->phbk = phbk;
data->parent_win = parent;
/* create keyboards and menus for our window
*/
data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookDetailsKbdCB );
data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookDetailsKbdLongCB );
bookSetEditAttributes( 0, 0, 80, 40, 0, 0, edtCurNone, 0, data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr );
data->edt = edtCreate( data->win, &data->attr, 0, 0 );
edtUnhide( data->edt );
/* 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: bookDetailsStart
$Description: Start routine for the phonebook details window
$Returns: None, assigns the window handle to the name_details_win
hook in the current phone book
$Arguments: m, menu, i, menu item
*******************************************************************************/
void bookDetailsStart( MfwMnu* m, MfwMnuItem* i )
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
tBookStandard *data = (tBookStandard *)win_data->user;
TRACE_FUNCTION ("bookDetailsStart()");
data->phbk->name_details_win = bookDetailsCreate( data->phbk->win );
}
/*******************************************************************************
$Function: bookDetailsDestroy
$Description: Destroy the phone book details window
$Returns: None
$Arguments: window, handle of window to close
*******************************************************************************/
void bookDetailsDestroy( MfwHnd window )
{
T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
tBookStandard *data = (tBookStandard *)win->user;
TRACE_FUNCTION ("bookDetailsdestroy()");
/* Only need to do this if the data is valid
*/
if ( data )
{
data->phbk->name_details_win = 0;
winDelete( data->win );
FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
}
}
/*******************************************************************************
End of File
*******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -