⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmismsmenu.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 4 页
字号:
      {
               SEND_EVENT(data->waiting_win,DIALOG_DESTROY,0,0 );
        data->waiting_win = 0;
      }

        win_delete (data->win);

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

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

 $Function:     M_DEL_ALL_exec_cb

 $Description:  Exec callback function for the Delete All window

 $Returns:    none

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

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

void M_DEL_ALL_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_M_DEL_ALL    * data = (T_M_DEL_ALL *)win_data->user;
    T_MFW_HND      * l_parent;
    SHORT            l_id;
  T_MFW_EVENT      MfwEvents;

    T_DISPLAY_DATA  DisplayInfo;

    TRACE_FUNCTION ("M_DEL_ALL_exec_cb()");

    switch (event)
  {
  case E_INIT:
      /* initialization of administrative data */
      data->id = value;

      /* initialization of the dialog data */
    data->type = (enum SmsType)parameter;


    MfwEvents = E_SMS_MO_AVAIL | E_SMS_ERR | E_SMS_OK;
    data->sms_hnd = sms_create(data->win,MfwEvents,(MfwCb)M_DEL_ALL_mfw_cb);

    /* create the dialog handler */
    // Display the dialog window to delete all the SMS
    SmsMenu_loadDialogDefault(&DisplayInfo);

    //NM 29.8 Check before deleting, is SIM ready ?!  */
    if (!smsidle_get_ready_state())
    {
      DisplayInfo.TextId     = TxtWaiting;
      DisplayInfo.Identifier = SMSMENU_ID_NOTREADY;
      }
    else
    {

      DisplayInfo.TextId       = TxtOkToDelete;
      DisplayInfo.Time         = FIVE_SECS;
      DisplayInfo.KeyEvents    = KEY_RIGHT|KEY_LEFT|KEY_CLEAR;
      DisplayInfo.Identifier   = SMSMENU_ID_DELETEALL;
      DisplayInfo.LeftSoftKey  = TxtSoftOK;
      DisplayInfo.RightSoftKey = TxtSoftBack;
    }
    // Generic function for info messages

        (void) info_dialog(win, &DisplayInfo);

    winShow(win);

    break;

  case E_ABORT:
  case E_EXIT:
      l_parent = data->parent;
      l_id = data->id;
      M_DEL_ALL_destroy (data->win);
      break;

  case E_RETURN:
  default:
      return;
  }
}

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

 $Function:     M_DEL_ALL_win_cb

 $Description:  Window callback function for the delete all window

 $Returns:    none

 $Arguments:  e - current window
        w - event id

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

static int M_DEL_ALL_win_cb (MfwEvt e, MfwWin *w)
    /* V window event handler */
{
    TRACE_FUNCTION ("M_DEL_ALL_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:     M_DEL_ALL_mfw_cb

 $Description:  Exec callback function for the DEL_ALL window


 $Returns:    none

 $Arguments:  event - event id
        parameter - optional data.

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

int M_DEL_ALL_mfw_cb (MfwEvt event, void *parameter)
{
    T_MFW_HND         win       = mfwParent((MfwHdr *)mfw_header());
    T_MFW_WIN   * win_data = ((T_MFW_HDR *)win)->data;
    T_M_DEL_ALL     * data = (T_M_DEL_ALL *)win_data->user;

  T_MFW_EVENT       MfwEvents;


  T_DISPLAY_DATA DisplayInfo;

    TRACE_FUNCTION ("M_DEL_ALL_ACK_mfw_cb()");

    switch (event)
  {

  case E_SMS_ERR:

    g_SmsMenu_state = SMS_READY;

    SmsMenu_loadDialogDefault(&DisplayInfo);
    DisplayInfo.Identifier = SMSMENU_ID_DELERR;
    DisplayInfo.TextId     = TxtFailed;
    info_dialog(win,&DisplayInfo);
    break;

  case E_SMS_OK:

    if (g_ListLength2 > 0)
    {
      g_ListLength2--;

      sms_msg_delete(data->g_SmsMenu_messages[g_ListLength2].index);
    }
    else
    {
      /* there is now anymore sms to delete !! */
      g_SmsMenu_state = SMS_READY;
      SmsMenu_loadDialogDefault(&DisplayInfo);
      DisplayInfo.Identifier = SMSMENU_ID_DELOK;
      DisplayInfo.TextId     = TxtDeleted;
	  // API - 17-01-03 - 1571 - Add this call to sms_delete() to free memory
   	  sms_delete(data->sms_hnd);
      info_dialog(win,&DisplayInfo);
    }

    break;

  default:
      return MFW_EVENT_REJECTED;

  }
    return MFW_EVENT_CONSUMED;

}

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

 $Function:     V_start

 $Description:  Start the voice mailbox dialog window.


 $Returns:    window handle

 $Arguments:  parent_window - parent window handle
        menuAttr - Menu attributes

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

T_MFW_HND V_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
{
    T_MFW_HND win;

    TRACE_FUNCTION ("V_start()");

    win = V_create (parent_window);

    if (win NEQ NULL)
  {
      SEND_EVENT (win, E_INIT, V_ID_SET, (void *)menuAttr);
  }
    return win;
}

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

 $Function:     V_create

 $Description:  create the voice mailbox window

 $Returns:    window handle

 $Arguments:  parent_window - parent window handle

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

static T_MFW_HND V_create(MfwHnd parent_window)
{
    T_V      * data = (T_V *)ALLOC_MEMORY (sizeof (T_V));
    T_MFW_WIN  * win;

    TRACE_FUNCTION ("V_create()");

    /*
     * Create window handler
     */

    data->win =
  win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)V_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_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_destroy

 $Description:  Destroy the voice mailbox window

 $Returns:    none

 $Arguments:  own_window - current window

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

static void V_destroy(MfwHnd own_window)
{
    T_MFW_WIN * win_data;
    T_V     * data;

    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
         */
        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

#ifdef NEW_EDITOR
	T_AUI_EDITOR_DATA editor_data;	/* SPR#1428 - SH - New Editor data */
#else
    T_EDITOR_DATA editor_data;
#endif

    TRACE_FUNCTION ("V_exec_cb()");

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

      if ( (FFS_flashData.voice_mail[0] EQ '\0') || (value EQ V_ID_SET) )
      {
      /* initialization of administrative data */
      data->id = value;

	/* SPR#1428 - SH - New Editor changes */
	
#ifdef NEW_EDITOR
		AUI_edit_SetDefault(&editor_data);
		AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT);
		AUI_edit_SetEvents(&editor_data, value, TRUE, FOREVER, (T_AUI_EDIT_CB)SmsMenu_StandardEditor_cb);
		AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtSoftBack, TxtVoiceMail, NULL);
		AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
		AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)FFS_flashData.voice_mail, PHB_MAX_LEN);
		AUI_edit_Start(win, &editor_data);
#else /* NEW_EDITOR */
        SmsMenu_loadEditDefault(&editor_data);

        editor_data.editor_attr.text    = (char *)FFS_flashData.voice_mail;
        editor_data.editor_attr.size    = PHB_MAX_LEN;
        editor_data.TextId          = TxtVoiceMail;
        editor_data.LeftSoftKey       = TxtSoftOK;
        editor_data.Identifier        = value;

        editor_start(win,&editor_data);  /* start the editor */
#endif /* NEW_EDITOR */

        winShow(win);
      }
      else
      {
        if (value EQ V_ID_CALL)
        {
          callNumber(FFS_flashData.voice_mail);
          V_destroy(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);
      break;
  case MfwWinFocussed: /* input focus / selected   */
  case MfwWinDelete:   /* window will be deleted   */
        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 = ((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_standard_dialog_cb()");

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

  switch (Identifier)
  {
  case SMSMENU_ID_DELETEALL:

⌨️ 快捷键说明

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