EmailAppPSInterface.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:189k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * EmailAppPSInterface.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements utilities to interact with PS.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  *------------------------------------------------------------------------------
  160.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  161.  *============================================================================
  162.  ****************************************************************************/
  163. /**
  164.  * Copyright Notice
  165.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  166.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  167.  *  (It is illegal to remove this copyright notice from this software or any
  168.  *  portion of it)
  169.  */
  170. /**************************************************************
  171.    FILENAME : EmailAppPSInterface.c
  172.    PURPOSE     : nil
  173.    REMARKS     : nil 
  174.    AUTHOR      : Magesh k
  175.    DATE     : 30-01-2004 
  176. **************************************************************/
  177. #ifndef _MMI_EMAILAPPPSINTERFACE_C
  178. #define _MMI_EMAILAPPPSINTERFACE_C
  179. #include "MMI_features.h"
  180. #ifdef __MMI_EMAIL__
  181. #include "stdC.h"
  182. #include "L4Dr1.h"
  183. #include "FileSystemDef.h"
  184. #include "FileMgr.h"
  185. #include "mdi_datatype.h"
  186. // e-mail header files
  187. //micha1230
  188. #include "custom_nvram_editor_data_item.h"
  189. #include "custom_data_account.h"
  190. #include "EmailAppProt.h"
  191. #include "EmailAppGProt.h"
  192. #include "MessagesResourceData.h"
  193. /* other files */
  194. #include "GlobalDefs.h"
  195. #include "QueueGprot.h"
  196. #include "Unicodexdcl.h"
  197. #include "DebugInitDef.h"
  198. #include "ProtocolEvents.h"
  199. #include "PixtelDataTypes.h"
  200. #include "EventsGprot.h"
  201. #include "CustDataRes.h"
  202. #include "SettingProfile.h"
  203. #include "IdleAppProt.h"
  204. #include "FrameworkStruct.h"
  205. #include "AlarmFrameWorkProt.h"
  206. #include "HistoryGprot.h"
  207. #include "DownloadDefs.h"
  208. #include "DownloadProtos.h"
  209. #include "Conversions.h"
  210. #include "DataAccount.h"
  211. #include "PhoneBookGprot.h"
  212. #include "GpioInc.h"
  213. #include "ProfileGprots.h"
  214. #include "MemPoolContainerProt.h"
  215. #include "CommonScreens.h"
  216. #include "mmi_trc.h"
  217. /*****************************************************************************
  218.  * FUNCTION
  219.  *  mmi_email_init_protocol_hdlr
  220.  * DESCRIPTION
  221.  *  Initialize all protocol event handlers of email.
  222.  * PARAMETERS
  223.  *  void
  224.  * RETURNS
  225.  *  void
  226.  *****************************************************************************/
  227. void mmi_email_init_protocol_hdlr(void)
  228. {
  229.     /*----------------------------------------------------------------*/
  230.     /* Local Variables                                                */
  231.     /*----------------------------------------------------------------*/
  232.     /*----------------------------------------------------------------*/
  233.     /* Code Body                                                      */
  234.     /*----------------------------------------------------------------*/
  235.     /* init, deinit, start, stop mail */
  236.     SetProtocolEventHandler(mmi_email_ps_init_rsp, PRT_MMI_EMAIL_INIT_RSP);
  237.     SetProtocolEventHandler(mmi_email_ps_deinit_rsp, PRT_MMI_EMAIL_DEINIT_RSP);
  238.     SetProtocolEventHandler(mmi_email_ps_start_rsp, PRT_MMI_EMAIL_START_RSP);
  239.     SetProtocolEventHandler(mmi_email_ps_stop_rsp, PRT_MMI_EMAIL_STOP_RSP);
  240.     SetProtocolEventHandler(mmi_email_ps_abort_rsp, PRT_MMI_EMAIL_ABORT_RSP);
  241.     /* send and receive, auto check */
  242. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  243.     SetProtocolEventHandler(mmi_email_ps_auto_chk_ind, PRT_MMI_EMAIL_AUTOCHECK_EXPIRY_IND);
  244. #endif 
  245.     SetProtocolEventHandler(mmi_email_ps_server_conn_ind, PRT_MMI_EMAIL_SERVER_CONNECT_IND);
  246.     SetProtocolEventHandler(mmi_email_ps_msg_sent_ind, PRT_MMI_EMAIL_MSG_SENT_IND);
  247.     SetProtocolEventHandler(mmi_email_ps_num_msgs_sent_ind, PRT_MMI_EMAIL_NUM_MSGS_SENT_IND);
  248.     SetProtocolEventHandler(mmi_email_ps_authverify_ind, PRT_MMI_EMAIL_AUTHVERIFY_IND);
  249.     SetProtocolEventHandler(mmi_email_ps_recv_msgs_ind, PRT_MMI_EMAIL_RECV_MSGS_IND);
  250.     SetProtocolEventHandler(mmi_email_ps_new_msgs_ind, PRT_MMI_EMAIL_NEW_MSGS_IND);
  251.     SetProtocolEventHandler(mmi_email_ps_snr_rsp, PRT_MMI_EMAIL_SEND_RECV_RSP);
  252.     /* folder */
  253.     SetProtocolEventHandler(mmi_email_ps_list_folders_rsp, PRT_MMI_EMAIL_LIST_FOLDERS_RSP);
  254.     SetProtocolEventHandler(mmi_email_ps_folder_select_rsp, PRT_MMI_EMAIL_FOLDER_SELECT_RSP);
  255.     SetProtocolEventHandler(mmi_email_ps_folder_msg_select_rsp, PRT_MMI_EMAIL_FOLDER_MSG_SELECT_RSP);
  256.     SetProtocolEventHandler(mmi_email_ps_folder_msg_del_rsp, PRT_MMI_EMAIL_FOLDER_MSG_DELETE_RSP);
  257.     /* send/save */
  258.     SetProtocolEventHandler(mmi_email_ps_send_only_rsp, PRT_MMI_EMAIL_SEND_ONLY_RSP);
  259.     SetProtocolEventHandler(mmi_email_ps_save_to_draft_rsp, PRT_MMI_EMAIL_SAVE_DRAFTS_RSP);
  260.     SetProtocolEventHandler(mmi_email_ps_move_to_draft_rsp, PRT_MMI_EMAIL_MSG_MOVE_RSP);
  261.     SetProtocolEventHandler(mmi_email_ps_save_and_send_rsp, PRT_MMI_EMAIL_SEND_NOW_RSP);
  262.     SetProtocolEventHandler(mmi_email_ps_send_from_mailbox_rsp, PRT_MMI_EMAIL_SEND_FROM_MAILBOX_RSP);
  263.     /* memory full, available */
  264.     SetProtocolEventHandler(mmi_email_ps_msg_available_ind, PRT_MMI_EMAIL_MSG_AVAILABLE_IND);
  265.     SetProtocolEventHandler(mmi_email_ps_msg_full_ind, PRT_MMI_EMAIL_MSG_FULL_IND);
  266.     /* profiles */
  267.     SetProtocolEventHandler(mmi_email_ps_list_acct_profile_rsp, PRT_MMI_EMAIL_LIST_ACCT_PROFILE_RSP);
  268.     SetProtocolEventHandler(mmi_email_ps_set_acct_profile_rsp, PRT_MMI_EMAIL_SET_ACCT_PROFILE_RSP);
  269.     SetProtocolEventHandler(mmi_email_ps_get_acct_profile_rsp, PRT_MMI_EMAIL_GET_ACCT_PROFILE_RSP);
  270.     SetProtocolEventHandler(mmi_email_ps_activate_acct_rsp, PRT_MMI_EMAIL_ACTIVATE_ACCT_RSP);
  271. }
  272. /*****************************************************************************
  273.  * FUNCTION
  274.  *  mmi_email_ps_send_msg
  275.  * DESCRIPTION
  276.  *  Wrapper function to send message to Email module
  277.  * PARAMETERS
  278.  *  msg_id              [IN]        
  279.  *  local_param_ptr     [?]         
  280.  *  peer_buf_ptr        [?]         
  281.  * RETURNS
  282.  *  void
  283.  *****************************************************************************/
  284. void mmi_email_ps_send_msg(U16 msg_id, void *local_param_ptr, void *peer_buf_ptr)
  285. {
  286.     /*----------------------------------------------------------------*/
  287.     /* Local Variables                                                */
  288.     /*----------------------------------------------------------------*/
  289.     MYQUEUE Message;
  290.     /*----------------------------------------------------------------*/
  291.     /* Code Body                                                      */
  292.     /*----------------------------------------------------------------*/
  293.     Message.oslSrcId = MOD_MMI;
  294.     Message.oslDestId = MOD_EMAIL;
  295.     Message.oslMsgId = (msg_type) msg_id;
  296.     Message.oslDataPtr = (oslParaType*) local_param_ptr;
  297.     Message.oslPeerBuffPtr = peer_buf_ptr;
  298.     OslMsgSendExtQueue(&Message);
  299. }
  300. /*****************************************************************************
  301.  * FUNCTION
  302.  *  mmi_email_ps_init_req
  303.  * DESCRIPTION
  304.  *  Send of MSG_ID_MMI_EMAIL_INIT_REQ to Email.
  305.  * PARAMETERS
  306.  *  void
  307.  * RETURNS
  308.  *  void
  309.  *****************************************************************************/
  310. void mmi_email_ps_init_req(void)
  311. {
  312.     /*----------------------------------------------------------------*/
  313.     /* Local Variables                                                */
  314.     /*----------------------------------------------------------------*/
  315.     /*----------------------------------------------------------------*/
  316.     /* Code Body                                                      */
  317.     /*----------------------------------------------------------------*/
  318.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_INIT_REQ, NULL, NULL);
  319. }
  320. /*****************************************************************************
  321.  * FUNCTION
  322.  *  mmi_email_ps_init_rsp
  323.  * DESCRIPTION
  324.  *  Handler of MSG_ID_MMI_EMAIL_INIT_RSP.
  325.  *  Store state variables from PS.
  326.  * PARAMETERS
  327.  *  inMsg       [IN]        Struct variable of response message.
  328.  * RETURNS
  329.  *  void
  330.  *****************************************************************************/
  331. void mmi_email_ps_init_rsp(void *inMsg)
  332. {
  333.     /*----------------------------------------------------------------*/
  334.     /* Local Variables                                                */
  335.     /*----------------------------------------------------------------*/
  336.     mmi_email_init_rsp_struct *msgRsp = (mmi_email_init_rsp_struct*) inMsg;
  337.     /*----------------------------------------------------------------*/
  338.     /* Code Body                                                      */
  339.     /*----------------------------------------------------------------*/
  340.     MMI_ASSERT(msgRsp->result == MMI_TRUE);
  341.     email_p->main_info.unread_mails = msgRsp->no_unread_inbox_msg;
  342.     email_p->prof_info.act_prof.act_indx = msgRsp->activated_acct_index - 1;
  343.     /* update status icon in IDLE screen */
  344.     mmi_email_util_update_status_icon();
  345.     email_p->main_info.ready_state |= EMAIL_PS_INIT_DONE;
  346.     /* if profile is activated, get information of current activated profile */
  347.     if (mmi_email_prof_is_activated())
  348.     {
  349.         mmi_email_prof_fill_act_info(&msgRsp->activated_acct);
  350.     }
  351. }
  352. /*****************************************************************************
  353.  * FUNCTION
  354.  *  mmi_email_ps_deinit_req
  355.  * DESCRIPTION
  356.  *  Send of MSG_ID_MMI_EMAIL_DEINIT_REQ to Email.
  357.  * PARAMETERS
  358.  *  void
  359.  * RETURNS
  360.  *  void
  361.  *****************************************************************************/
  362. void mmi_email_ps_deinit_req(void)
  363. {
  364.     /*----------------------------------------------------------------*/
  365.     /* Local Variables                                                */
  366.     /*----------------------------------------------------------------*/
  367.     /*----------------------------------------------------------------*/
  368.     /* Code Body                                                      */
  369.     /*----------------------------------------------------------------*/
  370.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_DEINIT_REQ, NULL, NULL);
  371. }
  372. /*****************************************************************************
  373.  * FUNCTION
  374.  *  mmi_email_ps_deinit_rsp
  375.  * DESCRIPTION
  376.  *  Handler of MSG_ID_MMI_EMAIL_DEINIT_RSP.
  377.  *  Store state variables from PS.
  378.  * PARAMETERS
  379.  *  inMsg       [IN]        Struct variable of response message.
  380.  * RETURNS
  381.  *  void
  382.  *****************************************************************************/
  383. void mmi_email_ps_deinit_rsp(void *inMsg)
  384. {
  385.     /*----------------------------------------------------------------*/
  386.     /* Local Variables                                                */
  387.     /*----------------------------------------------------------------*/
  388.     mmi_email_deinit_rsp_struct *msgRsp = (mmi_email_deinit_rsp_struct*) inMsg;
  389.     U8 i, j;
  390.     /*----------------------------------------------------------------*/
  391.     /* Code Body                                                      */
  392.     /*----------------------------------------------------------------*/
  393.     MMI_ASSERT(msgRsp->result == MMI_TRUE);
  394.     /* similar as abort_rsp */
  395. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  396.     if (email_p->snr_info.is_auto_chk)  /* in case in the middle of email auto-checking */
  397.     {
  398.         email_p->snr_info.is_auto_chk = FALSE;
  399.     }
  400. #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  401.     /* in write email screen and in the middle of email sending */
  402.     if (IsScreenPresent(SCR_ID_EMAIL_COMP_OPT) && IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  403.     {
  404.         for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  405.         {
  406.             if (email_p->comp_info.attch_list[i].attch_present)
  407.             {
  408.                 mmi_email_util_rename_after_abort(j, (S8*)email_p->comp_info.attch_list[i].file_path);
  409.                 j++;
  410.             }
  411.         }
  412.     }
  413.     /* similar as stop_rsp */
  414.     mmi_email_util_free_container_pool();
  415.     email_p->main_info.stop_cause = EMAIL_STOP_NONE;
  416.     email_p->main_info.entry_src = EMAIL_FROM_MSG;
  417.     email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
  418.     AlmEnableExpiryHandler();
  419. }
  420. /*****************************************************************************
  421.  * FUNCTION
  422.  *  mmi_email_ps_start_req
  423.  * DESCRIPTION
  424.  *  Send of MSG_ID_MMI_EMAIL_START_REQ to Email.
  425.  * PARAMETERS
  426.  *  void
  427.  * RETURNS
  428.  *  void
  429.  *****************************************************************************/
  430. void mmi_email_ps_start_req(void)
  431. {
  432.     /*----------------------------------------------------------------*/
  433.     /* Local Variables                                                */
  434.     /*----------------------------------------------------------------*/
  435.     /*----------------------------------------------------------------*/
  436.     /* Code Body                                                      */
  437.     /*----------------------------------------------------------------*/
  438.     AlmDisableExpiryHandler();
  439.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_START_REQ, NULL, NULL);
  440. }
  441. /*****************************************************************************
  442.  * FUNCTION
  443.  *  mmi_email_ps_start_rsp
  444.  * DESCRIPTION
  445.  *  Handler of MSG_ID_MMI_EMAIL_START_RSP
  446.  * PARAMETERS
  447.  *  inMsg       [IN]        Struct variable of response message.
  448.  * RETURNS
  449.  *  void
  450.  *****************************************************************************/
  451. void mmi_email_ps_start_rsp(void *inMsg)
  452. {
  453.     /*----------------------------------------------------------------*/
  454.     /* Local Variables                                                */
  455.     /*----------------------------------------------------------------*/
  456.     mmi_email_start_rsp_struct *msgRsp = (mmi_email_start_rsp_struct*) inMsg;
  457.     /*----------------------------------------------------------------*/
  458.     /* Code Body                                                      */
  459.     /*----------------------------------------------------------------*/
  460.     if (msgRsp->result == MMI_TRUE)
  461.     {
  462.         email_p->main_info.stop_cause = EMAIL_MODULE_ACTIVE_NOW;
  463.         MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_START_RSP, email_p->main_info.entry_src));
  464.         if (email_p->main_info.entry_src == EMAIL_FROM_APP)
  465.         {
  466.             /* enter write Email screen from other app like phonebook, file manager */
  467.             email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  468.             /* add signature attach and text, if present */
  469.             if (mmi_email_comp_add_sig() == FALSE)
  470.             {
  471.                 return;
  472.             }
  473.             mmi_email_entry_comp();
  474.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  475.         }
  476.     #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  477.         else if (email_p->main_info.entry_src == EMAIL_FROM_IDLE)
  478.         {
  479.             /* read mail from idle screen */
  480.             email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  481.             mmi_email_inbox_pre_entry();
  482.         }
  483.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  484.         else
  485.         {
  486.             /* normal entry */
  487.             if (email_p->fldr_info.fldr_update_state == EMAIL_LIST_FLDR_REQUIRED)
  488.             {
  489.                 mmi_email_ps_list_folders_req();
  490.             }
  491.             else
  492.             {
  493.                 email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  494.                 mmi_email_entry_main();
  495.             }
  496.         }
  497.     }
  498.     else
  499.     {
  500.         mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, 0, SCR_ID_EMAIL_MAIN);
  501.     }
  502.     AlmEnableExpiryHandler();
  503. }
  504. /*****************************************************************************
  505.  * FUNCTION
  506.  *  mmi_email_ps_stop_req
  507.  * DESCRIPTION
  508.  *  Send MSG_ID_MMI_EMAIL_STOP_REQ message to protocol.
  509.  * PARAMETERS
  510.  *  void
  511.  * RETURNS
  512.  *  void
  513.  *****************************************************************************/
  514. void mmi_email_ps_stop_req(void)
  515. {
  516.     /*----------------------------------------------------------------*/
  517.     /* Local Variables                                                */
  518.     /*----------------------------------------------------------------*/
  519.     /*----------------------------------------------------------------*/
  520.     /* Code Body                                                      */
  521.     /*----------------------------------------------------------------*/
  522.     AlmDisableExpiryHandler();
  523.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_STOP_REQ, NULL, NULL);
  524. }
  525. /*****************************************************************************
  526.  * FUNCTION
  527.  *  mmi_email_ps_stop_rsp
  528.  * DESCRIPTION
  529.  *  Handler of MSG_ID_MMI_EMAIL_STOP_RSP message.
  530.  * PARAMETERS
  531.  *  inMsg       [?]     
  532.  * RETURNS
  533.  *  inMsg    IN    struct variable of response message.(?)
  534.  *****************************************************************************/
  535. void mmi_email_ps_stop_rsp(void *inMsg)
  536. {
  537.     /*----------------------------------------------------------------*/
  538.     /* Local Variables                                                */
  539.     /*----------------------------------------------------------------*/
  540.     /*----------------------------------------------------------------*/
  541.     /* Code Body                                                      */
  542.     /*----------------------------------------------------------------*/
  543.     MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_STOP_RSP, email_p->main_info.stop_cause));
  544.     switch (email_p->main_info.stop_cause)
  545.     {
  546.         case EMAIL_STOP_BACK_HIST:
  547.             if (IsScreenPresent(SCR_ID_EMAIL_MAIN))
  548.             {
  549.                 DeleteNScrId(SCR_ID_EMAIL_MAIN);
  550.             }
  551.             else if (IsScreenPresent(SCR_ID_EMAIL_INBOX))
  552.             {
  553.                 DeleteNScrId(SCR_ID_EMAIL_INBOX);
  554.             }
  555.             /* do not force call screen to go back history */
  556.             if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
  557.             {
  558.                 GoBackHistory();
  559.             }
  560.             break;
  561.         case EMAIL_STOP_GOTO_IDLE:
  562.             DeleteUptoScrID(IDLE_SCREEN_ID);
  563.             /* do not force call screen to go to idle screen */
  564.             if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
  565.             {
  566.                 GoBackHistory();
  567.             }
  568.             break;
  569.     }
  570.     mmi_email_util_free_container_pool();
  571.     email_p->main_info.stop_cause = EMAIL_STOP_NONE;
  572.     email_p->main_info.entry_src = EMAIL_FROM_MSG;
  573.     email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
  574.     AlmEnableExpiryHandler();
  575. }
  576. /*****************************************************************************
  577.  * FUNCTION
  578.  *  mmi_email_ps_abort_req
  579.  * DESCRIPTION
  580.  *  Send abort request to PS
  581.  * PARAMETERS
  582.  *  void
  583.  * RETURNS
  584.  *  void
  585.  *****************************************************************************/
  586. void mmi_email_ps_abort_req(void)
  587. {
  588.     /*----------------------------------------------------------------*/
  589.     /* Local Variables                                                */
  590.     /*----------------------------------------------------------------*/
  591.     /*----------------------------------------------------------------*/
  592.     /* Code Body                                                      */
  593.     /*----------------------------------------------------------------*/
  594. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  595.     email_p->snr_info.auto_chk_scr = 0;
  596. #endif 
  597.     AlmDisableExpiryHandler();
  598.     mmi_email_pre_entry_progressing(
  599.         STR_EMAIL_MAIN_ID,
  600.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  601.         0,
  602.         0,
  603.         0,
  604.         0,
  605.         (U8*) GetString(STR_GLOBAL_ABORT),
  606.         (U8*) NULL,
  607.         IMG_GLOBAL_PROGRESS,
  608.         NULL,
  609.         NULL,
  610.         NULL,
  611.         0);
  612.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  613.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_ABORT_REQ, NULL, NULL);
  614. }
  615. /*****************************************************************************
  616.  * FUNCTION
  617.  *  mmi_email_ps_abort_rsp
  618.  * DESCRIPTION
  619.  *  Handler for MSG_ID_MMI_EMAIL_ABORT_RSP message
  620.  * PARAMETERS
  621.  *  inMsg       [?]     
  622.  * RETURNS
  623.  *  inMsg    IN    struct variable of response message.(?)
  624.  *****************************************************************************/
  625. void mmi_email_ps_abort_rsp(void *inMsg)
  626. {
  627.     /*----------------------------------------------------------------*/
  628.     /* Local Variables                                                */
  629.     /*----------------------------------------------------------------*/
  630.     U16 delScrnId;
  631.     S32 i, j;
  632.     mmi_email_abort_rsp_struct *msgRsp = (mmi_email_abort_rsp_struct*) inMsg;
  633.     /*----------------------------------------------------------------*/
  634.     /* Code Body                                                      */
  635.     /*----------------------------------------------------------------*/
  636. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  637.     email_p->snr_info.is_auto_chk = FALSE;
  638. #endif 
  639.     if (msgRsp->result == MMI_TRUE)
  640.     {
  641.         DisplayPopup(
  642.             (U8*) GetString(STR_EMAIL_ABORTED_ID),
  643.             IMG_GLOBAL_ACTIVATED,
  644.             1,
  645.             UI_POPUP_NOTIFYDURATION_TIME,
  646.             (U8) SUCCESS_TONE);
  647.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
  648.         email_p->fldr_info.need_fldr_sel = FALSE;
  649.     }
  650.     else
  651.     {
  652.         DisplayPopup(
  653.             (U8*) GetString(STR_GLOBAL_NOT_DONE),
  654.             IMG_GLOBAL_UNFINISHED,
  655.             1,
  656.             UI_POPUP_NOTIFYDURATION_TIME,
  657.             (U8) WARNING_TONE);
  658.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  659.         email_p->fldr_info.need_fldr_sel = TRUE;
  660.         /* if email is entered by other application and abort is fail also,
  661.            it should directly return to other application's screen */
  662.         if (email_p->main_info.entry_src == EMAIL_FROM_APP)
  663.         {
  664.             return;
  665.         }
  666.     }
  667.     MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_ABORT_RSP, email_p->main_info.curr_menu));
  668.     if (IsScreenPresent(SCR_ID_EMAIL_COMP_OPT) && email_p->snr_info.snr_state == EMAIL_SNR_IDLE)    /* in write Email screen, for all folders */
  669.     {
  670.         for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  671.         {
  672.             if (email_p->comp_info.attch_list[i].attch_present)
  673.             {
  674.                 mmi_email_util_rename_after_abort((U8) j, (S8*) email_p->comp_info.attch_list[i].file_path);
  675.                 j++;
  676.             }
  677.         }
  678.         GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &delScrnId);
  679.         DeleteBetweenScreen(delScrnId, SCR_ID_EMAIL_PROGRESS);
  680.     }
  681.     else
  682.     {
  683.         switch (email_p->main_info.curr_menu)
  684.         {
  685.             case MMI_EMAIL_SNR:
  686.             {
  687.                 /* abort send and receive should not do list folder again */
  688.             #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  689.                 if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3)
  690.                 {
  691.                     if (email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
  692.                     {
  693.                         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  694.                         email_p->fldr_info.need_fldr_sel = TRUE;
  695.                     } 
  696.                 }
  697.             #else /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
  698.                 if (email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
  699.                 {
  700.                     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  701.                     email_p->fldr_info.need_fldr_sel = TRUE;
  702.                 }
  703.             #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
  704.                 if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
  705.                 {
  706.                     mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
  707.                 }
  708.                 email_p->snr_info.snr_state = EMAIL_SNR_IDLE;
  709.                 break;
  710.             }
  711.             case MMI_EMAIL_COMP:
  712.             {
  713.                 email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  714.                 /* if email is entered by other application, email main menu is definitely not in the history.
  715.                    but email main menu should not show up, intead, the screen should remain as original */
  716.                 if (!IsScreenPresent(SCR_ID_EMAIL_MAIN) && email_p->main_info.entry_src != EMAIL_FROM_APP)
  717.                 {
  718.                     mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
  719.                 }
  720.                 break;
  721.             }
  722.             case MMI_EMAIL_INBOX:
  723.             case MMI_EMAIL_UNSENT:
  724.             case MMI_EMAIL_SENT:
  725.             case MMI_EMAIL_DRAFT:
  726.             {
  727.                 U16 listScrnId = mmi_email_util_get_fldr_scr_id();
  728.                 /* delete screen to inbox / unsent / sent / draft folder only if it doesn't abort from auto check */
  729.                 if (IsScreenPresent(listScrnId) && email_p->snr_info.snr_state == EMAIL_SNR_IDLE)
  730.                 {
  731.                     U16 startSrcnId;
  732.                     GetNextScrnIdOf(listScrnId, &startSrcnId);
  733.                     if (startSrcnId == SCR_ID_EMAIL_FLDR_LIST_PROGRESS)
  734.                     {
  735.                         mmi_email_util_del_upto_scr(listScrnId);
  736.                     }
  737.                     else
  738.                     {
  739.                         mmi_email_util_del_between_scr(startSrcnId, SCR_ID_EMAIL_PROGRESS);
  740.                     }
  741.                 }
  742.                 else /* abort from auto check, go back to original screen */
  743.                 {
  744.                     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  745.                     if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
  746.                     {
  747.                         mmi_email_fldr_exec_curr_rsp(
  748.                             SCR_ID_EMAIL_PROGRESS,
  749.                             mmi_email_entry_main,
  750.                             mmi_email_exit_main_menu);
  751.                     }
  752.                 }
  753.                 break;
  754.             }
  755.             case MMI_EMAIL_DEL_ALL:
  756.             {
  757.                 email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  758.                 if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
  759.                 {
  760.                     mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
  761.                 }
  762.                 break;
  763.             }
  764.             default:
  765.             {
  766.                 /*
  767.                  * default state, go to main menu. 
  768.                  * case MMI_EMAIL_NONE:    
  769.                  * case MMI_EMAIL_PROF:
  770.                  * case MMI_EMAIL_REFRESH:
  771.                  */
  772.                 email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  773.                 if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
  774.                 {
  775.                     mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
  776.                 }
  777.                 break;
  778.             }
  779.         }
  780.         DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  781.         DeleteScreenIfPresent(SCR_ID_EMAIL_FLDR_LIST_PROGRESS);
  782.     }
  783.     email_p->snr_info.snr_state = EMAIL_SNR_IDLE;   /* to prevent auto SNR happened in Email app */
  784.     AlmEnableExpiryHandler();
  785. }
  786. /*****************************************************************************
  787.  * FUNCTION
  788.  *  mmi_email_ps_msg_available_ind
  789.  * DESCRIPTION
  790.  *  Handler of MSG_ID_MMI_EMAIL_MSG_AVAILABLE_IND messages
  791.  * PARAMETERS
  792.  *  inMsg       [IN]        Struct variable of response message.
  793.  * RETURNS
  794.  *  void
  795.  *****************************************************************************/
  796. void mmi_email_ps_msg_available_ind(void *inMsg)
  797. {
  798.     /*----------------------------------------------------------------*/
  799.     /* Local Variables                                                */
  800.     /*----------------------------------------------------------------*/
  801.     /*----------------------------------------------------------------*/
  802.     /* Code Body                                                      */
  803.     /*----------------------------------------------------------------*/
  804.     email_p->main_info.is_mem_full = FALSE;
  805.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  806.     email_p->fldr_info.need_fldr_sel = TRUE;
  807.     mmi_email_util_update_status_icon();
  808. }
  809. /*****************************************************************************
  810.  * FUNCTION
  811.  *  mmi_email_ps_msg_full_ind
  812.  * DESCRIPTION
  813.  *  Handler of MSG_ID_MMI_EMAIL_MSG_FULL_IND messages
  814.  * PARAMETERS
  815.  *  inMsg       [IN]        Struct variable of response message.
  816.  * RETURNS
  817.  *  void
  818.  *****************************************************************************/
  819. void mmi_email_ps_msg_full_ind(void *inMsg)
  820. {
  821.     /*----------------------------------------------------------------*/
  822.     /* Local Variables                                                */
  823.     /*----------------------------------------------------------------*/
  824.     /*----------------------------------------------------------------*/
  825.     /* Code Body                                                      */
  826.     /*----------------------------------------------------------------*/
  827.     email_p->main_info.is_mem_full = TRUE;
  828.     mmi_email_util_update_status_icon();
  829.     TurnOnBacklight(1);
  830.     playRequestedTone(WARNING_TONE);
  831. }
  832. #define PROFILE_PS_EMAIL
  833. /*****************************************************************************
  834.  * FUNCTION
  835.  *  mmi_email_ps_list_acct_profile_req
  836.  * DESCRIPTION
  837.  *  Send list account request to PS
  838.  * PARAMETERS
  839.  *  void
  840.  * RETURNS
  841.  *  void
  842.  *****************************************************************************/
  843. void mmi_email_ps_list_acct_profile_req(void)
  844. {
  845.     /*----------------------------------------------------------------*/
  846.     /* Local Variables                                                */
  847.     /*----------------------------------------------------------------*/
  848.     /*----------------------------------------------------------------*/
  849.     /* Code Body                                                      */
  850.     /*----------------------------------------------------------------*/
  851.     mmi_email_pre_entry_progressing(
  852.         STR_EMAIL_MAIN_ID,
  853.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  854.         0,
  855.         0,
  856.         0,
  857.         0,
  858.         (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  859.         NULL,
  860.         IMG_EMAIL_SENDING_ID,
  861.         NULL,
  862.         NULL,
  863.         NULL,
  864.         0);
  865.     AlmDisableExpiryHandler();
  866.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_LIST_ACCT_PROFILE_REQ, NULL, NULL);
  867. }
  868. /*****************************************************************************
  869.  * FUNCTION
  870.  *  mmi_email_ps_list_acct_profile_rsp
  871.  * DESCRIPTION
  872.  *  Response handler of MSG_ID_MMI_EMAIL_LIST_ACCT_PROFILE_RSP message.
  873.  * PARAMETERS
  874.  *  inMsg       [?]     
  875.  * RETURNS
  876.  *  inMsg    IN    struct variable of response message.(?)
  877.  *****************************************************************************/
  878. void mmi_email_ps_list_acct_profile_rsp(void *inMsg)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     mmi_email_list_acct_profile_rsp_struct *msgRsp = (mmi_email_list_acct_profile_rsp_struct*) inMsg;
  884.     /*----------------------------------------------------------------*/
  885.     /* Code Body                                                      */
  886.     /*----------------------------------------------------------------*/
  887.     MMI_ASSERT(msgRsp->result == MMI_TRUE);
  888.     mmi_email_prof_fill_data(&msgRsp->list_acct);
  889.     DataAccountReadyCheck(mmi_email_ps_dt_acct_callback);
  890. }
  891. /*****************************************************************************
  892.  * FUNCTION
  893.  *  mmi_email_ps_dt_acct_callback
  894.  * DESCRIPTION
  895.  *  Callback function when data account ready
  896.  * PARAMETERS
  897.  *  void
  898.  * RETURNS
  899.  *  void
  900.  *****************************************************************************/
  901. void mmi_email_ps_dt_acct_callback(void)
  902. {
  903.     /*----------------------------------------------------------------*/
  904.     /* Local Variables                                                */
  905.     /*----------------------------------------------------------------*/
  906.     /*----------------------------------------------------------------*/
  907.     /* Code Body                                                      */
  908.     /*----------------------------------------------------------------*/
  909.     if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
  910.     {
  911.         mmi_email_entry_prof();
  912.     }
  913.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  914. }
  915. /*****************************************************************************
  916.  * FUNCTION
  917.  *  mmi_email_ps_set_acct_profile_req
  918.  * DESCRIPTION
  919.  *  Send request to set profile.
  920.  * PARAMETERS
  921.  *  void
  922.  * RETURNS
  923.  *  void
  924.  *****************************************************************************/
  925. void mmi_email_ps_set_acct_profile_req(void)
  926. {
  927.     /*----------------------------------------------------------------*/
  928.     /* Local Variables                                                */
  929.     /*----------------------------------------------------------------*/
  930.     mmi_email_set_acct_profile_req_struct *msgReq =
  931.         (mmi_email_set_acct_profile_req_struct*) OslConstructDataPtr(sizeof(mmi_email_set_acct_profile_req_struct));
  932.     /*----------------------------------------------------------------*/
  933.     /* Code Body                                                      */
  934.     /*----------------------------------------------------------------*/
  935.     mmi_email_prof_set_acct_data((mmi_email_set_acct_profile_req_struct*) msgReq);
  936.     AlmDisableExpiryHandler();
  937.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_SET_ACCT_PROFILE_REQ, msgReq, NULL);
  938. }
  939. /*****************************************************************************
  940.  * FUNCTION
  941.  *  mmi_email_ps_set_acct_profile_rsp
  942.  * DESCRIPTION
  943.  *  Response handler of MSG_ID_MMI_EMAIL_SET_ACCT_PROFILE_RSP message.
  944.  * PARAMETERS
  945.  *  inMsg       [IN]        Variable contains reulst of saving account
  946.  * RETURNS
  947.  *  void
  948.  *****************************************************************************/
  949. void mmi_email_ps_set_acct_profile_rsp(void *inMsg)
  950. {
  951.     /*----------------------------------------------------------------*/
  952.     /* Local Variables                                                */
  953.     /*----------------------------------------------------------------*/
  954.     U16 startSrcnId;
  955.     mmi_email_set_acct_profile_rsp_struct *msgRsp = (mmi_email_set_acct_profile_rsp_struct*) inMsg;
  956.     /*----------------------------------------------------------------*/
  957.     /* Code Body                                                      */
  958.     /*----------------------------------------------------------------*/
  959.     if (msgRsp->result == MMI_TRUE)
  960.     {
  961.         pfnUnicodeStrcpy(
  962.             (S8*) email_p->prof_info.prof_misc.acct_names[email_p->prof_info.prof_misc.curr_sel_prof],
  963.             (S8*) email_p->prof_info.editing_prof.setting_info.prof_name);
  964.         /* current editing profile is activative profile */
  965.         if (email_p->prof_info.prof_misc.curr_sel_prof == email_p->prof_info.act_prof.act_indx)
  966.         {
  967.             mmi_email_prof_update_act_info();
  968.         }
  969.         DisplayPopup(
  970.             (U8*) GetString(STR_GLOBAL_SAVED),
  971.             IMG_GLOBAL_SAVE,
  972.             1,
  973.             UI_POPUP_NOTIFYDURATION_TIME,
  974.             SUCCESS_TONE);
  975.         GetNextScrnIdOf(SCR_ID_EMAIL_PROF_OPT_EDIT, &startSrcnId);
  976.         DeleteBetweenScreen(startSrcnId, SCR_ID_EMAIL_PROGRESS);
  977.     }
  978.     else
  979.     {
  980.     #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  981.         if (!email_p->snr_info.is_auto_chk)
  982.     #endif 
  983.         {
  984.             U16 errMsgId = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
  985.             DisplayPopup(
  986.                 (U8*) GetString(errMsgId),
  987.                 IMG_GLOBAL_UNFINISHED,
  988.                 1,
  989.                 UI_POPUP_NOTIFYDURATION_TIME,
  990.                 (U8) WARNING_TONE);
  991.             GetNextScrnIdOf(email_p->prof_info.prof_misc.curr_scr, &startSrcnId);
  992.             DeleteBetweenScreen(startSrcnId, SCR_ID_EMAIL_PROGRESS);
  993.         }
  994.     }
  995.     AlmEnableExpiryHandler();
  996. }
  997. /*****************************************************************************
  998.  * FUNCTION
  999.  *  mmi_email_ps_get_acct_profile_req
  1000.  * DESCRIPTION
  1001.  *  Send request to get data of a specific profile.
  1002.  * PARAMETERS
  1003.  *  index       [IN]        Index of profile(indexing from 1).
  1004.  * RETURNS
  1005.  *  void
  1006.  *****************************************************************************/
  1007. void mmi_email_ps_get_acct_profile_req(U8 index)
  1008. {
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Local Variables                                                */
  1011.     /*----------------------------------------------------------------*/
  1012.     mmi_email_get_acct_profile_req_struct *msgReq;
  1013.     /*----------------------------------------------------------------*/
  1014.     /* Code Body                                                      */
  1015.     /*----------------------------------------------------------------*/
  1016.     msgReq =
  1017.         (mmi_email_get_acct_profile_req_struct*) OslConstructDataPtr(sizeof(mmi_email_get_acct_profile_req_struct));
  1018.     msgReq->acct_index = index;
  1019.     mmi_email_pre_entry_progressing(
  1020.         STR_EMAIL_MAIN_ID,
  1021.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1022.         0,
  1023.         0,
  1024.         0,
  1025.         0,
  1026.         (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  1027.         (U8*) NULL,
  1028.         IMG_NEW_SMS_SEND,
  1029.         NULL,
  1030.         NULL,
  1031.         NULL,
  1032.         0);
  1033.     AlmDisableExpiryHandler();
  1034.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_GET_ACCT_PROFILE_REQ, msgReq, NULL);
  1035. }
  1036. /*****************************************************************************
  1037.  * FUNCTION
  1038.  *  mmi_email_ps_get_acct_profile_rsp
  1039.  * DESCRIPTION
  1040.  *  Handler of get profile response
  1041.  * PARAMETERS
  1042.  *  inMsg       [IN]        Data of response
  1043.  * RETURNS
  1044.  *  void
  1045.  *****************************************************************************/
  1046. void mmi_email_ps_get_acct_profile_rsp(void *inMsg)
  1047. {
  1048.     /*----------------------------------------------------------------*/
  1049.     /* Local Variables                                                */
  1050.     /*----------------------------------------------------------------*/
  1051.     mmi_email_get_acct_profile_rsp_struct *msgRsp = (mmi_email_get_acct_profile_rsp_struct*) inMsg;
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     if (msgRsp->result == MMI_TRUE)
  1056.     {
  1057.         mmi_email_prof_get_acct_data(&msgRsp->acct);
  1058.         email_p->prof_info.prof_misc.curr_hilite_indx = 0;
  1059.         switch (email_p->prof_info.prof_misc.curr_scr)
  1060.         {
  1061.             case SCR_ID_EMAIL_PROF_SETTING:
  1062.                 /* store current protocol to check if protocol changed afterwards */
  1063.         #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1064.                 email_p->prof_info.prof_misc.curr_prot = msgRsp->acct.imap_pop3_info.in_protocol;
  1065.         #endif 
  1066.                 mmi_email_entry_prof_setting();
  1067.                 break;
  1068.             case SCR_ID_EMAIL_PROF_SMTP:
  1069.                 mmi_email_entry_prof_smtp();
  1070.                 break;
  1071.             case SCR_ID_EMAIL_PROF_POP3_IMAP4:
  1072.                 mmi_email_entry_prof_pop3_imap4();
  1073.                 break;
  1074.             case SCR_ID_EMAIL_PROF_SIG:
  1075.                 mmi_email_prof_pre_entry_sig();
  1076.                 break;
  1077.         }
  1078.         DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1079.     }
  1080.     else
  1081.     {
  1082.     #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  1083.         if (!email_p->snr_info.is_auto_chk)
  1084.     #endif 
  1085.         {
  1086.             mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, 0, SCR_ID_EMAIL_MAIN);
  1087.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1088.         }
  1089.     }
  1090.     AlmEnableExpiryHandler();
  1091. }
  1092. /*****************************************************************************
  1093.  * FUNCTION
  1094.  *  mmi_email_ps_activate_acct_req
  1095.  * DESCRIPTION
  1096.  *  Send request to Email to activate a specific account
  1097.  * PARAMETERS
  1098.  *  index       [IN]        Index of account to be activated.
  1099.  * RETURNS
  1100.  *  void
  1101.  *****************************************************************************/
  1102. void mmi_email_ps_activate_acct_req(U8 index)
  1103. {
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Local Variables                                                */
  1106.     /*----------------------------------------------------------------*/
  1107.     mmi_email_activate_acct_req_struct *msgReq;
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Code Body                                                      */
  1110.     /*----------------------------------------------------------------*/
  1111.     msgReq = (mmi_email_activate_acct_req_struct*) OslConstructDataPtr(sizeof(mmi_email_activate_acct_req_struct));
  1112.     msgReq->acct_index = index;
  1113.     mmi_email_pre_entry_progressing(
  1114.         STR_EMAIL_MAIN_ID,
  1115.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1116.         0,
  1117.         0,
  1118.         0,
  1119.         0,
  1120.         (U8*) GetString(STR_GLOBAL_SAVING),
  1121.         (U8*) NULL,
  1122.         IMG_NEW_SMS_SEND,
  1123.         NULL,
  1124.         NULL,
  1125.         NULL,
  1126.         0);
  1127.     AlmDisableExpiryHandler();
  1128.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_ACTIVATE_ACCT_REQ, msgReq, NULL);
  1129. }
  1130. /*****************************************************************************
  1131.  * FUNCTION
  1132.  *  mmi_email_ps_activate_acct_rsp
  1133.  * DESCRIPTION
  1134.  *  Handler of activate profile response
  1135.  * PARAMETERS
  1136.  *  inMsg       [IN]        Data of response
  1137.  * RETURNS
  1138.  *  void
  1139.  *****************************************************************************/
  1140. void mmi_email_ps_activate_acct_rsp(void *inMsg)
  1141. {
  1142.     /*----------------------------------------------------------------*/
  1143.     /* Local Variables                                                */
  1144.     /*----------------------------------------------------------------*/
  1145.     U16 startScrnid;
  1146.     mmi_email_activate_acct_rsp_struct *msgRsp;
  1147.     /*----------------------------------------------------------------*/
  1148.     /* Code Body                                                      */
  1149.     /*----------------------------------------------------------------*/
  1150.     msgRsp = (mmi_email_activate_acct_rsp_struct*) inMsg;
  1151.     if (msgRsp->result == MMI_TRUE)
  1152.     {
  1153.         BOOL prof_changed = FALSE;
  1154.         if (email_p->prof_info.act_prof.act_indx != email_p->prof_info.prof_misc.curr_sel_prof)
  1155.         {
  1156.             prof_changed = TRUE;
  1157.         }
  1158.         email_p->prof_info.act_prof.act_indx = email_p->prof_info.prof_misc.curr_sel_prof;
  1159.         mmi_email_prof_fill_act_info(&msgRsp->acct);
  1160.         if (prof_changed)
  1161.         {
  1162.             mmi_email_prof_update_hint();
  1163.         }
  1164.         DisplayPopup(
  1165.             (U8*) GetString(STR_EMAIL_PROFILE_ACTIVATED),
  1166.             IMG_GLOBAL_ACTIVATED,
  1167.             1,
  1168.             UI_POPUP_NOTIFYDURATION_TIME,
  1169.             SUCCESS_TONE);
  1170.     }
  1171.     else
  1172.     {
  1173.         DisplayPopup(
  1174.             (U8*) GetString(mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major)),
  1175.             IMG_GLOBAL_WARNING,
  1176.             0,
  1177.             UI_POPUP_NOTIFYDURATION_TIME,
  1178.             WARNING_TONE);
  1179.     }
  1180.     GetNextScrnIdOf(SCR_ID_EMAIL_PROF, &startScrnid);
  1181.     DeleteBetweenScreen(startScrnid, SCR_ID_EMAIL_PROGRESS);
  1182.     AlmEnableExpiryHandler();
  1183. }
  1184. #define FOLDER_PS_EMAIL
  1185. /*****************************************************************************
  1186.  * FUNCTION
  1187.  *  mmi_email_ps_list_folders_req
  1188.  * DESCRIPTION
  1189.  *  Display progressing screen and send list folder request to PS.
  1190.  * PARAMETERS
  1191.  *  void
  1192.  * RETURNS
  1193.  *  void
  1194.  *****************************************************************************/
  1195. void mmi_email_ps_list_folders_req(void)
  1196. {
  1197.     /*----------------------------------------------------------------*/
  1198.     /* Local Variables                                                */
  1199.     /*----------------------------------------------------------------*/
  1200.     /*----------------------------------------------------------------*/
  1201.     /* Code Body                                                      */
  1202.     /*----------------------------------------------------------------*/
  1203.     mmi_email_pre_entry_progressing(
  1204.         STR_EMAIL_MAIN_ID,
  1205.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1206.         0,
  1207.         0,
  1208.         mmi_email_util_abort_str(),
  1209.         mmi_email_util_abort_img(),
  1210.         (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  1211.         (U8*) NULL,
  1212.         IMG_EMAIL_CONNECTING_ID,
  1213.         NULL,
  1214.         mmi_email_util_get_abort_func(),
  1215.         mmi_email_util_get_abort_func(),
  1216.         0);
  1217.     AlmDisableExpiryHandler();
  1218.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_LIST_FOLDERS_REQ, NULL, NULL);
  1219. }
  1220. /*****************************************************************************
  1221.  * FUNCTION
  1222.  *  mmi_email_ps_list_folders_rsp
  1223.  * DESCRIPTION
  1224.  *  Handler of MSG_ID_MMI_EMAIL_LIST_FOLDERS_RSP message.
  1225.  * PARAMETERS
  1226.  *  inMsg       [IN]        Struct variable of responsed message
  1227.  * RETURNS
  1228.  *  void
  1229.  *****************************************************************************/
  1230. void mmi_email_ps_list_folders_rsp(void *inMsg)
  1231. {
  1232.     /*----------------------------------------------------------------*/
  1233.     /* Local Variables                                                */
  1234.     /*----------------------------------------------------------------*/
  1235.     mmi_email_list_folders_rsp_struct *msgRsp;
  1236.     /*----------------------------------------------------------------*/
  1237.     /* Code Body                                                      */
  1238.     /*----------------------------------------------------------------*/
  1239.     msgRsp = (mmi_email_list_folders_rsp_struct*) inMsg;
  1240.     TurnOnBacklight(1);
  1241.     if (msgRsp->result == MMI_TRUE)
  1242.     {
  1243.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_DONE;
  1244.         mmi_email_fldr_reset_cntx(EMAIL_RESET_ALL_FLDR);
  1245.         memcpy(&email_p->fldr_info.fldr_data, &msgRsp->folders, sizeof(email_folder_info_struct) * EMAIL_FLDR_TOTAL);
  1246.         /* update unread email status */
  1247.         email_p->main_info.unread_mails = email_p->fldr_info.fldr_data[MMI_EMAIL_INBOX].num_unread_mails;
  1248.         mmi_email_util_update_status_icon();
  1249.         MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_LIST_FOLDERS_RSP, email_p->fldr_info.list_fldr_cause));
  1250.         switch (email_p->fldr_info.list_fldr_cause)
  1251.         {
  1252.             case EMAIL_LIST_FLDR_NORMAL:
  1253.             {
  1254.                 mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
  1255.                 DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1256.                 break;
  1257.             }
  1258.             case EMAIL_LIST_FLDR_REFRESH:
  1259.             case EMAIL_LIST_FLDR_BACK_MAIN:
  1260.             {
  1261.                 if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
  1262.                 {
  1263.                     mmi_email_entry_main();
  1264.                     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1265.                     SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, NULL);
  1266.                     DeleteScreenIfPresent(SCR_ID_EMAIL_MAIN);
  1267.                     SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, (HistoryDelCBPtr) mmi_email_main_del_callback);
  1268.                 }
  1269.                 else
  1270.                 {
  1271.                     SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, NULL);
  1272.                     DeleteScreenIfPresent(SCR_ID_EMAIL_MAIN);
  1273.                     SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, (HistoryDelCBPtr) mmi_email_main_del_callback);
  1274.                     HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
  1275.                 }
  1276.                 break;
  1277.             }
  1278.             case EMAIL_LIST_FLDR_DEL_ALL:
  1279.             {
  1280.                 mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_del_all, mmi_email_exit_del_all);
  1281.                 DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1282.                 break;
  1283.             }
  1284.         }
  1285.     }
  1286.     else
  1287.     {
  1288.         U16 errorMessageId;
  1289.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  1290.         errorMessageId = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
  1291.         switch (email_p->fldr_info.list_fldr_cause)
  1292.         {
  1293.             case EMAIL_LIST_FLDR_NORMAL:
  1294.                 DisplayPopup(
  1295.                     (U8*) GetString(errorMessageId),
  1296.                     IMG_GLOBAL_UNFINISHED,
  1297.                     1,
  1298.                     UI_POPUP_NOTIFYDURATION_TIME,
  1299.                     (U8) WARNING_TONE);
  1300.                 if (IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  1301.                 {
  1302.                     HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
  1303.                 }
  1304.                 break;
  1305.             #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1306.             case EMAIL_LIST_FLDR_REFRESH:
  1307.                 DisplayPopup(
  1308.                     (U8*) GetString(errorMessageId),
  1309.                     IMG_GLOBAL_UNFINISHED,
  1310.                     1,
  1311.                     UI_POPUP_NOTIFYDURATION_TIME,
  1312.                     (U8) WARNING_TONE);
  1313.                 break;
  1314.             #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1315.             case EMAIL_LIST_FLDR_DEL_ALL:
  1316.                 DisplayPopup(
  1317.                     (U8*) GetString(errorMessageId),
  1318.                     IMG_GLOBAL_UNFINISHED,
  1319.                     1,
  1320.                     UI_POPUP_NOTIFYDURATION_TIME,
  1321.                     (U8) WARNING_TONE);
  1322.                 if (!IsScreenPresent(SCR_ID_EMAIL_MAIN) && IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  1323.                 {
  1324.                     HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
  1325.                 }
  1326.                 break;
  1327.             case EMAIL_LIST_FLDR_BACK_MAIN:
  1328.                 DisplayPopup(
  1329.                     (U8*) GetString(errorMessageId),
  1330.                     IMG_GLOBAL_UNFINISHED,
  1331.                     1,
  1332.                     UI_POPUP_NOTIFYDURATION_TIME,
  1333.                     (U8) WARNING_TONE);
  1334.                 if (IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  1335.                 {
  1336.                     HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
  1337.                 }
  1338.                 break;
  1339.         }
  1340.     }
  1341.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1342.     email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
  1343.     AlmEnableExpiryHandler();
  1344. }
  1345. /*****************************************************************************
  1346.  * FUNCTION
  1347.  *  mmi_email_ps_folder_select_req
  1348.  * DESCRIPTION
  1349.  *  Display progressing screen and send list folder request to PS.
  1350.  * PARAMETERS
  1351.  *  void
  1352.  * RETURNS
  1353.  *  void
  1354.  *****************************************************************************/
  1355. void mmi_email_ps_folder_select_req(void)
  1356. {
  1357.     /*----------------------------------------------------------------*/
  1358.     /* Local Variables                                                */
  1359.     /*----------------------------------------------------------------*/
  1360.     mmi_email_folder_select_req_struct *msgReq;
  1361.     /*----------------------------------------------------------------*/
  1362.     /* Code Body                                                      */
  1363.     /*----------------------------------------------------------------*/
  1364.     msgReq = (mmi_email_folder_select_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_select_req_struct));
  1365.     msgReq->folder = (email_folder_names_enum) email_p->main_info.curr_menu;
  1366.     msgReq->page_number = email_p->fldr_info.curr_page;
  1367.     mmi_email_entry_fldr_progress();
  1368.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_SELECT_REQ, msgReq, NULL);
  1369. }
  1370. /*****************************************************************************
  1371.  * FUNCTION
  1372.  *  mmi_email_ps_folder_select_rsp
  1373.  * DESCRIPTION
  1374.  *  Handler of MSG_ID_MMI_EMAIL_FOLDER_SELECT_RSP message.
  1375.  * PARAMETERS
  1376.  *  inMsg       [IN]        Struct variable of responsed message
  1377.  * RETURNS
  1378.  *  void
  1379.  * RETURNS
  1380.  *  void
  1381.  *****************************************************************************/
  1382. void mmi_email_ps_folder_select_rsp(void *inMsg)
  1383. {
  1384.     /*----------------------------------------------------------------*/
  1385.     /* Local Variables                                                */
  1386.     /*----------------------------------------------------------------*/
  1387.     mmi_email_folder_select_rsp_struct *msgRsp;
  1388.     /*----------------------------------------------------------------*/
  1389.     /* Code Body                                                      */
  1390.     /*----------------------------------------------------------------*/
  1391.     msgRsp = (mmi_email_folder_select_rsp_struct*) inMsg;
  1392.     TurnOnBacklight(1);
  1393.     AlmEnableExpiryHandler();
  1394.     if (msgRsp->result == MMI_TRUE)
  1395.     {
  1396.         mmi_email_fldr_sel_rsp_hdlr(msgRsp);
  1397.     }
  1398.     else
  1399.     {
  1400.         mmi_email_util_display_err_popup(
  1401.             msgRsp->minor,
  1402.             msgRsp->major,
  1403.             mmi_email_util_get_fldr_scr_id(),
  1404.             SCR_ID_EMAIL_FLDR_LIST_PROGRESS);
  1405.         email_p->fldr_info.need_fldr_sel = FALSE;
  1406.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
  1407.     }
  1408. }
  1409. /*****************************************************************************
  1410.  * FUNCTION
  1411.  *  mmi_email_ps_folder_msg_select_req
  1412.  * DESCRIPTION
  1413.  *  Display progressing screen and send folder message select request.
  1414.  * PARAMETERS
  1415.  *  void
  1416.  * RETURNS
  1417.  *  void
  1418.  *****************************************************************************/
  1419. void mmi_email_ps_folder_msg_select_req(void)
  1420. {
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Local Variables                                                */
  1423.     /*----------------------------------------------------------------*/
  1424.     mmi_email_folder_msg_select_req_struct *msgReq;
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Code Body                                                      */
  1427.     /*----------------------------------------------------------------*/
  1428.     msgReq =
  1429.         (mmi_email_folder_msg_select_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_msg_select_req_struct));
  1430.     msgReq->folder = (email_folder_names_enum) email_p->main_info.curr_menu;
  1431.     msgReq->email_msg_uid = email_p->fldr_info.curr_mail_uid;
  1432.     mmi_email_pre_entry_progressing(
  1433.         STR_EMAIL_MAIN_ID,
  1434.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1435.         0,
  1436.         0,
  1437.         mmi_email_util_abort_str(),
  1438.         mmi_email_util_abort_img(),
  1439.         (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  1440.         (U8*) NULL,
  1441.         IMG_EMAIL_CONNECTING_ID,
  1442.         NULL,
  1443.         mmi_email_util_get_abort_func(),
  1444.         mmi_email_util_get_abort_func(),
  1445.         0);
  1446.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_MSG_SELECT_REQ, msgReq, NULL);
  1447. }
  1448. /*****************************************************************************
  1449.  * FUNCTION
  1450.  *  mmi_email_ps_folder_msg_select_rsp
  1451.  * DESCRIPTION
  1452.  *  Response handler of MSG_ID_MMI_EMAIL_FOLDER_MSG_SELECT_RSP message.
  1453.  * PARAMETERS
  1454.  *  inMsg       [IN]        Struct variable of message
  1455.  * RETURNS
  1456.  *  void
  1457.  *****************************************************************************/
  1458. void mmi_email_ps_folder_msg_select_rsp(void *inMsg)
  1459. {
  1460.     /*----------------------------------------------------------------*/
  1461.     /* Local Variables                                                */
  1462.     /*----------------------------------------------------------------*/
  1463.     mmi_email_folder_msg_select_rsp_struct *msgRsp;
  1464.     /*----------------------------------------------------------------*/
  1465.     /* Code Body                                                      */
  1466.     /*----------------------------------------------------------------*/
  1467.     msgRsp = (mmi_email_folder_msg_select_rsp_struct*) inMsg;
  1468.     TurnOnBacklight(1);
  1469.     AlmEnableExpiryHandler();
  1470.     /* folder selection successfully */
  1471.     if (msgRsp->result == MMI_TRUE)
  1472.     {
  1473.         mmi_email_fldr_get_msg_rsp_data(msgRsp);
  1474.     }
  1475.     else
  1476.     {   /* some error happens, may becuase of mail body incorrect/corrputed */
  1477.         email_p->inbox_info.read_err_msg = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
  1478.         mmi_email_fldr_exec_curr_rsp(
  1479.             SCR_ID_EMAIL_PROGRESS,
  1480.             mmi_email_entry_fldr_corrupt_mail,
  1481.             mmi_email_exit_fldr_corrupt_mail);
  1482.     }
  1483.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1484. }
  1485. /*****************************************************************************
  1486.  * FUNCTION
  1487.  *  mmi_email_ps_folder_msg_del_req
  1488.  * DESCRIPTION
  1489.  *  Send request to delete single/all messages
  1490.  * PARAMETERS
  1491.  *  void
  1492.  *  inMsg(?)        [IN]        Struct variable of message
  1493.  * RETURNS
  1494.  *  void
  1495.  *****************************************************************************/
  1496. void mmi_email_ps_folder_msg_del_req(void)
  1497. {
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     mmi_email_folder_msg_delete_req_struct *msgReq;
  1502.     /*----------------------------------------------------------------*/
  1503.     /* Code Body                                                      */
  1504.     /*----------------------------------------------------------------*/
  1505.     msgReq =
  1506.         (mmi_email_folder_msg_delete_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_msg_delete_req_struct));
  1507.     msgReq->folder = (email_folder_names_enum) email_p->del_info.curr_del_fldr;
  1508.     msgReq->delete_all = (MMI_BOOL) (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL);
  1509.     msgReq->email_msg_uid = email_p->fldr_info.curr_mail_uid;
  1510.     mmi_email_pre_entry_progressing(
  1511.         STR_EMAIL_MAIN_ID,
  1512.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1513.         0,
  1514.         0,
  1515.         mmi_email_util_abort_str(),
  1516.         mmi_email_util_abort_img(),
  1517.         (U8*) GetString(STR_EMAIL_COMMON_DELETING_ID),
  1518.         (U8*) NULL,
  1519.         IMG_EMAIL_CONNECTING_ID,
  1520.         NULL,
  1521.         mmi_email_util_get_abort_func(),
  1522.         mmi_email_util_get_abort_func(),
  1523.         0);
  1524.     AlmDisableExpiryHandler();
  1525.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_MSG_DELETE_REQ, msgReq, NULL);
  1526. }
  1527. /*****************************************************************************
  1528.  * FUNCTION
  1529.  *  mmi_email_ps_folder_msg_del_rsp
  1530.  * DESCRIPTION
  1531.  *  Response handler of MSG_ID_MMI_EMAIL_FOLDER_MSG_DELETE_RSP
  1532.  *  If it's from each folder, go back to folder list
  1533.  *  else if previous operation is to delete all folders, proceed next folder.
  1534.  *  else go back to Delete All menu.
  1535.  * PARAMETERS
  1536.  *  inMsg       [IN]        Struct variable of message
  1537.  * RETURNS
  1538.  *  void
  1539.  *****************************************************************************/
  1540. void mmi_email_ps_folder_msg_del_rsp(void *inMsg)
  1541. {
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Local Variables                                                */
  1544.     /*----------------------------------------------------------------*/
  1545.     mmi_email_folder_msg_delete_rsp_struct *msgRsp;
  1546.     /*----------------------------------------------------------------*/
  1547.     /* Code Body                                                      */
  1548.     /*----------------------------------------------------------------*/
  1549.     msgRsp = (mmi_email_folder_msg_delete_rsp_struct*) inMsg;
  1550.     TurnOnBacklight(1);
  1551.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  1552.     email_p->fldr_info.need_fldr_sel = TRUE;
  1553.     if (msgRsp->result == MMI_TRUE)
  1554.     {
  1555.         if (email_p->del_info.del_all_fldr) /* delete all mails in all folders */
  1556.         {
  1557.             email_p->fldr_info.fldr_data[email_p->del_info.curr_del_fldr].total_mails = 0;
  1558.             email_p->del_info.curr_del_fldr++;
  1559.             mmi_email_del_all_folders();
  1560.         }
  1561.         else
  1562.         {
  1563.             U16 delScrnId;
  1564.             if (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL)      /* delete all mails in one folder */
  1565.             {
  1566.                 if (email_p->del_info.curr_del_fldr == MMI_EMAIL_INBOX)
  1567.                 {
  1568.                     email_p->main_info.unread_mails = 0;
  1569.                     mmi_email_util_update_status_icon();
  1570.                 }
  1571.                 email_p->fldr_info.fldr_data[email_p->del_info.curr_del_fldr].total_mails = 0;
  1572.                 DisplayPopup(
  1573.                     (U8*) GetString(STR_GLOBAL_DONE),
  1574.                     IMG_GLOBAL_ACTIVATED,
  1575.                     1,
  1576.                     UI_POPUP_NOTIFYDURATION_TIME,
  1577.                     (U8) SUCCESS_TONE);
  1578.                 GetNextScrnIdOf(SCR_ID_EMAIL_DELETE_ALL, &delScrnId);
  1579.             }
  1580.             else    /* delete single mail */
  1581.             {
  1582.                 mmi_email_fldr_update_page_num();
  1583.                 DisplayPopup(
  1584.                     (U8*) GetString(STR_GLOBAL_DONE),
  1585.                     IMG_GLOBAL_ACTIVATED,
  1586.                     1,
  1587.                     UI_POPUP_NOTIFYDURATION_TIME,
  1588.                     (U8) SUCCESS_TONE);
  1589.                 delScrnId = mmi_email_fldr_get_start_scr();
  1590.             }
  1591.             DeleteBetweenScreen(delScrnId, SCR_ID_EMAIL_PROGRESS);
  1592.         }
  1593.     }
  1594.     else
  1595.     {
  1596.         if (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL)
  1597.         {
  1598.             U16 startSrcnId;
  1599.             GetNextScrnIdOf(SCR_ID_EMAIL_DELETE_ALL, &startSrcnId);
  1600.             mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, startSrcnId, SCR_ID_EMAIL_PROGRESS);
  1601.         }
  1602.         else
  1603.         {
  1604.             mmi_email_util_display_err_popup(
  1605.                 msgRsp->minor,
  1606.                 msgRsp->major,
  1607.                 mmi_email_fldr_get_start_scr(),
  1608.                 SCR_ID_EMAIL_PROGRESS);
  1609.         }
  1610.     }
  1611.     AlmEnableExpiryHandler();
  1612. }
  1613. #define SNR_PS_EMAIL
  1614. /*****************************************************************************
  1615.  * FUNCTION
  1616.  *  mmi_email_snr_abort
  1617.  * DESCRIPTION
  1618.  *  
  1619.  * PARAMETERS
  1620.  *  void
  1621.  * RETURNS
  1622.  *  void
  1623.  *****************************************************************************/
  1624. void mmi_email_snr_abort(void)
  1625. {
  1626.     /*----------------------------------------------------------------*/
  1627.     /* Local Variables                                                */
  1628.     /*----------------------------------------------------------------*/
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     email_p->snr_info.snr_state = EMAIL_SNR_ABORTING;
  1633.     mmi_email_ps_abort_req();
  1634. }
  1635. /*****************************************************************************
  1636.  * FUNCTION
  1637.  *  mmi_email_ps_snr_req
  1638.  * DESCRIPTION
  1639.  *  Send MSG_ID_MMI_EMAIL_SEND_RECV_REQ to PS
  1640.  * PARAMETERS
  1641.  *  void
  1642.  * RETURNS
  1643.  *  void
  1644.  *****************************************************************************/
  1645. void mmi_email_ps_snr_req(void)
  1646. {
  1647.     /*----------------------------------------------------------------*/
  1648.     /* Local Variables                                                */
  1649.     /*----------------------------------------------------------------*/
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     memset(&email_p->snr_info, 0, sizeof(mmi_email_snr_info_struct));
  1654.     email_p->snr_info.snr_state = EMAIL_SNR_CONN_SMTP;
  1655.     mmi_email_pre_entry_progressing(
  1656.         STR_EMAIL_CONNECTING_ID,
  1657.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1658.         0,
  1659.         0,
  1660.         STR_GLOBAL_ABORT,
  1661.         IMG_GLOBAL_BACK,
  1662.         (U8*) GetString(STR_EMAIL_CONNECTING_TO_OUTGOING_SERVER_ID),
  1663.         (U8*) NULL,
  1664.         IMG_EMAIL_CONNECTING_ID,
  1665.         NULL,
  1666.         mmi_email_snr_abort,
  1667.         mmi_email_ps_abort_req,
  1668.         0);
  1669.     AlmDisableExpiryHandler();
  1670.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_SEND_RECV_REQ, NULL, NULL);
  1671. }
  1672. /*****************************************************************************
  1673.  * FUNCTION
  1674.  *  mmi_email_ps_snr_rsp
  1675.  * DESCRIPTION
  1676.  *  Response handler of MSG_ID_MMI_EMAIL_SEND_RECV_RSP
  1677.  * PARAMETERS
  1678.  *  inMsg       [IN]        Message struct to store the result, currently it's no usage.
  1679.  * RETURNS
  1680.  *  void
  1681.  *****************************************************************************/
  1682. void mmi_email_ps_snr_rsp(void *inMsg)
  1683. {
  1684.     /*----------------------------------------------------------------*/
  1685.     /* Local Variables                                                */
  1686.     /*----------------------------------------------------------------*/
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Code Body                                                      */
  1689.     /*----------------------------------------------------------------*/
  1690. }
  1691. /*****************************************************************************
  1692.  * FUNCTION
  1693.  *  mmi_email_ps_server_conn_ind
  1694.  * DESCRIPTION
  1695.  *  Handler of MSG_ID_MMI_EMAIL_SERVER_CONNECT_IND.
  1696.  * PARAMETERS
  1697.  *  inMsg       [IN]        Message struct to store data, currently it's no usage.
  1698.  * RETURNS
  1699.  *  void
  1700.  *****************************************************************************/
  1701. void mmi_email_ps_server_conn_ind(void *inMsg)
  1702. {
  1703.     /*----------------------------------------------------------------*/
  1704.     /* Local Variables                                                */
  1705.     /*----------------------------------------------------------------*/
  1706.     /*----------------------------------------------------------------*/
  1707.     /* Code Body                                                      */
  1708.     /*----------------------------------------------------------------*/
  1709.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1710.     {
  1711.         if (email_p->snr_info.snr_state == EMAIL_SNR_CONN_SMTP)
  1712.         {
  1713.             email_p->snr_info.snr_state = EMAIL_SNR_SENDING;
  1714.             mmi_email_pre_entry_progressing(
  1715.                 STR_EMAIL_SENDING_ID,
  1716.                 GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1717.                 0,
  1718.                 0,
  1719.                 STR_GLOBAL_ABORT,
  1720.                 IMG_GLOBAL_BACK,
  1721.                 (U8*) GetString(STR_EMAIL_SENDING_ID),
  1722.                 (U8*) NULL,
  1723.                 IMG_EMAIL_SENDING_ID,
  1724.                 NULL,
  1725.                 mmi_email_snr_abort,
  1726.                 mmi_email_ps_abort_req,
  1727.                 0);
  1728.         }
  1729.         else
  1730.         {
  1731.             email_p->snr_info.snr_state = EMAIL_SNR_AUTH;
  1732.             mmi_email_pre_entry_progressing(
  1733.                 STR_EMAIL_AUTHORIZING_ID,
  1734.                 GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1735.                 0,
  1736.                 0,
  1737.                 STR_GLOBAL_ABORT,
  1738.                 IMG_GLOBAL_BACK,
  1739.                 (U8*) GetString(STR_EMAIL_VERIFYING_USERNAME_ID),
  1740.                 (U8*) GetString(STR_EMAIL_VERIFYING_PASSOWRD_ID),
  1741.                 IMG_EMAIL_CONNECTING_ID,
  1742.                 NULL,
  1743.                 mmi_email_snr_abort,
  1744.                 mmi_email_ps_abort_req,
  1745.                 0);
  1746.         }
  1747.     }
  1748. }
  1749. /*****************************************************************************
  1750.  * FUNCTION
  1751.  *  mmi_email_ps_msg_sent_ind
  1752.  * DESCRIPTION
  1753.  *  Handler of MSG_ID_MMI_EMAIL_MSG_SENT_IND.
  1754.  *  Update display buffer of progressing screen.
  1755.  * PARAMETERS
  1756.  *  inMsg       [IN]        Message struct to store data
  1757.  * RETURNS
  1758.  *  void
  1759.  *****************************************************************************/
  1760. void mmi_email_ps_msg_sent_ind(void *inMsg)
  1761. {
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Local Variables                                                */
  1764.     /*----------------------------------------------------------------*/
  1765.     S32 len;
  1766.     U8 *tmp_buff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1767.     mmi_email_msg_sent_ind_struct *sentInd = (mmi_email_msg_sent_ind_struct*) inMsg;
  1768.     /*----------------------------------------------------------------*/
  1769.     /* Code Body                                                      */
  1770.     /*----------------------------------------------------------------*/
  1771.     email_p->snr_info.num_sent = sentInd->sent_mails;
  1772.     sprintf((S8*) tmp_buff, "(%d/%d)", sentInd->sent_mails, sentInd->total_mails);
  1773.     len = strlen((S8*) tmp_buff);
  1774.     AnsiiNToUnicodeString((S8*) email_p->snr_info.sent_buff, (S8*) tmp_buff, len);
  1775.     email_p->snr_info.sent_buff[len] = 0x0000;  /* null terminate */
  1776.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1777.     {
  1778.         mmi_email_pre_entry_progressing(
  1779.             STR_EMAIL_SENDING_ID,
  1780.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1781.             0,
  1782.             0,
  1783.             STR_GLOBAL_ABORT,
  1784.             IMG_GLOBAL_BACK,
  1785.             (U8*) GetString(STR_EMAIL_SENDING_ID),
  1786.             (U8*) email_p->snr_info.sent_buff,
  1787.             IMG_EMAIL_SENDING_ID,
  1788.             NULL,
  1789.             mmi_email_snr_abort,
  1790.             mmi_email_ps_abort_req,
  1791.             0);
  1792.     }
  1793.     OslMfree(tmp_buff);
  1794. }
  1795. /*****************************************************************************
  1796.  * FUNCTION
  1797.  *  mmi_email_ps_num_msgs_sent_ind
  1798.  * DESCRIPTION
  1799.  *  Handler of MSG_ID_MMI_EMAIL_NUM_MSGS_SENT_IND.
  1800.  *  Update display buffer of progressing screen.
  1801.  *  Change state from sending to receiving.
  1802.  * PARAMETERS
  1803.  *  inMsg       [IN]        Message struct to store data
  1804.  * RETURNS
  1805.  *  void
  1806.  *****************************************************************************/
  1807. void mmi_email_ps_num_msgs_sent_ind(void *inMsg)
  1808. {
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Local Variables                                                */
  1811.     /*----------------------------------------------------------------*/
  1812.     mmi_email_num_msgs_ind_struct *msgRsp = (mmi_email_num_msgs_ind_struct*) inMsg;
  1813.     /*----------------------------------------------------------------*/
  1814.     /* Code Body                                                      */
  1815.     /*----------------------------------------------------------------*/
  1816.     email_p->snr_info.num_to_be_sent = msgRsp->total_mails;
  1817.     if (msgRsp->result == MMI_TRUE)
  1818.     {
  1819.         email_p->snr_info.num_sent = msgRsp->num_new_mails;
  1820.         if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1821.         {
  1822.             email_p->fldr_info.fldr_data[MMI_EMAIL_SENT].num_unread_mails += msgRsp->num_new_mails;
  1823.         #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1824.             if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3)
  1825.         #endif 
  1826.                 email_p->fldr_info.fldr_data[MMI_EMAIL_SENT].total_mails += msgRsp->num_new_mails;
  1827.             mmi_email_main_update_hint(MMI_EMAIL_SENT);
  1828.         }
  1829.     }
  1830.     else
  1831.     {
  1832.         email_p->snr_info.sent_err_str = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
  1833.     }
  1834.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1835.     {
  1836.         /* success or not, always change state to connecting */
  1837.         email_p->snr_info.snr_state = EMAIL_SNR_CONN_POP3;
  1838.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1839.         if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4)
  1840.         {
  1841.             mmi_email_pre_entry_progressing(
  1842.                 STR_EMAIL_CONNECTING_ID,
  1843.                 GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1844.                 0,
  1845.                 0,
  1846.                 STR_GLOBAL_ABORT,
  1847.                 IMG_GLOBAL_BACK,
  1848.                 (U8*) GetString(STR_EMAIL_CONNECTING_TO_INCOMING_SERVER_IMAP4_ID),
  1849.                 (U8*) NULL,
  1850.                 IMG_EMAIL_CONNECTING_ID,
  1851.                 NULL,
  1852.                 mmi_email_snr_abort,
  1853.                 mmi_email_ps_abort_req,
  1854.                 0);
  1855.         }
  1856.         else
  1857.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1858.             mmi_email_pre_entry_progressing(
  1859.                 STR_EMAIL_CONNECTING_ID,
  1860.                 GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1861.                 0,
  1862.                 0,
  1863.                 STR_GLOBAL_ABORT,
  1864.                 IMG_GLOBAL_BACK,
  1865.                 (U8*) GetString(STR_EMAIL_CONNECTING_TO_INCOMING_SERVER_POP3_ID),
  1866.                 (U8*) NULL,
  1867.                 IMG_EMAIL_CONNECTING_ID,
  1868.                 NULL,
  1869.                 mmi_email_snr_abort,
  1870.                 mmi_email_ps_abort_req,
  1871.                 0);
  1872.     }
  1873. }
  1874. /*****************************************************************************
  1875.  * FUNCTION
  1876.  *  mmi_email_ps_authverify_ind
  1877.  * DESCRIPTION
  1878.  *  Handler of MSG_ID_MMI_EMAIL_AUTHVERIFY_IND.
  1879.  *  Update display buffer of progressing screen.
  1880.  *  Change state from connecting to authr
  1881.  * PARAMETERS
  1882.  *  inMsg       [IN]        Message struct to store data
  1883.  * RETURNS
  1884.  *  void
  1885.  *****************************************************************************/
  1886. void mmi_email_ps_authverify_ind(void *inMsg)
  1887. {
  1888.     /*----------------------------------------------------------------*/
  1889.     /* Local Variables                                                */
  1890.     /*----------------------------------------------------------------*/
  1891.     /*----------------------------------------------------------------*/
  1892.     /* Code Body                                                      */
  1893.     /*----------------------------------------------------------------*/
  1894.     email_p->snr_info.snr_state = EMAIL_SNR_RECVING;
  1895.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1896.     {
  1897.         mmi_email_pre_entry_progressing(
  1898.             STR_EMAIL_RECEIVING_ID,
  1899.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1900.             0,
  1901.             0,
  1902.             STR_GLOBAL_ABORT,
  1903.             IMG_GLOBAL_BACK,
  1904.             (U8*) GetString(STR_EMAIL_RECEIVING_ID),
  1905.             (U8*) email_p->snr_info.recv_buff,
  1906.             IMG_EMAIL_RECEIVING_ID,
  1907.             NULL,
  1908.             mmi_email_snr_abort,
  1909.             mmi_email_ps_abort_req,
  1910.             0);
  1911.     }
  1912. }
  1913. /*****************************************************************************
  1914.  * FUNCTION
  1915.  *  mmi_email_ps_recv_msgs_ind
  1916.  * DESCRIPTION
  1917.  *  Handler of MSG_ID_MMI_EMAIL_RECV_MSGS_IND.
  1918.  *  Update display buffer of progressing screen.
  1919.  * PARAMETERS
  1920.  *  inMsg       [IN]        Message struct to store data
  1921.  * RETURNS
  1922.  *  void
  1923.  *****************************************************************************/
  1924. void mmi_email_ps_recv_msgs_ind(void *inMsg)
  1925. {
  1926.     /*----------------------------------------------------------------*/
  1927.     /* Local Variables                                                */
  1928.     /*----------------------------------------------------------------*/
  1929.     S32 len;
  1930.     S8 *tmp_buff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1931.     mmi_email_recv_msgs_ind_struct *recvMsgsInd = (mmi_email_recv_msgs_ind_struct*) inMsg;
  1932.     /*----------------------------------------------------------------*/
  1933.     /* Code Body                                                      */
  1934.     /*----------------------------------------------------------------*/
  1935.     email_p->snr_info.num_recv = recvMsgsInd->received_mails;
  1936.     email_p->main_info.unread_mails++;
  1937.     email_p->snr_info.num_to_be_recv = recvMsgsInd->total_mails + recvMsgsInd->num_exceeded_mails;
  1938.     sprintf((S8*) tmp_buff, "(%u/%u)", email_p->snr_info.num_recv, email_p->snr_info.num_to_be_recv);
  1939.     len = strlen((S8*) tmp_buff);
  1940.     AnsiiNToUnicodeString((S8*) email_p->snr_info.recv_buff, (S8*) tmp_buff, len);
  1941.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  1942.     {
  1943.         mmi_email_pre_entry_progressing(
  1944.             STR_EMAIL_RECEIVING_ID,
  1945.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1946.             0,
  1947.             0,
  1948.             STR_GLOBAL_ABORT,
  1949.             IMG_GLOBAL_BACK,
  1950.             (U8*) GetString(STR_EMAIL_RECEIVING_ID),
  1951.             (U8*) email_p->snr_info.recv_buff,
  1952.             IMG_EMAIL_RECEIVING_ID,
  1953.             NULL,
  1954.             mmi_email_snr_abort,
  1955.             mmi_email_ps_abort_req,
  1956.             0);
  1957.     }
  1958.     OslMfree(tmp_buff);
  1959.     mmi_email_util_update_status_icon();
  1960. }
  1961. /*****************************************************************************
  1962.  * FUNCTION
  1963.  *  mmi_email_ps_new_msgs_ind
  1964.  * DESCRIPTION
  1965.  *  Handler of MSG_ID_MMI_EMAIL_NEW_MSGS_IND.
  1966.  *  Update display buffer of progressing screen.
  1967.  *  Result screen is displayed in this function.
  1968.  * PARAMETERS
  1969.  *  inMsg       [IN]        Message struct to store data
  1970.  * RETURNS
  1971.  *  void
  1972.  *****************************************************************************/
  1973. void mmi_email_ps_new_msgs_ind(void *inMsg)
  1974. {
  1975.     /*----------------------------------------------------------------*/
  1976.     /* Local Variables                                                */
  1977.     /*----------------------------------------------------------------*/
  1978.     FuncPtr back_func;
  1979.     mmi_email_new_msgs_ind_struct *msgRsp = (mmi_email_new_msgs_ind_struct*) inMsg;
  1980.     /*----------------------------------------------------------------*/
  1981.     /* Code Body                                                      */
  1982.     /*----------------------------------------------------------------*/
  1983.     /* update number of received mails regardless result is successful or not 
  1984.        because some mails may be received though some error happens */
  1985.     email_p->snr_info.num_recv = msgRsp->num_new_mails;
  1986.     email_p->snr_info.num_to_be_recv = msgRsp->total_mails + msgRsp->num_exceeded_mails;
  1987.     /* email_p->main_info.unread_mails += msgRsp->num_new_mails; */
  1988.     mmi_email_util_update_status_icon();
  1989.     mmi_email_main_update_hint(MMI_EMAIL_INBOX);
  1990.     if (msgRsp->result != MMI_TRUE)
  1991.     {
  1992.         email_p->snr_info.recv_err_str = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
  1993.     }
  1994.     /* list folder is required if list folder is not executed yet or number of emails is changed */
  1995.     if (email_p->fldr_info.fldr_update_state == EMAIL_LIST_FLDR_REQUIRED || 
  1996.         email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
  1997.     {
  1998.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  1999.         email_p->fldr_info.need_fldr_sel = TRUE;
  2000.     }
  2001.     else
  2002.     {
  2003.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
  2004.         email_p->fldr_info.need_fldr_sel = FALSE;
  2005.     }
  2006.     AlmEnableExpiryHandler();
  2007.     TurnOnBacklight(1);
  2008.     email_p->snr_info.snr_state = EMAIL_SNR_IDLE;
  2009. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  2010.     if (email_p->snr_info.is_auto_chk == TRUE)
  2011.     {
  2012.         email_p->snr_info.is_auto_chk = FALSE;
  2013.         /* it's not in email application */
  2014.         if (email_p->main_info.stop_cause != EMAIL_MODULE_ACTIVE_NOW)
  2015.         {
  2016.             /* Disable auto check popup */
  2017.         #if 0
  2018. /* under construction !*/
  2019. /* under construction !*/
  2020. /* under construction !*/
  2021. /* under construction !*/
  2022. /* under construction !*/
  2023. /* under construction !*/
  2024. /* under construction !*/
  2025. /* under construction !*/
  2026. /* under construction !*/
  2027. /* under construction !*/
  2028. /* under construction !*/
  2029.         #endif /* 0 */ 
  2030.             return;
  2031.         }
  2032.         back_func = mmi_email_auto_chk_go_back;
  2033.     }
  2034.     else
  2035. #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  2036.         back_func = mmi_email_snr_back_to_main;
  2037.     if ((email_p->main_info.is_mem_full) && (!email_p->snr_info.recv_err_str))
  2038.     {
  2039.         email_p->snr_info.recv_err_str = STR_EMAIL_MEMORY_FULL_ID;
  2040.     }
  2041.     
  2042.     /* directly display detail result screen */
  2043. #if 0
  2044. /* under construction !*/
  2045. /* under construction !*/
  2046. #endif
  2047.     mmi_email_entry_snr_detail();
  2048. }
  2049. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  2050. /*****************************************************************************
  2051.  * FUNCTION
  2052.  *  mmi_email_ps_auto_chk_ind
  2053.  * DESCRIPTION
  2054.  *  Handler of MSG_ID_MMI_EMAIL_AUTOCHECK_EXPIRY_IND.
  2055.  * PARAMETERS
  2056.  *  inMsg       [IN]        Message struct to store data
  2057.  * RETURNS
  2058.  *  void
  2059.  *****************************************************************************/
  2060. void mmi_email_ps_auto_chk_ind(void *inMsg)
  2061. {
  2062.     /*----------------------------------------------------------------*/
  2063.     /* Local Variables                                                */
  2064.     /*----------------------------------------------------------------*/
  2065.     /*----------------------------------------------------------------*/
  2066.     /* Code Body                                                      */
  2067.     /*----------------------------------------------------------------*/
  2068.     MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_AUTOCHECK_EXPIRY_IND, email_p->main_info.stop_cause));
  2069.     /* TurnOnBacklight(TRUE); */
  2070.     /* reset context */
  2071.     memset(&email_p->snr_info, 0, sizeof(mmi_email_snr_info_struct));
  2072.     if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  2073.     {
  2074.         /* get curr scren id, to back to */
  2075.         U16 activeScrnId = GetExitScrnID();
  2076.         if ((activeScrnId != SCR_ID_EMAIL_PROGRESS) && (!mmi_email_util_is_call_interrupt_allow()))
  2077.         {
  2078.             email_p->snr_info.auto_chk_scr = activeScrnId;
  2079.         }
  2080.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  2081.         email_p->fldr_info.need_fldr_sel = TRUE;
  2082.         email_p->snr_info.snr_state = EMAIL_SNR_CONN_SMTP;
  2083.         mmi_email_pre_entry_progressing(
  2084.             STR_EMAIL_CONNECTING_ID,
  2085.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2086.             0,
  2087.             0,
  2088.             STR_GLOBAL_ABORT,
  2089.             IMG_GLOBAL_BACK,
  2090.             (U8*) GetString(STR_EMAIL_CONNECTING_TO_OUTGOING_SERVER_ID),
  2091.             (U8*) NULL,
  2092.             IMG_EMAIL_CONNECTING_ID,
  2093.             NULL,
  2094.             mmi_email_snr_abort,
  2095.             mmi_email_ps_abort_req,
  2096.             0);
  2097.         AlmDisableExpiryHandler();
  2098.         if (mmi_email_util_is_call_interrupt_allow())
  2099.         {
  2100.             mmi_email_util_set_insert_history_flag(TRUE);
  2101.             mmi_email_exit_progressing();
  2102.         }
  2103.     }
  2104.     else
  2105.     {
  2106.         email_p->snr_info.auto_chk_scr = 0;
  2107.         /* Disable auto check popup */
  2108.     #if 0
  2109. /* under construction !*/
  2110. /* under construction !*/
  2111. /* under construction !*/
  2112. /* under construction !*/
  2113. /* under construction !*/
  2114.     #endif /* 0 */ 
  2115.     }
  2116.     email_p->snr_info.is_auto_chk = TRUE;
  2117. }
  2118. #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  2119. #define SEND_SAVE_PS_EMAIL
  2120. /*****************************************************************************
  2121.  * FUNCTION
  2122.  *  mmi_email_ps_send_only_req
  2123.  * DESCRIPTION
  2124.  *  Send MSG_ID_MMI_EMAIL_SEND_ONLY_REQ to PS
  2125.  * PARAMETERS
  2126.  *  void
  2127.  * RETURNS
  2128.  *  void
  2129.  *****************************************************************************/
  2130. void mmi_email_ps_send_only_req(void)
  2131. {
  2132.     /*----------------------------------------------------------------*/
  2133.     /* Local Variables                                                */
  2134.     /*----------------------------------------------------------------*/
  2135.     S32 result;
  2136.     mmi_email_send_only_req_struct *msgReq;
  2137.     /*----------------------------------------------------------------*/
  2138.     /* Code Body                                                      */
  2139.     /*----------------------------------------------------------------*/
  2140.     /* chekc email address */
  2141.     if (!mmi_email_comp_is_addr_present())
  2142.     {
  2143.         DisplayPopup(
  2144.             (U8*) GetString(STR_EMAIL_ERROR_CODE_INVALID_EMAIL_ADDR_ID),
  2145.             IMG_GLOBAL_UNFINISHED,
  2146.             1,
  2147.             UI_POPUP_NOTIFYDURATION_TIME,
  2148.             (U8) WARNING_TONE);
  2149.         return;
  2150.     }
  2151.     /* construct email */
  2152.     msgReq = (mmi_email_send_only_req_struct*) OslConstructDataPtr(sizeof(mmi_email_send_only_req_struct));
  2153.     memset(&msgReq->email_msg, 0, sizeof(email_msg_info_struct));
  2154.     if ((result = mmi_email_util_fill_msg_struct(&msgReq->email_msg)) != FS_NO_ERROR)
  2155.     {
  2156.         OslMfree(msgReq);
  2157.         DisplayPopup(
  2158.             (U8*) GetString(GetFileSystemErrorString(result)),
  2159.             IMG_GLOBAL_UNFINISHED,
  2160.             1,
  2161.             UI_POPUP_NOTIFYDURATION_TIME,
  2162.             (U8) WARNING_TONE);
  2163.         DeleteUptoScrID(SCR_ID_EMAIL_COMP_OPT);
  2164.         return;
  2165.     }
  2166.     mmi_email_pre_entry_progressing(
  2167.         STR_EMAIL_MAIN_ID,
  2168.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2169.         0,
  2170.         0,
  2171.         STR_GLOBAL_ABORT,
  2172.         IMG_GLOBAL_BACK,
  2173.         (U8*) GetString(STR_EMAIL_SENDING_ID),
  2174.         (U8*) NULL,
  2175.         IMG_EMAIL_SENDING_ID,
  2176.         NULL,
  2177.         mmi_email_ps_abort_req,
  2178.         mmi_email_ps_abort_req,
  2179.         0);
  2180.     AlmDisableExpiryHandler();
  2181.     mmi_email_ps_send_msg(PRT_MMI_EMAIL_SEND_ONLY_REQ, msgReq, NULL);
  2182. }
  2183. /*****************************************************************************
  2184.  * FUNCTION
  2185.  *  mmi_email_ps_send_only_rsp
  2186.  * DESCRIPTION
  2187.  *  Handler of MSG_ID_MMI_EMAIL_SEND_ONLY_RSP message
  2188.  * PARAMETERS
  2189.  *  inMsg       [IN]        Struct variable of response message.
  2190.  * RETURNS
  2191.  *  void
  2192.  *****************************************************************************/
  2193. void mmi_email_ps_send_only_rsp(void *inMsg)
  2194. {
  2195.     /*----------------------------------------------------------------*/
  2196.     /* Local Variables                                                */
  2197.     /*----------------------------------------------------------------*/
  2198.     mmi_email_send_only_rsp_struct *msgRsp = (mmi_email_send_only_rsp_struct*) inMsg;
  2199.     U8 keep_in_opt = FALSE;
  2200.     /*----------------------------------------------------------------*/
  2201.     /* Code Body                                                      */
  2202.     /*----------------------------------------------------------------*/
  2203.     TurnOnBacklight(1);
  2204.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  2205.     email_p->fldr_info.need_fldr_sel = TRUE;
  2206.     if (msgRsp->result == MMI_TRUE)
  2207.     {
  2208.         mmi_email_comp_reset_member();
  2209.         DisplayPopup(
  2210.             (U8*) GetString(STR_EMAIL_COMMON_SENT_ID),
  2211.             IMG_GLOBAL_ACTIVATED,
  2212.             1,
  2213.             UI_POPUP_NOTIFYDURATION_TIME,
  2214.             (U8) SUCCESS_TONE);
  2215.         DeleteBetweenScreen(mmi_email_fldr_get_start_scr(), SCR_ID_EMAIL_PROGRESS);
  2216.     }
  2217.     else
  2218.     {
  2219.         U16 startScrnId;
  2220.         if (!msgRsp->is_sent && msgRsp->is_saved)
  2221.         {
  2222.             /* send failed, save successfully, go back to main menu */
  2223.             mmi_email_comp_reset_member();
  2224.             DisplayPopup(
  2225.                 (U8*) GetString(STR_EMAIL_SEND_FAILED_SAVE_SUCCESS_ID),
  2226.                 IMG_GLOBAL_UNFINISHED,
  2227.                 1,
  2228.                 UI_POPUP_NOTIFYDURATION_TIME,
  2229.                 WARNING_TONE);
  2230.             DeleteBetweenScreen(mmi_email_fldr_get_start_scr(), SCR_ID_EMAIL_PROGRESS);
  2231.         }
  2232.         else if (!msgRsp->is_sent && !msgRsp->is_saved)
  2233.         {
  2234.             /* send and save falied, go back to option menu */
  2235.             S32 i, j;
  2236.             DisplayPopup(
  2237.                 (U8*) GetString(STR_EMAIL_SEND_FAILED_ID),
  2238.                 IMG_GLOBAL_UNFINISHED,
  2239.                 1,
  2240.                 UI_POPUP_NOTIFYDURATION_TIME,
  2241.                 WARNING_TONE);
  2242.             GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &startScrnId);
  2243.             DeleteBetweenScreen(startScrnId, SCR_ID_EMAIL_PROGRESS);
  2244.             /* rollback attachment file */
  2245.             for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  2246.             {
  2247.                 if (email_p->comp_info.attch_list[i].attch_present)
  2248.                 {
  2249.                     mmi_email_util_rename_after_abort((U8) j, (S8*) email_p->comp_info.attch_list[i].file_path);
  2250.                     j++;
  2251.                 }
  2252.             }
  2253.             keep_in_opt = TRUE;
  2254.         }
  2255.         else
  2256.         {
  2257.             /* other cases, go back to option menu */
  2258.             DisplayPopup(
  2259.                 (U8*) GetString(mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major)),
  2260.                 IMG_GLOBAL_UNFINISHED,
  2261.                 1,
  2262.                 UI_POPUP_NOTIFYDURATION_TIME,
  2263.                 WARNING_TONE);
  2264.             GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &startScrnId);
  2265.             DeleteBetweenScreen(startScrnId, SCR_ID_EMAIL_PROGRESS);
  2266.         }
  2267.     }
  2268.     if ((email_p->main_info.entry_src == EMAIL_FROM_APP) && (keep_in_opt == FALSE))
  2269.     {
  2270.         mmi_email_main_quit_to_app();
  2271.     }
  2272.     AlmEnableExpiryHandler();