📄 mmibookphonebook.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: MmiBookPhoneBook.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description
This module provides the basic phone book functionality
********************************************************************************
$History: MmiBookPhoneBook.c
25/10/00 Original Condat(UK) BMI version.
08/08 version 0.102 fzq modified
19/08/02 version 0.102 xusufang modified
20/08/02 version 0.103 fzq modified
$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"
#include "MmiBookController.h"
//#include "uniparad.h"
#include "l1tm_cust_add.h" //hxl add for pcsync 20020925
#include "Mmismsmenu.h"//yq added 2003/3/17
#include "mmiiconresource.h"/* 2004/06 sunsj modify for icon manage */
//#define TDTRACE 1
#include "mmiutilapi.h"
#define MaxHanZi 7336*4
#define PHONEBOOK_RECORD_PERPAGE 3//电话簿
//static int ReadEntries(U8 p_type, U8 p_idx, U8 p_mode, U8 p_number);
//static int ReadSIM_Init(U8 p_type,U8 p_mode);
static void ChoiceSort(T_MFW_PHB_SORT_INDEX *SortData,int RecordLen);
static U8 ChLowCase(U8 n);
static U8 UnchangePinYinProgramCode(U8 code);
static T_MFW_HND bookShowWait( MfwHnd parent,int reason);
static void show_number();
static void yq_edtchar(T_MFW_HND edt,unsigned char code);
void bookCallPhbDestroy( MfwHnd window );
static void ShowWaitDestroy( MfwHnd window );
extern BOOL phonebook_search_flag;
//static T_MFW_PHB_ENTRY l_phb_entry[PE_SIZE]; // in NVM_phbk, we also read 10 entries once, revised by gan chunhui
//static T_MFW_PHB_LIST l_phb_list; /* phonebook list */
//static T_MFW_PHB_STATUS l_phb_status;
//static U8 l_idx;
//static U8 l_startidx; /* start index of found matches */
//static U8 l_found; /* number of pattern matches */
static int wait_reason;
static unsigned char dynamic_index;
unsigned char no_wait=1;/*2003/12/13, wangyan modify*/
static MfwHnd dynamic_tim;
typedef enum
{
Wait_Init,
Wait_Ok,
Wait_Destroy
}ShowWaitEvent;
typedef enum
{
CALLPHB_INIT,
CALLPHB_DESTROY
}CallPhbEvent;
typedef enum
{
NONE,
TOLEFT,
TORIGHT
} T_BrowserWay;
typedef enum
{
B_NUMBER,
B_HOME,
B_OFFICE,
B_MEMO
} T_BrowserType;
static MfwMnuAttr readName_menuAttrib =//the default menu attr
{
0,
&menuDynamicArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0 /* number of items */
};
/*2003/12/16, WANGYAN MODIFY*/
static MfwMnuAttr readName_fromcall_menuAttrib =//the default menu attr
{
0,
&menuDynamicArea_fromcall,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0 /* number of items */
};
/*2003/12/16, WANGYAN MODIFY*/
T_DynamicBuffer Dynamic_menu[5];
extern unsigned char backgroundBit[];
/* 2004/05/17 sunsj modify */
//extern unsigned char waiting1[];
//extern unsigned char waiting2[];
//extern unsigned char waiting3[];
/*extern unsigned char waiting4[];
extern unsigned char waiting5[];
extern unsigned char waiting6[];
extern unsigned char waiting7[];*//*2003/12/13, wangyan modify*/
extern UINT8 SimNumber[ALL_SIM_LIST][PHB_number_len/2+1];
//yq added for phb in calling
extern void ShowPhoneBookNumber(int Index,T_BrowserWay way);
static void ClearCallWindowHandle();
static void SetCallWindowsHandle(T_MFW_HND win);
extern void ShortCutLocation(ListWinInfo * dataInfo, char * NewKey,TABLE_TYPE table, int *BufferIndex,int flag);
extern void GetVoiceData();
/* 2004/06 sunsj modify for icon manage */
//extern const unsigned char abc_bmp[];
extern T_BrowserType CurrentType;
extern T_call call_data;//yq added 2003/4/7 for reset the call_data.win_phb
static int search_total;
static MfwHnd showtimer=0;
static MfwHnd edttimer=0;
static MfwHnd calldatawin=0;
static USHORT show_index;
static UBYTE refresh_flag;
static unsigned char cursor_correct=1; //the flag indicate the cursor correct or not
static unsigned char key_before=0xff; //the key you pressed before this key
static unsigned char key_index=0; //the index of the key in edt_key
static const unsigned char edt_key[8][5]={"abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};//the key array for edt
/*******************************************************************************
Private Methods
*******************************************************************************/
/*******************************************************************************
$Function: bookPhonebookDialog
$Description: Dialog function for the phone book application
$Returns: none
$Arguments: win, window handle
event, event to be handled
value, not used
parameter, reason for call
*******************************************************************************/
static void bookPhonebookDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
{
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
T_phbk *data = (T_phbk *) win_data->user;
SHORT *reason = (SHORT *) parameter;
/*
char temp[100];
TRACE_FUNCTION ("bookPhonebookDialog()");
Sprintf(temp,"event,%d,reason,%d",event,*reason);
TRACE_EVENT(temp);
*/
switch( event )
{
case PHBK_INIT:
{
/* Initialise the phone book application.
Note that we need to deal with a number of different
initialisation types, depending on the reason given
*/
memset( data->edt_buf_name, '\0', sizeof( data->edt_buf_name ) );
memset( data->edt_buf_number, '\0', sizeof( data->edt_buf_number ) );
/* 2004/05/26 sunsj modify */
//bookSetEditAttributes( 4, 26, 80, 20, 0, 0, edtCurBar1, 0,
// (char *) data->edt_buf_name, PHB_name_len, &data->edt_attr_name );
//bookSetEditAttributes( 4, 26, 80, 20, 0, 0, edtCurBar1, 0,
// (char *) data->edt_buf_number, PHB_number_len, &data->edt_attr_number );
// deal with the different initialisation types
//if ((bookPhoneBookLoading()==BOOK_FAILURE)&&(( *reason )!=)&&(( *reason )!=PhbkHostkeyList)) //xsf add &&(( *reason )!=PhbkHostkeyList)) 08/19
if( ( ( *reason )!=PhbkMainMenu) && (( *reason )!=PhbkHostkeyList)&& (( *reason )!=PhbkHostkeyOnOffList) && ((*reason)!=PhbkFromVoiceMemo) )
{
if( (bookPhoneBookLoading()==BOOK_FAILURE) ) //xsf add &&(( *reason )!=PhbkHostkeyList)) 08/19
{
/* T_DISPLAY_DATA display_info;
dialog_info_init(&display_info);//gdy add
display_info.TextId2 = TxtPleaseWait;
display_info.Time = 5000;
display_info.Callback = (T_VOID_FUNC) NULL;
display_info.iconindex =REMIND_WAITTING;
// Call Info Screen
info_dialog( idle_get_window(), &display_info );
bookPhonebookDestroy(data->win);
Sprintf(temp,"reason:%d",*reason);
TRACE_EVENT(temp);
*/
bookShowWait(data->win,*reason);
return;
}
else
{
//hxl add for updata the nvm data
if( NVMLoadingPhbk==FALSE )
{
Get_NVM_data();
PHBKTotal=NVMTotal+SIMTotal;//hxl add fot update the
Create_SORT_Table(l_phb_index,ALL_NUMBER_LIST);
NVMLoadingPhbk=TRUE;
}
if( SIMLoadingPhbk==FALSE )
{
if( no_wait )
{
bookShowWait(data->win,*reason);
return;
}
else
{
TRACE_EVENT("glowing: bookPhonebookDialog---before GetSIMData");
GetSIMData();
TRACE_EVENT("glowing: bookPhonebookDialog---after GetSIMData");
phb_get_upn();
SIMLoadingPhbk=TRUE;
}
}
}
}
switch( *reason )
{
case PhbkNormal:
{
// Normal initialisation
data->current.status.book = bookActiveBook(READ);
data->current.index = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -