mmismsmenu.c

来自「是一个手机功能的模拟程序」· C语言 代码 · 共 2,291 行 · 第 1/5 页

C
2,291
字号
    TRACE_FUNCTION ("V_destroy()");

    if (own_window)
  {
      win_data = ((T_MFW_HDR *)own_window)->data;
      data = (T_V *)win_data->user;

      if (data)
    {
        /*
         * Delete WIN handler
         */
		if (data->voice_edit)
	  		editor_destroy(data->voice_edit);
        win_delete (data->win);

        /*
         * Free Memory
         */
        FREE_MEMORY ((void *)data, sizeof (T_V));
    }
      else
    {
        TRACE_FUNCTION ("V_destroy() called twice");
    }
  }
}

/*******************************************************************************

 $Function:     V_exec_cb

 $Description:  Exec callback function for the voice mailbox window

 $Returns:    none

 $Arguments:  win - current window
        event - event id
        value - Unique id
        parameter - optional data.

*******************************************************************************/

void V_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_V          * data = (T_V *)win_data->user;

  char mail_alpha[10+1] = ""; // size hard coded in pcm.h

    T_EDITOR_DATA editor_data;

    TRACE_FUNCTION ("V_exec_cb()");

  switch (event)
  {
    // On exit from the editor, we try again to call the number
    case E_INIT:

      if ( (value EQ V_ID_SET) )
      {
      /* initialization of administrative data */
      data->id = value;
//nm, later have to save the voicemail number on FFS  !!!

//      if (SmsRead_convertMailbox(MFW_MB_LINE1, (char *)data->FFS_flashData.voice_mail, mail_alpha) == TRUE)
        // If there is a voice mail number stored in PCM, we call it directly
//        callNumber(data->FFS_flashData.voice_mail);
  //    else
        // Open an editor to enter the number
//      {
			memset(data->voice_mail,0,sizeof(data->voice_mail));
      		memcpy(data->voice_mail,FFS_flashData.voice_mail,PHB_MAX_LEN);
        	SmsMenu_loadEditDefault(&editor_data);
			editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtVoicemail,(char*)data->voice_mail,PHB_MAX_LEN,edtCurBar1);
			editor_data.edtInPbk           = 0;
			editor_data.LeftSoftKey          = TxtSave;
			editor_data.AlternateLeftSoftKey = TxtNull;
			editor_data.RightSoftKey         = TxtDelete;
			editor_data.Identifier           = value ; 
			editor_data.destroyEditor		 = FALSE;
			editor_data.mode=PHONENUMONLY_MODE	;
			data->voice_edit=editor_start(data->win, &editor_data);  /* start the editor */ 
        	winShow(win);
//      }
      }
      else
      {
        if (value EQ V_ID_CALL)
        {
	        SmsMenu_loadEditDefault(&editor_data);
      		memcpy(data->voice_mail,FFS_flashData.voice_mail,PHB_MAX_LEN);
			editor_attr_init_fullscr(&editor_data.editor_attr,1,TxtVoicemail,(char*)data->voice_mail,PHB_MAX_LEN,edtCurBar1);
			editor_data.edtInPbk           = 0;
            //if((FFS_flashData.voice_mail[0] != '\0') )        
			editor_data.LeftSoftKey          = TxtSoftCall;
			editor_data.AlternateLeftSoftKey = TxtNull;
			editor_data.RightSoftKey         = TxtDelete;
			editor_data.Identifier           = value ; 
			editor_data.destroyEditor		 = FALSE;
			editor_data.mode=PHONENUMONLY_MODE	;
			data->voice_edit=editor_start(data->win, &editor_data);  /* start the editor */ 
        	winShow(win);
        }
      }

      break;

    case E_ABORT:
        V_destroy(win);

        break;

    case E_RETURN:
    case E_EXIT:

    default:
        return;
  }
}

/*******************************************************************************

 $Function:     V_win_cb

 $Description:  Window callback function for the voice mailbox window

 $Returns:    Execution status

 $Arguments:  e - event id
        w - mfw window handle

*******************************************************************************/

static int V_win_cb (MfwEvt e, MfwWin *w)
    /* V window event handler */
{
    TRACE_FUNCTION ("V_win_cb()");

    switch (e)
  {
        case MfwWinVisible:  /* window is visible  */
      displaySoftKeys(TxtSoftSelect,TxtSoftBack);
#if(MAIN_LCD_SIZE==3)
	  draw_softkeybar_updown_arrow();//jhxu720
#endif
      break;
  case MfwWinFocussed: /* input focus / selected   */
  case MfwWinDelete:   /* window will be deleted   */
        default:
      return MFW_EVENT_REJECTED;
  }
    return MFW_EVENT_CONSUMED;
}


/*******************************************************************************

 $Function:     V_NUM_start

 $Description:  Start the Voice Mailbox number edition window

 $Returns:    mfw window handle

 $Arguments:  parent_window - parent window
        menuAttr - Menu attribute.

*******************************************************************************/

//T_MFW_HND V_NUM_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
//{
//    T_MFW_HND win;
//
//    TRACE_EVENT ("V_NUM_start()");
//
//    win = V_NUM_create (parent_window);
//
//    if (win NEQ NULL)
//  {
//      SEND_EVENT (win, E_INIT, V_NUM_ID, (void *)menuAttr);
//  }
//    return win;
//}

/*******************************************************************************

 $Function:     V_NUM_create

 $Description:  Create the Voice Mailbox number edition window

 $Returns:    mfw window handle

 $Arguments:  parent_window - parent window

*******************************************************************************/

//static T_MFW_HND V_NUM_create(MfwHnd parent_window)
//{
//    T_V_NUM      * data = (T_V_NUM *)ALLOC_MEMORY (sizeof (T_V_NUM));
//    T_MFW_WIN  * win;
//
//    TRACE_FUNCTION ("V_NUM_create()");
//
//    /*
//     * Create window handler
//     */
//
//    data->win =
//  win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)V_NUM_win_cb);
//    if (data->win EQ NULL)
//  {
//      return NULL;
//  }
//    /*
//     * connect the dialog data to the MFW-window
//     */
//
//    data->mmi_control.dialog = (T_DIALOG_FUNC)V_NUM_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:     V_NUM_destroy

 $Description:  Destroy the Voice Mailbox number edition window

 $Returns:    none

 $Arguments:  own_window - current window

*******************************************************************************/

//static void V_NUM_destroy(MfwHnd own_window)
//{
//    T_MFW_WIN * win_data;
//    T_V_NUM     * data;
//
//    TRACE_FUNCTION ("V_NUM_destroy()");
//
//    if (own_window)
//  {
//      win_data = ((T_MFW_HDR *)own_window)->data;
//      data = (T_V_NUM *)win_data->user;
//
//      if (data)
//    {
//        /*
//         * Delete WIN handler
//         */
//        win_delete (data->win);
//
//        /*
//         * Free Memory
//         */
//        FREE_MEMORY ((void *)data, sizeof (T_V_NUM));
//    }
//      else
//    {
//        TRACE_EVENT ("V_NUM_destroy() called twice");
//    }
//  }
//}

/*******************************************************************************

 $Function:     V_NUM_exec_cb

 $Description:  Exec callback function of the Voice Mailbox number edition window

 $Returns:    none

$Arguments:   win - current window
        event - event id
        value - Unique id
        parameter - optional data.

*******************************************************************************/

//void V_NUM_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_V_NUM          * data = (T_V_NUM *)win_data->user;
//    T_MFW_HND      * l_parent;
//    SHORT            l_id;
//
//  T_EDITOR_DATA editor_info;
//
//    TRACE_FUNCTION ("V_NUM_exec_cb()");
//
//  l_parent = data->parent;
//  l_id = data->id;
//
//  switch (event)
//  {
//  case E_INIT:
//      /* initialization of administrative data */
//      data->id = value;
//
//    winShow(win);
//
//    /* initialization of the dialog data */
//
//    editor_info.editor_attr.text     = (char *)data->voice_number_buffer;
//    editor_info.editor_attr.size     = 32;
//
//    editor_info.LeftSoftKey       = TxtSoftBack;
//    editor_info.RightSoftKey      = TxtHelp;
//    editor_info.TextId            = TxtEnterVoiceNumber;
//    editor_info.Identifier        = 0;  /* optional */
//    editor_info.mode              = DIGITS_MODE; /* or ALPHA_MODE */
//    editor_info.destroyEditor     = TRUE;
//    editor_info.Callback          = (T_EDIT_CB)SmsMenu_V_NUM_editor_cb;
//
//    data->voice_number_buffer[0] = '\0';
//
//    editor_start(win,&editor_info);  /* start the editor */
//
//      break;
//
//  case E_ABORT:
//  case E_EXIT:
//      V_NUM_destroy(data->win);
//      SEND_EVENT (l_parent, event, l_id, NULL); /* forward event to parent */
//      break;
//
//  case E_RETURN:
//  default:
//      return;
//  }
//}

/*******************************************************************************

 $Function:     V_NUM_win_cb

 $Description:  Window callback function of the Voice Mailbox number edition window

 $Returns:    Execution status

$Arguments:   e - event id
        w - mfw window handle

*******************************************************************************/

//static int V_NUM_win_cb (MfwEvt e, MfwWin *w)
//    /* V_NUM window event handler */
//{
//    TRACE_FUNCTION ("V_NUM_win_cb()");
//
//    switch (e)
//  {
//        case MfwWinVisible:  /* window is visible  */
//      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:    	Delete_NVM_ALL_sms

 $Description:	delete all NVM sms 
 			
 $Returns:		if success return 1 else return 0

 $Arguments:	
*******************************************************************************/
int Delete_NVM_ALL_sms()
{
  	//FlashSms * tmp;
  	int i;
    TRACE_FUNCTION ("Delete_NVM_ALL_sms()");
    memset(Flash_sms_sort_index,0,sizeof(T_MMI_FLASH_SORT_INDEX)*FLSAH_SMS_NUM);
	memset(Flash_sms_messages,0,sizeof(T_MMI_FLASH_SMS_INDEX)*FLSAH_SMS_NUM);
    for (i=0;i<FlashSMS_Table;i++)              
    {                                   
      if (flash_Smsread(FlashSMSTable[i])!=0)
      {
         ConfigFLASHSMSReset();
         flash_Smswrite(FlashSMSTable[i]);                                      
      }
    }
    #if 0
  	
	for(i=0;i<FlashSMStotal;i++)
	{
		tmp=&FFS_SMSData.NVMSMS[i];
		if( (tmp->state == MFW_SMS_MO)||(tmp->state == MMI_SMS_MO)
		||(tmp->state == MFW_SMS_STOR_UNSENT)||(tmp->state == MFW_SMS_STOR_SENT))
		{
			memset(tmp->addr,0,MFW_NUM_LEN);
			memset((char *)tmp->sms_msg,0,MAX_MSG_LEN);
			tmp->msg_len=0;
			tmp->dcs=0xff;
			tmp->state =0;
		}
		else if(( tmp->state == MFW_SMS_MT)||(tmp->state == MMI_SMS_MT))
		{
			memset(tmp->addr,0,MFW_NUM_LEN);
			memset((char *)tmp->sms_msg,0,MAX_MSG_LEN);
			memset((char *)tmp->time.year, 0, MAX_SCTP_DIGITS);
	  		memset((char *)tmp->time.month, 0,MAX_SCTP_DIGITS);
	  		memset((char *)tmp->time.day, 0, MAX_SCTP_DIGITS);
	  		memset((char *)tmp->time.hour,0, MAX_SCTP_DIGITS);
	  		memset((char *)tmp->time.minute, 0, MAX_SCTP_DIGITS);
			tmp->msg_len=0;
			tmp->dcs=0xff;
			tmp->state =0;
		}
	}
	#endif
	FlashSMStotal=0;
	return 1;
}
/*******************************************************************************

 $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 Sms_NVM_DEL_ALL_dialog_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;
    T_DISPLAY_DATA  DisplayInfo;

    TRACE_FUNCTION ("Sms_NVM_DEL_ALL_dialog_cb()");

  	l_parent = data->parent;
  	l_id = data->id;

    switch (Reason)
    {
    	// User want to delete the SMS

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?