📄 mmibooksdnwindow.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: MmiBookSDNWindow.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
This module provides the service numbers window for the phone book
********************************************************************************
$History: MmiBookSDNWindow.c
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 "mfw_cnvt.h" //GW Added for 'mfw_SIM2GsmStr'
#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: bookSDN
$Description: window dialog function
$Returns: none.
$Arguments: win, window handle
event, event to be handled
value, not used
parameter, not used
*******************************************************************************/
static void bookSDN( T_MFW_HND win, USHORT event, SHORT value, void * parameter )
{
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
tBookStandard *data = (tBookStandard *)win_data->user;
MfwMnu *mnu;
tMmiPhbData *my;
TRACE_FUNCTION ("bookSDN()");
/* Guard against bad incoming data
*/
if ( ! data )
return;
/* Grab the current phonebook data element, we use this a lot
*/
my = &data->phbk->current;
/* simple event handler, dealing with the messages we know about
*/
switch (event)
{
case SEARCH_INIT:
{
/* Search initialise, no action required
*/
}
break;
case SEARCH_SCROLL_UP:
{
/* Scroll up event we need to deal with correctly
*/
if ( ( my->index==1 ) && ( my->selectedName == 0 ) )
{
/* select the correct boundary for the list
*/
my->selectedName = my->status.used_entries;
if ( my->selectedName > MAX_SEARCH_NAME )
my->selectedName = MAX_SEARCH_NAME;
/* and subtract one cos we are dealing with an array starting
at zero
*/
my->selectedName--;
/* and calculate the correct index value
*/
my->index = my->status.used_entries - my->selectedName;
}
else
{
if ( my->selectedName == 0 )
my->index--;
else
my->selectedName--;
}
/* update menu structures
*/
mnu = (MfwMnu *)mfwControl( data->menu );
mnu->lCursor[ mnu->level ] = my->selectedName;
/* and go find the name
*/
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
}
break;
case SEARCH_SCROLL_DOWN:
{
/* scroll down event is a bit easier than the scroll up
*/
if ( (my->index + my->selectedName) == my->status.used_entries )
{
my->index = 1;
my->selectedName = 0;
}
else
{
if ( my->selectedName == (MAX_SEARCH_NAME - 1) )
my->index++;
else
my->selectedName++;
}
/* update menu structures
*/
mnu = (MfwMnu *)mfwControl( data->menu );
mnu->lCursor[ mnu->level ] = my->selectedName;
/* and go find the name
*/
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
}
break;
case SEARCH_STRING:
{
/* search for the current element selected in our buffer
*/
my->index = my->index + my->selectedName;
if ( bookSearchName( data->edtBuf, MAX_SEARCH_NAME, &data->phbk->current ) == MFW_PHB_OK )
{
if ( my->index > (my->status.used_entries - MAX_SEARCH_NAME + 1) )
{
/* need to reorganise a bit here
*/
if ( my->status.used_entries > MAX_SEARCH_NAME )
{
my->selectedName = my->index - my->status.used_entries;
my->selectedName += MAX_SEARCH_NAME - 1;
my->index -= my->selectedName;
}
else
{
my->selectedName = my->index - 1;
my->index = 1;
}
/* find the appropriate name
*/
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
}
else
data->phbk->current.selectedName = 0;
/* update menu structures
*/
mnu = (MfwMnu *)mfwControl(data->menu);
mnu->lCursor[mnu->level] = data->phbk->current.selectedName;
}
}
break;
case SEARCH_UPDATE:
{
/* Update search message
*/
my->index = 1;
my->selectedName = 0;
memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
edtReset( data->edt );
/* deal with the new search using the method above
*/
SEND_EVENT( win, SEARCH_STRING, 0, 0 );
}
break;
default:
{
/* no default handler, just ignore any other messages
*/
}
break;
}
}
/*******************************************************************************
$Function: bookSDNWinCB
$Description: Window call back function
$Returns: status indicating if event handled or not
$Arguments: e, event, w, window handle
*******************************************************************************/
static int bookSDNWinCB( MfwEvt e, MfwWin *w )
{
tBookStandard *data = (tBookStandard *)w->user;
char *ElemPtr, *NumPtr;
int leftKey, rightKey, ElemSize, Position, i;
TRACE_FUNCTION ("phbk_sdn_win_cb()");
switch (e)
{
case MfwWinVisible:
{
/* Paint function, clear the screen and paint in each
of our controls
*/
dspl_ClearAll();
edtShow(data->edt);
/* Populate the names screen buffer
*/
for (i=0;i<MAX_SEARCH_NAME;i++)
{
/* Grab info for this element
*/
ElemPtr = MmiBookCallList(i);
ElemSize = MmiBookCallListSize(i);
/* Decide on whether to use number or name
*/
#ifdef NO_ASCIIZ
NumPtr = (char*)data->phbk->current.entry[i].name.data;
#else
NumPtr = (char*)data->phbk->current.entry[i].name;
#endif
if ( *NumPtr == '\0' )
{
NumPtr = (char*)data->phbk->current.entry[i].number;
Position = POS_END;
}
else
Position = POS_BEGIN;
/* Clear the buffer, then fill it with the required value
*/
memset( ElemPtr, '\0', ElemSize );
truncateString( ElemPtr, NumPtr, ElemSize, Position, "..." );
}
/* Show the menu and stick up the find prompt
*/
mnuUnhide(data->menu);
PROMPT( MmiBookMenuArea().px, 45, 0, TxtFind );
/* The softkeys are dependant on how we got here
*/
if ( ( data->phbk->fromSMS ) || ( data->phbk->fromSMS )|| ( data->phbk->current.status.book == PHB_SDN ) )
{
leftKey = TxtSoftSelect;
rightKey = TxtSoftBack;
}
else
{
leftKey = TxtSoftCall;
rightKey = TxtSoftOptions;
}
displaySoftKeys( leftKey, rightKey );
}
break;
default:
{
/* Default handler, just return zero and let the next handler in the
chain deal with the event if required
*/
return 0;
}
}
/* return non-zero status indicating we have dealt with the event
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookSDNKbdCB
$Description: Keyboard handler
$Returns: stats indicating if event handled or not
(Always MFW_EVENT_CONSUMED)
$Arguments: e, event, k, keyboard handle
*******************************************************************************/
static int bookSDNKbdCB( 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;
tBookMessageEvents MyEvent = SEARCH_STRING;
char *Number;
int i = 0;
TRACE_FUNCTION ("bookSDNKbdCB()");
/* Make sure we have the correct editor enabled
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -