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

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.  * EmailAppUIInterface.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements UI interface of Email application.
  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.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  *------------------------------------------------------------------------------
  240.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  241.  *============================================================================
  242.  ****************************************************************************/
  243. /**
  244.  * Copyright Notice
  245.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  246.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  247.  *  (It is illegal to remove this copyright notice from this software or any
  248.  *  portion of it)
  249.  */
  250. /**************************************************************
  251.    FILENAME : EmailAppUIInterface.c
  252.    PURPOSE     : nil
  253.    REMARKS     : nil
  254.    AUTHOR      : Magesh k
  255.    DATE     : 30-01-2004
  256. **************************************************************/
  257. #ifndef _MMI_EMAILAPPUIINTERFACE_C
  258. #define _MMI_EMAILAPPUIINTERFACE_C
  259. #include "MMI_features.h"
  260. #ifdef __MMI_EMAIL__
  261. #include "stdC.h"
  262. #include "L4Dr1.h"
  263. #include "FileSystemDef.h"
  264. #include "FileMgr.h"
  265. #include "FileManagerGprot.h"
  266. #include "mdi_datatype.h"
  267. #include "mdi_audio.h"
  268. /* micha1230 */
  269. #include "custom_nvram_editor_data_item.h"
  270. #include "custom_data_account.h"
  271. #include "EmailAppProt.h"
  272. #include "EmailAppGProt.h"
  273. #include "MessagesExDcl.h"
  274. #include "MessagesResourceData.h"
  275. #include "KeyBrd.h"
  276. #include "GlobalDefs.h"
  277. #include "DebugInitDef.h"
  278. #include "GlobalConstants.h"
  279. #include "FrameworkStruct.h"
  280. #include "EventsGprot.h"
  281. #include "HistoryGprot.h"
  282. #include "wgui_ems.h"
  283. #include "wgui_categories_ems.h"//062706 revise
  284. #include "wgui_categories.h"
  285. #include "wgui_status_icons.h"
  286. #include "CommonScreens.h"
  287. #include "CustDataRes.h"
  288. #include "SettingProfile.h"
  289. #include "ProfileGprots.h"
  290. #include "PhoneBookGprot.h"
  291. #include "TimerEvents.h"
  292. #include "PhoneBookDef.h"
  293. #include "FileSystemDef.h"
  294. #include "FileSystemGProt.h"
  295. #include "Conversions.h"
  296. #include "app_mine.h"
  297. #include "MemPoolContainerProt.h"
  298. #include "wgui_asyncdynamic_menuitems.h"
  299. #include "Wgui_categories_inputs.h"
  300. #include "Wgui_categories_defs.h"
  301. #include "wgui_categories_email.h"
  302. #include "GlobalScrEnum.h"
  303. #include "Gdi_include.h"
  304. #include "Wgui_categories_multimedia.h"
  305. #include "Wgui_categories_popup.h"
  306. #include "AudioPlayerProt.h"
  307. #include "VdoPlyGProt.h"
  308. #include "CallManagementGprot.h"
  309. #include "mmi_trc.h"    /* debug info */
  310. #include "CommonScreens.h"
  311. #include "fmt_struct.h"
  312. #ifdef __MMI_TOUCH_SCREEN__
  313. #include "gui_virtual_keyboard.h"
  314. #include "EditorPen.h"
  315. #endif
  316. #ifdef __USB_IN_NORMAL_MODE__
  317. #include "USBDeviceGprot.h"
  318. #endif 
  319. extern void set_leading_zero(U8 u8type);
  320. extern void Category53ChangeItemDescription(S32 index, U8 *text);
  321. /***************************************************************/
  322. const U8 g_email_re_str[] = { 'R', '', 'e', '', ':', '', ' ', '', '', '' };
  323. const U8 g_email_fw_str[] = { 'F', '', 'w', '', ':', '', ' ', '', '', '' };
  324. const U8 g_email_subj_left_op[] = { '<', '', '', '' };
  325. const U8 g_email_subj_right_op[] = { '>', '', '', '' };
  326. const U8 g_email_3dots[] = { '.', '', '.', '', '.', '', '', '' };
  327. const S8 g_email_new_line[] = { 'n', '', '', '' };
  328. #ifdef __MMI_TOUCH_SCREEN__
  329. gui_virtual_keyboard_pen_enum g_email_disable_new_line[] = {GUI_VKBD_PEN_NEWLINE, GUI_VKBD_PEN_NONE};
  330. #endif
  331. extern InlineItem wgui_inline_items[];
  332. #define INIT_EMAIL
  333. /*****************************************************************************
  334.  * FUNCTION
  335.  *  mmi_email_init_hilite_hdlr
  336.  * DESCRIPTION
  337.  *  Initialize all highlight handlers
  338.  * PARAMETERS
  339.  *  void
  340.  * RETURNS
  341.  *  void
  342.  *****************************************************************************/
  343. void mmi_email_init_hilite_hdlr(void)
  344. {
  345.     /*----------------------------------------------------------------*/
  346.     /* Local Variables                                                */
  347.     /*----------------------------------------------------------------*/
  348.     /*----------------------------------------------------------------*/
  349.     /* Code Body                                                      */
  350.     /*----------------------------------------------------------------*/
  351.     /* Wrirte Email */
  352.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_ADD, mmi_email_hilite_comp_addr_add);
  353.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_EDIT, mmi_email_hilite_comp_addr_edit);
  354.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_DEL, mmi_email_hilite_comp_addr_del);
  355.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_DEL_ALL, mmi_email_hilite_comp_addr_del_all);
  356.     SetHiliteHandler(MENU_ID_EMAIL_COMP_SUBJ_DONE, mmi_email_hilite_comp_subj_done);
  357.     SetHiliteHandler(MENU_ID_EMAIL_COMP_SUBJ_INPUT_METH, mmi_email_hilite_comp_subj_input_meth);
  358.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_EDIT_OPT_DONE, mmi_email_hilite_comp_addr_done);
  359.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ADDR_EDIT_OPT_INPUT_METH, mmi_email_hilite_comp_addr_input_meth);
  360.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ATTCH_EDIT, mmi_email_hilite_comp_attach_edit);
  361.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ATTCH_VIEW, mmi_email_hilite_comp_attach_view);
  362.     SetHiliteHandler(MENU_ID_EMAIL_COMP_ATTCH_DEL, mmi_email_hilite_comp_attach_del);
  363.     SetHiliteHandler(MENU_ID_EMAIL_COMP_SEND, mmi_email_hilite_comp_send);
  364.     SetHiliteHandler(MENU_ID_EMAIL_COMP_SAVE_N_SEND, mmi_email_hilite_comp_save_n_send);
  365.     SetHiliteHandler(MENU_ID_EMAIL_COMP_SAVE_TO_DRAFT, mmi_email_hilite_comp_save_to_draft);
  366.     SetHiliteHandler(MENU_ID_EMAIL_COMP_QUIT_NO_SAVE, mmi_email_hilite_comp_quit);
  367.     /* Inbox */
  368.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_ADDR_OPT_SAVE, mmi_email_hilite_read_addr_save_phb);
  369.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_ADDR_OPT_SEND, mmi_email_hilite_read_addr_send);
  370.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_ATTCH_OPT_VIEW, mmi_email_hilite_read_attach_view);
  371.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_ATTCH_OPT_SAVE, mmi_email_hilite_read_attach_save);
  372.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_READ_ATTCH_SAVE_DONE, mmi_email_hilite_read_attach_save_done);
  373.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_READ_ATTCH_SAVE_INPUT_METH, mmi_email_hilite_read_attach_save_input_meth);
  374.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_REPLY, mmi_email_hilite_read_reply);
  375.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_REPLY_WITHOUT, mmi_email_hilite_read_reply_without);
  376.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_REPLY_ALL, mmi_email_hilite_read_reply_all);
  377.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_REPLY_ALL_WITHOUT, mmi_email_hilite_read_reply_all_without);
  378.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_FW, mmi_email_hilite_read_forward);
  379.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_DEL, mmi_email_hilite_fldr_msg_del);
  380. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  381.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_READ, mmi_email_hilite_inbox_read);
  382.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_NEXT_PAGE, mmi_email_hilite_fldr_next_page);
  383.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_PREV_PAGE, mmi_email_hilite_fldr_prev_page);
  384.     SetHiliteHandler(MENU_ID_EMAIL_INBOX_OPT_JUMP_PAGE, mmi_email_hilite_fldr_jump_to_page);
  385. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  386.     /* Sent */
  387.     SetHiliteHandler(MENU_ID_EMAIL_SENT_OPT_FW, mmi_email_hilite_sent_forward);
  388.     SetHiliteHandler(MENU_ID_EMAIL_SENT_OPT_DEL, mmi_email_hilite_fldr_msg_del);
  389. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  390.     SetHiliteHandler(MENU_ID_EMAIL_SENT_OPT_NEXT_PAGE, mmi_email_hilite_fldr_next_page);
  391.     SetHiliteHandler(MENU_ID_EMAIL_SENT_OPT_PREV_PAGE, mmi_email_hilite_fldr_prev_page);
  392.     SetHiliteHandler(MENU_ID_EMAIL_SENT_OPT_JUMP_PAGE, mmi_email_hilite_fldr_jump_to_page);
  393. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  394.     /* Unsent */
  395.     SetHiliteHandler(MENU_ID_EMAIL_UNSENT_OPT_SEND, mmi_email_hilite_unsent_send);
  396.     SetHiliteHandler(MENU_ID_EMAIL_UNSENT_OPT_SAVE_N_SEND, mmi_email_hilite_unsent_save_n_send);
  397.     SetHiliteHandler(MENU_ID_EMAIL_UNSENT_OPT_EDIT, mmi_email_hilite_unsent_edit);
  398.     SetHiliteHandler(MENU_ID_EMAIL_UNSENT_OPT_MOVE, mmi_email_hilite_unsent_move);
  399.     SetHiliteHandler(MENU_ID_EMAIL_UNSENT_OPT_DEL, mmi_email_hilite_fldr_msg_del);
  400.     /* Draft */
  401.     SetHiliteHandler(MENU_ID_EMAIL_DRAFT_OPT_EDIT, mmi_email_hilite_draft_edit);
  402.     SetHiliteHandler(MENU_ID_EMAIL_DRAFT_OPT_DEL, mmi_email_hilite_fldr_msg_del);
  403. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  404.     SetHiliteHandler(MENU_ID_EMAIL_DRAFT_OPT_NEXT_PAGE, mmi_email_hilite_fldr_next_page);
  405.     SetHiliteHandler(MENU_ID_EMAIL_DRAFT_OPT_PREV_PAGE, mmi_email_hilite_fldr_prev_page);
  406.     SetHiliteHandler(MENU_ID_EMAIL_DRAFT_OPT_JUMP_PAGE, mmi_email_hilite_fldr_jump_to_page);
  407. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  408.     /* Profile */
  409.     SetHiliteHandler(MENU_ID_EMAIL_PROF_ACTIVATE, mmi_email_hilite_prof_activate);
  410.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDIT, mmi_email_hilite_prof_edit);
  411.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDIT_OPT_SETTING, mmi_email_hilite_prof_setting);
  412.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDIT_OPT_SMTP, mmi_email_hilite_prof_smtp);
  413.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDIT_OPT_POP3_IMAP4, mmi_email_hilite_prof_pop3_impa4);
  414.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDIT_OPT_SIG, mmi_email_hilite_prof_sig);
  415. #ifdef __MMI_GPRS_FEATURES__
  416.     SetHiliteHandler(MENU_ID_EMAIL_PROF_DATA_ACCT_OPT_GPRS, mmi_email_hilite_prof_gprs);
  417.     SetHiliteHandler(MENU_ID_EMAIL_PROF_DATA_ACCT_OPT_GSM, mmi_email_hilite_prof_csd);
  418. #endif /* __MMI_GPRS_FEATURES__ */ 
  419.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDITOR_OPT_DONE, mmi_email_hilite_prof_done);
  420.     SetHiliteHandler(MENU_ID_EMAIL_PROF_EDITOR_OPT_INPUT_METH, mmi_email_hilite_prof_input_meth);
  421.     /* Signature */
  422.     SetHiliteHandler(MENU_ID_EMAIL_SIG_ATTCH_OPT_VIEW, mmi_email_hilite_prof_sig_view);
  423.     SetHiliteHandler(MENU_ID_EMAIL_SIG_ATTCH_OPT_SEL, mmi_email_hilite_prof_sig_select);
  424.     SetHiliteHandler(MENU_ID_EMAIL_SIG_ATTCH_OPT_DEL, mmi_email_hilite_prof_sig_del);
  425. }
  426. /*****************************************************************************
  427.  * FUNCTION
  428.  *  mmi_email_highlight_main_menu
  429.  * DESCRIPTION
  430.  *  Highlight handler of Email menu in Mesaage screen.
  431.  * PARAMETERS
  432.  *  void
  433.  * RETURNS
  434.  *  void
  435.  *****************************************************************************/
  436. void mmi_email_highlight_main_menu(void)
  437. {
  438.     /*----------------------------------------------------------------*/
  439.     /* Local Variables                                                */
  440.     /*----------------------------------------------------------------*/
  441.     /*----------------------------------------------------------------*/
  442.     /* Code Body                                                      */
  443.     /*----------------------------------------------------------------*/
  444.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  445.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  446.     SetLeftSoftkeyFunction(mmi_email_main_pre_entry, KEY_EVENT_UP);
  447.     SetKeyHandler(mmi_email_main_pre_entry, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  448.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  449.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  450. }
  451. /*****************************************************************************
  452.  * FUNCTION
  453.  *  mmi_email_hilite_snr
  454.  * DESCRIPTION
  455.  *  Highlight handler of Send And Receive option
  456.  * PARAMETERS
  457.  *  void
  458.  * RETURNS
  459.  *  void
  460.  *****************************************************************************/
  461. void mmi_email_hilite_snr(void)
  462. {
  463.     /*----------------------------------------------------------------*/
  464.     /* Local Variables                                                */
  465.     /*----------------------------------------------------------------*/
  466.     /*----------------------------------------------------------------*/
  467.     /* Code Body                                                      */
  468.     /*----------------------------------------------------------------*/
  469.     email_p->main_info.curr_menu = MMI_EMAIL_SNR;
  470.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  mmi_email_hilite_comp
  475.  * DESCRIPTION
  476.  *  Highlight handler of Write Email option
  477.  * PARAMETERS
  478.  *  void
  479.  * RETURNS
  480.  *  void
  481.  *****************************************************************************/
  482. void mmi_email_hilite_comp(void)
  483. {
  484.     /*----------------------------------------------------------------*/
  485.     /* Local Variables                                                */
  486.     /*----------------------------------------------------------------*/
  487.     /*----------------------------------------------------------------*/
  488.     /* Code Body                                                      */
  489.     /*----------------------------------------------------------------*/
  490.     email_p->main_info.curr_menu = MMI_EMAIL_COMP;
  491.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  492.     SetKeyHandler(mmi_email_main_exec_lsk, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  493. }
  494. /*****************************************************************************
  495.  * FUNCTION
  496.  *  mmi_email_hilite_inbox
  497.  * DESCRIPTION
  498.  *  Highlight handler of Inbox option
  499.  * PARAMETERS
  500.  *  void
  501.  * RETURNS
  502.  *  void
  503.  *****************************************************************************/
  504. void mmi_email_hilite_inbox(void)
  505. {
  506.     /*----------------------------------------------------------------*/
  507.     /* Local Variables                                                */
  508.     /*----------------------------------------------------------------*/
  509.     /*----------------------------------------------------------------*/
  510.     /* Code Body                                                      */
  511.     /*----------------------------------------------------------------*/
  512.     email_p->main_info.curr_menu = MMI_EMAIL_INBOX;
  513.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  514. }
  515. /*****************************************************************************
  516.  * FUNCTION
  517.  *  mmi_email_hilite_sent
  518.  * DESCRIPTION
  519.  *  Highlight handler of Sent option
  520.  * PARAMETERS
  521.  *  void
  522.  * RETURNS
  523.  *  void
  524.  *****************************************************************************/
  525. void mmi_email_hilite_sent(void)
  526. {
  527.     /*----------------------------------------------------------------*/
  528.     /* Local Variables                                                */
  529.     /*----------------------------------------------------------------*/
  530.     /*----------------------------------------------------------------*/
  531.     /* Code Body                                                      */
  532.     /*----------------------------------------------------------------*/
  533.     email_p->main_info.curr_menu = MMI_EMAIL_SENT;
  534.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  535. }
  536. /*****************************************************************************
  537.  * FUNCTION
  538.  *  mmi_email_hilite_unsent
  539.  * DESCRIPTION
  540.  *  Highlight handler of Unsent option
  541.  * PARAMETERS
  542.  *  void
  543.  * RETURNS
  544.  *  void
  545.  *****************************************************************************/
  546. void mmi_email_hilite_unsent(void)
  547. {
  548.     /*----------------------------------------------------------------*/
  549.     /* Local Variables                                                */
  550.     /*----------------------------------------------------------------*/
  551.     /*----------------------------------------------------------------*/
  552.     /* Code Body                                                      */
  553.     /*----------------------------------------------------------------*/
  554.     email_p->main_info.curr_menu = MMI_EMAIL_UNSENT;
  555.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  556. }
  557. /*****************************************************************************
  558.  * FUNCTION
  559.  *  mmi_email_hilite_draft
  560.  * DESCRIPTION
  561.  *  Highlight handler of Draft option
  562.  * PARAMETERS
  563.  *  void
  564.  * RETURNS
  565.  *  void
  566.  *****************************************************************************/
  567. void mmi_email_hilite_draft(void)
  568. {
  569.     /*----------------------------------------------------------------*/
  570.     /* Local Variables                                                */
  571.     /*----------------------------------------------------------------*/
  572.     /*----------------------------------------------------------------*/
  573.     /* Code Body                                                      */
  574.     /*----------------------------------------------------------------*/
  575.     email_p->main_info.curr_menu = MMI_EMAIL_DRAFT;
  576.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  577. }
  578. /*****************************************************************************
  579.  * FUNCTION
  580.  *  mmi_email_hilite_del_all
  581.  * DESCRIPTION
  582.  *  Highlight handler of Delete All option
  583.  * PARAMETERS
  584.  *  void
  585.  * RETURNS
  586.  *  void
  587.  *****************************************************************************/
  588. void mmi_email_hilite_del_all(void)
  589. {
  590.     /*----------------------------------------------------------------*/
  591.     /* Local Variables                                                */
  592.     /*----------------------------------------------------------------*/
  593.     /*----------------------------------------------------------------*/
  594.     /* Code Body                                                      */
  595.     /*----------------------------------------------------------------*/
  596.     email_p->main_info.curr_menu = MMI_EMAIL_DEL_ALL;
  597.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  598. }
  599. /*****************************************************************************
  600.  * FUNCTION
  601.  *  mmi_email_hilite_prof
  602.  * DESCRIPTION
  603.  *  Highlight handler of Profile option
  604.  * PARAMETERS
  605.  *  void
  606.  * RETURNS
  607.  *  void
  608.  *****************************************************************************/
  609. void mmi_email_hilite_prof(void)
  610. {
  611.     /*----------------------------------------------------------------*/
  612.     /* Local Variables                                                */
  613.     /*----------------------------------------------------------------*/
  614.     /*----------------------------------------------------------------*/
  615.     /* Code Body                                                      */
  616.     /*----------------------------------------------------------------*/
  617.     email_p->main_info.curr_menu = MMI_EMAIL_PROF;
  618.     SetLeftSoftkeyFunction(mmi_email_ps_list_acct_profile_req, KEY_EVENT_UP);
  619.     SetKeyHandler(mmi_email_ps_list_acct_profile_req, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  620. }
  621. /*****************************************************************************
  622.  * FUNCTION
  623.  *  mmi_email_hilite_refresh
  624.  * DESCRIPTION
  625.  *  Highlight handler of Refresh option
  626.  * PARAMETERS
  627.  *  void
  628.  * RETURNS
  629.  *  void
  630.  *****************************************************************************/
  631. void mmi_email_hilite_refresh(void)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     /*----------------------------------------------------------------*/
  637.     /* Code Body                                                      */
  638.     /*----------------------------------------------------------------*/
  639.     email_p->main_info.curr_menu = MMI_EMAIL_REFRESH;
  640.     SetLeftSoftkeyFunction(mmi_email_main_exec_lsk, KEY_EVENT_UP);
  641. }
  642. #define MAIN_MENU_EMAIL
  643. /*****************************************************************************
  644.  * FUNCTION
  645.  *  mmi_email_main_pre_entry
  646.  * DESCRIPTION
  647.  *  Pre-entry function of Email application.
  648.  * PARAMETERS
  649.  *  void
  650.  * RETURNS
  651.  *  void
  652.  *****************************************************************************/
  653. void mmi_email_main_pre_entry(void)
  654. {
  655.     /*----------------------------------------------------------------*/
  656.     /* Local Variables                                                */
  657.     /*----------------------------------------------------------------*/
  658.     /*----------------------------------------------------------------*/
  659.     /* Code Body                                                      */
  660.     /*----------------------------------------------------------------*/
  661.     if ((email_p->main_info.ready_state & EMAIL_READY) == EMAIL_READY)
  662.     {
  663.     #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  664.         if (email_p->snr_info.is_auto_chk)
  665.         {
  666.             DisplayPopup(
  667.                 (U8*) GetString(STR_EMAIL_AUTO_CHECK_BUSY_ID),
  668.                 IMG_GLOBAL_WARNING,
  669.                 1,
  670.                 UI_POPUP_NOTIFYDURATION_TIME,
  671.                 (U8) WARNING_TONE);
  672.         }
  673.         else
  674.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  675.         {
  676.             /* set curr folder and folder info req state  */
  677.             email_p->main_info.curr_menu = MMI_EMAIL_NONE;
  678.             email_p->main_info.main_indx = 0;
  679.             /* if profile is not ready, then don't allow user to connet network */
  680.             mmi_email_fldr_reset_cntx(EMAIL_RESET_ALL_FLDR);
  681.             if (mmi_email_prof_is_activated())
  682.             {
  683.                 email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  684.                 /* check for imap4/pop3 */
  685.             #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  686.                 if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4)
  687.                 {
  688.                     mmi_email_display_confirm(
  689.                         STR_EMAIL_COMMON_CONNECT_NETWORK_ID,
  690.                         mmi_email_main_imap4_confirm_yes,
  691.                         mmi_email_main_no_list_fldr);
  692.                 }
  693.                 else
  694.             #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  695.                     mmi_email_main_start();
  696.             }
  697.             else
  698.             {
  699.                 /* regarded as enter email without list folder req */
  700.                 mmi_email_main_no_list_fldr();
  701.             }
  702.         }
  703.     }
  704.     else    /* email application not ready */
  705.     {
  706.     #ifdef __USB_IN_NORMAL_MODE__
  707.         if (mmi_usb_is_in_mass_storage_mode())
  708.         {
  709.             mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
  710.         }
  711.         else
  712.     #endif /* __USB_IN_NORMAL_MODE__ */ 
  713.         {
  714.             DisplayPopup(
  715.                 (U8*) GetString(STR_EMAIL_NOT_READY_ID),
  716.                 IMG_GLOBAL_WARNING,
  717.                 1,
  718.                 UI_POPUP_NOTIFYDURATION_TIME,
  719.                 (U8) WARNING_TONE);
  720.         }
  721.     }
  722. }
  723. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  724. /*****************************************************************************
  725.  * FUNCTION
  726.  *  mmi_email_main_imap4_confirm_yes
  727.  * DESCRIPTION
  728.  *  Handler when the user selects "Yes" in IMAP4 confirmaion screen.
  729.  *  Enter Email main menu with list folder request.
  730.  * PARAMETERS
  731.  *  void
  732.  * RETURNS
  733.  *  void
  734.  *****************************************************************************/
  735. void mmi_email_main_imap4_confirm_yes(void)
  736. {
  737.     /*----------------------------------------------------------------*/
  738.     /* Local Variables                                                */
  739.     /*----------------------------------------------------------------*/
  740.     /*----------------------------------------------------------------*/
  741.     /* Code Body                                                      */
  742.     /*----------------------------------------------------------------*/
  743.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  744.     mmi_email_main_start();
  745. }
  746. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  747. /*****************************************************************************
  748.  * FUNCTION
  749.  *  mmi_email_main_no_list_fldr
  750.  * DESCRIPTION
  751.  *  Handler when the user selects "No" in IMAP4 confirmaion screen.
  752.  *  Enter Email main menu directly.
  753.  * PARAMETERS
  754.  *  void
  755.  * RETURNS
  756.  *  void
  757.  *****************************************************************************/
  758. void mmi_email_main_no_list_fldr(void)
  759. {
  760.     /*----------------------------------------------------------------*/
  761.     /* Local Variables                                                */
  762.     /*----------------------------------------------------------------*/
  763.     /*----------------------------------------------------------------*/
  764.     /* Code Body                                                      */
  765.     /*----------------------------------------------------------------*/
  766.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_REQUIRED;
  767.     mmi_email_main_start();
  768. }
  769. /*****************************************************************************
  770.  * FUNCTION
  771.  *  mmi_email_main_start
  772.  * DESCRIPTION
  773.  *  Send start request
  774.  * PARAMETERS
  775.  *  void
  776.  * RETURNS
  777.  *  void
  778.  *****************************************************************************/
  779. void mmi_email_main_start(void)
  780. {
  781.     /*----------------------------------------------------------------*/
  782.     /* Local Variables                                                */
  783.     /*----------------------------------------------------------------*/
  784.     /*----------------------------------------------------------------*/
  785.     /* Code Body                                                      */
  786.     /*----------------------------------------------------------------*/
  787.     email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_NORMAL;
  788.     mmi_email_ps_start_req();
  789. }
  790. /*****************************************************************************
  791.  * FUNCTION
  792.  *  mmi_email_main_back_from_history
  793.  * DESCRIPTION
  794.  *  Go back to Email main menu.
  795.  *  If folder information changed, send list folder request first,
  796.  *  otherwise, enter Email main menu.
  797.  * PARAMETERS
  798.  *  void
  799.  * RETURNS
  800.  *  void
  801.  *****************************************************************************/
  802. void mmi_email_main_back_from_history(void)
  803. {
  804.     /*----------------------------------------------------------------*/
  805.     /* Local Variables                                                */
  806.     /*----------------------------------------------------------------*/
  807.     /*----------------------------------------------------------------*/
  808.     /* Code Body                                                      */
  809.     /*----------------------------------------------------------------*/
  810.     /* update email main menu only when it is not in small screen redrawing process */
  811.     if ((email_p->fldr_info.fldr_update_state == EMAIL_LIST_FLDR_REQUIRED) && (is_redrawing_old_screens() == 0))
  812.     {
  813.         email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_BACK_MAIN;
  814.         mmi_email_ps_list_folders_req();
  815.     }
  816.     else
  817.     {
  818.         mmi_email_entry_main();
  819.     }
  820. }
  821. /*****************************************************************************
  822.  * FUNCTION
  823.  *  mmi_email_entry_main
  824.  * DESCRIPTION
  825.  *  Entry function of Email main menu
  826.  * PARAMETERS
  827.  *  void
  828.  * RETURNS
  829.  *  void
  830.  *****************************************************************************/
  831. void mmi_email_entry_main(void)
  832. {
  833.     /*----------------------------------------------------------------*/
  834.     /* Local Variables                                                */
  835.     /*----------------------------------------------------------------*/
  836.     U16 numItems = EMAIL_MAIN_MENU_TOTAL;
  837.     U16 itemIcons[EMAIL_MAIN_MENU_TOTAL];
  838.     U8 *nStrItemList[EMAIL_MAIN_MENU_TOTAL];
  839.     U8 *popUpList[EMAIL_MAIN_MENU_TOTAL];
  840.     U8 *guiBuffer;
  841.     /*----------------------------------------------------------------*/
  842.     /* Code Body                                                      */
  843.     /*----------------------------------------------------------------*/
  844.     /* to free container buffer when back from folder list to main menu */
  845.     mmi_email_util_free_container_pool();
  846.     EntryNewScreen(SCR_ID_EMAIL_MAIN, mmi_email_exit_main_menu, NULL, NULL);
  847.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_MAIN);
  848.     mmi_email_main_get_menu_detail(nStrItemList, itemIcons, popUpList);
  849.     RegisterHighlightHandler(mmi_email_hilite_main_menu_item);
  850.     /* hide refresh item */
  851. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  852.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3)
  853.     {
  854.         numItems--;
  855.     }
  856. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  857.     ShowCategory53Screen(
  858.         STR_EMAIL_MAIN_ID,
  859.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  860.         STR_GLOBAL_OK,
  861.         IMG_GLOBAL_OK,
  862.         STR_GLOBAL_BACK,
  863.         IMG_GLOBAL_BACK,
  864.         numItems,
  865.         (U8 **) nStrItemList,
  866.         (U16*) itemIcons,
  867.         (U8 **) popUpList,
  868.         0,
  869.         (S32) email_p->main_info.main_indx,
  870.         guiBuffer);
  871.     SetRightSoftkeyFunction(mmi_email_main_quit_email, KEY_EVENT_UP);
  872.     SetKeyHandler(mmi_email_main_quit_email, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  873.     SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_MAIN, (HistoryDelCBPtr) mmi_email_main_del_callback);
  874. }
  875. /*****************************************************************************
  876.  * FUNCTION
  877.  *  mmi_email_exit_main_menu
  878.  * DESCRIPTION
  879.  *  Exit function of Email main menu
  880.  * PARAMETERS
  881.  *  void
  882.  * RETURNS
  883.  *  void
  884.  *****************************************************************************/
  885. void mmi_email_exit_main_menu(void)
  886. {
  887.     /*----------------------------------------------------------------*/
  888.     /* Local Variables                                                */
  889.     /*----------------------------------------------------------------*/
  890.     /*----------------------------------------------------------------*/
  891.     /* Code Body                                                      */
  892.     /*----------------------------------------------------------------*/
  893.     mmi_email_util_add_history(SCR_ID_EMAIL_MAIN, mmi_email_main_back_from_history);
  894. }
  895. /*****************************************************************************
  896.  * FUNCTION
  897.  *  mmi_email_main_del_callback
  898.  * DESCRIPTION
  899.  *  Callback function when main menu is deleted.
  900.  * PARAMETERS
  901.  *  param       [IN]        Parameter from framework
  902.  * RETURNS
  903.  *  void
  904.  *****************************************************************************/
  905. U8 mmi_email_main_del_callback(void *param)
  906. {
  907.     /*----------------------------------------------------------------*/
  908.     /* Local Variables                                                */
  909.     /*----------------------------------------------------------------*/
  910.     /*----------------------------------------------------------------*/
  911.     /* Code Body                                                      */
  912.     /*----------------------------------------------------------------*/
  913.     if (param != (void*)MMI_TRUE)
  914.     {
  915.         /* do not send stop request if deinit request is sent */
  916.         if ((email_p->main_info.ready_state & EMAIL_PS_INIT_DONE) == EMAIL_PS_INIT_DONE &&
  917.             email_p->main_info.stop_cause == EMAIL_MODULE_ACTIVE_NOW)
  918.         {
  919.             email_p->main_info.stop_cause = EMAIL_STOP_BACK_FROM_OTHER;
  920.             mmi_email_comp_reset_member();  /* reset email compose buffer in case the attachment is not valid anymore */
  921.             mmi_email_ps_stop_req();
  922.         }
  923.     }
  924.     return FALSE;
  925. }
  926. /*****************************************************************************
  927.  * FUNCTION
  928.  *  mmi_email_main_exec_lsk
  929.  * DESCRIPTION
  930.  *  Execute selected item in Email menu menu.
  931.  * PARAMETERS
  932.  *  void
  933.  * RETURNS
  934.  *  void
  935.  *****************************************************************************/
  936. void mmi_email_main_exec_lsk(void)
  937. {
  938.     /*----------------------------------------------------------------*/
  939.     /* Local Variables                                                */
  940.     /*----------------------------------------------------------------*/
  941.     /*----------------------------------------------------------------*/
  942.     /* Code Body                                                      */
  943.     /*----------------------------------------------------------------*/
  944.     /* if not profile is not configured,  then user can't go enter any menu except profie */
  945.     if (mmi_email_prof_is_activated() == FALSE)
  946.     {
  947.         DisplayPopup(
  948.             (U8*) GetString(STR_EMAIL_ERROR_CODE_ACCT_NOT_CONFIG_ID),
  949.             IMG_GLOBAL_WARNING,
  950.             1,
  951.             UI_POPUP_NOTIFYDURATION_TIME,
  952.             (U8) WARNING_TONE);
  953.         return;
  954.     }
  955.     /* to reset highlight index of folder */
  956.     email_p->fldr_info.curr_mail_indx = 0;
  957.     /* execute curr folder lask handler */
  958.     switch (email_p->main_info.curr_menu)
  959.     {
  960.         case MMI_EMAIL_SNR:
  961.             mmi_email_ps_snr_req();
  962.             break;
  963.         case MMI_EMAIL_COMP:
  964.             mmi_email_comp_pre_entry();
  965.             break;
  966.         case MMI_EMAIL_INBOX:
  967.             mmi_email_inbox_pre_entry();
  968.             break;
  969.         case MMI_EMAIL_SENT:
  970.         case MMI_EMAIL_UNSENT:
  971.         case MMI_EMAIL_DRAFT:
  972.             mmi_email_fldr_pre_entry();
  973.             break;
  974.         case MMI_EMAIL_DEL_ALL:
  975.             email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_DEL_ALL;
  976.             mmi_email_ps_list_folders_req();
  977.             break;
  978.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  979.         case MMI_EMAIL_REFRESH:
  980.             email_p->fldr_info.list_fldr_cause = EMAIL_LIST_FLDR_REFRESH;
  981.             mmi_email_ps_list_folders_req();
  982.             break;
  983.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  984.     }
  985. }
  986. /*****************************************************************************
  987.  * FUNCTION
  988.  *  mmi_email_main_get_menu_detail
  989.  * DESCRIPTION
  990.  *  Get detailed information to display Email main menu.
  991.  * PARAMETERS
  992.  *  strList             [IN]            
  993.  *  iconList            [?]             
  994.  *  hintList            [IN]            
  995.  *  popUpList(?)        [IN/OUT]        Hint list of menu items
  996.  *  itemIcons(?)        [IN/OUT]        Icon list of menu items
  997.  *  nStrItemList(?)     [IN/OUT]        String list of menu items
  998.  * RETURNS
  999.  *  void
  1000.  *****************************************************************************/
  1001. void mmi_email_main_get_menu_detail(U8 **strList, U16 *iconList, U8 **hintList)
  1002. {
  1003.     /*----------------------------------------------------------------*/
  1004.     /* Local Variables                                                */
  1005.     /*----------------------------------------------------------------*/
  1006.     S32 i;
  1007.     /*----------------------------------------------------------------*/
  1008.     /* Code Body                                                      */
  1009.     /*----------------------------------------------------------------*/
  1010.     /* initialization */
  1011.     for (i = 0; i < EMAIL_MAIN_MENU_TOTAL; i++)
  1012.     {
  1013.         strList[i] = (U8*) GetString((U16) (STR_EMAIL_SEND_AND_RECEIVE_ID + i));
  1014.         iconList[i] = IMG_EMAIL_SEND_AND_RECEIVE_ID + i;
  1015.         hintList[i] = NULL;
  1016.     }
  1017. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1018.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4)
  1019.     {
  1020.         /* sent folder */
  1021.         if (pfnUnicodeStrlen((S8*) email_p->prof_info.act_prof.sent_name))
  1022.         {
  1023.             strList[EMAIL_SENT_ENUM] = (U8*) email_p->prof_info.act_prof.sent_name;
  1024.         }
  1025.         /* draft folder */
  1026.         if (pfnUnicodeStrlen((S8*) email_p->prof_info.act_prof.draft_name))
  1027.         {
  1028.             strList[EMAIL_DRAFT_ENUM] = (U8*) email_p->prof_info.act_prof.draft_name;
  1029.         }
  1030.     }
  1031. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1032.     hintList[EMAIL_INBOX_ENUM] = mmi_email_util_get_fldr_hint_value(EMAIL_DEL_ALL_INBOX_ENUM, MMI_EMAIL_INBOX);
  1033.     hintList[EMAIL_SENT_ENUM] = mmi_email_util_get_fldr_hint_value(EMAIL_DEL_ALL_SENT_ENUM, MMI_EMAIL_SENT);
  1034.     hintList[EMAIL_UNSENT_ENUM] = mmi_email_util_get_fldr_hint_value(EMAIL_DEL_ALL_UNSENT_ENUM, MMI_EMAIL_UNSENT);
  1035.     hintList[EMAIL_DRAFT_ENUM] = mmi_email_util_get_fldr_hint_value(EMAIL_DEL_ALL_DRAFT_ENUM, MMI_EMAIL_DRAFT);
  1036. }
  1037. /*****************************************************************************
  1038.  * FUNCTION
  1039.  *  mmi_email_main_update_hint
  1040.  * DESCRIPTION
  1041.  *  Update hint value of a folder.
  1042.  * PARAMETERS
  1043.  *  fldr_name       [IN]        
  1044.  * RETURNS
  1045.  *  void
  1046.  *****************************************************************************/
  1047. void mmi_email_main_update_hint(S8 fldr_name)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     if (GetExitScrnID() == SCR_ID_EMAIL_MAIN)
  1056.     {
  1057.         S32 index = 0;
  1058.         switch (fldr_name)
  1059.         {
  1060.             case MMI_EMAIL_INBOX:
  1061.                 index = EMAIL_INBOX_ENUM;
  1062.                 break;
  1063.             case MMI_EMAIL_UNSENT:
  1064.                 index = EMAIL_UNSENT_ENUM;
  1065.                 break;
  1066.             case MMI_EMAIL_SENT:
  1067.                 index = EMAIL_SENT_ENUM;
  1068.                 break;
  1069.             case MMI_EMAIL_DRAFT:
  1070.                 index = EMAIL_DRAFT_ENUM;
  1071.                 break;
  1072.         }
  1073.         mmi_email_util_get_fldr_hint_value((U16) index, fldr_name);
  1074.         Category53ChangeItemDescription(index, hintData[index]);
  1075.         RedrawCategoryFunction();
  1076.     }
  1077. }
  1078. /*****************************************************************************
  1079.  * FUNCTION
  1080.  *  mmi_email_hilite_main_menu_item
  1081.  * DESCRIPTION
  1082.  *  Highlight handler of main menu items
  1083.  * PARAMETERS
  1084.  *  index       [IN]        
  1085.  * RETURNS
  1086.  *  void
  1087.  *****************************************************************************/
  1088. void mmi_email_hilite_main_menu_item(S32 index)
  1089. {
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Local Variables                                                */
  1092.     /*----------------------------------------------------------------*/
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Code Body                                                      */
  1095.     /*----------------------------------------------------------------*/
  1096.     email_p->main_info.main_indx = (U8) index;
  1097.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1098.     switch (index)
  1099.     {
  1100.         case EMAIL_SEND_AND_RECEIVE_ENUM:
  1101.             mmi_email_hilite_snr();
  1102.             break;
  1103.         case EMAIL_WRITE_EMAIL_ENUM:
  1104.             mmi_email_hilite_comp();
  1105.             break;
  1106.         case EMAIL_INBOX_ENUM:
  1107.             mmi_email_hilite_inbox();
  1108.             break;
  1109.         case EMAIL_SENT_ENUM:
  1110.             mmi_email_hilite_sent();
  1111.             break;
  1112.         case EMAIL_UNSENT_ENUM:
  1113.             mmi_email_hilite_unsent();
  1114.             break;
  1115.         case EMAIL_DRAFT_ENUM:
  1116.             mmi_email_hilite_draft();
  1117.             break;
  1118.         case EMAIL_DELETE_ALL_ENUM:
  1119.             mmi_email_hilite_del_all();
  1120.             break;
  1121.         case EMAIL_EMAIL_PROFILE_ENUM:
  1122.             mmi_email_hilite_prof();
  1123.             break;
  1124.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1125.         case EMAIL_REFRESH_ENUM:
  1126.             mmi_email_hilite_refresh();
  1127.             break;
  1128.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1129.     }
  1130. }
  1131. /*****************************************************************************
  1132.  * FUNCTION
  1133.  *  mmi_email_main_goto_idle
  1134.  * DESCRIPTION
  1135.  *  Stop email application and go to idle screen.
  1136.  * PARAMETERS
  1137.  *  void
  1138.  * RETURNS
  1139.  *  void
  1140.  *****************************************************************************/
  1141. void mmi_email_main_goto_idle(void)
  1142. {
  1143.     /*----------------------------------------------------------------*/
  1144.     /* Local Variables                                                */
  1145.     /*----------------------------------------------------------------*/
  1146.     /*----------------------------------------------------------------*/
  1147.     /* Code Body                                                      */
  1148.     /*----------------------------------------------------------------*/
  1149.     mmi_email_pre_entry_progressing(
  1150.         STR_EMAIL_MAIN_ID,
  1151.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1152.         0,
  1153.         0,
  1154.         0,
  1155.         0,
  1156.         (U8*) GetString(STR_EMAIL_COMMON_QUITING_ID),
  1157.         (U8*) NULL,
  1158.         IMG_EMAIL_CONNECTING_ID,
  1159.         NULL,
  1160.         NULL,
  1161.         NULL,
  1162.         0);
  1163.     email_p->main_info.stop_cause = EMAIL_STOP_GOTO_IDLE;
  1164.     mmi_email_ps_stop_req();
  1165. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  1166.     email_p->snr_info.auto_chk_scr = 0;
  1167. #endif 
  1168. }
  1169. /*****************************************************************************
  1170.  * FUNCTION
  1171.  *  mmi_email_main_quit_email
  1172.  * DESCRIPTION
  1173.  *  Quit email application.
  1174.  * PARAMETERS
  1175.  *  void
  1176.  * RETURNS
  1177.  *  void
  1178.  *****************************************************************************/
  1179. void mmi_email_main_quit_email(void)
  1180. {
  1181.     /*----------------------------------------------------------------*/
  1182.     /* Local Variables                                                */
  1183.     /*----------------------------------------------------------------*/
  1184.     /*----------------------------------------------------------------*/
  1185.     /* Code Body                                                      */
  1186.     /*----------------------------------------------------------------*/
  1187.     email_p->main_info.stop_cause = EMAIL_STOP_BACK_HIST;
  1188.     mmi_email_pre_entry_progressing(
  1189.         STR_EMAIL_MAIN_ID,
  1190.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1191.         0,
  1192.         0,
  1193.         0,
  1194.         0,
  1195.         (U8*) GetString(STR_EMAIL_COMMON_QUITING_ID),
  1196.         (U8*) NULL,
  1197.         IMG_EMAIL_CONNECTING_ID,
  1198.         NULL,
  1199.         NULL,
  1200.         NULL,
  1201.         0);
  1202.     mmi_email_ps_stop_req();
  1203. }
  1204. /*****************************************************************************
  1205.  * FUNCTION
  1206.  *  mmi_email_main_quit_to_app
  1207.  * DESCRIPTION
  1208.  *  Quit email application and go back to previous application.
  1209.  * PARAMETERS
  1210.  *  void
  1211.  * RETURNS
  1212.  *  void
  1213.  *****************************************************************************/
  1214. void mmi_email_main_quit_to_app(void)
  1215. {
  1216.     /*----------------------------------------------------------------*/
  1217.     /* Local Variables                                                */
  1218.     /*----------------------------------------------------------------*/
  1219.     /*----------------------------------------------------------------*/
  1220.     /* Code Body                                                      */
  1221.     /*----------------------------------------------------------------*/
  1222.     email_p->main_info.stop_cause = EMAIL_STOP_BACK_FROM_OTHER;
  1223.     mmi_email_ps_stop_req();
  1224. }
  1225. #define COMMON_SCR_UTIL_EMAIL
  1226. /*****************************************************************************
  1227.  * FUNCTION
  1228.  *  mmi_email_pre_entry_progressing
  1229.  * DESCRIPTION
  1230.  *  Pre-entry function for progressing screen
  1231.  * PARAMETERS
  1232.  *  strCaption      [IN]        
  1233.  *  imgCaption      [IN]        
  1234.  *  strLsk          [IN]        
  1235.  *  imgLsk          [IN]        
  1236.  *  strRsk          [IN]        
  1237.  *  imgRsk          [IN]        
  1238.  *  strBody1        [?]         
  1239.  *  strBody2        [?]         
  1240.  *  imgBody         [IN]        
  1241.  *  lskFuncPtr      [IN]        
  1242.  *  rskFuncPtr      [IN]        
  1243.  *  endFuncPtr      [IN]        
  1244.  *  leftAlign       [IN]        
  1245.  * RETURNS
  1246.  *  void
  1247.  *****************************************************************************/
  1248. void mmi_email_pre_entry_progressing(
  1249.         U16 strCaption,
  1250.         U16 imgCaption,
  1251.         U16 strLsk,
  1252.         U16 imgLsk,
  1253.         U16 strRsk,
  1254.         U16 imgRsk,
  1255.         U8 *strBody1,
  1256.         U8 *strBody2,
  1257.         U16 imgBody,
  1258.         FuncPtr lskFuncPtr,
  1259.         FuncPtr rskFuncPtr,
  1260.         FuncPtr endFuncPtr,
  1261.         S8 leftAlign)
  1262. {
  1263.     /*----------------------------------------------------------------*/
  1264.     /* Local Variables                                                */
  1265.     /*----------------------------------------------------------------*/
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Code Body                                                      */
  1268.     /*----------------------------------------------------------------*/
  1269.     email_p->misc_info.progress_info.strCaption = strCaption;
  1270.     email_p->misc_info.progress_info.imgCaption = imgCaption;
  1271.     email_p->misc_info.progress_info.strLsk = strLsk;
  1272.     email_p->misc_info.progress_info.imgLsk = imgLsk;
  1273.     email_p->misc_info.progress_info.strRsk = strRsk;
  1274.     email_p->misc_info.progress_info.imgRsk = imgRsk;
  1275.     email_p->misc_info.progress_info.strBody1 = strBody1;
  1276.     email_p->misc_info.progress_info.strBody2 = strBody2;
  1277.     email_p->misc_info.progress_info.imgBody = imgBody;
  1278.     email_p->misc_info.progress_info.lskFuncPtr = lskFuncPtr;
  1279.     email_p->misc_info.progress_info.rskFuncPtr = rskFuncPtr;
  1280.     email_p->misc_info.progress_info.endFuncPtr = endFuncPtr;
  1281.     email_p->misc_info.progress_info.leftAlign = leftAlign;
  1282.     if (mmi_email_util_is_call_interrupt_allow())
  1283.     {
  1284.         mmi_email_entry_progressing();
  1285.     }
  1286. }
  1287. /*****************************************************************************
  1288.  * FUNCTION
  1289.  *  mmi_email_entry_progressing
  1290.  * DESCRIPTION
  1291.  *  Common entry function for all progressing screens.
  1292.  * PARAMETERS
  1293.  *  void
  1294.  * RETURNS
  1295.  *  void
  1296.  *****************************************************************************/
  1297. void mmi_email_entry_progressing(void)
  1298. {
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Local Variables                                                */
  1301.     /*----------------------------------------------------------------*/
  1302.     U8 *guiBuffer;
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Code Body                                                      */
  1305.     /*----------------------------------------------------------------*/
  1306.     EntryNewScreen(SCR_ID_EMAIL_PROGRESS, mmi_email_exit_progressing, NULL, NULL);
  1307.     mmi_email_util_clear_end_key_hdlr();
  1308.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_PROGRESS);
  1309.     if (email_p->misc_info.progress_info.leftAlign)
  1310.     {
  1311.         Setcategory154LeftAlign();
  1312.     }
  1313.     ShowCategory154Screen(
  1314.         email_p->misc_info.progress_info.strCaption,
  1315.         email_p->misc_info.progress_info.imgCaption,
  1316.         email_p->misc_info.progress_info.strLsk,
  1317.         email_p->misc_info.progress_info.imgLsk,
  1318.         email_p->misc_info.progress_info.strRsk,
  1319.         email_p->misc_info.progress_info.imgRsk,
  1320.         (U8*) email_p->misc_info.progress_info.strBody1,
  1321.         (U8*) email_p->misc_info.progress_info.strBody2,
  1322.         email_p->misc_info.progress_info.imgBody,
  1323.         guiBuffer);
  1324.     SetLeftSoftkeyFunction(email_p->misc_info.progress_info.lskFuncPtr, KEY_EVENT_UP);
  1325.     SetRightSoftkeyFunction(email_p->misc_info.progress_info.rskFuncPtr, KEY_EVENT_UP);
  1326.     SetKeyHandler(email_p->misc_info.progress_info.endFuncPtr, KEY_END, KEY_EVENT_DOWN);
  1327. }
  1328. /*****************************************************************************
  1329.  * FUNCTION
  1330.  *  mmi_email_exit_progressing
  1331.  * DESCRIPTION
  1332.  *  Common exit function for all progressing screens.
  1333.  * PARAMETERS
  1334.  *  void
  1335.  * RETURNS
  1336.  *  void
  1337.  *****************************************************************************/
  1338. void mmi_email_exit_progressing(void)
  1339. {
  1340.     /*----------------------------------------------------------------*/
  1341.     /* Local Variables                                                */
  1342.     /*----------------------------------------------------------------*/
  1343.     /*----------------------------------------------------------------*/
  1344.     /* Code Body                                                      */
  1345.     /*----------------------------------------------------------------*/
  1346.     if (!IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  1347.     {
  1348.         mmi_email_util_add_history(SCR_ID_EMAIL_PROGRESS, mmi_email_entry_progressing);
  1349.     }
  1350. }
  1351. #define SEND_N_RECV_EMAIL
  1352. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  1353. /*****************************************************************************
  1354.  * FUNCTION
  1355.  *  mmi_email_auto_chk_update_scr
  1356.  * DESCRIPTION
  1357.  *  Update screen when auto-check process finished.
  1358.  * PARAMETERS
  1359.  *  void
  1360.  * RETURNS
  1361.  *  void
  1362.  *****************************************************************************/
  1363. void mmi_email_auto_chk_update_scr(void)        // #ifdef __MMI_SLIM_EMAIL_NO_AUTO_CHECK__
  1364. {
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Local Variables                                                */
  1367.     /*----------------------------------------------------------------*/
  1368.     /*----------------------------------------------------------------*/
  1369.     /* Code Body                                                      */
  1370.     /*----------------------------------------------------------------*/
  1371.     ClearKeyEvents();
  1372.     if (mmi_email_util_is_key_locked())
  1373.     {
  1374.         EntryIdleScreen();
  1375.     }
  1376.     else
  1377.     {
  1378.         mmi_email_pre_entry_new_mail_ind();
  1379.     }
  1380. }
  1381. /*****************************************************************************
  1382.  * FUNCTION
  1383.  *  mmi_email_util_is_new_mail
  1384.  * DESCRIPTION
  1385.  *  Get the status of new mail indication
  1386.  * PARAMETERS
  1387.  *  void
  1388.  * RETURNS
  1389.  *  TRUE if there is any new mail indication to be displayed in IDLE;
  1390.  *  otherwise, FALSE.
  1391.  *****************************************************************************/
  1392. U8 mmi_email_util_is_new_mail(void)
  1393. {
  1394.     /*----------------------------------------------------------------*/
  1395.     /* Local Variables                                                */
  1396.     /*----------------------------------------------------------------*/
  1397.     /*----------------------------------------------------------------*/
  1398.     /* Code Body                                                      */
  1399.     /*----------------------------------------------------------------*/
  1400.     return email_p->snr_info.new_mail_ind;
  1401. }
  1402. /*****************************************************************************
  1403.  * FUNCTION
  1404.  *  mmi_email_entry_auto_chk_result
  1405.  * DESCRIPTION
  1406.  *  Update screen when auto-check process finished.
  1407.  * PARAMETERS
  1408.  *  void
  1409.  * RETURNS
  1410.  *  void
  1411.  *****************************************************************************/
  1412. void mmi_email_entry_auto_chk_result(void)
  1413. {
  1414.     /*----------------------------------------------------------------*/
  1415.     /* Local Variables                                                */
  1416.     /*----------------------------------------------------------------*/
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Code Body                                                      */
  1419.     /*----------------------------------------------------------------*/
  1420.     mmi_email_pre_entry_new_mail_ind();
  1421. }
  1422. /*****************************************************************************
  1423.  * FUNCTION
  1424.  *  mmi_email_pre_entry_new_mail_ind
  1425.  * DESCRIPTION
  1426.  *  Pre-Entry function of new mail indication screen
  1427.  * PARAMETERS
  1428.  *  void
  1429.  * RETURNS
  1430.  *  void
  1431.  *****************************************************************************/
  1432. void mmi_email_pre_entry_new_mail_ind(void)
  1433. {
  1434.     /*----------------------------------------------------------------*/
  1435.     /* Local Variables                                                */
  1436.     /*----------------------------------------------------------------*/
  1437.     U8 ansiiTempBuff[10];
  1438.     U8 ucs2TempBuff[10 * ENCODING_LENGTH];
  1439.     S32 len;
  1440.     /*----------------------------------------------------------------*/
  1441.     /* Code Body                                                      */
  1442.     /*----------------------------------------------------------------*/
  1443.     /* Sent buffer */
  1444.     sprintf((S8*) ansiiTempBuff, ":%u", email_p->snr_info.num_sent);
  1445.     len = strlen((S8*) ansiiTempBuff);
  1446.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1447.     memset(&ucs2TempBuff[len * ENCODING_LENGTH], 0, ENCODING_LENGTH);
  1448.     pfnUnicodeStrcpy((S8*) email_p->snr_info.sent_buff, (S8*) GetString(STR_EMAIL_COMMON_SENT_ID));
  1449.     pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) ucs2TempBuff);
  1450.     pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1451.     /* Received buffer */
  1452.     sprintf((S8*) ansiiTempBuff, ":%u ", email_p->snr_info.num_recv);
  1453.     len = strlen((S8*) ansiiTempBuff);
  1454.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1455.     memset(&ucs2TempBuff[len * ENCODING_LENGTH], 0, ENCODING_LENGTH);
  1456.     pfnUnicodeStrcpy((S8*) email_p->snr_info.recv_buff, (S8*) GetString(STR_EMAIL_RECEIVED_ID));
  1457.     pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) ucs2TempBuff);
  1458.     pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1459.     mmi_email_entry_new_mail_ind();
  1460. }
  1461. /*****************************************************************************
  1462.  * FUNCTION
  1463.  *  mmi_email_entry_new_mail_ind
  1464.  * DESCRIPTION
  1465.  *  Display New Email indication screen in IDLE screen.
  1466.  * PARAMETERS
  1467.  *  void
  1468.  * RETURNS
  1469.  *  void
  1470.  *****************************************************************************/
  1471. void mmi_email_entry_new_mail_ind(void)
  1472. {
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Local Variables                                                */
  1475.     /*----------------------------------------------------------------*/
  1476.     /*----------------------------------------------------------------*/
  1477.     /* Code Body                                                      */
  1478.     /*----------------------------------------------------------------*/
  1479.     EntryNewScreen(SCR_ID_EMAIL_NEW_MAIL_IND, NULL, mmi_email_entry_new_mail_ind, NULL);
  1480.     ShowCategory154Screen(
  1481.         STR_EMAIL_NEW_EMAILS_ID,
  1482.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1483.         STR_EMAIL_READ_ID,
  1484.         IMG_GLOBAL_OK,
  1485.         STR_GLOBAL_BACK,
  1486.         IMG_GLOBAL_BACK,
  1487.         (U8*) email_p->snr_info.sent_buff,
  1488.         (U8*) email_p->snr_info.recv_buff,
  1489.         IMG_EMAIL_REPORT_ID,
  1490.         NULL);
  1491.     SetLeftSoftkeyFunction(mmi_email_list_inbox_from_idle, KEY_EVENT_UP);
  1492.     SetRightSoftkeyFunction(mmi_email_go_back_to_idle, KEY_EVENT_UP);
  1493.     SetKeyHandler(mmi_email_go_back_to_idle, KEY_END, KEY_EVENT_DOWN);
  1494. }
  1495. /*****************************************************************************
  1496.  * FUNCTION
  1497.  *  mmi_email_list_inbox_from_idle
  1498.  * DESCRIPTION
  1499.  *  Entry Inbox from IDLE screen (auto-check)
  1500.  * PARAMETERS
  1501.  *  void
  1502.  * RETURNS
  1503.  *  void
  1504.  *****************************************************************************/
  1505. void mmi_email_list_inbox_from_idle(void)
  1506. {
  1507.     /*----------------------------------------------------------------*/
  1508.     /* Local Variables                                                */
  1509.     /*----------------------------------------------------------------*/
  1510.     /*----------------------------------------------------------------*/
  1511.     /* Code Body                                                      */
  1512.     /*----------------------------------------------------------------*/
  1513.     if ((email_p->main_info.ready_state & EMAIL_READY) == EMAIL_READY)
  1514.     {
  1515.         email_p->main_info.entry_src = EMAIL_FROM_IDLE;
  1516.         email_p->main_info.curr_menu = MMI_EMAIL_INBOX;
  1517.         mmi_email_ps_start_req();
  1518.     }
  1519.     else    /* email application not ready */
  1520.     {
  1521.     #ifdef __USB_IN_NORMAL_MODE__
  1522.         if (mmi_usb_is_in_mass_storage_mode())
  1523.         {
  1524.             mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
  1525.         }
  1526.         else
  1527.     #endif /* __USB_IN_NORMAL_MODE__ */ 
  1528.         {
  1529.             DisplayPopup(
  1530.                 (U8*) GetString(STR_EMAIL_NOT_READY_ID),
  1531.                 IMG_GLOBAL_WARNING,
  1532.                 1,
  1533.                 UI_POPUP_NOTIFYDURATION_TIME,
  1534.                 (U8) WARNING_TONE);
  1535.         }
  1536.     }
  1537. }
  1538. /*****************************************************************************
  1539.  * FUNCTION
  1540.  *  mmi_email_go_back_to_idle
  1541.  * DESCRIPTION
  1542.  *  Go back to idle screen in auto-check indication.
  1543.  * PARAMETERS
  1544.  *  void
  1545.  * RETURNS
  1546.  *  void
  1547.  *****************************************************************************/
  1548. void mmi_email_go_back_to_idle(void)
  1549. {
  1550.     /*----------------------------------------------------------------*/
  1551.     /* Local Variables                                                */
  1552.     /*----------------------------------------------------------------*/
  1553.     /*----------------------------------------------------------------*/
  1554.     /* Code Body                                                      */
  1555.     /*----------------------------------------------------------------*/
  1556.     email_p->snr_info.new_mail_ind = FALSE;
  1557.     DisplayIdleScreen();
  1558. }
  1559. /*****************************************************************************
  1560.  * FUNCTION
  1561.  *  mmi_email_entry_snr_key_lock_result
  1562.  * DESCRIPTION
  1563.  *  Display result screen when keypad is locked
  1564.  * PARAMETERS
  1565.  *  void
  1566.  * RETURNS
  1567.  *  void
  1568.  *****************************************************************************/
  1569. void mmi_email_entry_snr_key_lock_result(void)
  1570. {
  1571.     /*----------------------------------------------------------------*/
  1572.     /* Local Variables                                                */
  1573.     /*----------------------------------------------------------------*/
  1574.     /*----------------------------------------------------------------*/
  1575.     /* Code Body                                                      */
  1576.     /*----------------------------------------------------------------*/
  1577.     mmi_email_snr_prepare_result_data();
  1578.     ShowCategory154Screen(
  1579.         0,
  1580.         0,
  1581.         0,
  1582.         0,
  1583.         KEYPAD_LOCKED_RSK_TEXT,
  1584.         0,
  1585.         (U8*) email_p->snr_info.sent_buff,
  1586.         (U8*) email_p->snr_info.recv_buff,
  1587.         IMG_EMAIL_REPORT_ID,
  1588.         NULL);
  1589. }
  1590. /*****************************************************************************
  1591.  * FUNCTION
  1592.  *  mmi_email_auto_chk_go_back
  1593.  * DESCRIPTION
  1594.  *  Back key handler of send and receive result if it's not in Email application
  1595.  * PARAMETERS
  1596.  *  void
  1597.  * RETURNS
  1598.  *  void
  1599.  *****************************************************************************/
  1600. void mmi_email_auto_chk_go_back(void)   // #ifdef __MMI_SLIM_EMAIL_NO_AUTO_CHECK__
  1601. {
  1602.     /*----------------------------------------------------------------*/
  1603.     /* Local Variables                                                */
  1604.     /*----------------------------------------------------------------*/
  1605.     /*----------------------------------------------------------------*/
  1606.     /* Code Body                                                      */
  1607.     /*----------------------------------------------------------------*/
  1608.     if (email_p->snr_info.auto_chk_scr)
  1609.     {
  1610.         GoBackToHistory(email_p->snr_info.auto_chk_scr);
  1611.     }
  1612.     else
  1613.     {
  1614.         DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1615.         GoBackHistory();
  1616.     }
  1617.     email_p->snr_info.auto_chk_scr = 0;
  1618. }
  1619. #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  1620. /*****************************************************************************
  1621.  * FUNCTION
  1622.  *  mmi_email_snr_back_to_main
  1623.  * DESCRIPTION
  1624.  *  Back key handler of send and receive result if it's in Email application
  1625.  * PARAMETERS
  1626.  *  void
  1627.  * RETURNS
  1628.  *  void
  1629.  *****************************************************************************/
  1630. void mmi_email_snr_back_to_main(void)
  1631. {
  1632.     /*----------------------------------------------------------------*/
  1633.     /* Local Variables                                                */
  1634.     /*----------------------------------------------------------------*/
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Code Body                                                      */
  1637.     /*----------------------------------------------------------------*/    
  1638.     /* do not delete other application's screen */
  1639.     // GoBackToHistory(SCR_ID_EMAIL_MAIN);
  1640.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1641.     GoBackHistory();
  1642. }
  1643. /*****************************************************************************
  1644.  * FUNCTION
  1645.  *  mmi_email_entry_snr_detail
  1646.  * DESCRIPTION
  1647.  *  Entry detailed result screen of send and receive
  1648.  * PARAMETERS
  1649.  *  void
  1650.  * RETURNS
  1651.  *  void
  1652.  *****************************************************************************/
  1653. void mmi_email_entry_snr_detail(void)
  1654. {
  1655.     /*----------------------------------------------------------------*/
  1656.     /* Local Variables                                                */
  1657.     /*----------------------------------------------------------------*/
  1658.     U16 snr_icons[EMAIL_REPORT_TOTAL_ITEM] = 
  1659.     {
  1660.         IMG_EMAIL_SENT_CAPTION_REPORT_ID, 0,
  1661.         IMG_EMAIL_RECEIVED_CAPTION_REPORT_ID, 0
  1662.     };
  1663.     U8 *guiBuffer;
  1664.     U8 *inputBuffer;
  1665.     U16 inputBufferSize;
  1666.     /*----------------------------------------------------------------*/
  1667.     /* Code Body                                                      */
  1668.     /*----------------------------------------------------------------*/
  1669.     EntryNewScreen(SCR_ID_EMAIL_SNR_DETAIL, mmi_email_exit_snr_detail, NULL, NULL);
  1670.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_SNR_DETAIL);
  1671.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_SNR_DETAIL, &inputBufferSize);
  1672.     InitializeCategory57Screen();
  1673.     mmi_email_snr_fill_inline_struct();
  1674.     if (inputBuffer != NULL)
  1675.     {
  1676.         SetCategory57Data(wgui_inline_items, EMAIL_REPORT_TOTAL_ITEM, inputBuffer);
  1677.     }
  1678.     ShowCategory57Screen(
  1679.         STR_EMAIL_COMMON_DETAIL_RESULT_ID,
  1680.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1681.         0,
  1682.         0,
  1683.         STR_GLOBAL_BACK,
  1684.         IMG_GLOBAL_BACK,
  1685.         EMAIL_REPORT_TOTAL_ITEM,
  1686.         (U16*) snr_icons,
  1687.         wgui_inline_items,
  1688.         0,
  1689.         guiBuffer);
  1690.     SetCategory57RightSoftkeyFunctions(NULL, mmi_email_snr_back_from_result);
  1691.     SetKeyHandler(mmi_email_main_goto_idle, KEY_END, KEY_EVENT_DOWN);
  1692. }
  1693. /*****************************************************************************
  1694.  * FUNCTION
  1695.  *  mmi_email_exit_snr_detail
  1696.  * DESCRIPTION
  1697.  *  Exit detailed result screen of send and receive
  1698.  * PARAMETERS
  1699.  *  void
  1700.  * RETURNS
  1701.  *  void
  1702.  *****************************************************************************/
  1703. void mmi_email_exit_snr_detail(void)
  1704. {
  1705.     /*----------------------------------------------------------------*/
  1706.     /* Local Variables                                                */
  1707.     /*----------------------------------------------------------------*/
  1708.     /*----------------------------------------------------------------*/
  1709.     /* Code Body                                                      */
  1710.     /*----------------------------------------------------------------*/
  1711.     if (!IsScreenPresent(SCR_ID_EMAIL_PROGRESS))
  1712.     {
  1713.         mmi_email_util_add_n_history(SCR_ID_EMAIL_SNR_DETAIL, mmi_email_entry_snr_detail);
  1714.     }
  1715.     else
  1716.     {
  1717.         HistoryReplace(SCR_ID_EMAIL_PROGRESS, SCR_ID_EMAIL_SNR_DETAIL, mmi_email_entry_snr_detail);
  1718.     }
  1719. }
  1720. /*****************************************************************************
  1721.  * FUNCTION
  1722.  *  mmi_email_snr_prepare_result_data
  1723.  * DESCRIPTION
  1724.  *  Fill string buffer for result screen.
  1725.  * PARAMETERS
  1726.  *  void
  1727.  * RETURNS
  1728.  *  void
  1729.  *****************************************************************************/
  1730. void mmi_email_snr_prepare_result_data(void)
  1731. {
  1732.     /*----------------------------------------------------------------*/
  1733.     /* Local Variables                                                */
  1734.     /*----------------------------------------------------------------*/
  1735.     S32 len;
  1736.     U8 *ansiiTempBuff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1737.     U8 *ucs2TempBuff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1738.     /*----------------------------------------------------------------*/
  1739.     /* Code Body                                                      */
  1740.     /*----------------------------------------------------------------*/
  1741.     /* sent string */
  1742.     sprintf((S8*) ansiiTempBuff, ": %u ", email_p->snr_info.num_sent);
  1743.     len = strlen((S8*) ansiiTempBuff);
  1744.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1745.     ucs2TempBuff[len * ENCODING_LENGTH] = '';
  1746.     ucs2TempBuff[len * ENCODING_LENGTH + 1] = '';
  1747.     pfnUnicodeStrcpy((S8*) email_p->snr_info.sent_buff, (S8*) GetString(STR_EMAIL_COMMON_SENT_ID));
  1748.     pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) ucs2TempBuff);
  1749.     pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1750.     /* received string */
  1751.     sprintf((S8*) ansiiTempBuff, ": %u ", email_p->snr_info.num_recv);
  1752.     len = strlen((S8*) ansiiTempBuff);
  1753.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1754.     ucs2TempBuff[len * ENCODING_LENGTH] = '';
  1755.     ucs2TempBuff[len * ENCODING_LENGTH + 1] = '';
  1756.     pfnUnicodeStrcpy((S8*) email_p->snr_info.recv_buff, (S8*) GetString(STR_EMAIL_RECEIVED_ID));
  1757.     pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) ucs2TempBuff);
  1758.     pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1759.     OslMfree(ansiiTempBuff);
  1760.     OslMfree(ucs2TempBuff);
  1761. }
  1762. /*****************************************************************************
  1763.  * FUNCTION
  1764.  *  mmi_email_snr_display_result
  1765.  * DESCRIPTION
  1766.  *  Display result screen of according to the error state of Send and Receive
  1767.  * PARAMETERS
  1768.  *  entryFuncPtrGoBackTo        [IN]        Function for "Back" key
  1769.  * RETURNS
  1770.  *  void
  1771.  *****************************************************************************/
  1772. void mmi_email_snr_display_result(FuncPtr entryFuncPtrGoBackTo)
  1773. {
  1774.     /*----------------------------------------------------------------*/
  1775.     /* Local Variables                                                */
  1776.     /*----------------------------------------------------------------*/
  1777.     FuncPtr fPtr = NULL;
  1778.     U16 StrRsk = 0;
  1779.     U16 ImgRsk = 0;
  1780.     /*----------------------------------------------------------------*/
  1781.     /* Code Body                                                      */
  1782.     /*----------------------------------------------------------------*/
  1783.     if (email_p->snr_info.sent_err_str || email_p->snr_info.recv_err_str)
  1784.     {
  1785.         fPtr = mmi_email_entry_snr_detail;
  1786.         StrRsk = STR_EMAIL_COMMON_DETAILS_ID;
  1787.         ImgRsk = IMG_GLOBAL_BACK;
  1788.     }
  1789.     mmi_email_pre_entry_progressing(
  1790.         STR_EMAIL_SEND_AND_RECEIVE_ID,
  1791.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1792.         STR_GLOBAL_OK,
  1793.         IMG_GLOBAL_OK,
  1794.         StrRsk,
  1795.         ImgRsk,
  1796.         (U8*) email_p->snr_info.sent_buff,
  1797.         (U8*) email_p->snr_info.recv_buff,
  1798.         IMG_EMAIL_REPORT_ID,
  1799.         entryFuncPtrGoBackTo,
  1800.         fPtr,
  1801.         mmi_email_main_goto_idle,
  1802.         1);
  1803. }
  1804. /*****************************************************************************
  1805.  * FUNCTION
  1806.  *  mmi_email_snr_fill_inline_struct
  1807.  * DESCRIPTION
  1808.  *  Fill inline structure for Detailed screen.
  1809.  * PARAMETERS
  1810.  *  void
  1811.  * RETURNS
  1812.  *  void
  1813.  *****************************************************************************/
  1814. void mmi_email_snr_fill_inline_struct(void)
  1815. {
  1816.     /*----------------------------------------------------------------*/
  1817.     /* Local Variables                                                */
  1818.     /*----------------------------------------------------------------*/
  1819.     S32 len;
  1820.     U8 *ansiiTempBuff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1821.     U8 *ucs2TempBuff = OslMalloc(EMAIL_MAX_SNR_RESULT_LEN * ENCODING_LENGTH);
  1822.     S8 ucs2ComaBuff[] = { ',', '', ' ', '', '', '' };
  1823.     /*----------------------------------------------------------------*/
  1824.     /* Code Body                                                      */
  1825.     /*----------------------------------------------------------------*/
  1826.     /* sent string */
  1827.     sprintf((S8*) ansiiTempBuff, "%u/%u ", email_p->snr_info.num_sent, email_p->snr_info.num_to_be_sent);
  1828.     len = strlen((S8*) ansiiTempBuff);
  1829.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1830.     ucs2TempBuff[len * ENCODING_LENGTH] = '';
  1831.     ucs2TempBuff[len * ENCODING_LENGTH + 1] = '';
  1832.     pfnUnicodeStrcpy((S8*) email_p->snr_info.sent_buff, (S8*) ucs2TempBuff);
  1833.     pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1834.     if (email_p->snr_info.sent_err_str)
  1835.     {
  1836.         pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) ucs2ComaBuff);
  1837.         pfnUnicodeStrcat((S8*) email_p->snr_info.sent_buff, (S8*) GetString(email_p->snr_info.sent_err_str));
  1838.     }
  1839.     /* received string */
  1840.     sprintf((S8*) ansiiTempBuff, "%u/%u ", email_p->snr_info.num_recv, email_p->snr_info.num_to_be_recv);
  1841.     len = strlen((S8*) ansiiTempBuff);
  1842.     AnsiiNToUnicodeString((S8*) ucs2TempBuff, (S8*) ansiiTempBuff, len);
  1843.     ucs2TempBuff[len * ENCODING_LENGTH] = '';
  1844.     ucs2TempBuff[len * ENCODING_LENGTH + 1] = '';
  1845.     pfnUnicodeStrcpy((S8*) email_p->snr_info.recv_buff, (S8*) ucs2TempBuff);
  1846.     pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) GetString(STR_EMAIL_MAILS_ID));
  1847.     if (email_p->snr_info.recv_err_str)
  1848.     {
  1849.         pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) ucs2ComaBuff);
  1850.         pfnUnicodeStrcat((S8*) email_p->snr_info.recv_buff, (S8*) GetString(email_p->snr_info.recv_err_str));
  1851.     }
  1852.     /* sent caption */
  1853.     SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1854.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_EMAIL_COMMON_SENT_ID));
  1855.     /* sent result */
  1856.     SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1857.     SetInlineItemDisplayOnly(&wgui_inline_items[1], (U8*) email_p->snr_info.sent_buff);
  1858.     /* received caption */
  1859.     SetInlineItemActivation(&wgui_inline_items[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1860.     SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_EMAIL_RECEIVED_ID));
  1861.     /* received result */
  1862.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1863.     SetInlineItemDisplayOnly((&wgui_inline_items[3]), (U8*) email_p->snr_info.recv_buff);
  1864.     OslMfree(ansiiTempBuff);
  1865.     OslMfree(ucs2TempBuff);
  1866. }
  1867. /*****************************************************************************
  1868.  * FUNCTION
  1869.  *  mmi_email_snr_back_from_result
  1870.  * DESCRIPTION
  1871.  *  Back from Detail Result screen to Email main menu.
  1872.  * PARAMETERS
  1873.  *  void
  1874.  * RETURNS
  1875.  *  void
  1876.  *****************************************************************************/
  1877. void mmi_email_snr_back_from_result(void)
  1878. {
  1879.     /*----------------------------------------------------------------*/
  1880.     /* Local Variables                                                */
  1881.     /*----------------------------------------------------------------*/
  1882.     /*----------------------------------------------------------------*/
  1883.     /* Code Body                                                      */
  1884.     /*----------------------------------------------------------------*/
  1885. #if 0
  1886. /* under construction !*/
  1887. #endif
  1888.     DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1889.     GoBackHistory();
  1890. }
  1891. #define WRITE_EMAIL
  1892. /*****************************************************************************
  1893.  * FUNCTION
  1894.  *  mmi_email_hilite_comp_addr_add
  1895.  * DESCRIPTION
  1896.  *  Highlight handler of Write Email->To/CC->Add option
  1897.  * PARAMETERS
  1898.  *  void
  1899.  * RETURNS
  1900.  *  void
  1901.  *****************************************************************************/
  1902. void mmi_email_hilite_comp_addr_add(void)
  1903. {
  1904.     /*----------------------------------------------------------------*/
  1905.     /* Local Variables                                                */
  1906.     /*----------------------------------------------------------------*/
  1907.     /*----------------------------------------------------------------*/
  1908.     /* Code Body                                                      */
  1909.     /*----------------------------------------------------------------*/
  1910.     SetLeftSoftkeyFunction(mmi_email_comp_addr_pre_add, KEY_EVENT_UP);
  1911.     SetKeyHandler(mmi_email_comp_addr_pre_add, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1912. }
  1913. /*****************************************************************************
  1914.  * FUNCTION
  1915.  *  mmi_email_hilite_comp_addr_edit
  1916.  * DESCRIPTION
  1917.  *  Highlight handler of Write Email->To/CC->Edit option
  1918.  * PARAMETERS
  1919.  *  void
  1920.  * RETURNS
  1921.  *  void
  1922.  *****************************************************************************/
  1923. void mmi_email_hilite_comp_addr_edit(void)
  1924. {
  1925.     /*----------------------------------------------------------------*/
  1926.     /* Local Variables                                                */
  1927.     /*----------------------------------------------------------------*/
  1928.     /*----------------------------------------------------------------*/
  1929.     /* Code Body                                                      */
  1930.     /*----------------------------------------------------------------*/
  1931.     SetLeftSoftkeyFunction(mmi_email_comp_addr_pre_edit, KEY_EVENT_UP);
  1932.     SetKeyHandler(mmi_email_comp_addr_pre_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1933. }
  1934. /*****************************************************************************
  1935.  * FUNCTION
  1936.  *  mmi_email_hilite_comp_addr_del
  1937.  * DESCRIPTION
  1938.  *  Highlight handler of Write Email->To/CC->Delete option
  1939.  * PARAMETERS
  1940.  *  void
  1941.  * RETURNS
  1942.  *  void
  1943.  *****************************************************************************/
  1944. void mmi_email_hilite_comp_addr_del(void)
  1945. {
  1946.     /*----------------------------------------------------------------*/
  1947.     /* Local Variables                                                */
  1948.     /*----------------------------------------------------------------*/
  1949.     /*----------------------------------------------------------------*/
  1950.     /* Code Body                                                      */
  1951.     /*----------------------------------------------------------------*/
  1952.     SetLeftSoftkeyFunction(mmi_email_comp_addr_del, KEY_EVENT_UP);
  1953. }
  1954. /*****************************************************************************
  1955.  * FUNCTION
  1956.  *  mmi_email_hilite_comp_addr_del_all
  1957.  * DESCRIPTION
  1958.  *  Highlight handler of Write Email->To/CC->Delete All option
  1959.  * PARAMETERS
  1960.  *  void
  1961.  * RETURNS
  1962.  *  void
  1963.  *****************************************************************************/
  1964. void mmi_email_hilite_comp_addr_del_all(void)
  1965. {
  1966.     /*----------------------------------------------------------------*/
  1967.     /* Local Variables                                                */
  1968.     /*----------------------------------------------------------------*/
  1969.     /*----------------------------------------------------------------*/
  1970.     /* Code Body                                                      */
  1971.     /*----------------------------------------------------------------*/
  1972.     SetLeftSoftkeyFunction(mmi_email_comp_addr_del_all, KEY_EVENT_UP);
  1973. }
  1974. /*****************************************************************************
  1975.  * FUNCTION
  1976.  *  mmi_email_hilite_comp_subj_done
  1977.  * DESCRIPTION
  1978.  *  Highlight handler of Done option in full screen editor of Write Email->Subject
  1979.  * PARAMETERS
  1980.  *  void
  1981.  * RETURNS
  1982.  *  void
  1983.  *****************************************************************************/
  1984. void mmi_email_hilite_comp_subj_done(void)
  1985. {
  1986.     /*----------------------------------------------------------------*/
  1987.     /* Local Variables                                                */
  1988.     /*----------------------------------------------------------------*/
  1989.     /*----------------------------------------------------------------*/
  1990.     /* Code Body                                                      */
  1991.     /*----------------------------------------------------------------*/
  1992.     SetLeftSoftkeyFunction(mmi_email_comp_subj_cont_done, KEY_EVENT_UP);
  1993. }
  1994. /*****************************************************************************
  1995.  * FUNCTION
  1996.  *  mmi_email_hilite_comp_subj_input_meth
  1997.  * DESCRIPTION
  1998.  *  Highlight handler of Input Method option in full screen editor of Write Email->Subject
  1999.  * PARAMETERS
  2000.  *  void
  2001.  * RETURNS
  2002.  *  void
  2003.  *****************************************************************************/
  2004. void mmi_email_hilite_comp_subj_input_meth(void)
  2005. {
  2006.     /*----------------------------------------------------------------*/
  2007.     /* Local Variables                                                */
  2008.     /*----------------------------------------------------------------*/
  2009.     /*----------------------------------------------------------------*/
  2010.     /* Code Body                                                      */
  2011.     /*----------------------------------------------------------------*/
  2012.     SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
  2013.     SetKeyHandler(EntryInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2014.     RegisterInputMethodScreenCloseFunction(mmi_email_util_go_back_2_hist);
  2015. }
  2016. /*****************************************************************************
  2017.  * FUNCTION
  2018.  *  mmi_email_hilite_comp_addr_done
  2019.  * DESCRIPTION
  2020.  *  Highlight handler of Done option in full screen editor of
  2021.  *  Write Email->To/CC-> Option -> Done
  2022.  * PARAMETERS
  2023.  *  void
  2024.  * RETURNS
  2025.  *  void
  2026.  *****************************************************************************/
  2027. void mmi_email_hilite_comp_addr_done(void)
  2028. {
  2029.     /*----------------------------------------------------------------*/
  2030.     /* Local Variables                                                */
  2031.     /*----------------------------------------------------------------*/
  2032.     /*----------------------------------------------------------------*/
  2033.     /* Code Body                                                      */
  2034.     /*----------------------------------------------------------------*/
  2035.     SetLeftSoftkeyFunction(mmi_email_comp_addr_input_done, KEY_EVENT_UP);
  2036. }
  2037. /*****************************************************************************
  2038.  * FUNCTION
  2039.  *  mmi_email_hilite_comp_addr_input_meth
  2040.  * DESCRIPTION
  2041.  *  Highlight handler of Input Method option in full screen editor of Write Email->To/CC
  2042.  * PARAMETERS
  2043.  *  void
  2044.  * RETURNS
  2045.  *  void
  2046.  *****************************************************************************/
  2047. void mmi_email_hilite_comp_addr_input_meth(void)
  2048. {
  2049.     /*----------------------------------------------------------------*/
  2050.     /* Local Variables                                                */
  2051.     /*----------------------------------------------------------------*/
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Code Body                                                      */
  2054.     /*----------------------------------------------------------------*/
  2055.     SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
  2056.     SetKeyHandler(EntryInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2057.     RegisterInputMethodScreenCloseFunction(mmi_email_util_go_back_2_hist);
  2058. }
  2059. /*****************************************************************************
  2060.  * FUNCTION
  2061.  *  mmi_email_hilite_comp_attach_edit
  2062.  * DESCRIPTION
  2063.  *  Highlight handler of Write Email->Attachment->Edit option
  2064.  * PARAMETERS
  2065.  *  void
  2066.  * RETURNS
  2067.  *  void
  2068.  *****************************************************************************/
  2069. void mmi_email_hilite_comp_attach_edit(void)
  2070. {
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Local Variables                                                */
  2073.     /*----------------------------------------------------------------*/
  2074.     /*----------------------------------------------------------------*/
  2075.     /* Code Body                                                      */
  2076.     /*----------------------------------------------------------------*/
  2077.     SetLeftSoftkeyFunction(mmi_email_comp_add_attach, KEY_EVENT_UP);
  2078.     SetKeyHandler(mmi_email_comp_add_attach, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2079. }
  2080. /*****************************************************************************
  2081.  * FUNCTION
  2082.  *  mmi_email_hilite_comp_attach_view
  2083.  * DESCRIPTION
  2084.  *  Highlight handler of Write Email->Attachment->View option
  2085.  * PARAMETERS
  2086.  *  void
  2087.  * RETURNS
  2088.  *  void
  2089.  *****************************************************************************/
  2090. void mmi_email_hilite_comp_attach_view(void)
  2091. {
  2092.     /*----------------------------------------------------------------*/
  2093.     /* Local Variables                                                */
  2094.     /*----------------------------------------------------------------*/
  2095.     /*----------------------------------------------------------------*/
  2096.     /* Code Body                                                      */
  2097.     /*----------------------------------------------------------------*/
  2098.     SetLeftSoftkeyFunction(mmi_email_comp_pre_entry_view_attach, KEY_EVENT_UP);
  2099.     SetKeyHandler(mmi_email_comp_pre_entry_view_attach, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2100. }
  2101. /*****************************************************************************
  2102.  * FUNCTION
  2103.  *  mmi_email_hilite_comp_attach_del
  2104.  * DESCRIPTION
  2105.  *  Highlight handler of Write Email->Attachment->Delete option
  2106.  * PARAMETERS
  2107.  *  void
  2108.  * RETURNS
  2109.  *  void
  2110.  *****************************************************************************/
  2111. void mmi_email_hilite_comp_attach_del(void)
  2112. {
  2113.     /*----------------------------------------------------------------*/
  2114.     /* Local Variables                                                */
  2115.     /*----------------------------------------------------------------*/
  2116.     /*----------------------------------------------------------------*/
  2117.     /* Code Body                                                      */
  2118.     /*----------------------------------------------------------------*/
  2119.     SetLeftSoftkeyFunction(mmi_email_comp_attch_del, KEY_EVENT_UP);
  2120. }
  2121. /*****************************************************************************
  2122.  * FUNCTION
  2123.  *  mmi_email_hilite_comp_send
  2124.  * DESCRIPTION
  2125.  *  Highlight handler of Write Email->Send option
  2126.  * PARAMETERS
  2127.  *  void
  2128.  * RETURNS
  2129.  *  void
  2130.  *****************************************************************************/
  2131. void mmi_email_hilite_comp_send(void)
  2132. {
  2133.     /*----------------------------------------------------------------*/
  2134.     /* Local Variables                                                */
  2135.     /*----------------------------------------------------------------*/
  2136.     /*----------------------------------------------------------------*/
  2137.     /* Code Body                                                      */
  2138.     /*----------------------------------------------------------------*/
  2139.     SetLeftSoftkeyFunction(mmi_email_ps_send_only_req, KEY_EVENT_UP);
  2140. }
  2141. /*****************************************************************************
  2142.  * FUNCTION
  2143.  *  mmi_email_hilite_comp_save_n_send
  2144.  * DESCRIPTION
  2145.  *  Highlight handler of Write Email->Save and Send option
  2146.  * PARAMETERS
  2147.  *  void
  2148.  * RETURNS
  2149.  *  void
  2150.  *****************************************************************************/
  2151. void mmi_email_hilite_comp_save_n_send(void)
  2152. {
  2153.     /*----------------------------------------------------------------*/
  2154.     /* Local Variables                                                */
  2155.     /*----------------------------------------------------------------*/
  2156.     /*----------------------------------------------------------------*/
  2157.     /* Code Body                                                      */
  2158.     /*----------------------------------------------------------------*/
  2159.     SetLeftSoftkeyFunction(mmi_email_ps_save_and_send_req, KEY_EVENT_UP);
  2160. }
  2161. /*****************************************************************************
  2162.  * FUNCTION
  2163.  *  mmi_email_hilite_comp_save_to_draft
  2164.  * DESCRIPTION
  2165.  *  Highlight handler of Write Email->Save To Draft option
  2166.  * PARAMETERS
  2167.  *  void
  2168.  * RETURNS
  2169.  *  void
  2170.  *****************************************************************************/
  2171. void mmi_email_hilite_comp_save_to_draft(void)
  2172. {
  2173.     /*----------------------------------------------------------------*/
  2174.     /* Local Variables                                                */
  2175.     /*----------------------------------------------------------------*/
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Code Body                                                      */
  2178.     /*----------------------------------------------------------------*/
  2179.     SetLeftSoftkeyFunction(mmi_email_ps_save_to_draft_req, KEY_EVENT_UP);
  2180. }
  2181. /*****************************************************************************
  2182.  * FUNCTION
  2183.  *  mmi_email_hilite_comp_quit
  2184.  * DESCRIPTION
  2185.  *  Highlight handler of Write Email->Quit option
  2186.  * PARAMETERS
  2187.  *  void
  2188.  * RETURNS
  2189.  *  void
  2190.  *****************************************************************************/
  2191. void mmi_email_hilite_comp_quit(void)
  2192. {
  2193.     /*----------------------------------------------------------------*/
  2194.     /* Local Variables                                                */
  2195.     /*----------------------------------------------------------------*/
  2196.     /*----------------------------------------------------------------*/
  2197.     /* Code Body                                                      */
  2198.     /*----------------------------------------------------------------*/
  2199.     SetLeftSoftkeyFunction(mmi_email_comp_opt_quit, KEY_EVENT_UP);
  2200. }
  2201. /*****************************************************************************
  2202.  * FUNCTION
  2203.  *  mmi_email_comp_pre_entry
  2204.  * DESCRIPTION
  2205.  *  Pre-Entry function of Write Email screen.
  2206.  *  Reset attachment and add siganture if the mail is not composed yet.
  2207.  * PARAMETERS
  2208.  *  void
  2209.  * RETURNS
  2210.  *  void
  2211.  *****************************************************************************/
  2212. void mmi_email_comp_pre_entry(void)
  2213. {
  2214.     /*----------------------------------------------------------------*/
  2215.     /* Local Variables                                                */
  2216.     /*----------------------------------------------------------------*/
  2217.     /*----------------------------------------------------------------*/
  2218.     /* Code Body                                                      */
  2219.     /*----------------------------------------------------------------*/
  2220.     email_p->comp_info.done_flag = FALSE;
  2221.     /* if previous-written mail is not sent/saved */
  2222.     if (!mmi_email_comp_get_done_status())
  2223.     {
  2224.         /* default attach info */
  2225.         mmi_email_comp_reset_member();
  2226.         /* put signature in the third attachment */
  2227.         if (mmi_email_comp_add_sig() == FALSE)
  2228.         {
  2229.             return;
  2230.         }
  2231.         /* entry Write Email screen after signature copy complete */
  2232.     }
  2233.     mmi_email_entry_comp();
  2234. }
  2235. /*****************************************************************************
  2236.  * FUNCTION
  2237.  *  mmi_email_comp_add_sig
  2238.  * DESCRIPTION
  2239.  *  Add signature attachment into Write Email screen.
  2240.  * PARAMETERS
  2241.  *  void
  2242.  * RETURNS
  2243.  *  TRUE if the called can entrr Write Email screen directly; otherwise, FALSE.
  2244.  *****************************************************************************/
  2245. BOOL mmi_email_comp_add_sig(void)
  2246. {
  2247.     /*----------------------------------------------------------------*/
  2248.     /* Local Variables                                                */
  2249.     /*----------------------------------------------------------------*/
  2250.     /*----------------------------------------------------------------*/
  2251.     /* Code Body                                                      */
  2252.     /*----------------------------------------------------------------*/
  2253.     if (email_p->prof_info.act_prof.sig_status) /* if signaure is on, insert into Write Email screen */
  2254.     {
  2255.         /* signature text */
  2256.         if (pfnUnicodeStrlen((S8*) email_p->prof_info.act_prof.sig_buff))
  2257.         {
  2258.             /* copy text data with new line char */
  2259.             pfnUnicodeStrcpy((S8*) email_p->comp_info.cont_buff, (S8*) g_email_new_line);
  2260.             pfnUnicodeStrcat((S8*) email_p->comp_info.cont_buff, (S8*) email_p->prof_info.act_prof.sig_buff);
  2261.         }
  2262.         /* image */
  2263.         if (pfnUnicodeStrlen((S8*) email_p->prof_info.act_prof.sig_img))
  2264.         {
  2265.             S8 *fileExt;
  2266.             S8 *tmp_file = OslMalloc((FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH);
  2267.             /* insert image to the last slot of attachments */
  2268.             S32 i = (MMI_EMAIL_MAX_NUM_ATTACH - 1);
  2269.             /* file extension */
  2270.             fileExt = mmi_email_get_file_ext((S8*) email_p->prof_info.act_prof.sig_img);
  2271.             /* destination file name */
  2272.             mmi_email_util_get_attch_name((U8) (i + 1), (S8*) email_p->comp_info.attch_list[i].file_path);
  2273.             pfnUnicodeStrcat((S8*) email_p->comp_info.attch_list[i].file_path, (S8*) fileExt);
  2274.             /* source file name */
  2275.             mmi_email_util_get_sig_name((U8) (email_p->prof_info.act_prof.act_indx + 1), (S8*) tmp_file);
  2276.             pfnUnicodeStrcat((S8*) tmp_file, (S8*) fileExt);
  2277.             pfnUnicodeStrcpy((S8*) email_p->comm_buff, (S8*) tmp_file);
  2278.             email_p->misc_info.file_copy_state = EMAIL_FILE_ADD_SIG;
  2279.             mmi_email_pre_entry_progressing(
  2280.                 STR_EMAIL_MAIN_ID,
  2281.                 GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2282.                 0,
  2283.                 0,
  2284.                 0,
  2285.                 0,
  2286.                 (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  2287.                 (U8*) NULL,
  2288.                 IMG_GLOBAL_PROGRESS,
  2289.                 NULL,
  2290.                 NULL,
  2291.                 NULL,
  2292.                 0);
  2293.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  2294.             FS_Delete((U16*) email_p->comp_info.attch_list[i].file_path);
  2295.             mmi_fmgr_send_copy_req(
  2296.                 FMGR_ACTION_COPY,
  2297.                 (U8*) email_p->comm_buff,
  2298.                 (U8*) email_p->comp_info.attch_list[i].file_path,
  2299.                 mmi_email_comp_attach_copy_callback);
  2300.             OslMfree(tmp_file);
  2301.             return FALSE;
  2302.         }
  2303.     }
  2304.     return TRUE;
  2305. }
  2306. /*****************************************************************************
  2307.  * FUNCTION
  2308.  *  mmi_email_comp_reset_member
  2309.  * DESCRIPTION
  2310.  *  Reset variables of Write Email screen
  2311.  * PARAMETERS
  2312.  *  void
  2313.  * RETURNS
  2314.  *  void
  2315.  *****************************************************************************/
  2316. void mmi_email_comp_reset_member(void)
  2317. {
  2318.     /*----------------------------------------------------------------*/
  2319.     /* Local Variables                                                */
  2320.     /*----------------------------------------------------------------*/
  2321.     S32 i;
  2322.     /*----------------------------------------------------------------*/
  2323.     /* Code Body                                                      */
  2324.     /*----------------------------------------------------------------*/
  2325.     memset(&email_p->comp_info, 0, sizeof(mmi_email_comp_info_struct));
  2326.     email_p->misc_info.curr_hilite_attch = 0;
  2327.     /* set <Empty> string for all attachments */
  2328.     for (i = 0; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  2329.     {
  2330.         pfnUnicodeStrcpy((S8*) email_p->comp_info.attch_list[i].file_name, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  2331.     }
  2332.     reset_inscreen_multi_line_input_box_changed();
  2333. }
  2334. /*****************************************************************************
  2335.  * FUNCTION
  2336.  *  mmi_email_entry_comp
  2337.  * DESCRIPTION
  2338.  *  Entry function of Write Email screen
  2339.  * PARAMETERS
  2340.  *  void
  2341.  * RETURNS
  2342.  *  void
  2343.  *****************************************************************************/
  2344. void mmi_email_entry_comp(void)
  2345. {
  2346.     /*----------------------------------------------------------------*/
  2347.     /* Local Variables                                                */
  2348.     /*----------------------------------------------------------------*/
  2349.     U8 *guiBuffer;
  2350.     U8 *inputBuffer;
  2351.     U16 inputBufferSize;
  2352.     U16 comp_icons[EMAIL_COMP_TOTAL] = 
  2353.     {
  2354.         IMG_EMAIL_TO_ID,
  2355.         IMG_EMAIL_CC_ID,
  2356.         IMG_EMAIL_SUBJECT_ID,
  2357.         IMG_EMAIL_ATTACHMENT_ID,
  2358.         IMG_EMAIL_PRIORITY_ID,
  2359.         0
  2360.     };
  2361.     /*----------------------------------------------------------------*/
  2362.     /* Code Body                                                      */
  2363.     /*----------------------------------------------------------------*/
  2364.     EntryNewScreen(SCR_ID_EMAIL_COMP, mmi_email_exit_comp, NULL, NULL);
  2365.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP);
  2366.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_COMP, &inputBufferSize);
  2367.     InitializeCategory57Screen();
  2368.     mmi_email_comp_fill_inline_struct();
  2369.     RegisterHighlightHandler(mmi_email_hilite_comp_inline_item);
  2370.     if (inputBuffer != NULL)
  2371.     {
  2372.         SetCategory57Data(wgui_inline_items, EMAIL_COMP_TOTAL, inputBuffer);
  2373.     }
  2374.     SetHighlightedAttachment(&wgui_inline_items[EMAIL_COMP_ATTCH], email_p->misc_info.curr_hilite_attch);
  2375.     /* fill attachment images */
  2376.     mmi_email_comp_fill_attach();
  2377.     if (email_p->comp_info.attch_exceed)
  2378.     {
  2379.         email_p->comp_info.curr_inline_item = EMAIL_COMP_ATTCH;
  2380.     }
  2381.     else if (email_p->comp_info.cont_exceed)
  2382.     {
  2383.         email_p->comp_info.curr_inline_item = EMAIL_COMP_CONT;
  2384.     }
  2385.     ShowCategory57Screen(
  2386.         STR_EMAIL_TO_ID,
  2387.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2388.         STR_GLOBAL_EDIT,
  2389.         IMG_GLOBAL_OK,
  2390.         STR_GLOBAL_BACK,
  2391.         IMG_GLOBAL_BACK,
  2392.         EMAIL_COMP_TOTAL,
  2393.         (U16*) comp_icons,
  2394.         wgui_inline_items,
  2395.         email_p->comp_info.curr_inline_item,
  2396.         guiBuffer);
  2397.     SetCategory57RightSoftkeyFunctions(mmi_email_entry_comp_opt, mmi_email_comp_back_to_hist);
  2398.     /* display "message too long!" only if "content" is truncated, due to memory limitation */
  2399.     if (email_p->comp_info.attch_exceed)
  2400.     {
  2401.         DisplayPopup(
  2402.             (U8*) GetString(STR_EMAIL_ATTACH_TOO_LARGE),
  2403.             IMG_GLOBAL_EMPTY,
  2404.             1,
  2405.             UI_POPUP_NOTIFYDURATION_TIME,
  2406.             (U8) EMPTY_LIST_TONE);
  2407.     }
  2408.     else if (email_p->comp_info.cont_exceed)
  2409.     {
  2410.         DisplayPopup(
  2411.             (U8*) GetString(STR_EMAIL_CONTENT_MESSAGE_TOO_ID),
  2412.             IMG_GLOBAL_EMPTY,
  2413.             1,
  2414.             UI_POPUP_NOTIFYDURATION_TIME,
  2415.             (U8) EMPTY_LIST_TONE);
  2416.     }
  2417.     email_p->comp_info.attch_exceed = FALSE;
  2418.     email_p->comp_info.cont_exceed = FALSE;
  2419.     /* forward an attachment from file manager and plug-out memory card will directly go to file manager main screen 
  2420.        without sending stop_req to email, which will cause email serious problem.
  2421.        therefore, if SCR_ID_EMAIL_COMP is deleted from history, email should send stop_req */
  2422.     if (email_p->main_info.entry_src == EMAIL_FROM_APP)
  2423.     {
  2424.         SetDelScrnIDCallbackHandler(SCR_ID_EMAIL_COMP, (HistoryDelCBPtr) mmi_email_main_del_callback);
  2425.     }
  2426. }
  2427. /*****************************************************************************
  2428.  * FUNCTION
  2429.  *  mmi_email_exit_comp
  2430.  * DESCRIPTION
  2431.  *  Exit function of Write Email screen
  2432.  * PARAMETERS
  2433.  *  void
  2434.  * RETURNS
  2435.  *  void
  2436.  *****************************************************************************/
  2437. void mmi_email_exit_comp(void)
  2438. {
  2439.     /*----------------------------------------------------------------*/
  2440.     /* Local Variables                                                */
  2441.     /*----------------------------------------------------------------*/
  2442.     /*----------------------------------------------------------------*/
  2443.     /* Code Body                                                      */
  2444.     /*----------------------------------------------------------------*/
  2445.     mmi_email_util_add_n_history(SCR_ID_EMAIL_COMP, mmi_email_entry_comp);
  2446. }
  2447. /*****************************************************************************
  2448.  * FUNCTION
  2449.  *  mmi_email_comp_back_to_hist
  2450.  * DESCRIPTION
  2451.  *  Go back from Write Email screen
  2452.  * PARAMETERS
  2453.  *  void
  2454.  * RETURNS
  2455.  *  void
  2456.  *****************************************************************************/
  2457. void mmi_email_comp_back_to_hist(void)
  2458. {
  2459.     /*----------------------------------------------------------------*/
  2460.     /* Local Variables                                                */
  2461.     /*----------------------------------------------------------------*/
  2462.     /*----------------------------------------------------------------*/
  2463.     /* Code Body                                                      */
  2464.     /*----------------------------------------------------------------*/
  2465.     if (email_p->main_info.entry_src != EMAIL_FROM_APP)
  2466.     {
  2467.         GoBackHistory();
  2468.     }
  2469.     else
  2470.     {
  2471.         mmi_email_main_quit_email();
  2472.     }
  2473. }
  2474. /*****************************************************************************
  2475.  * FUNCTION
  2476.  *  mmi_email_comp_fill_inline_struct
  2477.  * DESCRIPTION
  2478.  *  Fill inline struct for Write Email
  2479.  * PARAMETERS
  2480.  *  void
  2481.  * RETURNS
  2482.  *  void
  2483.  *****************************************************************************/
  2484. void mmi_email_comp_fill_inline_struct(void)
  2485. {
  2486.     /*----------------------------------------------------------------*/
  2487.     /* Local Variables                                                */
  2488.     /*----------------------------------------------------------------*/
  2489.     /*----------------------------------------------------------------*/
  2490.     /* Code Body                                                      */
  2491.     /*----------------------------------------------------------------*/
  2492.     /* Priority */
  2493.     email_p->misc_info.priority_list[0] = (U8*) GetString(STR_EMAIL_PRIORITY_MEDIUM_ID);
  2494.     email_p->misc_info.priority_list[1] = (U8*) GetString(STR_EMAIL_PRIORITY_LOW_ID);
  2495.     email_p->misc_info.priority_list[2] = (U8*) GetString(STR_EMAIL_PRIORITY_HIGH_ID);
  2496.     /* TO */
  2497.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_TO], KEY_LSK, KEY_EVENT_UP);
  2498.     SetInlineItemImageText(
  2499.         &(wgui_inline_items[EMAIL_COMP_TO]),
  2500.         (U8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO],
  2501.         (PU8) GetImage(IMG_EMAIL_TO_ID),
  2502.         (PU8) GetImage(IMG_EMAIL_LEFT_BRACKET_ID),
  2503.         (PU8) GetImage(IMG_EMAIL_RIGHT_BRACKET_ID),
  2504.         sizeof(email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_TO]),
  2505.         STR_EMAIL_TO_ID,
  2506.         0,
  2507.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2508.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[EMAIL_COMP_TO]), mmi_email_comp_pre_entry_addr);
  2509.     ShowAsControl(&(wgui_inline_items[EMAIL_COMP_TO]));
  2510.     /* CC */
  2511.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_CC], KEY_LSK, KEY_EVENT_UP);
  2512.     SetInlineItemImageText(
  2513.         &(wgui_inline_items[EMAIL_COMP_CC]),
  2514.         (U8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_CC],
  2515.         (PU8) GetImage(IMG_EMAIL_CC_ID),
  2516.         (PU8) GetImage(IMG_EMAIL_LEFT_BRACKET_ID),
  2517.         (PU8) GetImage(IMG_EMAIL_RIGHT_BRACKET_ID),
  2518.         sizeof(email_p->comp_info.addr_disp_buff[EMAIL_ADDR_CC]),
  2519.         STR_EMAIL_CC_ID,
  2520.         0,
  2521.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2522.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[EMAIL_COMP_CC]), mmi_email_comp_pre_entry_addr);
  2523.     ShowAsControl(&(wgui_inline_items[EMAIL_COMP_CC]));
  2524.     /* SUBJECT */
  2525.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_SUBJ], KEY_LSK, KEY_EVENT_UP);
  2526.     SetInlineItemImageText(
  2527.         &(wgui_inline_items[EMAIL_COMP_SUBJ]),
  2528.         (U8*) email_p->comp_info.subj_buff,
  2529.         (PU8) GetImage(IMG_EMAIL_SUBJECT_ID),
  2530.         (PU8) GetImage(IMG_EMAIL_LEFT_BRACKET_ID),
  2531.         (PU8) GetImage(IMG_EMAIL_RIGHT_BRACKET_ID),
  2532.         (EMAIL_COMP_SUBJ_LEN + 1),
  2533.         STR_EMAIL_SUBJECT_ID,
  2534.         0,
  2535.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2536.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[EMAIL_COMP_SUBJ]), mmi_email_entry_comp_subj);
  2537.     ShowAsControl(&(wgui_inline_items[EMAIL_COMP_SUBJ]));
  2538.     /* ATTACHMENT */
  2539.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_ATTCH], KEY_LSK, KEY_EVENT_UP);
  2540.     SetInlineItemImageAttachment(
  2541.         &wgui_inline_items[EMAIL_COMP_ATTCH],
  2542.         (PU8) GetImage(IMG_EMAIL_ATTACHMENT_ID),
  2543.         (PU8) GetImage(IMG_EMAIL_LEFT_BRACKET_ID),
  2544.         (PU8) GetImage(IMG_EMAIL_RIGHT_BRACKET_ID),
  2545.         STR_EMAIL_ATTACHMENT_ID,
  2546.         0,
  2547.         email_p->misc_info.curr_hilite_attch);
  2548.     RegisterAttachmentHighlightedFunction(&wgui_inline_items[EMAIL_COMP_ATTCH], mmi_email_hilite_comp_attch);
  2549.     RegisterAttachmentLskFunction(&wgui_inline_items[EMAIL_COMP_ATTCH], mmi_email_comp_attach_lsk_func);
  2550.     RegisterAttachmentRskFunction(&wgui_inline_items[EMAIL_COMP_ATTCH], mmi_email_comp_attach_rsk_func);
  2551.     /* PRIORITY */
  2552.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_PRIOTRIY], KEY_LSK, KEY_EVENT_UP);
  2553.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_PRIOTRIY], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2554.     SetInlineItemSelect(
  2555.         &wgui_inline_items[EMAIL_COMP_PRIOTRIY],
  2556.         EMAIL_MAX_PRIORITY_ITEM,
  2557.         email_p->misc_info.priority_list,
  2558.         &email_p->comp_info.priority_indx);
  2559.     ShowAsControl(&(wgui_inline_items[EMAIL_COMP_PRIOTRIY]));
  2560.     /* CONTENT */
  2561.     SetInlineItemActivation(&wgui_inline_items[EMAIL_COMP_CONT], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2562.     SetInlineMultiLineRdOnly(
  2563.         &wgui_inline_items[EMAIL_COMP_CONT],
  2564.         (U8*) email_p->comp_info.cont_buff,
  2565.         pfnUnicodeStrlen((S8*) email_p->comp_info.cont_buff),
  2566.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2567.         7);
  2568.     DisableInlineItemHighlight(&wgui_inline_items[EMAIL_COMP_CONT]);
  2569. }
  2570. /*****************************************************************************
  2571.  * FUNCTION
  2572.  *  mmi_email_comp_change_rsk
  2573.  * DESCRIPTION
  2574.  *  Change right soft key according to current state of inline edior screen
  2575.  * PARAMETERS
  2576.  *  void
  2577.  * RETURNS
  2578.  *  void
  2579.  *****************************************************************************/
  2580. void mmi_email_comp_change_rsk(void)
  2581. {
  2582.     /*----------------------------------------------------------------*/
  2583.     /* Local Variables                                                */
  2584.     /*----------------------------------------------------------------*/
  2585.     /*----------------------------------------------------------------*/
  2586.     /* Code Body                                                      */
  2587.     /*----------------------------------------------------------------*/
  2588.     if (mmi_email_comp_get_done_status())
  2589.     {
  2590.         ChangeRightSoftkey(STR_GLOBAL_DONE, 0);
  2591.         SetRightSoftkeyFunction(mmi_email_entry_comp_opt, KEY_EVENT_UP);
  2592.     }
  2593. }
  2594. /*****************************************************************************
  2595.  * FUNCTION
  2596.  *  mmi_email_comp_get_done_status
  2597.  * DESCRIPTION
  2598.  *  Pre-Entry function of Write Email screen
  2599.  * PARAMETERS
  2600.  *  void
  2601.  * RETURNS
  2602.  *  void
  2603.  *****************************************************************************/
  2604. BOOL mmi_email_comp_get_done_status(void)
  2605. {
  2606.     /*----------------------------------------------------------------*/
  2607.     /* Local Variables                                                */
  2608.     /*----------------------------------------------------------------*/
  2609.     /*----------------------------------------------------------------*/
  2610.     /* Code Body                                                      */
  2611.     /*----------------------------------------------------------------*/
  2612.     if (email_p->comp_info.done_flag == FALSE)
  2613.     {
  2614.         if (email_p->comp_info.addr_list[EMAIL_ADDR_TO].num_addr ||
  2615.             email_p->comp_info.addr_list[EMAIL_ADDR_CC].num_addr ||
  2616.             email_p->comp_info.total_attch ||
  2617.             pfnUnicodeStrlen((S8*) email_p->comp_info.subj_buff) ||
  2618.             (email_p->comp_info.priority_indx != 0) || pfnUnicodeStrlen((S8*) email_p->comp_info.cont_buff))
  2619.         {
  2620.             email_p->comp_info.done_flag = TRUE;
  2621.         }
  2622.     }
  2623.     return email_p->comp_info.done_flag;
  2624. }
  2625. /*****************************************************************************
  2626.  * FUNCTION
  2627.  *  mmi_email_comp_fill_attach
  2628.  * DESCRIPTION
  2629.  *  Fill image of attachments to Write Email screen.
  2630.  * PARAMETERS
  2631.  *  void
  2632.  * RETURNS
  2633.  *  void
  2634.  *****************************************************************************/
  2635. void mmi_email_comp_fill_attach(void)
  2636. {
  2637.     /*----------------------------------------------------------------*/
  2638.     /* Local Variables                                                */
  2639.     /*----------------------------------------------------------------*/
  2640.     S32 i;
  2641.     U16 img_id;
  2642.     /*----------------------------------------------------------------*/
  2643.     /* Code Body                                                      */
  2644.     /*----------------------------------------------------------------*/
  2645.     for (i = 0; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  2646.     {
  2647.         if (email_p->comp_info.attch_list[i].attch_present)
  2648.         {
  2649.             img_id = mmi_email_util_get_attch_icon((S8*) email_p->comp_info.attch_list[i].file_path);
  2650.         }
  2651.         else
  2652.         {
  2653.             img_id = IMG_EMAIL_BALNK_ID;
  2654.         }
  2655.         email_p->comp_info.attch_icon[i].image1 = (PU8) GetImage(img_id);
  2656.     }
  2657.     /* update to UI */
  2658.     AddEmailImageAttachmentUI(&wgui_inline_items[3], (wgui_inline_images_detail*) email_p->comp_info.attch_icon);
  2659. }
  2660. /*****************************************************************************
  2661.  * FUNCTION
  2662.  *  mmi_email_comp_attach_lsk_func
  2663.  * DESCRIPTION
  2664.  *  Left soft key function of attachment component in Write Email screen.
  2665.  * PARAMETERS
  2666.  *  image       [IN]        Currently no use
  2667.  *  str         [IN]        Currently no use
  2668.  * RETURNS
  2669.  *  void
  2670.  *****************************************************************************/
  2671. void mmi_email_comp_attach_lsk_func(PU8 image, UI_string_type str)
  2672. {
  2673.     /*----------------------------------------------------------------*/
  2674.     /* Local Variables                                                */
  2675.     /*----------------------------------------------------------------*/
  2676.     /*----------------------------------------------------------------*/
  2677.     /* Code Body                                                      */
  2678.     /*----------------------------------------------------------------*/
  2679.     mmi_email_entry_comp_attch();
  2680. }
  2681. /*****************************************************************************
  2682.  * FUNCTION
  2683.  *  mmi_email_comp_attach_rsk_func
  2684.  * DESCRIPTION
  2685.  *  Right soft key function of attachment component in Write Email screen.
  2686.  * PARAMETERS
  2687.  *  image       [IN]        Currently no use
  2688.  *  str         [IN]        Currently no use
  2689.  * RETURNS
  2690.  *  void
  2691.  *****************************************************************************/
  2692. void mmi_email_comp_attach_rsk_func(PU8 image, UI_string_type str)
  2693. {
  2694.     /*----------------------------------------------------------------*/
  2695.     /* Local Variables                                                */
  2696.     /*----------------------------------------------------------------*/
  2697.     /*----------------------------------------------------------------*/
  2698.     /* Code Body                                                      */
  2699.     /*----------------------------------------------------------------*/
  2700.     GoBackHistory();
  2701. }
  2702. /*****************************************************************************
  2703.  * FUNCTION
  2704.  *  mmi_email_hilite_comp_inline_item
  2705.  * DESCRIPTION
  2706.  *  Highlight handler of Write Email screen
  2707.  * PARAMETERS
  2708.  *  index       [IN]        Index of highlighted item
  2709.  * RETURNS
  2710.  *  void
  2711.  *****************************************************************************/
  2712. void mmi_email_hilite_comp_inline_item(S32 index)
  2713. {
  2714.     /*----------------------------------------------------------------*/
  2715.     /* Local Variables                                                */
  2716.     /*----------------------------------------------------------------*/
  2717.     /*----------------------------------------------------------------*/
  2718.     /* Code Body                                                      */
  2719.     /*----------------------------------------------------------------*/
  2720.     email_p->comp_info.curr_inline_item = (U8) index;
  2721.     email_p->comp_info.curr_addr_type = EMAIL_ADDR_NONE;
  2722.     switch (email_p->comp_info.curr_inline_item)
  2723.     {
  2724.         case EMAIL_COMP_TO:
  2725.             email_p->comp_info.curr_addr_type = EMAIL_ADDR_TO;
  2726.             mmi_email_util_change_title(STR_EMAIL_TO_ID);
  2727.             break;
  2728.         case EMAIL_COMP_CC:
  2729.             email_p->comp_info.curr_addr_type = EMAIL_ADDR_CC;
  2730.             mmi_email_util_change_title(STR_EMAIL_CC_ID);
  2731.             break;
  2732.         case EMAIL_COMP_SUBJ:
  2733.             mmi_email_util_change_title(STR_EMAIL_SUBJECT_ID);
  2734.             pfnUnicodeStrcpy((S8*) email_p->misc_info.subj_inline_buff, (S8*) email_p->comp_info.subj_buff);
  2735.             break;
  2736.         case EMAIL_COMP_CONT:
  2737.             mmi_email_util_change_title(STR_EMAIL_CONTENT_ID);
  2738.             ChangeLeftSoftkey(STR_GLOBAL_EDIT, IMG_GLOBAL_OK);
  2739.             pfnUnicodeStrcpy((S8*) email_p->misc_info.cont_inline_buff, (S8*) email_p->comp_info.cont_buff);
  2740.             SetLeftSoftkeyFunction(mmi_email_entry_comp_cont, KEY_EVENT_UP);
  2741.             break;
  2742.         case EMAIL_COMP_ATTCH:
  2743.             mmi_email_util_change_title(STR_EMAIL_ATTACHMENT_ID);
  2744.             break;
  2745.         default:    /* case EMAIL_COMP_PRIOTRIY:  */
  2746.             mmi_email_util_change_title(STR_EMAIL_PRIORITY_ID);
  2747.             break;
  2748.     }
  2749.     mmi_email_comp_change_rsk();
  2750. }
  2751. /*****************************************************************************
  2752.  * FUNCTION
  2753.  *  mmi_email_entry_comp_subj_opt
  2754.  * DESCRIPTION
  2755.  *  Entry function of subject option for full screen editor.
  2756.  * PARAMETERS
  2757.  *  void
  2758.  * RETURNS
  2759.  *  void
  2760.  *****************************************************************************/
  2761. void mmi_email_entry_comp_subj_opt(void)
  2762. {
  2763.     /*----------------------------------------------------------------*/
  2764.     /* Local Variables                                                */
  2765.     /*----------------------------------------------------------------*/
  2766.     U16 numItems;
  2767.     U16 nStrItemList[2];    /* only done and input method */
  2768.     U8 *guiBuffer;
  2769.     /*----------------------------------------------------------------*/
  2770.     /* Code Body                                                      */
  2771.     /*----------------------------------------------------------------*/
  2772.     EntryNewScreen(SCR_ID_EMAIL_COMP_SUBJ_INPUT_OPT, NULL, mmi_email_entry_comp_subj_opt, NULL);
  2773.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_SUBJ_INPUT_OPT);
  2774.     SetParentHandler(MENU_ID_EMAIL_COMP_SUBJ_OPT);
  2775.     numItems = GetNumOfChild(MENU_ID_EMAIL_COMP_SUBJ_OPT);
  2776.     GetSequenceStringIds(MENU_ID_EMAIL_COMP_SUBJ_OPT, nStrItemList);
  2777.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2778.     ShowCategory52Screen(
  2779.         STR_GLOBAL_OPTIONS,
  2780.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2781.         STR_GLOBAL_OK,
  2782.         IMG_GLOBAL_OK,
  2783.         STR_GLOBAL_BACK,
  2784.         IMG_GLOBAL_BACK,
  2785.         numItems,
  2786.         nStrItemList,
  2787.         (U16*) gIndexIconsImageList,
  2788.         NULL,
  2789.         0,
  2790.         0,
  2791.         guiBuffer);
  2792.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2793.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2794. }
  2795. /*****************************************************************************
  2796.  * FUNCTION
  2797.  *  mmi_email_comp_add_attach
  2798.  * DESCRIPTION
  2799.  *  Enter file manager to select an file to attach
  2800.  * PARAMETERS
  2801.  *  void
  2802.  * RETURNS
  2803.  *  void
  2804.  *****************************************************************************/
  2805. void mmi_email_comp_add_attach(void)
  2806. {
  2807.     /*----------------------------------------------------------------*/
  2808.     /* Local Variables                                                */
  2809.     /*----------------------------------------------------------------*/
  2810.     FMGR_FILTER filter;
  2811.     /*----------------------------------------------------------------*/
  2812.     /* Code Body                                                      */
  2813.     /*----------------------------------------------------------------*/
  2814.     FMGR_FILTER_INIT(&filter);
  2815.     FMGR_FILTER_SET_ALL(&filter);
  2816.     mmi_fmgr_select_path_and_enter(
  2817.         APP_EMAIL,
  2818.         FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2819.         filter,
  2820.         (S8*) L"root",
  2821.         mmi_email_comp_add_attach_callback);
  2822. }
  2823. /*****************************************************************************
  2824.  * FUNCTION
  2825.  *  mmi_email_comp_add_attach_callback
  2826.  * DESCRIPTION
  2827.  *  Callback function when finish selecting an file for attachment
  2828.  * PARAMETERS
  2829.  *  filePath        [IN]        Path and name of selected file
  2830.  *  is_short        [IN]        
  2831.  * RETURNS
  2832.  *  void
  2833.  *****************************************************************************/
  2834. void mmi_email_comp_add_attach_callback(void *filePath, int is_short)
  2835. {
  2836.     /*----------------------------------------------------------------*/
  2837.     /* Local Variables                                                */
  2838.     /*----------------------------------------------------------------*/    
  2839.     S32 dirLen;
  2840.     S8 *fileName = (S8*) filePath;        
  2841.     S32 origLen;
  2842.     S32 fileLen;
  2843.     S32 f_result;
  2844.     S8 *fileExt;
  2845.     S8 i = email_p->misc_info.curr_hilite_attch;
  2846.     /*----------------------------------------------------------------*/
  2847.     /* Code Body                                                      */
  2848.     /*----------------------------------------------------------------*/
  2849.     if (filePath == NULL)
  2850.     {
  2851.         GoBackToHistory(SCR_ID_EMAIL_COMP_ATTCH);