EmailAppPSInterface.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:189k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * EmailAppPSInterface.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file implements utilities to interact with PS.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : EmailAppPSInterface.c
- PURPOSE : nil
- REMARKS : nil
- AUTHOR : Magesh k
- DATE : 30-01-2004
- **************************************************************/
- #ifndef _MMI_EMAILAPPPSINTERFACE_C
- #define _MMI_EMAILAPPPSINTERFACE_C
- #include "MMI_features.h"
- #ifdef __MMI_EMAIL__
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "FileSystemDef.h"
- #include "FileMgr.h"
- #include "mdi_datatype.h"
- // e-mail header files
- //micha1230
- #include "custom_nvram_editor_data_item.h"
- #include "custom_data_account.h"
- #include "EmailAppProt.h"
- #include "EmailAppGProt.h"
- #include "MessagesResourceData.h"
- /* other files */
- #include "GlobalDefs.h"
- #include "QueueGprot.h"
- #include "Unicodexdcl.h"
- #include "DebugInitDef.h"
- #include "ProtocolEvents.h"
- #include "PixtelDataTypes.h"
- #include "EventsGprot.h"
- #include "CustDataRes.h"
- #include "SettingProfile.h"
- #include "IdleAppProt.h"
- #include "FrameworkStruct.h"
- #include "AlarmFrameWorkProt.h"
- #include "HistoryGprot.h"
- #include "DownloadDefs.h"
- #include "DownloadProtos.h"
- #include "Conversions.h"
- #include "DataAccount.h"
- #include "PhoneBookGprot.h"
- #include "GpioInc.h"
- #include "ProfileGprots.h"
- #include "MemPoolContainerProt.h"
- #include "CommonScreens.h"
- #include "mmi_trc.h"
- /*****************************************************************************
- * FUNCTION
- * mmi_email_init_protocol_hdlr
- * DESCRIPTION
- * Initialize all protocol event handlers of email.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_init_protocol_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* init, deinit, start, stop mail */
- SetProtocolEventHandler(mmi_email_ps_init_rsp, PRT_MMI_EMAIL_INIT_RSP);
- SetProtocolEventHandler(mmi_email_ps_deinit_rsp, PRT_MMI_EMAIL_DEINIT_RSP);
- SetProtocolEventHandler(mmi_email_ps_start_rsp, PRT_MMI_EMAIL_START_RSP);
- SetProtocolEventHandler(mmi_email_ps_stop_rsp, PRT_MMI_EMAIL_STOP_RSP);
- SetProtocolEventHandler(mmi_email_ps_abort_rsp, PRT_MMI_EMAIL_ABORT_RSP);
- /* send and receive, auto check */
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- SetProtocolEventHandler(mmi_email_ps_auto_chk_ind, PRT_MMI_EMAIL_AUTOCHECK_EXPIRY_IND);
- #endif
- SetProtocolEventHandler(mmi_email_ps_server_conn_ind, PRT_MMI_EMAIL_SERVER_CONNECT_IND);
- SetProtocolEventHandler(mmi_email_ps_msg_sent_ind, PRT_MMI_EMAIL_MSG_SENT_IND);
- SetProtocolEventHandler(mmi_email_ps_num_msgs_sent_ind, PRT_MMI_EMAIL_NUM_MSGS_SENT_IND);
- SetProtocolEventHandler(mmi_email_ps_authverify_ind, PRT_MMI_EMAIL_AUTHVERIFY_IND);
- SetProtocolEventHandler(mmi_email_ps_recv_msgs_ind, PRT_MMI_EMAIL_RECV_MSGS_IND);
- SetProtocolEventHandler(mmi_email_ps_new_msgs_ind, PRT_MMI_EMAIL_NEW_MSGS_IND);
- SetProtocolEventHandler(mmi_email_ps_snr_rsp, PRT_MMI_EMAIL_SEND_RECV_RSP);
- /* folder */
- SetProtocolEventHandler(mmi_email_ps_list_folders_rsp, PRT_MMI_EMAIL_LIST_FOLDERS_RSP);
- SetProtocolEventHandler(mmi_email_ps_folder_select_rsp, PRT_MMI_EMAIL_FOLDER_SELECT_RSP);
- SetProtocolEventHandler(mmi_email_ps_folder_msg_select_rsp, PRT_MMI_EMAIL_FOLDER_MSG_SELECT_RSP);
- SetProtocolEventHandler(mmi_email_ps_folder_msg_del_rsp, PRT_MMI_EMAIL_FOLDER_MSG_DELETE_RSP);
- /* send/save */
- SetProtocolEventHandler(mmi_email_ps_send_only_rsp, PRT_MMI_EMAIL_SEND_ONLY_RSP);
- SetProtocolEventHandler(mmi_email_ps_save_to_draft_rsp, PRT_MMI_EMAIL_SAVE_DRAFTS_RSP);
- SetProtocolEventHandler(mmi_email_ps_move_to_draft_rsp, PRT_MMI_EMAIL_MSG_MOVE_RSP);
- SetProtocolEventHandler(mmi_email_ps_save_and_send_rsp, PRT_MMI_EMAIL_SEND_NOW_RSP);
- SetProtocolEventHandler(mmi_email_ps_send_from_mailbox_rsp, PRT_MMI_EMAIL_SEND_FROM_MAILBOX_RSP);
- /* memory full, available */
- SetProtocolEventHandler(mmi_email_ps_msg_available_ind, PRT_MMI_EMAIL_MSG_AVAILABLE_IND);
- SetProtocolEventHandler(mmi_email_ps_msg_full_ind, PRT_MMI_EMAIL_MSG_FULL_IND);
- /* profiles */
- SetProtocolEventHandler(mmi_email_ps_list_acct_profile_rsp, PRT_MMI_EMAIL_LIST_ACCT_PROFILE_RSP);
- SetProtocolEventHandler(mmi_email_ps_set_acct_profile_rsp, PRT_MMI_EMAIL_SET_ACCT_PROFILE_RSP);
- SetProtocolEventHandler(mmi_email_ps_get_acct_profile_rsp, PRT_MMI_EMAIL_GET_ACCT_PROFILE_RSP);
- SetProtocolEventHandler(mmi_email_ps_activate_acct_rsp, PRT_MMI_EMAIL_ACTIVATE_ACCT_RSP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_send_msg
- * DESCRIPTION
- * Wrapper function to send message to Email module
- * PARAMETERS
- * msg_id [IN]
- * local_param_ptr [?]
- * peer_buf_ptr [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_send_msg(U16 msg_id, void *local_param_ptr, void *peer_buf_ptr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_EMAIL;
- Message.oslMsgId = (msg_type) msg_id;
- Message.oslDataPtr = (oslParaType*) local_param_ptr;
- Message.oslPeerBuffPtr = peer_buf_ptr;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_init_req
- * DESCRIPTION
- * Send of MSG_ID_MMI_EMAIL_INIT_REQ to Email.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_init_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_INIT_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_init_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_INIT_RSP.
- * Store state variables from PS.
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_init_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_init_rsp_struct *msgRsp = (mmi_email_init_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(msgRsp->result == MMI_TRUE);
- email_p->main_info.unread_mails = msgRsp->no_unread_inbox_msg;
- email_p->prof_info.act_prof.act_indx = msgRsp->activated_acct_index - 1;
- /* update status icon in IDLE screen */
- mmi_email_util_update_status_icon();
- email_p->main_info.ready_state |= EMAIL_PS_INIT_DONE;
- /* if profile is activated, get information of current activated profile */
- if (mmi_email_prof_is_activated())
- {
- mmi_email_prof_fill_act_info(&msgRsp->activated_acct);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_deinit_req
- * DESCRIPTION
- * Send of MSG_ID_MMI_EMAIL_DEINIT_REQ to Email.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_deinit_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_DEINIT_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_deinit_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_DEINIT_RSP.
- * Store state variables from PS.
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_deinit_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_deinit_rsp_struct *msgRsp = (mmi_email_deinit_rsp_struct*) inMsg;
- U8 i, j;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(msgRsp->result == MMI_TRUE);
- /* similar as abort_rsp */
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- if (email_p->snr_info.is_auto_chk) /* in case in the middle of email auto-checking */
- {
- email_p->snr_info.is_auto_chk = FALSE;
- }
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */
- /* in write email screen and in the middle of email sending */
- if (IsScreenPresent(SCR_ID_EMAIL_COMP_OPT) && IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
- {
- for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
- {
- if (email_p->comp_info.attch_list[i].attch_present)
- {
- mmi_email_util_rename_after_abort(j, (S8*)email_p->comp_info.attch_list[i].file_path);
- j++;
- }
- }
- }
- /* similar as stop_rsp */
- mmi_email_util_free_container_pool();
- email_p->main_info.stop_cause = EMAIL_STOP_NONE;
- email_p->main_info.entry_src = EMAIL_FROM_MSG;
- email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_start_req
- * DESCRIPTION
- * Send of MSG_ID_MMI_EMAIL_START_REQ to Email.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_start_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_START_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_start_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_START_RSP
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_start_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_start_rsp_struct *msgRsp = (mmi_email_start_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgRsp->result == MMI_TRUE)
- {
- email_p->main_info.stop_cause = EMAIL_MODULE_ACTIVE_NOW;
- MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_START_RSP, email_p->main_info.entry_src));
- if (email_p->main_info.entry_src == EMAIL_FROM_APP)
- {
- /* enter write Email screen from other app like phonebook, file manager */
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- /* add signature attach and text, if present */
- if (mmi_email_comp_add_sig() == FALSE)
- {
- return;
- }
- mmi_email_entry_comp();
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- }
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- else if (email_p->main_info.entry_src == EMAIL_FROM_IDLE)
- {
- /* read mail from idle screen */
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- mmi_email_inbox_pre_entry();
- }
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */
- else
- {
- /* normal entry */
- if (email_p->fldr_info.fldr_update_state == EMAIL_LIST_FLDR_REQUIRED)
- {
- mmi_email_ps_list_folders_req();
- }
- else
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- mmi_email_entry_main();
- }
- }
- }
- else
- {
- mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, 0, SCR_ID_EMAIL_MAIN);
- }
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_stop_req
- * DESCRIPTION
- * Send MSG_ID_MMI_EMAIL_STOP_REQ message to protocol.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_stop_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_STOP_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_stop_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_STOP_RSP message.
- * PARAMETERS
- * inMsg [?]
- * RETURNS
- * inMsg IN struct variable of response message.(?)
- *****************************************************************************/
- void mmi_email_ps_stop_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_STOP_RSP, email_p->main_info.stop_cause));
- switch (email_p->main_info.stop_cause)
- {
- case EMAIL_STOP_BACK_HIST:
- if (IsScreenPresent(SCR_ID_EMAIL_MAIN))
- {
- DeleteNScrId(SCR_ID_EMAIL_MAIN);
- }
- else if (IsScreenPresent(SCR_ID_EMAIL_INBOX))
- {
- DeleteNScrId(SCR_ID_EMAIL_INBOX);
- }
- /* do not force call screen to go back history */
- if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
- {
- GoBackHistory();
- }
- break;
- case EMAIL_STOP_GOTO_IDLE:
- DeleteUptoScrID(IDLE_SCREEN_ID);
- /* do not force call screen to go to idle screen */
- if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
- {
- GoBackHistory();
- }
- break;
- }
- mmi_email_util_free_container_pool();
- email_p->main_info.stop_cause = EMAIL_STOP_NONE;
- email_p->main_info.entry_src = EMAIL_FROM_MSG;
- email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_abort_req
- * DESCRIPTION
- * Send abort request to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_abort_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- email_p->snr_info.auto_chk_scr = 0;
- #endif
- AlmDisableExpiryHandler();
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_GLOBAL_ABORT),
- (U8*) NULL,
- IMG_GLOBAL_PROGRESS,
- NULL,
- NULL,
- NULL,
- 0);
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_ABORT_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_abort_rsp
- * DESCRIPTION
- * Handler for MSG_ID_MMI_EMAIL_ABORT_RSP message
- * PARAMETERS
- * inMsg [?]
- * RETURNS
- * inMsg IN struct variable of response message.(?)
- *****************************************************************************/
- void mmi_email_ps_abort_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 delScrnId;
- S32 i, j;
- mmi_email_abort_rsp_struct *msgRsp = (mmi_email_abort_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- email_p->snr_info.is_auto_chk = FALSE;
- #endif
- if (msgRsp->result == MMI_TRUE)
- {
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_ABORTED_ID),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) SUCCESS_TONE);
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
- email_p->fldr_info.need_fldr_sel = FALSE;
- }
- else
- {
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_NOT_DONE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- /* if email is entered by other application and abort is fail also,
- it should directly return to other application's screen */
- if (email_p->main_info.entry_src == EMAIL_FROM_APP)
- {
- return;
- }
- }
- MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_ABORT_RSP, email_p->main_info.curr_menu));
- if (IsScreenPresent(SCR_ID_EMAIL_COMP_OPT) && email_p->snr_info.snr_state == EMAIL_SNR_IDLE) /* in write Email screen, for all folders */
- {
- for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
- {
- if (email_p->comp_info.attch_list[i].attch_present)
- {
- mmi_email_util_rename_after_abort((U8) j, (S8*) email_p->comp_info.attch_list[i].file_path);
- j++;
- }
- }
- GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &delScrnId);
- DeleteBetweenScreen(delScrnId, SCR_ID_EMAIL_PROGRESS);
- }
- else
- {
- switch (email_p->main_info.curr_menu)
- {
- case MMI_EMAIL_SNR:
- {
- /* abort send and receive should not do list folder again */
- #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
- if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3)
- {
- if (email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- }
- }
- #else /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
- if (email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- }
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
- }
- email_p->snr_info.snr_state = EMAIL_SNR_IDLE;
- break;
- }
- case MMI_EMAIL_COMP:
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- /* if email is entered by other application, email main menu is definitely not in the history.
- but email main menu should not show up, intead, the screen should remain as original */
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN) && email_p->main_info.entry_src != EMAIL_FROM_APP)
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
- }
- break;
- }
- case MMI_EMAIL_INBOX:
- case MMI_EMAIL_UNSENT:
- case MMI_EMAIL_SENT:
- case MMI_EMAIL_DRAFT:
- {
- U16 listScrnId = mmi_email_util_get_fldr_scr_id();
- /* delete screen to inbox / unsent / sent / draft folder only if it doesn't abort from auto check */
- if (IsScreenPresent(listScrnId) && email_p->snr_info.snr_state == EMAIL_SNR_IDLE)
- {
- U16 startSrcnId;
- GetNextScrnIdOf(listScrnId, &startSrcnId);
- if (startSrcnId == SCR_ID_EMAIL_FLDR_LIST_PROGRESS)
- {
- mmi_email_util_del_upto_scr(listScrnId);
- }
- else
- {
- mmi_email_util_del_between_scr(startSrcnId, SCR_ID_EMAIL_PROGRESS);
- }
- }
- else /* abort from auto check, go back to original screen */
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
- {
- mmi_email_fldr_exec_curr_rsp(
- SCR_ID_EMAIL_PROGRESS,
- mmi_email_entry_main,
- mmi_email_exit_main_menu);
- }
- }
- break;
- }
- case MMI_EMAIL_DEL_ALL:
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
- }
- break;
- }
- default:
- {
- /*
- * default state, go to main menu.
- * case MMI_EMAIL_NONE:
- * case MMI_EMAIL_PROF:
- * case MMI_EMAIL_REFRESH:
- */
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN))
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
- }
- break;
- }
- }
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- DeleteScreenIfPresent(SCR_ID_EMAIL_FLDR_LIST_PROGRESS);
- }
- email_p->snr_info.snr_state = EMAIL_SNR_IDLE; /* to prevent auto SNR happened in Email app */
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_msg_available_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_MSG_AVAILABLE_IND messages
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_msg_available_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->main_info.is_mem_full = FALSE;
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- mmi_email_util_update_status_icon();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_msg_full_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_MSG_FULL_IND messages
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_msg_full_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->main_info.is_mem_full = TRUE;
- mmi_email_util_update_status_icon();
- TurnOnBacklight(1);
- playRequestedTone(WARNING_TONE);
- }
- #define PROFILE_PS_EMAIL
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_list_acct_profile_req
- * DESCRIPTION
- * Send list account request to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_list_acct_profile_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
- NULL,
- IMG_EMAIL_SENDING_ID,
- NULL,
- NULL,
- NULL,
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_LIST_ACCT_PROFILE_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_list_acct_profile_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_EMAIL_LIST_ACCT_PROFILE_RSP message.
- * PARAMETERS
- * inMsg [?]
- * RETURNS
- * inMsg IN struct variable of response message.(?)
- *****************************************************************************/
- void mmi_email_ps_list_acct_profile_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_list_acct_profile_rsp_struct *msgRsp = (mmi_email_list_acct_profile_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(msgRsp->result == MMI_TRUE);
- mmi_email_prof_fill_data(&msgRsp->list_acct);
- DataAccountReadyCheck(mmi_email_ps_dt_acct_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_dt_acct_callback
- * DESCRIPTION
- * Callback function when data account ready
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_dt_acct_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
- {
- mmi_email_entry_prof();
- }
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_set_acct_profile_req
- * DESCRIPTION
- * Send request to set profile.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_set_acct_profile_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_set_acct_profile_req_struct *msgReq =
- (mmi_email_set_acct_profile_req_struct*) OslConstructDataPtr(sizeof(mmi_email_set_acct_profile_req_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_email_prof_set_acct_data((mmi_email_set_acct_profile_req_struct*) msgReq);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_SET_ACCT_PROFILE_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_set_acct_profile_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_EMAIL_SET_ACCT_PROFILE_RSP message.
- * PARAMETERS
- * inMsg [IN] Variable contains reulst of saving account
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_set_acct_profile_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 startSrcnId;
- mmi_email_set_acct_profile_rsp_struct *msgRsp = (mmi_email_set_acct_profile_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgRsp->result == MMI_TRUE)
- {
- pfnUnicodeStrcpy(
- (S8*) email_p->prof_info.prof_misc.acct_names[email_p->prof_info.prof_misc.curr_sel_prof],
- (S8*) email_p->prof_info.editing_prof.setting_info.prof_name);
- /* current editing profile is activative profile */
- if (email_p->prof_info.prof_misc.curr_sel_prof == email_p->prof_info.act_prof.act_indx)
- {
- mmi_email_prof_update_act_info();
- }
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_SAVED),
- IMG_GLOBAL_SAVE,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- GetNextScrnIdOf(SCR_ID_EMAIL_PROF_OPT_EDIT, &startSrcnId);
- DeleteBetweenScreen(startSrcnId, SCR_ID_EMAIL_PROGRESS);
- }
- else
- {
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- if (!email_p->snr_info.is_auto_chk)
- #endif
- {
- U16 errMsgId = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
- DisplayPopup(
- (U8*) GetString(errMsgId),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- GetNextScrnIdOf(email_p->prof_info.prof_misc.curr_scr, &startSrcnId);
- DeleteBetweenScreen(startSrcnId, SCR_ID_EMAIL_PROGRESS);
- }
- }
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_get_acct_profile_req
- * DESCRIPTION
- * Send request to get data of a specific profile.
- * PARAMETERS
- * index [IN] Index of profile(indexing from 1).
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_get_acct_profile_req(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_get_acct_profile_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq =
- (mmi_email_get_acct_profile_req_struct*) OslConstructDataPtr(sizeof(mmi_email_get_acct_profile_req_struct));
- msgReq->acct_index = index;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
- (U8*) NULL,
- IMG_NEW_SMS_SEND,
- NULL,
- NULL,
- NULL,
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_GET_ACCT_PROFILE_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_get_acct_profile_rsp
- * DESCRIPTION
- * Handler of get profile response
- * PARAMETERS
- * inMsg [IN] Data of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_get_acct_profile_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_get_acct_profile_rsp_struct *msgRsp = (mmi_email_get_acct_profile_rsp_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgRsp->result == MMI_TRUE)
- {
- mmi_email_prof_get_acct_data(&msgRsp->acct);
- email_p->prof_info.prof_misc.curr_hilite_indx = 0;
- switch (email_p->prof_info.prof_misc.curr_scr)
- {
- case SCR_ID_EMAIL_PROF_SETTING:
- /* store current protocol to check if protocol changed afterwards */
- #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
- email_p->prof_info.prof_misc.curr_prot = msgRsp->acct.imap_pop3_info.in_protocol;
- #endif
- mmi_email_entry_prof_setting();
- break;
- case SCR_ID_EMAIL_PROF_SMTP:
- mmi_email_entry_prof_smtp();
- break;
- case SCR_ID_EMAIL_PROF_POP3_IMAP4:
- mmi_email_entry_prof_pop3_imap4();
- break;
- case SCR_ID_EMAIL_PROF_SIG:
- mmi_email_prof_pre_entry_sig();
- break;
- }
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- }
- else
- {
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- if (!email_p->snr_info.is_auto_chk)
- #endif
- {
- mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, 0, SCR_ID_EMAIL_MAIN);
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- }
- }
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_activate_acct_req
- * DESCRIPTION
- * Send request to Email to activate a specific account
- * PARAMETERS
- * index [IN] Index of account to be activated.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_activate_acct_req(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_activate_acct_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (mmi_email_activate_acct_req_struct*) OslConstructDataPtr(sizeof(mmi_email_activate_acct_req_struct));
- msgReq->acct_index = index;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- 0,
- 0,
- (U8*) GetString(STR_GLOBAL_SAVING),
- (U8*) NULL,
- IMG_NEW_SMS_SEND,
- NULL,
- NULL,
- NULL,
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_ACTIVATE_ACCT_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_activate_acct_rsp
- * DESCRIPTION
- * Handler of activate profile response
- * PARAMETERS
- * inMsg [IN] Data of response
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_activate_acct_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 startScrnid;
- mmi_email_activate_acct_rsp_struct *msgRsp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgRsp = (mmi_email_activate_acct_rsp_struct*) inMsg;
- if (msgRsp->result == MMI_TRUE)
- {
- BOOL prof_changed = FALSE;
- if (email_p->prof_info.act_prof.act_indx != email_p->prof_info.prof_misc.curr_sel_prof)
- {
- prof_changed = TRUE;
- }
- email_p->prof_info.act_prof.act_indx = email_p->prof_info.prof_misc.curr_sel_prof;
- mmi_email_prof_fill_act_info(&msgRsp->acct);
- if (prof_changed)
- {
- mmi_email_prof_update_hint();
- }
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_PROFILE_ACTIVATED),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- }
- else
- {
- DisplayPopup(
- (U8*) GetString(mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major)),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- }
- GetNextScrnIdOf(SCR_ID_EMAIL_PROF, &startScrnid);
- DeleteBetweenScreen(startScrnid, SCR_ID_EMAIL_PROGRESS);
- AlmEnableExpiryHandler();
- }
- #define FOLDER_PS_EMAIL
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_list_folders_req
- * DESCRIPTION
- * Display progressing screen and send list folder request to PS.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_list_folders_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- mmi_email_util_abort_str(),
- mmi_email_util_abort_img(),
- (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_util_get_abort_func(),
- mmi_email_util_get_abort_func(),
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_LIST_FOLDERS_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_list_folders_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_LIST_FOLDERS_RSP message.
- * PARAMETERS
- * inMsg [IN] Struct variable of responsed message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_list_folders_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_list_folders_rsp_struct *msgRsp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgRsp = (mmi_email_list_folders_rsp_struct*) inMsg;
- TurnOnBacklight(1);
- if (msgRsp->result == MMI_TRUE)
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_DONE;
- mmi_email_fldr_reset_cntx(EMAIL_RESET_ALL_FLDR);
- memcpy(&email_p->fldr_info.fldr_data, &msgRsp->folders, sizeof(email_folder_info_struct) * EMAIL_FLDR_TOTAL);
- /* update unread email status */
- email_p->main_info.unread_mails = email_p->fldr_info.fldr_data[MMI_EMAIL_INBOX].num_unread_mails;
- mmi_email_util_update_status_icon();
- MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_LIST_FOLDERS_RSP, email_p->fldr_info.list_fldr_cause));
- switch (email_p->fldr_info.list_fldr_cause)
- {
- case EMAIL_LIST_FLDR_NORMAL:
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_main, mmi_email_exit_main_menu);
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- break;
- }
- case EMAIL_LIST_FLDR_REFRESH:
- case EMAIL_LIST_FLDR_BACK_MAIN:
- {
- if (GetExitScrnID() == SCR_ID_EMAIL_PROGRESS)
- {
- mmi_email_entry_main();
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, NULL);
- DeleteScreenIfPresent(SCR_ID_EMAIL_MAIN);
- SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, (HistoryDelCBPtr) mmi_email_main_del_callback);
- }
- else
- {
- SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, NULL);
- DeleteScreenIfPresent(SCR_ID_EMAIL_MAIN);
- SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, (HistoryDelCBPtr) mmi_email_main_del_callback);
- HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
- }
- break;
- }
- case EMAIL_LIST_FLDR_DEL_ALL:
- {
- mmi_email_fldr_exec_curr_rsp(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_del_all, mmi_email_exit_del_all);
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- break;
- }
- }
- }
- else
- {
- U16 errorMessageId;
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
- errorMessageId = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
- switch (email_p->fldr_info.list_fldr_cause)
- {
- case EMAIL_LIST_FLDR_NORMAL:
- DisplayPopup(
- (U8*) GetString(errorMessageId),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- if (IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
- {
- HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
- }
- break;
- #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
- case EMAIL_LIST_FLDR_REFRESH:
- DisplayPopup(
- (U8*) GetString(errorMessageId),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- break;
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
- case EMAIL_LIST_FLDR_DEL_ALL:
- DisplayPopup(
- (U8*) GetString(errorMessageId),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- if (!IsScreenPresent(SCR_ID_EMAIL_MAIN) && IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
- {
- HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
- }
- break;
- case EMAIL_LIST_FLDR_BACK_MAIN:
- DisplayPopup(
- (U8*) GetString(errorMessageId),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- if (IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
- {
- HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_MAIN, mmi_email_entry_main);
- }
- break;
- }
- }
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NONE;
- AlmEnableExpiryHandler();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_select_req
- * DESCRIPTION
- * Display progressing screen and send list folder request to PS.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_select_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_select_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq = (mmi_email_folder_select_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_select_req_struct));
- msgReq->folder = (email_folder_names_enum) email_p->main_info.curr_menu;
- msgReq->page_number = email_p->fldr_info.curr_page;
- mmi_email_entry_fldr_progress();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_SELECT_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_select_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_FOLDER_SELECT_RSP message.
- * PARAMETERS
- * inMsg [IN] Struct variable of responsed message
- * RETURNS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_select_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_select_rsp_struct *msgRsp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgRsp = (mmi_email_folder_select_rsp_struct*) inMsg;
- TurnOnBacklight(1);
- AlmEnableExpiryHandler();
- if (msgRsp->result == MMI_TRUE)
- {
- mmi_email_fldr_sel_rsp_hdlr(msgRsp);
- }
- else
- {
- mmi_email_util_display_err_popup(
- msgRsp->minor,
- msgRsp->major,
- mmi_email_util_get_fldr_scr_id(),
- SCR_ID_EMAIL_FLDR_LIST_PROGRESS);
- email_p->fldr_info.need_fldr_sel = FALSE;
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_msg_select_req
- * DESCRIPTION
- * Display progressing screen and send folder message select request.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_msg_select_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_msg_select_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq =
- (mmi_email_folder_msg_select_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_msg_select_req_struct));
- msgReq->folder = (email_folder_names_enum) email_p->main_info.curr_menu;
- msgReq->email_msg_uid = email_p->fldr_info.curr_mail_uid;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- mmi_email_util_abort_str(),
- mmi_email_util_abort_img(),
- (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_util_get_abort_func(),
- mmi_email_util_get_abort_func(),
- 0);
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_MSG_SELECT_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_msg_select_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_EMAIL_FOLDER_MSG_SELECT_RSP message.
- * PARAMETERS
- * inMsg [IN] Struct variable of message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_msg_select_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_msg_select_rsp_struct *msgRsp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgRsp = (mmi_email_folder_msg_select_rsp_struct*) inMsg;
- TurnOnBacklight(1);
- AlmEnableExpiryHandler();
- /* folder selection successfully */
- if (msgRsp->result == MMI_TRUE)
- {
- mmi_email_fldr_get_msg_rsp_data(msgRsp);
- }
- else
- { /* some error happens, may becuase of mail body incorrect/corrputed */
- email_p->inbox_info.read_err_msg = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
- mmi_email_fldr_exec_curr_rsp(
- SCR_ID_EMAIL_PROGRESS,
- mmi_email_entry_fldr_corrupt_mail,
- mmi_email_exit_fldr_corrupt_mail);
- }
- DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_msg_del_req
- * DESCRIPTION
- * Send request to delete single/all messages
- * PARAMETERS
- * void
- * inMsg(?) [IN] Struct variable of message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_msg_del_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_msg_delete_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgReq =
- (mmi_email_folder_msg_delete_req_struct*) OslConstructDataPtr(sizeof(mmi_email_folder_msg_delete_req_struct));
- msgReq->folder = (email_folder_names_enum) email_p->del_info.curr_del_fldr;
- msgReq->delete_all = (MMI_BOOL) (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL);
- msgReq->email_msg_uid = email_p->fldr_info.curr_mail_uid;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- mmi_email_util_abort_str(),
- mmi_email_util_abort_img(),
- (U8*) GetString(STR_EMAIL_COMMON_DELETING_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_util_get_abort_func(),
- mmi_email_util_get_abort_func(),
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_FOLDER_MSG_DELETE_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_folder_msg_del_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_EMAIL_FOLDER_MSG_DELETE_RSP
- * If it's from each folder, go back to folder list
- * else if previous operation is to delete all folders, proceed next folder.
- * else go back to Delete All menu.
- * PARAMETERS
- * inMsg [IN] Struct variable of message
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_folder_msg_del_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_folder_msg_delete_rsp_struct *msgRsp;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- msgRsp = (mmi_email_folder_msg_delete_rsp_struct*) inMsg;
- TurnOnBacklight(1);
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- if (msgRsp->result == MMI_TRUE)
- {
- if (email_p->del_info.del_all_fldr) /* delete all mails in all folders */
- {
- email_p->fldr_info.fldr_data[email_p->del_info.curr_del_fldr].total_mails = 0;
- email_p->del_info.curr_del_fldr++;
- mmi_email_del_all_folders();
- }
- else
- {
- U16 delScrnId;
- if (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL) /* delete all mails in one folder */
- {
- if (email_p->del_info.curr_del_fldr == MMI_EMAIL_INBOX)
- {
- email_p->main_info.unread_mails = 0;
- mmi_email_util_update_status_icon();
- }
- email_p->fldr_info.fldr_data[email_p->del_info.curr_del_fldr].total_mails = 0;
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) SUCCESS_TONE);
- GetNextScrnIdOf(SCR_ID_EMAIL_DELETE_ALL, &delScrnId);
- }
- else /* delete single mail */
- {
- mmi_email_fldr_update_page_num();
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) SUCCESS_TONE);
- delScrnId = mmi_email_fldr_get_start_scr();
- }
- DeleteBetweenScreen(delScrnId, SCR_ID_EMAIL_PROGRESS);
- }
- }
- else
- {
- if (email_p->main_info.curr_menu == MMI_EMAIL_DEL_ALL)
- {
- U16 startSrcnId;
- GetNextScrnIdOf(SCR_ID_EMAIL_DELETE_ALL, &startSrcnId);
- mmi_email_util_display_err_popup(msgRsp->minor, msgRsp->major, startSrcnId, SCR_ID_EMAIL_PROGRESS);
- }
- else
- {
- mmi_email_util_display_err_popup(
- msgRsp->minor,
- msgRsp->major,
- mmi_email_fldr_get_start_scr(),
- SCR_ID_EMAIL_PROGRESS);
- }
- }
- AlmEnableExpiryHandler();
- }
- #define SNR_PS_EMAIL
- /*****************************************************************************
- * FUNCTION
- * mmi_email_snr_abort
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_snr_abort(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->snr_info.snr_state = EMAIL_SNR_ABORTING;
- mmi_email_ps_abort_req();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_snr_req
- * DESCRIPTION
- * Send MSG_ID_MMI_EMAIL_SEND_RECV_REQ to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_snr_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(&email_p->snr_info, 0, sizeof(mmi_email_snr_info_struct));
- email_p->snr_info.snr_state = EMAIL_SNR_CONN_SMTP;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_CONNECTING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_CONNECTING_TO_OUTGOING_SERVER_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_SEND_RECV_REQ, NULL, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_snr_rsp
- * DESCRIPTION
- * Response handler of MSG_ID_MMI_EMAIL_SEND_RECV_RSP
- * PARAMETERS
- * inMsg [IN] Message struct to store the result, currently it's no usage.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_snr_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_server_conn_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_SERVER_CONNECT_IND.
- * PARAMETERS
- * inMsg [IN] Message struct to store data, currently it's no usage.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_server_conn_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- if (email_p->snr_info.snr_state == EMAIL_SNR_CONN_SMTP)
- {
- email_p->snr_info.snr_state = EMAIL_SNR_SENDING;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_SENDING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_SENDING_ID),
- (U8*) NULL,
- IMG_EMAIL_SENDING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- else
- {
- email_p->snr_info.snr_state = EMAIL_SNR_AUTH;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_AUTHORIZING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_VERIFYING_USERNAME_ID),
- (U8*) GetString(STR_EMAIL_VERIFYING_PASSOWRD_ID),
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_msg_sent_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_MSG_SENT_IND.
- * Update display buffer of progressing screen.
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_msg_sent_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 len;
- U8 *tmp_buff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
- mmi_email_msg_sent_ind_struct *sentInd = (mmi_email_msg_sent_ind_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->snr_info.num_sent = sentInd->sent_mails;
- sprintf((S8*) tmp_buff, "(%d/%d)", sentInd->sent_mails, sentInd->total_mails);
- len = strlen((S8*) tmp_buff);
- AnsiiNToUnicodeString((S8*) email_p->snr_info.sent_buff, (S8*) tmp_buff, len);
- email_p->snr_info.sent_buff[len] = 0x0000; /* null terminate */
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- mmi_email_pre_entry_progressing(
- STR_EMAIL_SENDING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_SENDING_ID),
- (U8*) email_p->snr_info.sent_buff,
- IMG_EMAIL_SENDING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- OslMfree(tmp_buff);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_num_msgs_sent_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_NUM_MSGS_SENT_IND.
- * Update display buffer of progressing screen.
- * Change state from sending to receiving.
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_num_msgs_sent_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_num_msgs_ind_struct *msgRsp = (mmi_email_num_msgs_ind_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->snr_info.num_to_be_sent = msgRsp->total_mails;
- if (msgRsp->result == MMI_TRUE)
- {
- email_p->snr_info.num_sent = msgRsp->num_new_mails;
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- email_p->fldr_info.fldr_data[MMI_EMAIL_SENT].num_unread_mails += msgRsp->num_new_mails;
- #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
- if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3)
- #endif
- email_p->fldr_info.fldr_data[MMI_EMAIL_SENT].total_mails += msgRsp->num_new_mails;
- mmi_email_main_update_hint(MMI_EMAIL_SENT);
- }
- }
- else
- {
- email_p->snr_info.sent_err_str = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
- }
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- /* success or not, always change state to connecting */
- email_p->snr_info.snr_state = EMAIL_SNR_CONN_POP3;
- #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
- if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4)
- {
- mmi_email_pre_entry_progressing(
- STR_EMAIL_CONNECTING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_CONNECTING_TO_INCOMING_SERVER_IMAP4_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- else
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
- mmi_email_pre_entry_progressing(
- STR_EMAIL_CONNECTING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_CONNECTING_TO_INCOMING_SERVER_POP3_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_authverify_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_AUTHVERIFY_IND.
- * Update display buffer of progressing screen.
- * Change state from connecting to authr
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_authverify_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->snr_info.snr_state = EMAIL_SNR_RECVING;
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- mmi_email_pre_entry_progressing(
- STR_EMAIL_RECEIVING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_RECEIVING_ID),
- (U8*) email_p->snr_info.recv_buff,
- IMG_EMAIL_RECEIVING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_recv_msgs_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_RECV_MSGS_IND.
- * Update display buffer of progressing screen.
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_recv_msgs_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 len;
- S8 *tmp_buff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
- mmi_email_recv_msgs_ind_struct *recvMsgsInd = (mmi_email_recv_msgs_ind_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- email_p->snr_info.num_recv = recvMsgsInd->received_mails;
- email_p->main_info.unread_mails++;
- email_p->snr_info.num_to_be_recv = recvMsgsInd->total_mails + recvMsgsInd->num_exceeded_mails;
- sprintf((S8*) tmp_buff, "(%u/%u)", email_p->snr_info.num_recv, email_p->snr_info.num_to_be_recv);
- len = strlen((S8*) tmp_buff);
- AnsiiNToUnicodeString((S8*) email_p->snr_info.recv_buff, (S8*) tmp_buff, len);
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- mmi_email_pre_entry_progressing(
- STR_EMAIL_RECEIVING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_RECEIVING_ID),
- (U8*) email_p->snr_info.recv_buff,
- IMG_EMAIL_RECEIVING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- }
- OslMfree(tmp_buff);
- mmi_email_util_update_status_icon();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_new_msgs_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_NEW_MSGS_IND.
- * Update display buffer of progressing screen.
- * Result screen is displayed in this function.
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_new_msgs_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FuncPtr back_func;
- mmi_email_new_msgs_ind_struct *msgRsp = (mmi_email_new_msgs_ind_struct*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* update number of received mails regardless result is successful or not
- because some mails may be received though some error happens */
- email_p->snr_info.num_recv = msgRsp->num_new_mails;
- email_p->snr_info.num_to_be_recv = msgRsp->total_mails + msgRsp->num_exceeded_mails;
- /* email_p->main_info.unread_mails += msgRsp->num_new_mails; */
- mmi_email_util_update_status_icon();
- mmi_email_main_update_hint(MMI_EMAIL_INBOX);
- if (msgRsp->result != MMI_TRUE)
- {
- email_p->snr_info.recv_err_str = mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major);
- }
- /* list folder is required if list folder is not executed yet or number of emails is changed */
- if (email_p->fldr_info.fldr_update_state == EMAIL_LIST_FLDR_REQUIRED ||
- email_p->snr_info.num_recv > 0 || email_p->snr_info.num_sent > 0)
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- }
- else
- {
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
- email_p->fldr_info.need_fldr_sel = FALSE;
- }
- AlmEnableExpiryHandler();
- TurnOnBacklight(1);
- email_p->snr_info.snr_state = EMAIL_SNR_IDLE;
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- if (email_p->snr_info.is_auto_chk == TRUE)
- {
- email_p->snr_info.is_auto_chk = FALSE;
- /* it's not in email application */
- if (email_p->main_info.stop_cause != EMAIL_MODULE_ACTIVE_NOW)
- {
- /* Disable auto check popup */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- return;
- }
- back_func = mmi_email_auto_chk_go_back;
- }
- else
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */
- back_func = mmi_email_snr_back_to_main;
- if ((email_p->main_info.is_mem_full) && (!email_p->snr_info.recv_err_str))
- {
- email_p->snr_info.recv_err_str = STR_EMAIL_MEMORY_FULL_ID;
- }
- /* directly display detail result screen */
- #if 0
- /* under construction !*/
- /* under construction !*/
- #endif
- mmi_email_entry_snr_detail();
- }
- #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_auto_chk_ind
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_AUTOCHECK_EXPIRY_IND.
- * PARAMETERS
- * inMsg [IN] Message struct to store data
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_auto_chk_ind(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G9_EMAIL, MMI_EMAIL_PS_AUTOCHECK_EXPIRY_IND, email_p->main_info.stop_cause));
- /* TurnOnBacklight(TRUE); */
- /* reset context */
- memset(&email_p->snr_info, 0, sizeof(mmi_email_snr_info_struct));
- if (email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
- {
- /* get curr scren id, to back to */
- U16 activeScrnId = GetExitScrnID();
- if ((activeScrnId != SCR_ID_EMAIL_PROGRESS) && (!mmi_email_util_is_call_interrupt_allow()))
- {
- email_p->snr_info.auto_chk_scr = activeScrnId;
- }
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- email_p->snr_info.snr_state = EMAIL_SNR_CONN_SMTP;
- mmi_email_pre_entry_progressing(
- STR_EMAIL_CONNECTING_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_CONNECTING_TO_OUTGOING_SERVER_ID),
- (U8*) NULL,
- IMG_EMAIL_CONNECTING_ID,
- NULL,
- mmi_email_snr_abort,
- mmi_email_ps_abort_req,
- 0);
- AlmDisableExpiryHandler();
- if (mmi_email_util_is_call_interrupt_allow())
- {
- mmi_email_util_set_insert_history_flag(TRUE);
- mmi_email_exit_progressing();
- }
- }
- else
- {
- email_p->snr_info.auto_chk_scr = 0;
- /* Disable auto check popup */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- }
- email_p->snr_info.is_auto_chk = TRUE;
- }
- #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */
- #define SEND_SAVE_PS_EMAIL
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_send_only_req
- * DESCRIPTION
- * Send MSG_ID_MMI_EMAIL_SEND_ONLY_REQ to PS
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_send_only_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 result;
- mmi_email_send_only_req_struct *msgReq;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* chekc email address */
- if (!mmi_email_comp_is_addr_present())
- {
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_ERROR_CODE_INVALID_EMAIL_ADDR_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- return;
- }
- /* construct email */
- msgReq = (mmi_email_send_only_req_struct*) OslConstructDataPtr(sizeof(mmi_email_send_only_req_struct));
- memset(&msgReq->email_msg, 0, sizeof(email_msg_info_struct));
- if ((result = mmi_email_util_fill_msg_struct(&msgReq->email_msg)) != FS_NO_ERROR)
- {
- OslMfree(msgReq);
- DisplayPopup(
- (U8*) GetString(GetFileSystemErrorString(result)),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) WARNING_TONE);
- DeleteUptoScrID(SCR_ID_EMAIL_COMP_OPT);
- return;
- }
- mmi_email_pre_entry_progressing(
- STR_EMAIL_MAIN_ID,
- GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) GetString(STR_EMAIL_SENDING_ID),
- (U8*) NULL,
- IMG_EMAIL_SENDING_ID,
- NULL,
- mmi_email_ps_abort_req,
- mmi_email_ps_abort_req,
- 0);
- AlmDisableExpiryHandler();
- mmi_email_ps_send_msg(PRT_MMI_EMAIL_SEND_ONLY_REQ, msgReq, NULL);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_email_ps_send_only_rsp
- * DESCRIPTION
- * Handler of MSG_ID_MMI_EMAIL_SEND_ONLY_RSP message
- * PARAMETERS
- * inMsg [IN] Struct variable of response message.
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_email_ps_send_only_rsp(void *inMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_email_send_only_rsp_struct *msgRsp = (mmi_email_send_only_rsp_struct*) inMsg;
- U8 keep_in_opt = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- TurnOnBacklight(1);
- email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
- email_p->fldr_info.need_fldr_sel = TRUE;
- if (msgRsp->result == MMI_TRUE)
- {
- mmi_email_comp_reset_member();
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_COMMON_SENT_ID),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- (U8) SUCCESS_TONE);
- DeleteBetweenScreen(mmi_email_fldr_get_start_scr(), SCR_ID_EMAIL_PROGRESS);
- }
- else
- {
- U16 startScrnId;
- if (!msgRsp->is_sent && msgRsp->is_saved)
- {
- /* send failed, save successfully, go back to main menu */
- mmi_email_comp_reset_member();
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_SEND_FAILED_SAVE_SUCCESS_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- DeleteBetweenScreen(mmi_email_fldr_get_start_scr(), SCR_ID_EMAIL_PROGRESS);
- }
- else if (!msgRsp->is_sent && !msgRsp->is_saved)
- {
- /* send and save falied, go back to option menu */
- S32 i, j;
- DisplayPopup(
- (U8*) GetString(STR_EMAIL_SEND_FAILED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &startScrnId);
- DeleteBetweenScreen(startScrnId, SCR_ID_EMAIL_PROGRESS);
- /* rollback attachment file */
- for (i = 0, j = 1; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
- {
- if (email_p->comp_info.attch_list[i].attch_present)
- {
- mmi_email_util_rename_after_abort((U8) j, (S8*) email_p->comp_info.attch_list[i].file_path);
- j++;
- }
- }
- keep_in_opt = TRUE;
- }
- else
- {
- /* other cases, go back to option menu */
- DisplayPopup(
- (U8*) GetString(mmi_email_util_get_err_code(msgRsp->minor, msgRsp->major)),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- GetNextScrnIdOf(SCR_ID_EMAIL_COMP_OPT, &startScrnId);
- DeleteBetweenScreen(startScrnId, SCR_ID_EMAIL_PROGRESS);
- }
- }
- if ((email_p->main_info.entry_src == EMAIL_FROM_APP) && (keep_in_opt == FALSE))
- {
- mmi_email_main_quit_to_app();
- }
- AlmEnableExpiryHandler();