📄 mmismssend.c
字号:
if( win NEQ NULL )
{
// SEND_EVENT (win, E_INIT, SEND_ID, (void *)UserData,);/* 2004/4/20, wangyan modify */
SEND_EVENT (win, E_INIT, SEND_ID, (void *)UserData);
call_data.win_sms=win;//zy 2003-04-01 if there a smssend win call_data.win_sms should have data
}
return win;
}
/*******************************************************************************
$Function: SmsSend_SEND_create
$Description: Create a window for entering the text
$Returns: window handle
$Arguments: parent_window - parent window.
*******************************************************************************/
static T_MFW_HND SmsSend_SEND_create(MfwHnd parent_window)
{
T_SEND * data = (T_SEND *)ALLOC_MEMORY (sizeof (T_SEND));
T_MFW_WIN * win;
TRACE_FUNCTION ("SmsSend_SEND_create()");
// Create window handler
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
if( data->win EQ NULL )
{
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)SmsSend_main_exec_cb;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (MfwUserDataPtr)data;
data->parent = parent_window;
data->id = SEND_ID;
winShow(data->win);
return data->win;
}
/*******************************************************************************
$Function: SmsSend_SEND_destroy
$Description: Destroy the windows for entering the text
$Returns: none
$Arguments: own_window - window.
*******************************************************************************/
void SmsSend_SEND_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
T_SEND * data = NULL;
TRACE_FUNCTION ("SmsSend_SEND_destroy()");
if( own_window )
{
win_data = ((T_MFW_HDR *)own_window)->data;
if( win_data != NULL )
data = (T_SEND *)win_data->user;
if( data )
{
// Delete sms handle
if( data->sms_handler != NULL )
sms_delete(data->sms_handler);
if( data->child_dialog != NULL )
{
TRACE_EVENT("child_dialog not deleted?");
}
if( data->text_editor != NULL )
{
TRACE_EVENT("current_editor not deleted?");
/* 2003/12/04 sunsj */
//editor_destroy(data->text_editor);
text_input_destroy(data->text_editor);
data->text_editor = 0;
}
if( data->number_editor!=NULL )
{
editor_destroy(data->number_editor);
data->number_editor = 0;
}
// Delete WIN handler
win_delete (data->win);
// Free Memory
FREE_MEMORY ((void *)data, sizeof (T_SEND));
call_data.win_sms=0;//zy 2003-04-01 if smssend win destroy this data should be set to 0
//win_data->user = NULL;
}
else
{
TRACE_EVENT ("SmsSend_SEND_destroy() called twice");
}
}
}
/*******************************************************************************
$Function: SmsSend_main_exec_cb
$Description: Main callback handler for events sent to to trigger execution
$Returns: none
$Arguments: win - current window
event - event id
identifier - unique id
parameter - optional data.
*******************************************************************************/
static void SmsSend_main_exec_cb (T_MFW_HND win, USHORT event, SHORT identifier, void * parameter)
{
TRACE_FUNCTION ("SmsSend_main_exec_cb()");
/* In this field we get the identifier of the window sending the event */
switch( identifier )
{
case SEND_ID:
case SAVE_ID: // events from the SAVE window are also managed in the SEND callback
case SMSSEND_ID_SAVE_NOT_READY:
SmsSend_SEND_exec_cb(win, event, parameter);
break;
case PHBK_ID:
SmsSend_PHBK_exec_cb(win, event, parameter);
break;
case SMSSEND_ID_TEXTEDIT:
case SMSSEND_ID_CM_TEXTEDIT:
SmsSend_TEXTEDIT_exec_cb(win, event, parameter);
break;
case SMSSEND_ID_NBEDIT:
case SMSSEND_ID_SC_NOT_READY:
SmsSend_NBEDIT_exec_cb(win, event, parameter);
break;
case SMSSEND_ID_CENTREEDIT:
SmsSend_CENTREEDIT_exec_cb(win, event, parameter);
break;
default:
TRACE_EVENT("Err: Default");
break;
}
}
/*******************************************************************************
$Function: SmsSend_SEND_exec_cb
$Description: Callback handler for events sent by the window itself
$Returns: none
$Arguments: win - current window
event - event id
parameter - optional data.
*******************************************************************************/
static void SmsSend_SEND_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SEND * data = (T_SEND *)win_data->user;
T_SmsUserData UserData;
T_MFW_HDR * parent = data->parent;
T_MFW_SMS_INFO sms_parameter;
T_MFW_EVENT MfwEvents;
//#ifdef NO_ASCIIZ_MMI
//#ifdef NO_ASCIIZ
// T_EDITOR2_DATA editor_data;
//#else
T_EDITOR_DATA editor_data;
//#endif
T_DISPLAY_DATA display_info;
TRACE_FUNCTION ("SmsSend_SEND_exec_cb()");
switch( event )
{
case E_INIT:
/* Create a sms handler to receive events */
MfwEvents = E_SMS_ERR | E_SMS_MO_AVAIL|E_SMS_SAVE_AVAIL|E_SMS_MEM_FULL;
data->sms_handler = sms_create(data->win,MfwEvents,(MfwCb)SmsSend_SEND_mfw_cb);
data->child_dialog = NULL;
memcpy(&(data->edt_data), (T_SmsUserData *)parameter, sizeof(T_SmsUserData));
Send_state=data->edt_data.Send_state;
/* if it 's now forward or reply a sms,we need store NUMBER and TEXT */
if( Send_state == E_FORWARD|| Send_state ==E_COMMON_MSG )
{
memset(data->edt_data.NumberBuffer,0,sizeof(data->edt_data.NumberBuffer));
if( ((T_SmsUserData *)parameter)->TextBuffer[0]==0x80 &&
wstrlen((char*)((T_SmsUserData *)parameter)->TextBuffer)>MAX_EDIT_MSG_LEN-2 )
{
memset(data->edt_data.TextBuffer,0,sizeof(data->edt_data.TextBuffer));
memcpy((char*)data->edt_data.TextBuffer,(char*)((T_SmsUserData *)parameter)->TextBuffer,MAX_EDIT_MSG_LEN-2);
}
else if( ((T_SmsUserData *)parameter)->TextBuffer[0]!=0x80 &&
wstrlen((char*)((T_SmsUserData *)parameter)->TextBuffer)>MAX_EDIT_MSG_LEN+20-3 )
{
memset(data->edt_data.TextBuffer,0,sizeof(data->edt_data.TextBuffer));
memcpy((char*)data->edt_data.TextBuffer,(char*)((T_SmsUserData *)parameter)->TextBuffer,MAX_EDIT_MSG_LEN+20-3);
}
}
else if( Send_state == E_SEND )
{
//if( LastTextBuffer[0]!='\0')
// memcpy((char*)data->edt_data.TextBuffer,(char*) LastTextBuffer, sizeof(LastTextBuffer));
//else
memset(data->edt_data.TextBuffer,0,sizeof(data->edt_data.TextBuffer));//wx 2003-04-03 don't set zero only call sms send
//if( LastNumberBuffer[0]!='\0')
// memcpy((char*)data->edt_data.NumberBuffer, (char*)LastNumberBuffer, sizeof(LastNumberBuffer));
//else
memset(data->edt_data.NumberBuffer,0,sizeof(data->edt_data.NumberBuffer));//wx 2003-04-03 don't set zero only call sms send
}
else if( Send_state==E_REPLY )
{
memset(data->edt_data.TextBuffer,0,sizeof(data->edt_data.TextBuffer));
}
/* in case of reply the sms we have to use the service center number from the caller
*/
if( data->edt_data.called_from_reply_item EQ FALSE )
{
// The SMS center is initialized to '\0'
data->edt_data.CentreBuffer[0] = '\0';
}
/* open the common editor */
// #ifdef NO_ASCIIZ_MMI
//#ifdef NO_ASCIIZ
// SmsSend_loadUCS2EditDefault(&editor_data);
// editor_data.text = (wstring_t *)&data->edt_data.w_TextBuffer;
// editor_data.max_length = MAX_MSG_LEN;
// data->current_editor = editor2_start(win,&editor_data); /* start the editor */
//#else
SmsSend_loadEditDefault(&editor_data);
#if 1//EASY_TEXT_ENABLED
//editor_attr_init_pred(&editor_data.editor_attr, NULL, edtCurBar1, 0, 0, 0);
if( Send_state ==E_COMMON_MSG )
{
editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtCommonMsg,(char *)data->edt_data.TextBuffer,MAX_COMSG_LEN,edtCurBar1);
editor_data.Identifier = SMSSEND_ID_CM_TEXTEDIT ;
}
else
{
editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtMessages,(char *)data->edt_data.TextBuffer,MAX_EDIT_MSG_LEN,edtCurBar1);
editor_data.Identifier = SMSSEND_ID_TEXTEDIT ;
}
editor_data.min_enter = 0;
//JVJE editor_data.zone_id = ZONE_FULL_EDITOR;
//if(Send_state == E_FORWARD)
//editor_data.LeftSoftKey = TxtSoftOK;
//else if(Send_state==E_REPLY)
//editor_data.LeftSoftKey = TxtSend;
//else
editor_data.LeftSoftKey = TxtConfirm; /* 2004/03/30 sunsj modify */
editor_data.edtInPbk = 0;
editor_data.AlternateLeftSoftKey = TxtSoftOptions;
editor_data.RightSoftKey = TxtDelete;
editor_data.Callback = (T_EDIT_CB)SmsSend_TEXTEDIT_edit_cb;
editor_data.destroyEditor = FALSE;
editor_data.mode = TEXTINPUT_MODE; /* 2003/12/04 sunsj modify */
editor_data.InputMode = PINYIN_INPUT_MODE; /* 2003/12/04 sunsj set default input mode */
#endif
if( Send_state != E_COMMON_MSG )
{
/* 2004/06/29 sunsj modify for long message */
#ifdef _M188_
editor_data.editor_attr.e_size = 163;
#else
editor_data.editor_attr.e_size = 573;
#endif
}
//set_esize (163, data->text_editor);
Send_ed_state=SEND_EDIT;
/* 2003/12/04 sunsj modify for new editor mode */
if( editor_data.mode == TEXTINPUT_MODE )
{
data->text_editor = text_input(win, &editor_data);
}
else
{
data->text_editor = editor_start(win,&editor_data); /* start the editor */
}
//#endif
/* Marcus: Issue 1170: 07/10/2002: Start */
/*
* Set whether status requests are to be indicated according to the
* value of the srr field of the T_MFW_SMS_INFO structure.
*/
SmsSend_get_config_data(&sms_parameter);
//glowing,2004-06-16, TCS2112 does not define MT_IND_SRR_OFF, MT_IND_SRR_ON
#ifdef _M188_
switch( sms_parameter.srr )
{
case SMS_NOT_REQUESTED_SRR:
sms_set_mt_ind(MT_IND_SRR_OFF);
break;
case SMS_REQUESTED_SRR:
sms_set_mt_ind(MT_IND_SRR_ON);
break;
default:
TRACE_EVENT_P1("default: sms_parameter.srr = %d", sms_parameter.srr);
break;
}
#endif
//glowing,2004-06-16, end of modify
/* Marcus: Issue 1170: 07/10/2002: Start */
break;
case E_RETURN:
break;
case E_EXIT:
if( data->sc_number_editor != NULL )
{
//GW Read config data - then set dcs parameter
SmsSend_get_config_data(&sms_parameter);
//windy disable followed code because the dcs has been set before
#if 0
if( Mmi_getCurrentLanguage() == CHINESE_LANGUAGE )
{ //We have a chinese text message - set dcs parameter to
sms_parameter.dcs = MFW_DCS_UCS2;
}
else
{
sms_parameter.dcs = MFW_DCS_7bits;
}
SmsSend_set_dcs_number (&sms_parameter);
#endif
// copy the SC number into the sms_parameter variable.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -