mmismsmenu.c
来自「是一个手机功能的模拟程序」· C语言 代码 · 共 2,291 行 · 第 1/5 页
C
2,291 行
case INFO_KCD_LEFT:
// Trigger the deletion
if(Delete_NVM_ALL_sms())
{
dialog_info_init(&DisplayInfo);//gdy add
SmsMenu_loadDialogDefault(&DisplayInfo);
//NM 29.8 Check before deleting, is SIM ready ?! */
DisplayInfo.TextId2 = TxtDelSucceed;
DisplayInfo.Identifier = SMSMENU_ID_DELOK;
DisplayInfo.iconindex =REMIND_SUCCEED;
(void) info_dialog(win, &DisplayInfo);
}
else
{
dialog_info_init(&DisplayInfo);//gdy add
SmsMenu_loadDialogDefault(&DisplayInfo);
//NM 29.8 Check before deleting, is SIM ready ?! */
DisplayInfo.TextId2 = TxtDelFail;
DisplayInfo.Identifier = SMSMENU_ID_DELERR;
DisplayInfo.iconindex =REMIND_FAILURE;
(void) info_dialog(win, &DisplayInfo);
}
break;
case INFO_KCD_RIGHT:
case INFO_KCD_HUP:
case INFO_TIMEOUT:
/* Destroy the owner of the dialog box */
M_DEL_ALL_destroy(win);
/* Send E_RETURN event to parent of M_DEL_ALL */
SEND_EVENT (l_parent, E_RETURN, l_id, NULL); /* forward event to parent */
break;
default:
return MFW_EVENT_REJECTED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: SmsMenu_standard_dialog_cb
$Description: Handler function for standard dialogs in smsmenu module
$Returns: Execution status
$Arguments: win - current window
Identifier - unique id
Reason- event id
*******************************************************************************/
int SmsMenu_standard_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason)
{
T_MFW_WIN * win_data = 0;//((T_MFW_HDR *) win)->data;
T_M_DEL_ALL * data = 0;//(T_M_DEL_ALL *)win_data->user;
T_MFW_HND * l_parent;
SHORT l_id;
MMI_TRACE_EVENT(("<<<talcon,SmsMenu_standard_dialog_cb()"));
MMI_TRACE_EVENT(("<<<talcon,SmsMenu_standard_dialog_cb()--win:0x%p,type:%d",win,((T_MFW_HDR *) win)->type));
if(((T_MFW_HDR *) win)->type != MfwTypWin)
{
MMI_TRACE_EVENT(("<<<talcon,SmsMenu_standard_dialog_cb---1"));
return MFW_EVENT_REJECTED;
}
if( (win_data = ((T_MFW_HDR *) win)->data ) == 0)
{
MMI_TRACE_EVENT(("<<<talcon,SmsMenu_standard_dialog_cb---2"));
return MFW_EVENT_REJECTED;
}
if( (data = (T_M_DEL_ALL *)win_data->user) == 0)
{
MMI_TRACE_EVENT(("<<<talcon,SmsMenu_standard_dialog_cb---3"));
return MFW_EVENT_REJECTED;
}
l_parent = data->parent;
l_id = data->id;
switch (Identifier)
{
case SMSMENU_ID_DELETEALL:
switch (Reason)
{
// User want to delete the SMS
case INFO_KCD_LEFT:
// Trigger the deletion
SmsMenu_sms_delete_all(win);
break;
case INFO_KCD_RIGHT:
case INFO_KCD_HUP:
case INFO_TIMEOUT:
/* Destroy the owner of the dialog box */
M_DEL_ALL_destroy(win);
/* Send E_RETURN event to parent of M_DEL_ALL */
SEND_EVENT (l_parent, E_RETURN, l_id, NULL); /* forward event to parent */
break;
default:
return MFW_EVENT_REJECTED;
}
break;
case SMSMENU_ID_NOTREADY:
//break;
case SMSMENU_ID_DELOK:
case SMSMENU_ID_DELERR:
case SMSMENU_ID_NOMESSAGES:
/* Destroy the owner of the dialog box */
data->waiting_win = 0;
M_DEL_ALL_destroy(win);
/* Send E_EXIT event to parent of M_DEL_ALL_ACK */
//JVJE SEND_EVENT(l_parent, E_EXIT, l_id, NULL); /* forward event to parent */
break;
case SMSMENU_ID_WAIT:
// No reaction to any event (wait to be destroyed when MFW event received)
break;
case SMSMENU_ID_SAVEOK:
V_destroy(win);
break;
default:
return MFW_EVENT_REJECTED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: SmsMenu_V_NUM_editor_cb
$Description: Common handler of the sms menu editor windows
$Returns: Execution status
$Arguments: win - current window
Identifier - unique id
Reason- event id
*******************************************************************************/
//int SmsMenu_V_NUM_editor_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason)
//{
// T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
// T_M_DEL_ALL * data = (T_M_DEL_ALL *)win_data->user;
// T_MFW_HND * l_parent;
// SHORT l_id;
//
// TRACE_FUNCTION ("SmsMenu_V_NUM_editor_cb()");
//
// l_parent = data->parent;
// l_id = data->id;
//
// switch (Reason)
// {
// case INFO_KCD_LEFT:
// /* We have to copy the phone number from the editor to the variable corresponding to the voice mailbox number TBD*/
// V_NUM_destroy(data->win);
// SEND_EVENT (l_parent, E_EXIT, l_id, NULL); /* forward event to parent */
// break;
// case INFO_KCD_RIGHT:
// case INFO_KCD_HUP:
// V_NUM_destroy(data->win);
// SEND_EVENT (l_parent, E_RETURN, l_id, NULL); /* forward event to parent */
// break;
// default:
// return MFW_EVENT_REJECTED;
// }
// return MFW_EVENT_CONSUMED;
//}
/*******************************************************************************
$Function: SmsMenu_loadDialogDefault
$Description: Loads standard default data for SMS information dialogs.
$Returns: Execution status
$Arguments: DisplayInfo - display settings
*******************************************************************************/
void SmsMenu_loadDialogDefault(T_DISPLAY_DATA * DisplayInfo)
{
DisplayInfo->TextString = 0;
DisplayInfo->TextString2 = 0;
DisplayInfo->LeftSoftKey = 0;
DisplayInfo->RightSoftKey = 0;
DisplayInfo->Time = ONE_SECS;
DisplayInfo->KeyEvents = KEY_CLEAR|KEY_HUP|KEY_RIGHT;
DisplayInfo->TextId = 0;
DisplayInfo->TextId2 = 0;
DisplayInfo->Identifier = DIALOGS_REASON_NULL;
DisplayInfo->Callback = (T_VOID_FUNC)SmsMenu_standard_dialog_cb;
}
/*******************************************************************************
$Function: SmsMenu_call_voice
$Description: dummy function.
$Returns: none
$Arguments: none
*******************************************************************************/
void SmsMenu_call_voice(void)
{
TRACE_FUNCTION ("call_voice");
}
/*******************************************************************************
$Function: SmsMenu_startcall
$Description: dummy function.
$Returns: Execution status
$Arguments: DisplayInfo - display settings
*******************************************************************************/
void SmsMenu_startcall(UBYTE * VoiceNumber)
{
TRACE_FUNCTION ("startcall");
}
/*******************************************************************************
$Function: SmsMenu_sms_delete_all
$Description: Delete all SMS messages.
$Returns: Execution status
$Arguments: win - current window.
*******************************************************************************/
int SmsMenu_sms_delete_all(T_MFW_HND win)
{
//T_MFW_HND win = mfw_parent (mfw_header());
T_DISPLAY_DATA DisplayInfo;
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_M_DEL_ALL * data = (T_M_DEL_ALL *)win_data->user;
g_ListLength2 = sms_message_list(MFW_SMS_ALL, data->g_SmsMenu_messages, MAX_MESSAGES);
//NM 22.8 msgsLoadInfoDefaults2(&DisplayInfo);
if (g_ListLength2 > 0)
{
/* Display "Please wait" on the screen*/
/* it is start now to delete sms*/
// SEND_EVENT (win, E_BACK, SMSMENU_ID_WAIT,NULL);
dialog_info_init(&DisplayInfo);//gdy add
SmsMenu_loadDialogDefault(&DisplayInfo);
DisplayInfo.RightSoftKey = 0;
DisplayInfo.Time = FOREVER;
DisplayInfo.KeyEvents = KEY_CLEAR|KEY_RIGHT;
DisplayInfo.TextId2 =TxtDeletingSms;
DisplayInfo.RightSoftKey=TxtSoftBack;
DisplayInfo.iconindex =REMIND_DELETING;//REMIND_NORECORD;
DisplayInfo.Identifier = SMSMENU_ID_NOMESSAGES;
data->waiting_win=info_dialog(win, &DisplayInfo);
/* delete now the first sms and than wait */
/* for the MFW EVENT "E_SMS_OK" */
g_ListLength2 --;
sms_msg_delete(data->g_SmsMenu_messages[g_ListLength2].index);
}
else
{
/* Display "No Messages" on the screen */
/* and go back to the parent */
dialog_info_init(&DisplayInfo);//gdy add
SmsMenu_loadDialogDefault(&DisplayInfo);
DisplayInfo.Identifier = SMSMENU_ID_NOMESSAGES;
DisplayInfo.iconindex =REMIND_NORECORD;
DisplayInfo.TextId2= TxtNoMessages;
info_dialog(win,&DisplayInfo);
//SEND_EVENT (win, E_BACK, SMSMENU_ID_NOMESSAGES,NULL);
}
return 1;
}
/*******************************************************************************
$Function: SmsRead_convertMailbox
$Description:
$Returns:
$Arguments:
*******************************************************************************/
UBYTE SmsRead_convertMailbox(T_MFW_MAILBOX_ID i, char *mail_number, char *mail_alpha)
{
USHORT max_rcd;
USHORT nlen;
char *international = mail_number; // Used to add '+' to the number if international
TRACE_FUNCTION ("SmsRead_convertMailbox()");
// If international number, add the '+' symbol
if (FFS_flashData.mbn_numTp & 0x10)
{
international[0] = '+';
international[1] = '\0';
international ++;
}
// Convert BCD number into string
cmhPHB_getAdrStr(international, PHB_MAX_LEN - 1, FFS_flashData.mbn_Num, FFS_flashData.mbn_len);
// If the same number then we get the alpha identifier
cmhPHB_getMfwTagNt((UBYTE*)FFS_flashData.mbn_AlphId, 10, (UBYTE*)mail_alpha, &nlen );
mail_alpha[nlen] = '\0';
return TRUE;
}
static void SmsMenu_StandardEditor_cb (T_MFW_HND win, USHORT Identifier, SHORT reason)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_V * voice_data = (T_V *)win_data->user;
T_DISPLAY_DATA DisplayInfo;
TRACE_FUNCTION ("SmsSend_NBEDIT_edit_cb()");
switch (reason)
{
case INFO_KCD_LEFT:
switch (Identifier)
{
// case SMSMENU_ID_VOICEMAIL_CALL:
// voice_data = (T_V *)win_data->user;
// callNumber(voice_data->FFS_flashData.voice_mail);
case V_ID_CALL:
memcpy(FFS_flashData.voice_mail,voice_data->voice_mail,PHB_MAX_LEN);
flash_write();
callNumber(voice_data->voice_mail);
V_destroy(win);
break;
case V_ID_SET:
//SmsMenu_loadDialogDefault(&DisplayInfo);
//DisplayInfo.Identifier = SMSMENU_ID_SAVEOK;
//DisplayInfo.TextId = TxtSaved;
//info_dialog(voice_data->win,&DisplayInfo);
mmi_dialog_information_screen(win, TxtSaved, 0,(T_VOID_FUNC)SmsMenu_standard_dialog_cb, SMSMENU_ID_SAVEOK);
memcpy(FFS_flashData.voice_mail,voice_data->voice_mail,PHB_MAX_LEN);
flash_write();
break;
// this is for saving the Voicemail number in PCM
// case SMSMENU_ID_VOICEMAIL:
// settings_data = (T_SETTINGS *)win_data->user;
// if (servicesStoreVoiceMailNumber((char *)settings_data->settings_numbers.FFS_flashData.voice_mail, MFW_MB_LINE1) == MFW_PHB_OK)
// mmi_dialog_information_screen(win, MMI_DIALOG_INFO_SAVED, (T_VOID_FUNC)SmsMenu_standard_dialog_cb, SMSMENU_ID_SAVEOK);
// else
// mmi_dialog_information_screen(win, MMI_DIALOG_INFO_FAILED, (T_VOID_FUNC)SmsMenu_standard_dialog_cb, SMSMENU_ID_SAVEERR);
// break;
}
break;
case INFO_KCD_RIGHT:
case INFO_KCD_CLEAR:
case INFO_KCD_HUP:
// switch (Identifier)
// {
// case SMSMENU_ID_VOICEMAIL:
// SmsMenu_SETTINGS_destroy(win);
// break;
// case SMSMENU_ID_VOICEMAIL_CALL:
V_destroy(win);
// break;
// default:
// break;
// }
default:
break;
}
}
/*******************************************************************************
$Function: SmsMenu_loadEditDefault
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void SmsMenu_loadEditDefault(T_EDITOR_DATA *editor_data)
{
TRACE_FUNCTION ("SmsMenu_loadEditDefault()");
editor_data->editor_attr.win.px = 6;
editor_data->editor_attr.win.py = 12;
editor_data->editor_attr.win.sx = 80;
editor_data->editor_attr.win.sy = 20;
editor_data->editor_attr.fgColor = 0;
editor_data->editor_attr.font = 0;
editor_data->editor_attr.mode = edtCurBar1;
editor_data->editor_attr.controls = 0;
editor_data->editor_attr.text = '\0';
editor_data->editor_attr.size = 0;
editor_data->hide = FALSE;
editor_data->Identifier = 0; /* optional */
editor_data->mode = DIGITS_MODE;
editor_data->destroyEditor = TRUE;
editor_data->LeftSoftKey = TxtSoftSelect;
editor_data->AlternateLeftSoftKey = TxtNull;
editor_data->RightSoftKey = TxtSoftBack;
editor_data->Identifier = 0;
editor_data->TextId = '\0';
editor_data->TextString = NULL;
editor_data->min_enter = 1; // Avoid to return empty strings
editor_data->timeout = FOREVER;
editor_data->Callback = (T_EDIT_CB)SmsMenu_StandardEditor_cb;
}
#undef MMI_SMSMENU_C
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?