📄 mmismssend.c
字号:
$Description: called when the user press Call sender in the Option menu
$Returns: execution status
$Arguments: m - Menu handle
i - Menu item selected.
*******************************************************************************/
static int SmsSend_R_OPTExeSave(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
TRACE_FUNCTION("SmsRead_R_OPTExeCallSender");
if (!smsidle_get_ready_state())
{
// SMS init processing not ready to access SIM to store the SMS
mmi_dialog_information_screen(win, 0,"Not Ready", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SAVE_NOT_READY);
// Recreate the editor on dialog callback
}
else
//END TB
// Start a save window and provide it a T_SmsUserData structure (in the future, will allow to save easily text but also number...)
{
SmsSend_SAVE_start(data->parent_data->win, &(data->parent_data->edt_data));
SmsSend_R_OPT_destroy(win);
}
return 1;
}
/*******************************************************************************
$Function: SmsSend_OPT_start
$Description: called when the user press Call sender in the Option menu
$Returns: execution status
$Arguments: parent_window -parent window handle
menuAttr - Menu attributes.
*******************************************************************************/
T_MFW_HND SmsSend_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
{
T_MFW_HND win;
TRACE_FUNCTION ("SmsSend_OPT_start()");
win = SmsSend_R_OPT_create (parent_window);
if (win NEQ NULL)
{
SEND_EVENT (win, E_INIT, NULL, (void *)menuAttr);
}
return win;
}
/*******************************************************************************
$Function: SmsSend_R_OPT_create
$Description: Create the Option window
$Returns: mfw window handle
$Arguments: parent_window -parent window handle
*******************************************************************************/
static T_MFW_HND SmsSend_R_OPT_create(MfwHnd parent_window)
{
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)ALLOC_MEMORY (sizeof (T_SMSSEND_R_OPT));
T_MFW_WIN * win;
TRACE_FUNCTION ("SmsSend_R_OPT_create()");
/*
* Create window handler
*/
data->win =
win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)SmsSend_R_OPT_win_cb);
if (data->win EQ NULL)
{
return NULL;
}
/*
* connect the dialog data to the MFW-window
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)SmsSend_R_OPT_exec_cb;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent = parent_window;
/*
* return window handle
*/
return data->win;
}
/*******************************************************************************
$Function: SmsSend_R_OPT_destroy
$Description: Destroy the Option window
$Returns: mfw window handle
$Arguments: own_window - current window
*******************************************************************************/
static void SmsSend_R_OPT_destroy(MfwHnd own_window)
{
T_MFW_WIN * win_data;
T_SMSSEND_R_OPT * data;
TRACE_FUNCTION ("SmsSend_R_OPT_destroy()");
if (own_window)
{
win_data = ((T_MFW_HDR *)own_window)->data;
data = (T_SMSSEND_R_OPT *)win_data->user;
if (data)
{
/*
* Delete WIN handler
*/
data->parent_data->options_win = 0;
win_delete (data->win);
/*
* Free Memory
*/
FREE_MEMORY ((void *)data, sizeof (T_SMSSEND_R_OPT));
}
else
{
TRACE_EVENT ("SmsSend_R_OPT_destroy() called twice");
}
}
}
/*******************************************************************************
$Function: SmsSend_R_OPT_exec_cb
$Description: Exec callback function for the Option window
$Returns: none
$Arguments: win - current window
event - event id
value - unique id
parameter - optional data.
*******************************************************************************/
void SmsSend_R_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
/* callback handler for events sent to to trigger execution */
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
T_MFW_HND * l_parent;
SHORT l_id;
T_MFW_HDR * parent = data->parent;
T_MFW_WIN * win_data2 = ((T_MFW_HDR *)parent)->data;
T_SEND * parent_data = (T_SEND *)win_data2->user;
T_MFW_EVENT MfwEvents;
TRACE_FUNCTION ("SmsSend_R_OPT_exec_cb()");
switch (event)
{
case E_INIT:
TRACE_EVENT("SmsSend_R_OPT_exec_cb() Event:5.E_INIT");
/* initialization of administrative data */
data->parent_data = parent_data;
data->id = value;
data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)SmsSend_R_OPT_kbd_cb);
data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)SmsSend_R_OPT_kbd_cb);
data->menu = mnuCreate(data->win,(MfwMnuAttr*)&SmsSend_R_OPTAttrib, E_MNU_ESCAPE, (MfwCb)SmsSend_R_OPT_mnu_cb);
mnuLang(data->menu,mainMmiLng);
/* put the (new) dialog window on top of the window stack */
mnuUnhide(data->menu);
winShow(win);
break;
default:
return;
}
}
/*******************************************************************************
$Function: SmsSend_R_OPT_mnu_cb
$Description: Menu callback function for the Option window
$Returns: none
$Arguments: e - event id
m - menu handle
*******************************************************************************/
static int SmsSend_R_OPT_mnu_cb (MfwEvt e, MfwMnu *m)
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
T_MFW_HND * l_parent;
SHORT l_id;
TRACE_FUNCTION ("SmsRead_R_OPT_mnu_cb()");
switch (e)
{
case E_MNU_ESCAPE: /* back to previous menu */
SmsSend_R_OPT_destroy(data->win);
break;
default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */
return MFW_EVENT_REJECTED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: SmsSend_R_OPT_win_cb
$Description: Window callback function for the Option window
$Returns: execution status
$Arguments: e - event id
w - window handle
*******************************************************************************/
static int SmsSend_R_OPT_win_cb (MfwEvt e, MfwWin *w)
{
TRACE_FUNCTION ("SmsSend_R_OPT_win_cb()");
switch (e)
{
case MfwWinVisible: /* window is visible */
dspl_ClearAll();
displaySoftKeys(TxtSoftSelect,TxtSoftBack);
break;
case MfwWinFocussed: /* input focus / selected */
case MfwWinDelete: /* window will be deleted */
default:
return MFW_EVENT_REJECTED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: SmsSend_R_OPT_kbd_cb
$Description: Exec callback function for the Option window
$Returns: execution status
$Arguments: e - event id
k - keyboard info
*******************************************************************************/
static int SmsSend_R_OPT_kbd_cb (MfwEvt e, MfwKbd *k)
/* SmsRead_R_OPT keyboard event handler */
{
T_MFW_HND win = mfwParent(mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user;
TRACE_FUNCTION ("SmsSend_R_OPT_kbd_cb()");
if (e & KEY_LONG)
{
switch (k->code)
{
case KCD_HUP: /* back to previous menu */
mnuEscape(data->menu);
break;
case KCD_RIGHT: /* Power Down */
return MFW_EVENT_REJECTED; /* handled by idle */
default: /* no response to all other keys */
return MFW_EVENT_CONSUMED;
}
}
else
{
switch (k->code)
{
case KCD_MNUUP: /* highlight previous entry */
mnuUp(data->menu);
break;
case KCD_MNUDOWN: /* highlight next entry */
mnuDown(data->menu);
break;
case KCD_MNUSELECT:
case KCD_LEFT: /* activate this entry */
mnuSelect(data->menu);
break;
case KCD_HUP: /* back to previous menu */
case KCD_RIGHT: /* back to previous menu */
mnuEscape(data->menu);
break;
default: /* no response to all other keys */
return MFW_EVENT_CONSUMED;
}
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: SmsSend_SEND_start
$Description: Create SMS send window
$Returns: execution status
$Arguments: parent_window - parent window.
UserData - SMS data
*******************************************************************************/
T_MFW_HND SmsSend_SEND_start(T_MFW_HND parent_window, T_SmsUserData *UserData)
{
T_MFW_HND win;
TRACE_FUNCTION ("SmsSend_SEND_start()");
parentWindow4SMS = parent_window;
win = SmsSend_SEND_create (parent_window);
if (win NEQ NULL)
{
SEND_EVENT (win, E_INIT, SEND_ID, (void *)UserData);
}
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.
*******************************************************************************/
static 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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -