📄 mmiidle.c
字号:
}
/*******************************************************************************
$Function: idle_win_cb
$Description:
$Returns:
$Arguments:
$History
GW 09/10/02 - Removed display code to separate procedure.
*******************************************************************************/
static int idle_win_cb (MfwEvt e, MfwWin *w)
{
TRACE_FUNCTION("idle_win_cb");
switch (e)
{
case MfwWinVisible:
idle_draw_main_idle();
break;
case MfwWinFocussed: /* input focus / selected*/
case MfwWinDelete:/* window will be deleted*/
default:
return MFW_EVENT_REJECTED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: keyEvent
$Description: keyboard event handler
$Returns:
$Arguments:
*******************************************************************************/
static int idle_kbd_cb (MfwEvt e, MfwKbd *k)
{
static UBYTE right_key_pressed=FALSE;
UBYTE currentRinger = getCurrentRingerSettings();
T_MFW_SMS_STAT sms_list_type = MFW_SMS_ALL;
UBYTE Temp_edt_buf[KEYPADLOCK_BUF_SIZE];
char debug[50];
TRACE_FUNCTION("idle_kbd_cb");
TRACE_EVENT_P1("Key: %d", k->code);
if (idle_data.starting_up) /*NH Do nothing when starting up */
return MFW_EVENT_CONSUMED;
if (!(e & KEY_MAKE))
{
switch (k->code)
{
case KCD_RIGHT:
pin_idle_emerg_call = FALSE;
break;
// sbh - power key pressed in idle screen, we can shut down
case KCD_POWER:
pin_idle_emerg_call = FALSE;
HUPKeyOrigin = 1;
break;
case KCD_LEFT:
break;
default:
break;
}
idle_data.right_key_pressed = FALSE;
return MFW_EVENT_CONSUMED;
}
idle_data.right_key_pressed = FALSE;
if(idle_data.missedCalls > 0)
{
switch (k->code)
{
case KCD_MNUSELECT:
case KCD_LEFT:
idle_data.missedCalls = 0;
bookPhonebookStart(idle_data.win,PhbkMissedCallsListNormal);
return MFW_EVENT_CONSUMED;
default:
break;
}
}
if (idle_data.search)
{
switch (idle_data.nm_status)
{
case NETWORK_NO_SERVICE :
case NETWORK_NO_PLMN_XXX_AVAIL:
switch (k->code)
{
case KCD_MNUSELECT:
case KCD_LEFT:
wake_up_rr();
winShow(idle_data.win);
case KCD_HUP:
idle_data.search=FALSE;
winShow(idle_data.win);
break;
/*CONQ 6436, MC allow entry of emergency number*/
/*API - 13-09-02 -Add all KCD_0 and KCD_8 */
case KCD_0:
case KCD_1:
case KCD_2:
case KCD_8:
case KCD_9:
memset(idle_data.edt_buf,'\0',sizeof(idle_data.edt_buf));
idle_data.edt_buf[0]=editControls[k->code];
TRACE_EVENT_P2("Idle_data.edt_buf[0] = %d, [1] = %d", idle_data.edt_buf[0], idle_data.edt_buf[1]);
idle_dialling_start(idle_data.win,NULL);
break;
default:
break;
}
return MFW_EVENT_CONSUMED;
default:
break;
}
}
if (smsidle_get_unread_sms_available()
&& (!idle_data.clean_screen)
&& idle_data.new_sms )
{
switch (k->code)
{
case KCD_MNUSELECT:
case KCD_LEFT:
// terminate the ringing
audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
idle_data.new_sms = FALSE;
idle_data.clean_screen = TRUE;
SmsRead_R_start(idle_data.win, (MfwMnuAttr *)&sms_list_type);
return MFW_EVENT_CONSUMED;
default:
break;
}
}
//this is for cell broadcast
if ((!idle_data.clean_screen) && idle_data.new_cbch )
{
switch (k->code)
{
case KCD_MNUSELECT:
case KCD_LEFT:
// terminate the ringing
audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
idle_data.new_cbch = FALSE;
idle_data.clean_screen = TRUE;
sms_cb_read_msg (ALL_MESSAGE);
return MFW_EVENT_CONSUMED;
default:
break;
}
}
switch (k->code)
{
case KCD_MNUUP:
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
if(idle_data.editor)
{
TRACE_EVENT("CB menu up");
ATB_edit_MoveCursor(idle_data.editor,ctrlUp, TRUE);
}
#else /* NEW_EDITOR */
if(idle_data.edt)
{
TRACE_EVENT("CB menu up");
edtChar(idle_data.edt,ecUp);
}
#endif /*NEW_EDITOR */
else
{
/*
Indicate that the volume settings menu has been invoked from the
incoming call screen.
*/
setSoundsReason(SettingVolume);
idle_data.info_win=bookMenuStart(idle_data.win, ringerVolumeSetting(), SettingVolume);
}
break;
case KCD_MNUDOWN:
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
if(idle_data.editor)
{
TRACE_EVENT("CB menu down");
ATB_edit_MoveCursor(idle_data.editor,ctrlDown, TRUE);
}
#else /* NEW_EDITOR */
if(idle_data.edt)
{
TRACE_EVENT("CB menu down");
edtChar(idle_data.edt,ecDown);
}
#endif /*NEW_EDITOR */
else
{
/*
Indicate that the volume settings menu has been invoked from the
incoming call screen.
*/
setSoundsReason(SettingVolume);
idle_data.info_win=bookMenuStart(idle_data.win, ringerVolumeSetting(), SettingVolume);
}
break;
break;
case KCD_MNUSELECT:
case KCD_LEFT: /* main menu */
bookPhonebookStart(idle_data.win,PhbkNormal);
break;
case KCD_CALL:
bookPhonebookStart(idle_data.win,PhbkRedialListNormal);
break;
case KCD_RIGHT: /* contacts (ADN) */
/* SPR#1449 - SH - Remove, as terminates GPRS connection.
* Seems to be unnecessary. */
/*cm_force_disconnect();
// terminate the ringing
audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
*/
bookPhonebookStart(idle_data.win,PhbkMainMenu);
break;
case KCD_HUP:
/*
** NDH : 15/05/2003 : If the Idle editor is being displayed the only way to
** remove it is by pressing the Hangup Key, if it is active, do not set
** "Clean Screen" so that the previous "Missed Calls" etc will be displayed
*/
if (!idle_data.editor)
{
//for clean the DISPLAY ZONE 3
//information like "missed calls" and "receive messages"
//disappear if the user press the HUP key
idle_data.clean_screen = TRUE;
}
/* delete the message buffer plus the editor */
statusCBCH(FALSE);
windowsUpdate();
break;
// sbh - power key pressed in idle screen, we can shut down
case KCD_POWER:
HUPKeyOrigin = 1;
break;
case KCD_0:
case KCD_1:
case KCD_2:
case KCD_3:
case KCD_4:
case KCD_5:
case KCD_6:
case KCD_7:
case KCD_8:
case KCD_9:
case KCD_STAR:
case KCD_HASH:
memset(idle_data.edt_buf,'\0',sizeof(idle_data.edt_buf));
idle_data.edt_buf[0]=editControls[k->code];
idle_dialling_start(idle_data.win,NULL);
break;
default:
break;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: idle_kbd_long_cb
$Description: Creation of an instance for the Idle dialog.
$Returns:
$Arguments:
*******************************************************************************/
static int idle_kbd_long_cb(MfwEvt e, MfwKbd *k)
{
TRACE_FUNCTION ("idle_kbd_long_cb");
if ((e & KEY_RIGHT) && (e & KEY_LONG) && (idle_data.right_key_pressed == TRUE))
{
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: idle_get_window
$Description:
$Returns:
$Arguments:
*******************************************************************************/
MfwHnd idle_get_window (void)
{
return idle_data.win;
}
/*******************************************************************************
$Function: idle_set_starting_up
$Description: Sets a flag that indicates to Idle that the phone is starting up
$Returns:
$Arguments:
*******************************************************************************/
void idle_set_starting_up (UBYTE set)
{
idle_data.starting_up = set;
}
/*******************************************************************************
$Function: idleIsFocussed
$Description:
$Returns:
$Arguments:
*******************************************************************************/
int idleIsFocussed(void)
{
if (winIsFocussed(idle_data.win))
{
TRACE_EVENT("idleIsFocussed");
return 1;
}
else
return 0;
}
/*******************************************************************************
$Function: addMissedCall
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void addMissedCall(void)
{
idle_data.missedCalls++;
// show the info about missed calls on the idle screen
idle_data.clean_screen = FALSE;
}
/*******************************************************************************
$Function: addCBCH
$Description: this indicates the incoming cell-info cellbroadcast
or incoming sms class 0 message
The Status tells about to show or not on the Idle screen
$Returns:
$Arguments:
*******************************************************************************/
void addCBCH(char* cbch_string, UBYTE type)
{
switch(type)
{
case IdleNewCBImmediateMessage:
if(cbch_string NEQ NULL)
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
if (!idle_data.editor)
{
idle_data.editor = ATB_edit_Create (&idle_data.editor_attr2,0);
}
#else /* NEW_EDITOR */
if (!idle_data.edt)
{
idle_data.edt = edtCreate (idle_data.win,&idle_data.edt_attr2,0,0);
}
#endif /* NEW_EDITOR */
memset(idle_data.incoming_cb_msg, '\0',MAX_CBMSG_LEN);
strcpy((char *)idle_data.incoming_cb_msg, (char *)cbch_string);
//this is centralize the cb message if it's a short one
//12 cos CB messages have some space character after the string
//it is just a estimate
/* SPR#1428 - SH - New Editor changes. Use centralise
* editor feature. */
#ifdef NEW_EDITOR
if ((strlen(cbch_string)) < 12)
idle_data.editor_attr2.startFormat.attr |= DS_ALIGN_CENTRE;
ATB_edit_Init(idle_data.editor);
#else /* NEW_EDITOR */
if ((strlen(cbch_string)) < 12)
idle_data.edt_attr2.win.px = WIN_CENTRALIZE_ORG_X;
else
idle_data.edt_attr2.win.px = WIN_DIALLING_ORG_X;
#endif /*NEW_EDITOR*/
}
else
{
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
if (idle_data.editor)
{
ATB_edit_Destroy(idle_data.editor);
}
idle_data.editor_attr2.startFormat.attr = 0;
idle_data.editor = 0;
#else /* NEW_EDITOR */
if (idle_data.edt)
{
edtDelete(idle_data.edt);
}
//set the centralize for the cb message to default
idle_data.edt_attr2.win.px = WIN_DIALLING_ORG_X;
idle_data.edt = 0;
#endif /*NEW_EDITOR */
memset(idle_data.incoming_cb_msg, '\0',MAX_CBMSG_LEN);
}
break;
case IdleNewCBNormalMessage:
//set back to default
idle_data.clean_screen = FALSE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -