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

MTK

开发平台:

C/C++

  1.     ShowCategory57Screen(
  2.         STR_EMAIL_SMTP_SETTING_ID,
  3.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  4.         STR_GLOBAL_EDIT,
  5.         IMG_GLOBAL_BACK,
  6.         STR_GLOBAL_DONE,
  7.         IMG_GLOBAL_BACK,
  8.         EMAIL_SMTP_TOTAL_ITEM,
  9.         (U16*) smtp_icons,
  10.         wgui_inline_items,
  11.         email_p->prof_info.prof_misc.curr_hilite_indx,
  12.         guiBuffer);
  13.     SetCategory57RightSoftkeyFunctions(mmi_email_prof_save_confirm, GoBackHistory);
  14. }
  15. /*****************************************************************************
  16.  * FUNCTION
  17.  *  mmi_email_exit_prof_smtp
  18.  * DESCRIPTION
  19.  *  Exit function of SMTP setting screen
  20.  * PARAMETERS
  21.  *  void
  22.  * RETURNS
  23.  *  void
  24.  *****************************************************************************/
  25. void mmi_email_exit_prof_smtp(void)
  26. {
  27.     /*----------------------------------------------------------------*/
  28.     /* Local Variables                                                */
  29.     /*----------------------------------------------------------------*/
  30.     /*----------------------------------------------------------------*/
  31.     /* Code Body                                                      */
  32.     /*----------------------------------------------------------------*/
  33.     set_leading_zero(TRUE);
  34.     mmi_email_util_add_n_history(SCR_ID_EMAIL_PROF_SMTP, mmi_email_entry_prof_smtp);
  35. }
  36. /*****************************************************************************
  37.  * FUNCTION
  38.  *  mmi_email_prof_save_smtp
  39.  * DESCRIPTION
  40.  *  Function to save SMTP setting
  41.  * PARAMETERS
  42.  *  void
  43.  * RETURNS
  44.  *  void
  45.  *****************************************************************************/
  46. void mmi_email_prof_save_smtp(void)
  47. {
  48.     /*----------------------------------------------------------------*/
  49.     /* Local Variables                                                */
  50.     /*----------------------------------------------------------------*/
  51.     S32 OutgoingPortnumber;
  52.     /*----------------------------------------------------------------*/
  53.     /* Code Body                                                      */
  54.     /*----------------------------------------------------------------*/
  55.     CloseCategory57Screen();
  56.     OutgoingPortnumber = gui_atoi((UI_string_type) email_p->prof_info.editing_prof.smtp_info.out_port);
  57.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.smtp_info.out_port) == 0)
  58.     {
  59.         OutgoingPortnumber = EMAIL_DEFAULT_SMTP_PORT;
  60.         gui_itoa(OutgoingPortnumber, (UI_string_type) email_p->prof_info.editing_prof.smtp_info.out_port, 10);
  61.     }
  62.     if ((OutgoingPortnumber > EMAIL_MAX_PORT) || (OutgoingPortnumber < EMAIL_MIN_PORT))
  63.     {
  64.         DisplayPopup(
  65.             (U8*) GetString(STR_EMAIL_PORT_NUMBER_OUTOF_RANGE),
  66.             IMG_GLOBAL_ERROR,
  67.             0,
  68.             UI_POPUP_NOTIFYDURATION_TIME,
  69.             ERROR_TONE);
  70.     }
  71.     else if ((pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.smtp_info.email_addr)) == 0)
  72.     {
  73.         DisplayPopup(
  74.             (U8*) GetString(STR_EMAIL_EMAIL_ADDRESS_EMPTY),
  75.             IMG_GLOBAL_ERROR,
  76.             1,
  77.             UI_POPUP_NOTIFYDURATION_TIME,
  78.             ERROR_TONE);
  79.         email_p->prof_info.prof_misc.curr_hilite_indx = (EMAIL_SMTP_ADDR);
  80.     }
  81.     else if (!mmi_email_util_chk_addr((U8*) email_p->prof_info.editing_prof.smtp_info.email_addr))
  82.     {
  83.         DisplayPopup(
  84.             (U8*) GetString(STR_EMAIL_ERROR_CODE_INVALID_EMAIL_ADDR_ID),
  85.             IMG_GLOBAL_ERROR,
  86.             0,
  87.             UI_POPUP_NOTIFYDURATION_TIME,
  88.             ERROR_TONE);
  89.         email_p->prof_info.prof_misc.curr_hilite_indx = (EMAIL_SMTP_ADDR);
  90.     }
  91.     else if (!mmi_email_util_is_username_vaild((S8*) email_p->prof_info.editing_prof.smtp_info.user_name))
  92.     {
  93.         DisplayPopup(
  94.             (U8*) GetString(STR_EMAIL_WRONG_USERNAME),
  95.             IMG_GLOBAL_ERROR,
  96.             0,
  97.             UI_POPUP_NOTIFYDURATION_TIME,
  98.             ERROR_TONE);
  99.         email_p->prof_info.prof_misc.curr_hilite_indx = (EMAIL_SMTP_USERNAME);
  100.     }
  101.     else
  102.     {
  103.         mmi_email_pre_entry_progressing(
  104.             STR_EMAIL_MAIN_ID,
  105.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  106.             0,
  107.             0,
  108.             0,
  109.             0,
  110.             (U8*) GetString(STR_GLOBAL_SAVING),
  111.             NULL,
  112.             IMG_EMAIL_SENDING_ID,
  113.             NULL,
  114.             NULL,
  115.             NULL,
  116.             0);
  117.         mmi_email_ps_set_acct_profile_req();
  118.     }
  119. }
  120. /*****************************************************************************
  121.  * FUNCTION
  122.  *  mmi_email_prof_fill_smtp_inline_struct
  123.  * DESCRIPTION
  124.  *  Fill inline sturcture of SMTP setting.
  125.  * PARAMETERS
  126.  *  void
  127.  * RETURNS
  128.  *  void
  129.  *****************************************************************************/
  130. void mmi_email_prof_fill_smtp_inline_struct(void)
  131. {
  132.     /*----------------------------------------------------------------*/
  133.     /* Local Variables                                                */
  134.     /*----------------------------------------------------------------*/
  135.     /*----------------------------------------------------------------*/
  136.     /* Code Body                                                      */
  137.     /*----------------------------------------------------------------*/
  138.     /* caption of outgoing server */
  139.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  140.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_EMAIL_OUTGOING_SERVER_ID));
  141.     /* outgoing server */
  142.     SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
  143.     SetInlineItemFullScreenEdit(
  144.         &wgui_inline_items[1],
  145.         STR_EMAIL_OUTGOING_SERVER_ID,
  146.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  147.         (U8*) email_p->prof_info.editing_prof.smtp_info.out_server,
  148.         MMI_EMAIL_MAX_SERVER_NAME + 1,
  149.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  150.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_email_hilite_prof_full_edit);
  151.     set_leading_zero(FALSE);
  152.     /* caption of outgoing port */
  153.     SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
  154.     SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_EMAIL_OUTGOING_PORT_ID));
  155.     /* outgoing port */
  156.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  157.     SetInlineItemTextEdit(
  158.         &wgui_inline_items[3],
  159.         (U8*) email_p->prof_info.editing_prof.smtp_info.out_port,
  160.         EMAIL_MAX_PROF_PORT_LEN + 1,
  161.         INPUT_TYPE_NUMERIC);
  162.     RightJustifyInlineItem(&wgui_inline_items[3]);
  163.     EnableInlineItemBoundary(&wgui_inline_items[3]);
  164.     DisableInlineItemHighlight(&wgui_inline_items[3]);
  165.     /* caption of display name */
  166.     SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
  167.     SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_EMAIL_DISPLAY_NAME_ID));
  168.     /* dispaly name */
  169.     SetInlineItemActivation(&wgui_inline_items[5], KEY_LSK, KEY_EVENT_UP);
  170.     SetInlineItemFullScreenEdit(
  171.         &wgui_inline_items[5],
  172.         STR_EMAIL_DISPLAY_NAME_ID,
  173.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  174.         (U8*) email_p->prof_info.editing_prof.smtp_info.disp_name,
  175.         EMAIL_PROF_DISP_NAME_LEN + 1,
  176.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  177.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[5], mmi_email_hilite_prof_full_edit);
  178.     /* caption of email address */
  179.     SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
  180.     SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_EMAIL_EMAIL_ADDRESS_ID));
  181.     /* email address */
  182.     SetInlineItemActivation(&wgui_inline_items[7], KEY_LSK, KEY_EVENT_UP);
  183. #if 0
  184. /* under construction !*/
  185. /* under construction !*/
  186. /* under construction !*/
  187. /* under construction !*/
  188. /* under construction !*/
  189. /* under construction !*/
  190. /* under construction !*/
  191. /* under construction !*/
  192. #endif
  193.     SetInlineItemFullScreenEdit_ext(
  194.         &wgui_inline_items[7], 
  195.         STR_EMAIL_EMAIL_ADDRESS_ID, 
  196.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN), 
  197.         (U8*)email_p->prof_info.editing_prof.smtp_info.email_addr, 
  198.         MMI_EMAIL_MAX_LEN_EMAIL_ADDRESS + 1, 
  199.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES |INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, 
  200.         INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL);
  201.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[7], mmi_email_hilite_prof_full_edit_ext);
  202.     /* caption of username */
  203.     SetInlineItemActivation(&wgui_inline_items[8], KEY_LSK, KEY_EVENT_UP);
  204.     SetInlineItemCaption(&wgui_inline_items[8], (U8*) GetString(STR_EMAIL_USER_NAME_ID));
  205.     /* username */
  206.     SetInlineItemActivation(&wgui_inline_items[9], KEY_LSK, KEY_EVENT_UP);
  207.     SetInlineItemFullScreenEdit(
  208.         &wgui_inline_items[9],
  209.         STR_EMAIL_USER_NAME_ID,
  210.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  211.         (U8*) email_p->prof_info.editing_prof.smtp_info.user_name,
  212.         MMI_EMAIL_USR_MAX_LEN + 1,
  213.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  214.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[9], mmi_email_hilite_prof_full_edit);
  215.     /* caption of password */
  216.     SetInlineItemActivation(&wgui_inline_items[10], KEY_LSK, KEY_EVENT_UP);
  217.     SetInlineItemCaption(&wgui_inline_items[10], (U8*) GetString(STR_EMAIL_PASSWORD_ID));
  218.     /* password */
  219.     SetInlineItemActivation(&wgui_inline_items[11], KEY_LSK, KEY_EVENT_UP);
  220.     SetInlineItemFullScreenEdit(
  221.         &wgui_inline_items[11],
  222.         STR_EMAIL_PASSWORD_ID,
  223.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  224.         (U8*) email_p->prof_info.editing_prof.smtp_info.passwd,
  225.         MMI_EMAIL_PASS_MAX_LEN + 1,
  226.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_PASSWORD);
  227.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[11], mmi_email_hilite_prof_full_edit);
  228. }
  229. /*****************************************************************************
  230.  * FUNCTION
  231.  *  mmi_email_hilite_prof_full_edit
  232.  * DESCRIPTION
  233.  *  Highlight handler of all common full screen eidtor.
  234.  * PARAMETERS
  235.  *  void
  236.  * RETURNS
  237.  *  void
  238.  *****************************************************************************/
  239. void mmi_email_hilite_prof_full_edit(void)
  240. {
  241.     /*----------------------------------------------------------------*/
  242.     /* Local Variables                                                */
  243.     /*----------------------------------------------------------------*/
  244.     /*----------------------------------------------------------------*/
  245.     /* Code Body                                                      */
  246.     /*----------------------------------------------------------------*/
  247.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, 0);
  248.     SetLeftSoftkeyFunction(mmi_email_entry_comm_full_edit_opt, KEY_EVENT_UP);
  249. }
  250. /*****************************************************************************
  251. * FUNCTION
  252. * mmi_email_hilite_prof_full_edit_ext
  253. * DESCRIPTION
  254. * Highlight handler of full screen eidtor without newline symbol.
  255. * PARAMETERS
  256. * None.
  257. * RETURNS
  258. * None.
  259. * GLOBALS AFFECTED
  260. * None.
  261. *****************************************************************************/
  262. void mmi_email_hilite_prof_full_edit_ext(void)
  263. {
  264. ChangeLeftSoftkey (STR_GLOBAL_OPTIONS, 0);
  265. SetLeftSoftkeyFunction(mmi_email_entry_comm_full_edit_opt, KEY_EVENT_UP);
  266. #ifdef __MMI_TOUCH_SCREEN__
  267.     mmi_pen_editor_set_vk_keys(MMI_FALSE, NULL, g_email_disable_new_line);
  268. #endif
  269. }
  270. /*****************************************************************************
  271.  * FUNCTION
  272.  *  mmi_email_hilite_prof_done
  273.  * DESCRIPTION
  274.  *  Highlight handler of all common full screen eidtor -> Done option
  275.  * PARAMETERS
  276.  *  void
  277.  * RETURNS
  278.  *  void
  279.  *****************************************************************************/
  280. void mmi_email_hilite_prof_done(void)
  281. {
  282.     /*----------------------------------------------------------------*/
  283.     /* Local Variables                                                */
  284.     /*----------------------------------------------------------------*/
  285.     /*----------------------------------------------------------------*/
  286.     /* Code Body                                                      */
  287.     /*----------------------------------------------------------------*/
  288.     SetLeftSoftkeyFunction(ConfirmInlineFullScreenEdit, KEY_EVENT_UP);
  289. }
  290. /*****************************************************************************
  291.  * FUNCTION
  292.  *  mmi_email_hilite_prof_input_meth
  293.  * DESCRIPTION
  294.  *  Highlight handler of all common full screen eidtor -> Input Method option
  295.  * PARAMETERS
  296.  *  void
  297.  * RETURNS
  298.  *  void
  299.  *****************************************************************************/
  300. void mmi_email_hilite_prof_input_meth(void)
  301. {
  302.     /*----------------------------------------------------------------*/
  303.     /* Local Variables                                                */
  304.     /*----------------------------------------------------------------*/
  305.     /*----------------------------------------------------------------*/
  306.     /* Code Body                                                      */
  307.     /*----------------------------------------------------------------*/
  308.     RegisterInputMethodScreenCloseFunction(mmi_email_util_go_back_2_hist);
  309.     SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
  310. }
  311. /*****************************************************************************
  312.  * FUNCTION
  313.  *  mmi_email_entry_prof_pop3_imap4
  314.  * DESCRIPTION
  315.  *  Entry POP3/IMAP4 setting screen
  316.  * PARAMETERS
  317.  *  void
  318.  * RETURNS
  319.  *  void
  320.  *****************************************************************************/
  321. void mmi_email_entry_prof_pop3_imap4(void)
  322. {
  323.     /*----------------------------------------------------------------*/
  324.     /* Local Variables                                                */
  325.     /*----------------------------------------------------------------*/
  326.     U16 pop3_imap4_icons[EMAIL_POP3_TOTAL_ITEM];
  327.     U8 *guiBuffer;
  328.     U8 *inputBuffer;
  329.     U16 inputBufferSize;
  330.     S32 num_of_items = EMAIL_POP3_TOTAL_ITEM;
  331.     S32 i = 0;
  332.     /*----------------------------------------------------------------*/
  333.     /* Code Body                                                      */
  334.     /*----------------------------------------------------------------*/
  335.     EntryNewScreen(SCR_ID_EMAIL_PROF_POP3_IMAP4, mmi_email_exit_prof_pop3_imap4, NULL, NULL);
  336.     InitializeCategory57Screen();
  337.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_PROF_POP3_IMAP4);
  338.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_PROF_POP3_IMAP4, &inputBufferSize);
  339.     mmi_email_prof_fill_pop3_imap4_inline_struct();
  340.     for (i = 0; i <= EMAIL_POP3_PASSWD; i++)
  341.     {
  342.         if (i % 2)
  343.         {
  344.             pop3_imap4_icons[i] = 0;
  345.         }
  346.         else
  347.         {
  348.             pop3_imap4_icons[i] = IMG_EMAIL_INCOMING_SERVER_ID + (i / 2);
  349.         }
  350.     }
  351. #ifdef __MMI_EMAIL_COPY_ON_SERVER__
  352.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  353.         /* remove sent/draft folder name items */
  354.         if (email_p->prof_info.editing_prof.setting_info.in_prot == MMI_EMAIL_PROTOCOL_POP3)
  355.         {
  356.             num_of_items -= 4;
  357.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 1] = IMG_EMAIL_SERVER_COPY_ID;
  358.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 2] = 0;
  359.         }
  360.         else /* MMI_EMAIL_PROTOCOL_IMAP4 */
  361.         {
  362.             num_of_items -= 2;
  363.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 1] = IMG_EMAIL_DRAFT_FOLDER_ID;
  364.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 2] = 0;
  365.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 3] = IMG_EMAIL_SENT_FOLDER_ID;
  366.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 4] = 0;
  367.         }
  368.     #else /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
  369.         pop3_imap4_icons[EMAIL_POP3_PASSWD + 1] = IMG_EMAIL_SERVER_COPY_ID;
  370.         pop3_imap4_icons[EMAIL_POP3_PASSWD + 2] = 0;
  371.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
  372. #else /* __MMI_EMAIL_COPY_ON_SERVER__ */
  373.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  374.         if (email_p->prof_info.editing_prof.setting_info.in_prot == MMI_EMAIL_PROTOCOL_POP3)
  375.         {
  376.             num_of_items -= 4;
  377.         }
  378.         else /* MMI_EMAIL_PROTOCOL_IMAP4 */
  379.         {
  380.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 1] = IMG_EMAIL_DRAFT_FOLDER_ID;
  381.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 2] = 0;
  382.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 3] = IMG_EMAIL_SENT_FOLDER_ID;
  383.             pop3_imap4_icons[EMAIL_POP3_PASSWD + 4] = 0;
  384.         }
  385.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */
  386. #endif /* __MMI_EMAIL_COPY_ON_SERVER__ */
  387.     if (inputBuffer != NULL)
  388.     {
  389.         SetCategory57Data(wgui_inline_items, num_of_items, inputBuffer);
  390.     }
  391.     ShowCategory57Screen(
  392.         STR_EMAIL_POP3_IMAP4_SETTING_ID,
  393.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  394.         STR_GLOBAL_EDIT,
  395.         IMG_GLOBAL_BACK,
  396.         STR_GLOBAL_BACK,
  397.         IMG_GLOBAL_BACK,
  398.         num_of_items,
  399.         (U16*) pop3_imap4_icons,
  400.         wgui_inline_items,
  401.         0,
  402.         guiBuffer);
  403.     SetCategory57RightSoftkeyFunctions(mmi_email_prof_save_confirm, GoBackHistory);
  404. }
  405. /*****************************************************************************
  406.  * FUNCTION
  407.  *  mmi_email_exit_prof_pop3_imap4
  408.  * DESCRIPTION
  409.  *  Exit function of POP3/IMAP4 setting screen
  410.  * PARAMETERS
  411.  *  void
  412.  * RETURNS
  413.  *  void
  414.  *****************************************************************************/
  415. void mmi_email_exit_prof_pop3_imap4(void)
  416. {
  417.     /*----------------------------------------------------------------*/
  418.     /* Local Variables                                                */
  419.     /*----------------------------------------------------------------*/
  420.     /*----------------------------------------------------------------*/
  421.     /* Code Body                                                      */
  422.     /*----------------------------------------------------------------*/
  423.     set_leading_zero(TRUE);
  424.     mmi_email_util_add_n_history(SCR_ID_EMAIL_PROF_POP3_IMAP4, mmi_email_entry_prof_pop3_imap4);
  425. }
  426. /*****************************************************************************
  427.  * FUNCTION
  428.  *  mmi_email_prof_save_pop3_imap4
  429.  * DESCRIPTION
  430.  *  Function to save POP3/IMAP4 setting
  431.  * PARAMETERS
  432.  *  void
  433.  * RETURNS
  434.  *  void
  435.  *****************************************************************************/
  436. void mmi_email_prof_save_pop3_imap4(void)
  437. {
  438.     /*----------------------------------------------------------------*/
  439.     /* Local Variables                                                */
  440.     /*----------------------------------------------------------------*/
  441.     S32 IncomingPortNumber;
  442.     /*----------------------------------------------------------------*/
  443.     /* Code Body                                                      */
  444.     /*----------------------------------------------------------------*/
  445.     CloseCategory57Screen();
  446.     IncomingPortNumber = gui_atoi((UI_string_type) email_p->prof_info.editing_prof.pop_imap_info.in_port);
  447.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.pop_imap_info.in_port) == 0)
  448.     {
  449.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  450.         if (email_p->prof_info.editing_prof.setting_info.in_prot == EMAIL_PROT_POP3)
  451.         {
  452.             IncomingPortNumber = EMAIL_DEFAULT_POP3_PORT;
  453.         }
  454.         else
  455.         {
  456.             IncomingPortNumber = EMAIL_DEFAULT_IMAP4_PORT;
  457.         }
  458.     #else /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  459.         IncomingPortNumber = EMAIL_DEFAULT_POP3_PORT;
  460.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  461.         gui_itoa(IncomingPortNumber, (UI_string_type) email_p->prof_info.editing_prof.pop_imap_info.in_port, 10);
  462.     }
  463.     if (IncomingPortNumber > EMAIL_MAX_PORT || IncomingPortNumber < EMAIL_MIN_PORT)
  464.     {
  465.         DisplayPopup(
  466.             (U8*) GetString(STR_EMAIL_PORT_NUMBER_OUTOF_RANGE),
  467.             IMG_GLOBAL_ERROR,
  468.             0,
  469.             UI_POPUP_NOTIFYDURATION_TIME,
  470.             ERROR_TONE);
  471.     }
  472.     else if (!mmi_email_util_is_username_vaild((S8*) email_p->prof_info.editing_prof.pop_imap_info.user_name))
  473.     {
  474.         DisplayPopup(
  475.             (U8*) GetString(STR_EMAIL_WRONG_USERNAME),
  476.             IMG_GLOBAL_ERROR,
  477.             0,
  478.             UI_POPUP_NOTIFYDURATION_TIME,
  479.             ERROR_TONE);
  480.         email_p->prof_info.prof_misc.curr_hilite_indx = (EMAIL_POP3_USERNAME);
  481.     }
  482.     else
  483.     {
  484.         mmi_email_pre_entry_progressing(
  485.             STR_EMAIL_MAIN_ID,
  486.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  487.             0,
  488.             0,
  489.             0,
  490.             0,
  491.             (U8*) GetString(STR_GLOBAL_SAVING),
  492.             NULL,
  493.             IMG_EMAIL_SENDING_ID,
  494.             NULL,
  495.             NULL,
  496.             NULL,
  497.             0);
  498.         mmi_email_ps_set_acct_profile_req();
  499.     }
  500. }
  501. /*****************************************************************************
  502.  * FUNCTION
  503.  *  mmi_email_prof_fill_pop3_imap4_inline_struct
  504.  * DESCRIPTION
  505.  *  Fill inline structure for POP/IMAP4 screen.
  506.  * PARAMETERS
  507.  *  void
  508.  * RETURNS
  509.  *  void
  510.  *****************************************************************************/
  511. void mmi_email_prof_fill_pop3_imap4_inline_struct(void)
  512. {
  513.     /*----------------------------------------------------------------*/
  514.     /* Local Variables                                                */
  515.     /*----------------------------------------------------------------*/
  516.     /*----------------------------------------------------------------*/
  517.     /* Code Body                                                      */
  518.     /*----------------------------------------------------------------*/
  519. #ifdef __MMI_EMAIL_COPY_ON_SERVER__
  520.     /* On/Off inline selection */
  521.     email_p->prof_info.prof_misc.copy_on_server[0] = (U8*) GetString(STR_GLOBAL_OFF);
  522.     email_p->prof_info.prof_misc.copy_on_server[1] = (U8*) GetString(STR_GLOBAL_ON);
  523. #endif /* __MMI_EMAIL_COPY_ON_SERVER__ */
  524.     /* caption of incoming server */
  525.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_IN_SERVER_CAP], KEY_LSK, KEY_EVENT_UP);
  526.     SetInlineItemCaption(&wgui_inline_items[EMAIL_POP3_IN_SERVER_CAP], (U8*) GetString(STR_EMAIL_INCOMING_SERVER_ID));
  527.     /* incoming server */
  528.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_IN_SERVER], KEY_LSK, KEY_EVENT_UP);
  529.     SetInlineItemFullScreenEdit(
  530.         &wgui_inline_items[EMAIL_POP3_IN_SERVER],
  531.         STR_EMAIL_INCOMING_SERVER_ID,
  532.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  533.         (U8*) email_p->prof_info.editing_prof.pop_imap_info.in_server,
  534.         MMI_EMAIL_MAX_SERVER_NAME + 1,
  535.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  536.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[EMAIL_POP3_IN_SERVER], mmi_email_hilite_prof_full_edit);
  537.     set_leading_zero(FALSE);
  538.     /* caption of incoming port */
  539.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_IN_PORT_CAP], KEY_LSK, KEY_EVENT_UP);
  540.     SetInlineItemCaption(&wgui_inline_items[EMAIL_POP3_IN_PORT_CAP], (U8*) GetString(STR_EMAIL_INCOMING_PORT_ID));
  541.     /* incoming port */
  542.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_IN_PORT], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  543.     SetInlineItemTextEdit(
  544.         &wgui_inline_items[EMAIL_POP3_IN_PORT],
  545.         (U8*) email_p->prof_info.editing_prof.pop_imap_info.in_port,
  546.         EMAIL_MAX_PROF_PORT_LEN + 1,
  547.         INPUT_TYPE_NUMERIC);
  548.     RightJustifyInlineItem(&wgui_inline_items[EMAIL_POP3_IN_PORT]);
  549.     EnableInlineItemBoundary(&wgui_inline_items[EMAIL_POP3_IN_PORT]);
  550.     DisableInlineItemHighlight(&wgui_inline_items[EMAIL_POP3_IN_PORT]);
  551.     /* caption of username */
  552.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_USERNAME_CAP], KEY_LSK, KEY_EVENT_UP);
  553.     SetInlineItemCaption(&wgui_inline_items[EMAIL_POP3_USERNAME_CAP], (U8*) GetString(STR_EMAIL_USER_NAME_ID));
  554.     /* username */
  555.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_USERNAME], KEY_LSK, KEY_EVENT_UP);
  556.     SetInlineItemFullScreenEdit(
  557.         &wgui_inline_items[EMAIL_POP3_USERNAME],
  558.         STR_EMAIL_USER_NAME_ID,
  559.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  560.         (U8*) email_p->prof_info.editing_prof.pop_imap_info.user_name,
  561.         MMI_EMAIL_USR_MAX_LEN + 1,
  562.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  563.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[EMAIL_POP3_USERNAME], mmi_email_hilite_prof_full_edit);
  564.     /* caption of password */
  565.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD_CAP], KEY_LSK, KEY_EVENT_UP);
  566.     SetInlineItemCaption(&wgui_inline_items[EMAIL_POP3_PASSWD_CAP], (U8*) GetString(STR_EMAIL_PASSWORD_ID));
  567.     /* password */
  568.     SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD], KEY_LSK, KEY_EVENT_UP);
  569.     SetInlineItemFullScreenEdit(
  570.         &wgui_inline_items[EMAIL_POP3_PASSWD],
  571.         STR_EMAIL_PASSWORD_ID,
  572.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  573.         (U8*) email_p->prof_info.editing_prof.pop_imap_info.passwd,
  574.         MMI_EMAIL_PASS_MAX_LEN + 1,
  575.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_PASSWORD);
  576.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[EMAIL_POP3_PASSWD], mmi_email_hilite_prof_full_edit);
  577. #ifdef __MMI_EMAIL_COPY_ON_SERVER__
  578. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  579.     if (email_p->prof_info.editing_prof.setting_info.in_prot == MMI_EMAIL_PROTOCOL_POP3)
  580. #endif
  581.     {
  582.         /* caption of copy on server */
  583.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 1], KEY_LSK, KEY_EVENT_UP);
  584.         SetInlineItemCaption(&wgui_inline_items[EMAIL_POP3_PASSWD + 1], (U8*) GetString(STR_EMAIL_SERVER_COPY_ID));
  585.         /* copy on server */
  586.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  587.         SetInlineItemSelect(
  588.             &wgui_inline_items[EMAIL_POP3_PASSWD + 2],
  589.             EMAIL_PROF_SERVER_COPY_STATUS_ITEM,
  590.             email_p->prof_info.prof_misc.copy_on_server,
  591.             &email_p->prof_info.editing_prof.pop_imap_info.copy_on_server);
  592.     }    
  593. #endif /* __MMI_EMAIL_COPY_ON_SERVER__ */
  594. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  595.     if (email_p->prof_info.editing_prof.setting_info.in_prot == MMI_EMAIL_PROTOCOL_IMAP4)
  596.     {
  597.         /* caption of sent folder */
  598.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 1], KEY_LSK, KEY_EVENT_UP);
  599.         SetInlineItemCaption(
  600.             &wgui_inline_items[EMAIL_POP3_PASSWD + 1],
  601.             (U8*) GetString(STR_EMAIL_SENT_FOLDER_NAME));
  602.         /* sent folder */
  603.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 2], KEY_LSK, KEY_EVENT_UP);
  604.         SetInlineItemFullScreenEdit(
  605.             &wgui_inline_items[EMAIL_POP3_PASSWD + 2],
  606.             STR_EMAIL_SENT_FOLDER_NAME,
  607.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  608.             (U8*) email_p->prof_info.editing_prof.pop_imap_info.sent_name,
  609.             (EMAIL_MAX_FLDR_NAME_LEN + 1),
  610.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  611.         SetInlineFullScreenEditCustomFunction(
  612.             &wgui_inline_items[EMAIL_POP3_PASSWD + 2],
  613.             mmi_email_hilite_prof_full_edit);
  614.         /* caption of draft folder */
  615.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 3], KEY_LSK, KEY_EVENT_UP);
  616.         SetInlineItemCaption(
  617.             &wgui_inline_items[EMAIL_POP3_PASSWD + 3],
  618.             (U8*) GetString(STR_EMAIL_DRAFT_FOLDER_NAME));
  619.         /* draft folder */
  620.         SetInlineItemActivation(&wgui_inline_items[EMAIL_POP3_PASSWD + 4], KEY_LSK, KEY_EVENT_UP);
  621.         SetInlineItemFullScreenEdit(
  622.             &wgui_inline_items[EMAIL_POP3_PASSWD + 4],
  623.             STR_EMAIL_DRAFT_FOLDER_NAME,
  624.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  625.             (U8*) email_p->prof_info.editing_prof.pop_imap_info.draft_name,
  626.             (EMAIL_MAX_FLDR_NAME_LEN + 1),
  627.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  628.         SetInlineFullScreenEditCustomFunction(
  629.             &wgui_inline_items[EMAIL_POP3_PASSWD + 4],
  630.             mmi_email_hilite_prof_full_edit);
  631.     }
  632. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  633. }
  634. /*****************************************************************************
  635.  * FUNCTION
  636.  *  mmi_email_prof_is_activated
  637.  * DESCRIPTION
  638.  *  Determine is there any activated profile
  639.  * PARAMETERS
  640.  *  void
  641.  * RETURNS
  642.  *  TURE if one of the profiles is activated; otherwise, FALSE.
  643.  *****************************************************************************/
  644. U8 mmi_email_prof_is_activated(void)
  645. {
  646.     /*----------------------------------------------------------------*/
  647.     /* Local Variables                                                */
  648.     /*----------------------------------------------------------------*/
  649.     /*----------------------------------------------------------------*/
  650.     /* Code Body                                                      */
  651.     /*----------------------------------------------------------------*/
  652.     if (email_p->prof_info.act_prof.act_indx < MMI_EMAIL_MAX_ACCTS)
  653.     {
  654.         return TRUE;
  655.     }
  656.     else
  657.     {
  658.         return FALSE;
  659.     }
  660. }
  661. /*****************************************************************************
  662.  * FUNCTION
  663.  *  mmi_email_prof_update_hint
  664.  * DESCRIPTION
  665.  *  Update hint value in main menu when profile changed.
  666.  * PARAMETERS
  667.  *  void
  668.  * RETURNS
  669.  *  void
  670.  *****************************************************************************/
  671. void mmi_email_prof_update_hint(void)
  672. {
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     /*----------------------------------------------------------------*/
  677.     /* Code Body                                                      */
  678.     /*----------------------------------------------------------------*/
  679.     mmi_email_fldr_reset_cntx(EAMIL_RESET_EXCEPT_UNSENT);
  680. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  681.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3 || email_p->main_info.curr_menu == MMI_EMAIL_UNSENT)
  682.     {
  683.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  684.     }
  685.     else
  686.     {
  687.         email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_NOT_DONE;
  688.         email_p->fldr_info.curr_page = 1;
  689.         /* reset unread email */
  690.         email_p->main_info.unread_mails = 0;
  691.         mmi_email_util_update_status_icon();
  692.     }
  693. #else /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  694.     email_p->fldr_info.fldr_update_state = EMAIL_LIST_FLDR_REQUIRED;
  695. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  696. }
  697. #define SIG_EMAIL
  698. /*****************************************************************************
  699.  * FUNCTION
  700.  *  mmi_email_prof_pre_entry_sig
  701.  * DESCRIPTION
  702.  *  Pre-Entry function of Signature setting screen.
  703.  * PARAMETERS
  704.  *  void
  705.  * RETURNS
  706.  *  void
  707.  *****************************************************************************/
  708. void mmi_email_prof_pre_entry_sig(void)
  709. {
  710.     /*----------------------------------------------------------------*/
  711.     /* Local Variables                                                */
  712.     /*----------------------------------------------------------------*/
  713.     /*----------------------------------------------------------------*/
  714.     /* Code Body                                                      */
  715.     /*----------------------------------------------------------------*/
  716.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.img_name))
  717.     {
  718.         S8 *fileExt = mmi_email_get_file_ext((S8*) email_p->prof_info.editing_prof.sig_info.img_name);
  719.         email_p->prof_info.prof_misc.sig_img_indx = 1;
  720.         pfnUnicodeStrcpy(
  721.             (S8*) email_p->prof_info.editing_prof.sig_info.file_name,
  722.             (S8*) email_p->prof_info.editing_prof.sig_info.img_name);
  723.         mmi_email_util_get_sig_name(
  724.             (U8) (email_p->prof_info.prof_misc.curr_sel_prof + 1),
  725.             (S8*) email_p->prof_info.editing_prof.sig_info.file_path);
  726.         pfnUnicodeStrcat((S8*) email_p->prof_info.editing_prof.sig_info.file_path, (S8*) fileExt);
  727.     }
  728.     else
  729.     {
  730.         memset(
  731.             email_p->prof_info.editing_prof.sig_info.file_name,
  732.             0,
  733.             sizeof(email_p->prof_info.editing_prof.sig_info.file_name));
  734.         memset(
  735.             email_p->prof_info.editing_prof.sig_info.file_path,
  736.             0,
  737.             sizeof(email_p->prof_info.editing_prof.sig_info.file_path));
  738.         email_p->prof_info.prof_misc.sig_img_indx = 0;
  739.     }
  740.     email_p->prof_info.prof_misc.is_sig_changed = FALSE;
  741.     mmi_email_entry_prof_sig();
  742. }
  743. /*****************************************************************************
  744.  * FUNCTION
  745.  *  mmi_email_entry_prof_sig
  746.  * DESCRIPTION
  747.  *  Entry function of Signature setting screen.
  748.  * PARAMETERS
  749.  *  void
  750.  * RETURNS
  751.  *  void
  752.  *****************************************************************************/
  753. void mmi_email_entry_prof_sig(void)
  754. {
  755.     /*----------------------------------------------------------------*/
  756.     /* Local Variables                                                */
  757.     /*----------------------------------------------------------------*/
  758.     U16 sig_icons[EMAIL_SIG_TOTAL_ITEM] = 
  759.     {
  760.         IMG_STATUS, 0,
  761.         IMG_EMAIL_SIGNATURE_IMAGE_ID, 0,
  762.         IMG_EMAIL_SIGNATURE_TEXT_ID, 0
  763.     };
  764.     U8 *guiBuffer;
  765.     U8 *inputBuffer;
  766.     U16 inputBufferSize;
  767.     /*----------------------------------------------------------------*/
  768.     /* Code Body                                                      */
  769.     /*----------------------------------------------------------------*/
  770.     EntryNewScreen(SCR_ID_EMAIL_PROF_SIG, mmi_email_exit_prof_sig, NULL, NULL);
  771.     InitializeCategory57Screen();
  772.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_PROF_SIG);
  773.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_PROF_SIG, &inputBufferSize);
  774.     /* temporary solution suggested by Terry */
  775.     /* SetCategory57RightSoftkeyFunctions (mmi_email_prof_save_confirm, GoBackHistory); */
  776.     mmi_email_prof_fill_sig_inline_struct();
  777.     /* RegisterHighlightHandler (mmi_email_hilite_prof_sig_inline_item); */
  778.     if (inputBuffer != NULL)
  779.     {
  780.         SetCategory57Data(wgui_inline_items, EMAIL_SIG_TOTAL_ITEM, inputBuffer);
  781.         if (email_p->prof_info.prof_misc.is_sig_changed && GetInlineDoneFlag(guiBuffer) == 0)
  782.         {
  783.             SetInlineDoneFlag(guiBuffer);
  784.         }
  785.     }
  786.     ShowCategory57Screen(
  787.         STR_EMAIL_SIGNATURE_ID,
  788.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  789.         STR_GLOBAL_EDIT,
  790.         IMG_GLOBAL_BACK,
  791.         STR_GLOBAL_BACK,
  792.         IMG_GLOBAL_BACK,
  793.         EMAIL_SIG_TOTAL_ITEM,
  794.         (U16*) sig_icons,
  795.         wgui_inline_items,
  796.         0,
  797.         guiBuffer);
  798.     SetCategory57RightSoftkeyFunctions(mmi_email_prof_save_confirm, GoBackHistory);
  799. }
  800. /*****************************************************************************
  801.  * FUNCTION
  802.  *  mmi_email_exit_prof_sig
  803.  * DESCRIPTION
  804.  *  Pre-Entry function of Signature setting screen.
  805.  * PARAMETERS
  806.  *  void
  807.  * RETURNS
  808.  *  void
  809.  *****************************************************************************/
  810. void mmi_email_exit_prof_sig(void)
  811. {
  812.     /*----------------------------------------------------------------*/
  813.     /* Local Variables                                                */
  814.     /*----------------------------------------------------------------*/
  815.     /*----------------------------------------------------------------*/
  816.     /* Code Body                                                      */
  817.     /*----------------------------------------------------------------*/
  818.     mmi_email_util_add_n_history(SCR_ID_EMAIL_PROF_SIG, mmi_email_entry_prof_sig);
  819. }
  820. /*****************************************************************************
  821.  * FUNCTION
  822.  *  mmi_email_prof_fill_sig_inline_struct
  823.  * DESCRIPTION
  824.  *  Fill inline structure for Profile->Signature screen.
  825.  * PARAMETERS
  826.  *  void
  827.  * RETURNS
  828.  *  void
  829.  *****************************************************************************/
  830. void mmi_email_prof_fill_sig_inline_struct(void)
  831. {
  832.     /*----------------------------------------------------------------*/
  833.     /* Local Variables                                                */
  834.     /*----------------------------------------------------------------*/
  835.     /*----------------------------------------------------------------*/
  836.     /* Code Body                                                      */
  837.     /*----------------------------------------------------------------*/
  838.     /* On/Off inline selection */
  839.     email_p->prof_info.prof_misc.sig_status_list[0] = (U8*) GetString(STR_GLOBAL_OFF);
  840.     email_p->prof_info.prof_misc.sig_status_list[1] = (U8*) GetString(STR_GLOBAL_ON);
  841.     /* image inline selection */
  842.     email_p->prof_info.prof_misc.sig_img_list[0] = (U8*) GetString(STR_GLOBAL_NONE);
  843.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.file_name))
  844.     {
  845.         email_p->prof_info.prof_misc.sig_img_list[1] = (U8*) email_p->prof_info.editing_prof.sig_info.file_name;
  846.     }
  847.     else
  848.     {
  849.         email_p->prof_info.prof_misc.sig_img_list[1] = (U8*) GetString(STR_EMAIL_SELECT_FROM_FILE_ID);
  850.     }
  851.     /* Status caption */
  852.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_STATUS_CAP], KEY_LSK, KEY_EVENT_UP);
  853.     SetInlineItemCaption(&wgui_inline_items[EMAIL_SIG_STATUS_CAP], (PU8) GetString(STR_EMAIL_SIGNATURE_ON_OFF_ID));
  854.     /* Status */
  855.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_STATUS], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  856.     SetInlineItemSelect(
  857.         &wgui_inline_items[EMAIL_SIG_STATUS],
  858.         EMAIL_PROF_SIG_STATUS_ITEM,
  859.         email_p->prof_info.prof_misc.sig_status_list,
  860.         &email_p->prof_info.editing_prof.sig_info.sig_status);
  861.     /* Image caption */
  862.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_IMAGE_CAP], KEY_LSK, KEY_EVENT_UP);
  863.     SetInlineItemCaption(&wgui_inline_items[EMAIL_SIG_IMAGE_CAP], (PU8) GetString(STR_EMAIL_SIGNATURE_IMAGE_ID));
  864.     /* Image */
  865.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_IMAGE], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  866.     SetInlineItemSelect(
  867.         &wgui_inline_items[EMAIL_SIG_IMAGE],
  868.         EMAIL_PROF_SIG_IMG_ITEM,
  869.         email_p->prof_info.prof_misc.sig_img_list,
  870.         &email_p->prof_info.prof_misc.sig_img_indx);
  871.     RegisterInlineSelectHighlightHandler(&wgui_inline_items[EMAIL_SIG_IMAGE], mmi_email_hilite_prof_sig_inline_sel);
  872.     /* Text caption */
  873.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_TEXT_CAP], KEY_LSK, KEY_EVENT_UP);
  874.     SetInlineItemCaption(&wgui_inline_items[EMAIL_SIG_TEXT_CAP], (PU8) GetString(STR_EMAIL_SIGNATURE_TEXT_ID));
  875.     /* Text */
  876.     SetInlineItemActivation(&wgui_inline_items[EMAIL_SIG_TEXT], KEY_LSK, KEY_EVENT_UP);
  877.     SetInlineItemFullScreenEdit(
  878.         &wgui_inline_items[EMAIL_SIG_TEXT],
  879.         STR_EMAIL_SIGNATURE_ID,
  880.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  881.         (PU8) email_p->prof_info.editing_prof.sig_info.sig_buff,
  882.         (EMAIL_MAX_SIG_LEN + 1),
  883.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  884.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[EMAIL_SIG_TEXT], mmi_email_hilite_prof_full_edit);
  885. }
  886. /*****************************************************************************
  887.  * FUNCTION
  888.  *  mmi_email_hilite_prof_sig_inline_sel
  889.  * DESCRIPTION
  890.  *  Highlight handler of selection sig image
  891.  * PARAMETERS
  892.  *  index       [IN]        Index of inline seletion item
  893.  * RETURNS
  894.  *  void
  895.  *****************************************************************************/
  896. void mmi_email_hilite_prof_sig_inline_sel(S32 index)
  897. {
  898.     /*----------------------------------------------------------------*/
  899.     /* Local Variables                                                */
  900.     /*----------------------------------------------------------------*/
  901.     /*----------------------------------------------------------------*/
  902.     /* Code Body                                                      */
  903.     /*----------------------------------------------------------------*/
  904.     ChangeLeftSoftkey(0, 0);
  905.     if (index != 0)
  906.     {
  907.         ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, 0);
  908.         SetCategory57LeftSoftkeyFunction(mmi_email_entry_prof_sig_sel_file);
  909.     }
  910. }
  911. /*****************************************************************************
  912.  * FUNCTION
  913.  *  mmi_email_prof_sig_sel_attach_callback
  914.  * DESCRIPTION
  915.  *  Callback function for selected image of signature from File Manager
  916.  * PARAMETERS
  917.  *  filePath        [IN]        File path+name from File Manager
  918.  *  is_short        [IN]        
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. void mmi_email_prof_sig_sel_attach_callback(void *filePath, int is_short)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     /*----------------------------------------------------------------*/
  928.     /* Code Body                                                      */
  929.     /*----------------------------------------------------------------*/
  930.     if (filePath == NULL)
  931.     {
  932.         GoBackToHistory(SCR_ID_EMAIL_PROF_SIG_SEL_FILE);
  933.     }
  934.     else
  935.     {
  936.         S32 fileLen;
  937.         S32 dirLen;
  938.         S8 *fileName;
  939.         S32 f_result;
  940.         if ((f_result = mmi_email_util_get_file_size(filePath, &fileLen)) == FS_NO_ERROR)
  941.         {
  942.             // if (fileLen > MMI_EMAIL_MAX_ATTACH_SIZE)
  943.             if (fileLen > MMI_EMAIL_TOTAL_MAX_ATTACH_SIZE)
  944.             {
  945.                 DisplayPopup(
  946.                     (U8*) GetString(STR_EMAIL_SIZE_TOO_LARGE),
  947.                     IMG_GLOBAL_UNFINISHED,
  948.                     1,
  949.                     UI_POPUP_NOTIFYDURATION_TIME,
  950.                     (U8) WARNING_TONE);
  951.                 DeleteUptoScrID(SCR_ID_EMAIL_PROF_SIG_SEL_FILE);
  952.                 return;
  953.             }
  954.         }
  955.         else
  956.         {
  957.             DisplayPopup(
  958.                 (U8*) GetString(GetFileSystemErrorString(f_result)),
  959.                 IMG_GLOBAL_UNFINISHED,
  960.                 1,
  961.                 UI_POPUP_NOTIFYDURATION_TIME,
  962.                 (U8) WARNING_TONE);
  963.             DeleteUptoScrID(SCR_ID_EMAIL_PROF_SIG_SEL_FILE);
  964.             return;
  965.         }
  966.         /* extract file name and path */
  967.         dirLen = (S32) mmi_fmgr_get_last_dir_index((S8*) filePath);
  968.         fileName = (S8*) filePath;
  969.         fileName += dirLen;
  970.         pfnUnicodeStrcpy((S8*) email_p->prof_info.editing_prof.sig_info.file_name, (S8*) fileName);
  971.         pfnUnicodeStrcpy((S8*) email_p->prof_info.editing_prof.sig_info.file_path, (S8*) filePath);
  972.         /* change RSK of signature secreen to Done */
  973.         email_p->prof_info.prof_misc.is_sig_changed = TRUE;
  974.         GoBackToHistory(SCR_ID_EMAIL_PROF_SIG_SEL_FILE);
  975.     }
  976. }
  977. /*****************************************************************************
  978.  * FUNCTION
  979.  *  mmi_email_prof_sig_sel_attach
  980.  * DESCRIPTION
  981.  *  Enter file manager to select an image file for signature
  982.  * PARAMETERS
  983.  *  void
  984.  * RETURNS
  985.  *  void
  986.  *****************************************************************************/
  987. void mmi_email_prof_sig_sel_attach(void)
  988. {
  989.     /*----------------------------------------------------------------*/
  990.     /* Local Variables                                                */
  991.     /*----------------------------------------------------------------*/
  992.     FMGR_FILTER filter;
  993.     /*----------------------------------------------------------------*/
  994.     /* Code Body                                                      */
  995.     /*----------------------------------------------------------------*/
  996.     FMGR_FILTER_INIT(&filter);
  997.     FMGR_FILTER_SET(&filter, FMGR_TYPE_BMP);
  998.     FMGR_FILTER_SET(&filter, FMGR_TYPE_JPG);
  999.     FMGR_FILTER_SET(&filter, FMGR_TYPE_PNG);
  1000.     FMGR_FILTER_SET(&filter, FMGR_TYPE_GIF);
  1001.     FMGR_FILTER_SET(&filter, FMGR_TYPE_WBMP);
  1002.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  1003.     /* use APP_SETTINGS because of DRM -- signautre shall not be DRM file */
  1004.     mmi_fmgr_select_path_and_enter(
  1005.         APP_EMAIL,
  1006.         FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  1007.         filter,
  1008.         (S8*) L"root",
  1009.         mmi_email_prof_sig_sel_attach_callback);
  1010. }
  1011. /*****************************************************************************
  1012.  * FUNCTION
  1013.  *  mmi_email_hilite_prof_sig_view
  1014.  * DESCRIPTION
  1015.  *  highlight handler for Signature -> View option
  1016.  * PARAMETERS
  1017.  *  void
  1018.  * RETURNS
  1019.  *  void
  1020.  *****************************************************************************/
  1021. void mmi_email_hilite_prof_sig_view(void)
  1022. {
  1023.     /*----------------------------------------------------------------*/
  1024.     /* Local Variables                                                */
  1025.     /*----------------------------------------------------------------*/
  1026.     /*----------------------------------------------------------------*/
  1027.     /* Code Body                                                      */
  1028.     /*----------------------------------------------------------------*/
  1029.     SetLeftSoftkeyFunction(mmi_email_entry_prof_sig_view_attach, KEY_EVENT_UP);
  1030.     SetKeyHandler(mmi_email_entry_prof_sig_view_attach, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1031. }
  1032. /*****************************************************************************
  1033.  * FUNCTION
  1034.  *  mmi_email_hilite_prof_sig_select
  1035.  * DESCRIPTION
  1036.  *  highlight handler for Signature -> Select option
  1037.  * PARAMETERS
  1038.  *  void
  1039.  * RETURNS
  1040.  *  void
  1041.  *****************************************************************************/
  1042. void mmi_email_hilite_prof_sig_select(void)
  1043. {
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Local Variables                                                */
  1046.     /*----------------------------------------------------------------*/
  1047.     /*----------------------------------------------------------------*/
  1048.     /* Code Body                                                      */
  1049.     /*----------------------------------------------------------------*/
  1050.     SetLeftSoftkeyFunction(mmi_email_prof_sig_sel_attach, KEY_EVENT_UP);
  1051.     SetKeyHandler(mmi_email_prof_sig_sel_attach, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1052. }
  1053. /*****************************************************************************
  1054.  * FUNCTION
  1055.  *  mmi_email_hilite_prof_sig_del
  1056.  * DESCRIPTION
  1057.  *  highlight handler for Signature -> Delete option
  1058.  * PARAMETERS
  1059.  *  void
  1060.  * RETURNS
  1061.  *  void
  1062.  *****************************************************************************/
  1063. void mmi_email_hilite_prof_sig_del(void)
  1064. {
  1065.     /*----------------------------------------------------------------*/
  1066.     /* Local Variables                                                */
  1067.     /*----------------------------------------------------------------*/
  1068.     /*----------------------------------------------------------------*/
  1069.     /* Code Body                                                      */
  1070.     /*----------------------------------------------------------------*/
  1071.     SetLeftSoftkeyFunction(mmi_email_prof_sig_del_attach, KEY_EVENT_UP);
  1072.     SetKeyHandler(mmi_email_prof_sig_del_attach, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1073. }
  1074. /*****************************************************************************
  1075.  * FUNCTION
  1076.  *  mmi_email_hilite_prof_sig_inline_item
  1077.  * DESCRIPTION
  1078.  *  Highlight handler for inline items in Signature screen
  1079.  * PARAMETERS
  1080.  *  index           [IN]        
  1081.  *  nidex(?)        [IN]        Index of inline item
  1082.  * RETURNS
  1083.  *  void
  1084.  *****************************************************************************/
  1085. void mmi_email_hilite_prof_sig_inline_item(S32 index)
  1086. {
  1087.     /*----------------------------------------------------------------*/
  1088.     /* Local Variables                                                */
  1089.     /*----------------------------------------------------------------*/
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Code Body                                                      */
  1092.     /*----------------------------------------------------------------*/
  1093.     if (index != 2)
  1094.     {
  1095.         /* if current highlighted item is Image, and the value is not "none" */
  1096.         if ((index == 1) && (email_p->prof_info.prof_misc.sig_img_indx != 0))
  1097.         {
  1098.             mmi_email_hilite_prof_sig_inline_sel(email_p->prof_info.prof_misc.sig_img_indx);
  1099.         }
  1100.         SetCategory57RightSoftkeyFunctions(mmi_email_prof_save_confirm, GoBackHistory);
  1101.     }
  1102. }
  1103. /*****************************************************************************
  1104.  * FUNCTION
  1105.  *  mmi_email_prof_save_sig
  1106.  * DESCRIPTION
  1107.  *  Save fuction for Sinature
  1108.  * PARAMETERS
  1109.  *  void
  1110.  * RETURNS
  1111.  *  void
  1112.  *****************************************************************************/
  1113. void mmi_email_prof_save_sig(void)
  1114. {
  1115.     /*----------------------------------------------------------------*/
  1116.     /* Local Variables                                                */
  1117.     /*----------------------------------------------------------------*/
  1118.     U8 is_attach;
  1119.     /*----------------------------------------------------------------*/
  1120.     /* Code Body                                                      */
  1121.     /*----------------------------------------------------------------*/
  1122.     is_attach = ((email_p->prof_info.prof_misc.sig_img_indx > 0) &&
  1123.                  (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.file_name)));
  1124.     if (email_p->prof_info.editing_prof.sig_info.sig_status)
  1125.     {
  1126.         /* both text and image are empty */
  1127.         if (!pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.sig_buff) && !is_attach)
  1128.         {
  1129.             DisplayPopup(
  1130.                 (U8*) GetString(STR_EMAIL_SIG_EMPTY_WARNING),
  1131.                 IMG_GLOBAL_WARNING,
  1132.                 1,
  1133.                 UI_POPUP_NOTIFYDURATION_TIME,
  1134.                 (U8) WARNING_TONE);
  1135.             return;
  1136.         }
  1137.     }
  1138.     mmi_email_pre_entry_progressing(
  1139.         STR_EMAIL_MAIN_ID,
  1140.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1141.         0,
  1142.         0,
  1143.         0,
  1144.         0,
  1145.         (U8*) GetString(STR_GLOBAL_SAVING),
  1146.         NULL,
  1147.         IMG_EMAIL_SENDING_ID,
  1148.         NULL,
  1149.         NULL,
  1150.         NULL,
  1151.         0);
  1152.     if (is_attach)
  1153.     {
  1154.         S8 *dest_path = OslMalloc((FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH);
  1155.         S8 *fileExt;
  1156.         /* send request to copy file */
  1157.         pfnUnicodeStrcpy(
  1158.             (S8*) email_p->prof_info.editing_prof.sig_info.img_name,
  1159.             (S8*) email_p->prof_info.editing_prof.sig_info.file_name);
  1160.         fileExt = mmi_email_get_file_ext((S8*) email_p->prof_info.editing_prof.sig_info.img_name);
  1161.         mmi_email_util_get_sig_name((U8) (email_p->prof_info.prof_misc.curr_sel_prof + 1), (S8*) dest_path);
  1162.         pfnUnicodeStrcat((S8*) dest_path, (S8*) fileExt);
  1163.         pfnUnicodeStrcpy((S8*) email_p->comm_buff, (S8*) dest_path);
  1164.         OslMfree(dest_path);
  1165.         if (pfnUnicodeStrcmp((S8*) email_p->prof_info.editing_prof.sig_info.file_path, (S8*) email_p->comm_buff) != 0)
  1166.         {
  1167.             FS_Delete((U16*) email_p->comm_buff);
  1168.             mmi_fmgr_send_copy_req(
  1169.                 FMGR_ACTION_COPY,
  1170.                 (U8*) email_p->prof_info.editing_prof.sig_info.file_path,
  1171.                 (U8*) email_p->comm_buff,
  1172.                 mmi_email_prof_sig_save_file_callback);
  1173.             return;
  1174.         }
  1175.     }
  1176.     else
  1177.     {
  1178.         email_p->prof_info.editing_prof.sig_info.img_name[0] = 0;
  1179.         email_p->prof_info.editing_prof.sig_info.img_name[1] = 0;
  1180.     }
  1181.     mmi_email_ps_set_acct_profile_req();
  1182. }
  1183. /*****************************************************************************
  1184.  * FUNCTION
  1185.  *  mmi_email_prof_sig_save_file_callback
  1186.  * DESCRIPTION
  1187.  *  Callback function for saving image file of signature.
  1188.  * PARAMETERS
  1189.  *  info        [IN]        Variable stores the result of copy
  1190.  * RETURNS
  1191.  *  void
  1192.  *****************************************************************************/
  1193. void mmi_email_prof_sig_save_file_callback(void *info)
  1194. {
  1195.     /*----------------------------------------------------------------*/
  1196.     /* Local Variables                                                */
  1197.     /*----------------------------------------------------------------*/
  1198.     mmi_fmt_copy_rsp_strcut *msgPtr;
  1199.     /*----------------------------------------------------------------*/
  1200.     /* Code Body                                                      */
  1201.     /*----------------------------------------------------------------*/
  1202.     msgPtr = (mmi_fmt_copy_rsp_strcut*) info;
  1203.     if (msgPtr->result >= 0)
  1204.     {
  1205.         mmi_email_ps_set_acct_profile_req();
  1206.     }
  1207.     else
  1208.     {
  1209.         DisplayPopup((PU8) GetString(GetFileSystemErrorString(msgPtr->result)), IMG_GLOBAL_ERROR, 0, 1000, ERROR_TONE);
  1210.         DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  1211.     }
  1212. }
  1213. /*****************************************************************************
  1214.  * FUNCTION
  1215.  *  mmi_email_entry_prof_sig_sel_file
  1216.  * DESCRIPTION
  1217.  *  Entry Signature -> Select From File screen
  1218.  * PARAMETERS
  1219.  *  void
  1220.  * RETURNS
  1221.  *  void
  1222.  *****************************************************************************/
  1223. void mmi_email_entry_prof_sig_sel_file(void)
  1224. {
  1225.     /*----------------------------------------------------------------*/
  1226.     /* Local Variables                                                */
  1227.     /*----------------------------------------------------------------*/
  1228.     U16 numItems;
  1229.     U16 nStrItemList[3];    /* only 3 options */
  1230.     U8 *guiBuffer;
  1231.     /*----------------------------------------------------------------*/
  1232.     /* Code Body                                                      */
  1233.     /*----------------------------------------------------------------*/
  1234.     EntryNewScreen(SCR_ID_EMAIL_PROF_SIG_SEL_FILE, NULL, mmi_email_entry_prof_sig_sel_file, NULL);
  1235.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_PROF_SIG_SEL_FILE);
  1236.     SetParentHandler(MENU_ID_EMAIL_SIG_ATTCH_OPT);
  1237.     numItems = GetNumOfChild(MENU_ID_EMAIL_SIG_ATTCH_OPT);
  1238.     GetSequenceStringIds(MENU_ID_EMAIL_SIG_ATTCH_OPT, nStrItemList);
  1239.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1240.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.file_name) == 0)       /* empty */
  1241.     {
  1242.         numItems = 1;
  1243.     }
  1244.     ShowCategory52Screen(
  1245.         STR_EMAIL_SIG_ATTACH_OPTION_IMAGES_ID,
  1246.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1247.         STR_GLOBAL_OK,
  1248.         IMG_GLOBAL_OK,
  1249.         STR_GLOBAL_BACK,
  1250.         IMG_GLOBAL_BACK,
  1251.         numItems,
  1252.         nStrItemList,
  1253.         (U16*) gIndexIconsImageList,
  1254.         NULL,
  1255.         0,
  1256.         0,
  1257.         guiBuffer);
  1258.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1259. }
  1260. /*****************************************************************************
  1261.  * FUNCTION
  1262.  *  mmi_email_entry_prof_sig_view_attach
  1263.  * DESCRIPTION
  1264.  *  Entry Signature -> Select From File -> View
  1265.  * PARAMETERS
  1266.  *  void
  1267.  * RETURNS
  1268.  *  void
  1269.  *****************************************************************************/
  1270. void mmi_email_entry_prof_sig_view_attach(void)
  1271. {
  1272.     /*----------------------------------------------------------------*/
  1273.     /* Local Variables                                                */
  1274.     /*----------------------------------------------------------------*/
  1275.     S32 f_result;
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Code Body                                                      */
  1278.     /*----------------------------------------------------------------*/
  1279.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.file_path))
  1280.     {
  1281.         if ((f_result = mmi_email_util_check_file_exist((S8*) email_p->prof_info.editing_prof.sig_info.file_path)) != FS_NO_ERROR)
  1282.         {
  1283.             email_p->prof_info.prof_misc.is_sig_changed = TRUE;
  1284.             memset(
  1285.                 email_p->prof_info.editing_prof.sig_info.file_name,
  1286.                 0,
  1287.                 sizeof(email_p->prof_info.editing_prof.sig_info.file_name));
  1288.             memset(
  1289.                 email_p->prof_info.editing_prof.sig_info.file_path,
  1290.                 0,
  1291.                 sizeof(email_p->prof_info.editing_prof.sig_info.file_path));
  1292.             DisplayPopup(
  1293.                 (U8*) GetString(GetFileSystemErrorString(f_result)),
  1294.                 IMG_GLOBAL_UNFINISHED,
  1295.                 1,
  1296.                 UI_POPUP_NOTIFYDURATION_TIME,
  1297.                 (U8) WARNING_TONE);
  1298.             return;
  1299.         }
  1300.         EntryNewScreen(SCR_ID_EMAIL_COMP_VIEW_IMAGE, NULL, mmi_email_entry_prof_sig_view_attach, NULL);
  1301.         ShowCategory222Screen(
  1302.             STR_GLOBAL_VIEW,
  1303.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1304.             0,
  1305.             0,
  1306.             STR_GLOBAL_BACK,
  1307.             IMG_GLOBAL_BACK,
  1308.             GDI_COLOR_WHITE,
  1309.             NULL,
  1310.             (S8*) email_p->prof_info.editing_prof.sig_info.file_path,
  1311.             FALSE,
  1312.             NULL);
  1313.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1314.     }
  1315.     else
  1316.     {
  1317.         DisplayPopup(
  1318.             (U8*) GetString(STR_GLOBAL_EMPTY),
  1319.             IMG_GLOBAL_EMPTY,
  1320.             1,
  1321.             UI_POPUP_NOTIFYDURATION_TIME,
  1322.             (U8) EMPTY_LIST_TONE);
  1323.     }
  1324. }
  1325. /*****************************************************************************
  1326.  * FUNCTION
  1327.  *  mmi_email_prof_sig_del_attach
  1328.  * DESCRIPTION
  1329.  *  Entry Signature -> Select From File -> Delete
  1330.  * PARAMETERS
  1331.  *  void
  1332.  * RETURNS
  1333.  *  void
  1334.  *****************************************************************************/
  1335. void mmi_email_prof_sig_del_attach(void)
  1336. {
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Local Variables                                                */
  1339.     /*----------------------------------------------------------------*/
  1340.     /*----------------------------------------------------------------*/
  1341.     /* Code Body                                                      */
  1342.     /*----------------------------------------------------------------*/
  1343.     if (pfnUnicodeStrlen((S8*) email_p->prof_info.editing_prof.sig_info.file_path))
  1344.     {
  1345.         /* change RSK of signature secreen to Done */
  1346.         email_p->prof_info.prof_misc.is_sig_changed = TRUE;
  1347.         memset(email_p->prof_info.editing_prof.sig_info.file_path, 0, ENCODING_LENGTH);
  1348.         memset(email_p->prof_info.editing_prof.sig_info.file_name, 0, ENCODING_LENGTH);
  1349.         DisplayPopup(
  1350.             (U8*) GetString(STR_GLOBAL_DELETE),
  1351.             IMG_GLOBAL_DELETED,
  1352.             1,
  1353.             UI_POPUP_NOTIFYDURATION_TIME,
  1354.             (U8) SUCCESS_TONE);
  1355.     }
  1356.     else
  1357.     {
  1358.         DisplayPopup(
  1359.             (U8*) GetString(STR_GLOBAL_EMPTY),
  1360.             IMG_GLOBAL_EMPTY,
  1361.             1,
  1362.             UI_POPUP_NOTIFYDURATION_TIME,
  1363.             (U8) EMPTY_LIST_TONE);
  1364.     }
  1365. }
  1366. /*****************************************************************************
  1367.  * FUNCTION
  1368.  *  mmi_email_prof_save_confirm
  1369.  * DESCRIPTION
  1370.  *  Display confirmation screen for Profile
  1371.  * PARAMETERS
  1372.  *  void
  1373.  * RETURNS
  1374.  *  void
  1375.  *****************************************************************************/
  1376. void mmi_email_prof_save_confirm(void)
  1377. {
  1378.     /*----------------------------------------------------------------*/
  1379.     /* Local Variables                                                */
  1380.     /*----------------------------------------------------------------*/
  1381.     FuncPtr func;
  1382.     /*----------------------------------------------------------------*/
  1383.     /* Code Body                                                      */
  1384.     /*----------------------------------------------------------------*/
  1385.     switch (email_p->prof_info.prof_misc.curr_scr)
  1386.     {
  1387.         case SCR_ID_EMAIL_PROF_SETTING:
  1388.             func = mmi_email_prof_save_setting;
  1389.             break;
  1390.         case SCR_ID_EMAIL_PROF_SMTP:
  1391.             func = mmi_email_prof_save_smtp;
  1392.             break;
  1393.         case SCR_ID_EMAIL_PROF_POP3_IMAP4:
  1394.             func = mmi_email_prof_save_pop3_imap4;
  1395.             break;
  1396.         default:    /* case SCR_ID_EMAIL_PROF_SIG: */
  1397.             func = mmi_email_prof_save_sig;
  1398.             break;
  1399.     }
  1400.     mmi_email_display_confirm(STR_GLOBAL_SAVE, func, mmi_email_prof_go_back_to_edit_menu);
  1401. }
  1402. /*****************************************************************************
  1403.  * FUNCTION
  1404.  *  mmi_email_prof_go_back_to_edit_menu
  1405.  * DESCRIPTION
  1406.  *  Delete all screen after Profile -> Edit screen and go back to Edit screen.
  1407.  * PARAMETERS
  1408.  *  void
  1409.  * RETURNS
  1410.  *  void
  1411.  *****************************************************************************/
  1412. void mmi_email_prof_go_back_to_edit_menu(void)
  1413. {
  1414.     /*----------------------------------------------------------------*/
  1415.     /* Local Variables                                                */
  1416.     /*----------------------------------------------------------------*/
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Code Body                                                      */
  1419.     /*----------------------------------------------------------------*/
  1420.     DeleteUptoScrID(SCR_ID_EMAIL_PROF_OPT_EDIT);
  1421.     GoBackHistory();
  1422. }
  1423. #define UTILITY_EMAIL
  1424. /*****************************************************************************
  1425.  * FUNCTION
  1426.  *  mmi_email_display_confirm
  1427.  * DESCRIPTION
  1428.  *  Display common confirmation screen.
  1429.  * PARAMETERS
  1430.  *  strId           [IN]        Confirmation string.
  1431.  *  lskFuncs        [IN]        Left soft key function.
  1432.  *  rskFuns         [IN]        Right soft key function.
  1433.  * RETURNS
  1434.  *  void
  1435.  *****************************************************************************/
  1436. void mmi_email_display_confirm(U16 strId, FuncPtr lskFuncs, FuncPtr rskFuns)
  1437. {
  1438.     /*----------------------------------------------------------------*/
  1439.     /* Local Variables                                                */
  1440.     /*----------------------------------------------------------------*/
  1441.     /*----------------------------------------------------------------*/
  1442.     /* Code Body                                                      */
  1443.     /*----------------------------------------------------------------*/
  1444.     EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
  1445.     ShowCategory164Screen(
  1446.         STR_GLOBAL_YES,
  1447.         IMG_GLOBAL_YES,
  1448.         STR_GLOBAL_NO,
  1449.         IMG_GLOBAL_NO,
  1450.         strId,
  1451.         IMG_GLOBAL_QUESTION,
  1452.         NULL);
  1453.     SetLeftSoftkeyFunction(lskFuncs, KEY_EVENT_UP);
  1454.     SetRightSoftkeyFunction(rskFuns, KEY_EVENT_UP);
  1455.     playRequestedTone(WARNING_TONE);
  1456. }
  1457. /*****************************************************************************
  1458.  * FUNCTION
  1459.  *  mmi_email_util_set_insert_history_flag
  1460.  * DESCRIPTION
  1461.  *  Set the state of inserting history.
  1462.  * PARAMETERS
  1463.  *  insert_hist     [IN]        State of inserting history
  1464.  * RETURNS
  1465.  *  void
  1466.  *****************************************************************************/
  1467. void mmi_email_util_set_insert_history_flag(BOOL insert_hist)
  1468. {
  1469.     /*----------------------------------------------------------------*/
  1470.     /* Local Variables                                                */
  1471.     /*----------------------------------------------------------------*/
  1472.     /*----------------------------------------------------------------*/
  1473.     /* Code Body                                                      */
  1474.     /*----------------------------------------------------------------*/
  1475.     /* insert current screen into history */
  1476.     email_p->misc_info.insert_hist = insert_hist;
  1477. }
  1478. /*****************************************************************************
  1479.  * FUNCTION
  1480.  *  mmi_email_util_get_hint_value_all_fldr
  1481.  * DESCRIPTION
  1482.  *  Retrieve hint value of total mails of folders in Delete All function.
  1483.  * PARAMETERS
  1484.  *  index       [IN]        Index of highlight item.
  1485.  * RETURNS
  1486.  *  Pointer to the result string.
  1487.  *****************************************************************************/
  1488. U8 *mmi_email_util_get_hint_value_all_fldr(U16 index)
  1489. {
  1490.     /*----------------------------------------------------------------*/
  1491.     /* Local Variables                                                */
  1492.     /*----------------------------------------------------------------*/
  1493.     S8 hintStr[5 * ENCODING_LENGTH];
  1494.     U32 allFolderCount = 0;
  1495.     /*----------------------------------------------------------------*/
  1496.     /* Code Body                                                      */
  1497.     /*----------------------------------------------------------------*/
  1498.     allFolderCount = email_p->fldr_info.fldr_data[MMI_EMAIL_INBOX].total_mails +
  1499.         email_p->fldr_info.fldr_data[MMI_EMAIL_SENT].total_mails +
  1500.         email_p->fldr_info.fldr_data[MMI_EMAIL_UNSENT].total_mails +
  1501.         email_p->fldr_info.fldr_data[MMI_EMAIL_DRAFT].total_mails;
  1502.     sprintf(hintStr, "%u ", allFolderCount);
  1503.     AnsiiToUnicodeString((S8*) hintData[index], hintStr);
  1504.     pfnUnicodeStrcat((S8*) hintData[index], (S8*) GetString(STR_EMAIL_MAILS_ID));
  1505.     return (U8*) hintData[index];
  1506. }
  1507. /*****************************************************************************
  1508.  * FUNCTION
  1509.  *  mmi_email_util_get_fldr_hint_value
  1510.  * DESCRIPTION
  1511.  *  Retrieve hint data of a selected mail.
  1512.  * PARAMETERS
  1513.  *  index           [IN]        Highlight index of a mail.
  1514.  *  curr_fldr       [IN]        Index of selected folder.
  1515.  * RETURNS
  1516.  *  Pointer to the result string.
  1517.  *****************************************************************************/
  1518. U8 *mmi_email_util_get_fldr_hint_value(U16 index, U8 curr_fldr)
  1519. {
  1520.     /*----------------------------------------------------------------*/
  1521.     /* Local Variables                                                */
  1522.     /*----------------------------------------------------------------*/
  1523.     S8 hintStr[5 * ENCODING_LENGTH];
  1524.     /*----------------------------------------------------------------*/
  1525.     /* Code Body                                                      */
  1526.     /*----------------------------------------------------------------*/
  1527.     sprintf(hintStr, "%d ", email_p->fldr_info.fldr_data[curr_fldr].total_mails);
  1528.     AnsiiToUnicodeString((S8*) hintData[index], hintStr);
  1529.     pfnUnicodeStrcat((S8*) hintData[index], (S8*) GetString(STR_EMAIL_MAILS_ID));
  1530.     return (U8*) hintData[index];
  1531. }
  1532. #define FOLDER_EMAIL
  1533. /*****************************************************************************
  1534.  * FUNCTION
  1535.  *  mmi_email_fldr_exec_entry
  1536.  * DESCRIPTION
  1537.  *  Execute entry function of current selected folder.
  1538.  * PARAMETERS
  1539.  *  void
  1540.  * RETURNS
  1541.  *  void
  1542.  *****************************************************************************/
  1543. void mmi_email_fldr_exec_entry(void)
  1544. {
  1545.     /*----------------------------------------------------------------*/
  1546.     /* Local Variables                                                */
  1547.     /*----------------------------------------------------------------*/
  1548.     /*----------------------------------------------------------------*/
  1549.     /* Code Body                                                      */
  1550.     /*----------------------------------------------------------------*/
  1551.     switch (email_p->main_info.curr_menu)
  1552.     {
  1553.         case MMI_EMAIL_INBOX:
  1554.             mmi_email_entry_inbox();
  1555.             break;
  1556.         case MMI_EMAIL_UNSENT:
  1557.             mmi_email_entry_unsent();
  1558.             break;
  1559.         case MMI_EMAIL_SENT:
  1560.             mmi_email_entry_sent();
  1561.             break;
  1562.         case MMI_EMAIL_DRAFT:
  1563.             mmi_email_entry_draft();
  1564.             break;
  1565.     }
  1566. }
  1567. /*****************************************************************************
  1568.  * FUNCTION
  1569.  *  mmi_email_fldr_get_async_items
  1570.  * DESCRIPTION
  1571.  *  Fill dynamic list items of each folder
  1572.  * PARAMETERS
  1573.  *  start_indx      [IN]            Start index of item to be retrieved.
  1574.  *  menuData        [IN/OUT]        UI structure to store the list data.
  1575.  *  num_item        [IN]            Number of items revrieved.
  1576.  * RETURNS
  1577.  *  void
  1578.  *****************************************************************************/
  1579. S32 mmi_email_fldr_get_async_items(S32 start_indx, gui_iconlist_menu_item *menuData, S32 num_item)
  1580. {
  1581.     /*----------------------------------------------------------------*/
  1582.     /* Local Variables                                                */
  1583.     /*----------------------------------------------------------------*/
  1584.     S32 i;
  1585.     mmi_mem_pool_ret_enum ret_result;
  1586.     mmi_email_mail_info_struct *listMsgsStruct[EMAIL_TOTAL_MSG_BUFF];
  1587.     /*----------------------------------------------------------------*/
  1588.     /* Code Body                                                      */
  1589.     /*----------------------------------------------------------------*/
  1590.     email_p->mem_pool_info.start_indx = start_indx;
  1591.     email_p->mem_pool_info.end_indx = (start_indx + num_item) - 1;
  1592.     ret_result = mmi_mem_get_values(
  1593.                     &email_p->mem_pool_info.mem_container,
  1594.                     (S16) email_p->mem_pool_info.start_indx,
  1595.                     (S16) email_p->mem_pool_info.end_indx,
  1596.                     (void **)listMsgsStruct,
  1597.                     &email_p->mem_pool_info.not_avail_pool);
  1598.     if (ret_result != MEM_CT_SUCCESS)
  1599.     {
  1600.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1601.         if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3 || email_p->main_info.curr_menu == MMI_EMAIL_UNSENT)
  1602.     #endif 
  1603.             email_p->fldr_info.curr_page = email_p->mem_pool_info.not_avail_pool + 1;
  1604.         if (email_p->fldr_info.is_list_displayed)
  1605.         {
  1606.             mmi_email_fldr_pre_folder_select_req();
  1607.         }
  1608.         return 0;
  1609.     }
  1610.     /* fill data */
  1611.     for (i = 0; i < num_item; ++i)
  1612.     {
  1613.         U16 status_img;
  1614.         mmi_email_mail_info_struct *temp = listMsgsStruct[i];
  1615.         /* subject */
  1616.         if (!pfnUnicodeStrlen((S8*) temp->subject))
  1617.         {
  1618.             pfnUnicodeStrncpy(
  1619.                 (S8*) menuData[i].item_list[0],
  1620.                 (S8*) GetString(STR_EMAIL_COMMON_NO_SUBJECT_ID),
  1621.                 EMAIL_MAX_SUBJ_DISPLAY_STR_LEN);
  1622.         }
  1623.         else
  1624.         {
  1625.             pfnUnicodeStrncpy((S8*) menuData[i].item_list[0], (S8*) temp->subject, EMAIL_MAX_SUBJ_DISPLAY_STR_LEN);
  1626.         }
  1627.         /* status icon */
  1628.         status_img = mmi_email_fldr_get_status_icon(temp->priority, temp->attch_num);
  1629.         menuData[i].image_list[0] = (PU8) GetImage(status_img);
  1630.     }
  1631.     return num_item;
  1632. }
  1633. /*****************************************************************************
  1634.  * FUNCTION
  1635.  *  mmi_email_fldr_prepare_forward
  1636.  * DESCRIPTION
  1637.  *  Prepare data to forward a mail
  1638.  * PARAMETERS
  1639.  *  void
  1640.  * RETURNS
  1641.  *  void
  1642.  *****************************************************************************/
  1643. void mmi_email_fldr_prepare_forward(void)
  1644. {
  1645.     /*----------------------------------------------------------------*/
  1646.     /* Local Variables                                                */
  1647.     /*----------------------------------------------------------------*/
  1648.     U32 subLenToBeForwarded;
  1649.     U32 prefixFwWithColonStrLen;
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     /* reset inline compose members */
  1654.     mmi_email_comp_reset_member();
  1655.     /* subject with "Fw: <previous >" */
  1656.     subLenToBeForwarded = pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.subj_buff);
  1657.     prefixFwWithColonStrLen = pfnUnicodeStrlen((S8*) g_email_fw_str);
  1658.     if ((subLenToBeForwarded + prefixFwWithColonStrLen) > EMAIL_COMP_SUBJ_LEN)
  1659.     {
  1660.         subLenToBeForwarded = EMAIL_COMP_SUBJ_LEN - prefixFwWithColonStrLen;
  1661.     }
  1662.     pfnUnicodeStrcpy((S8*) email_p->comp_info.subj_buff, (S8*) g_email_fw_str);
  1663.     pfnUnicodeStrncat(
  1664.         (S8*) email_p->comp_info.subj_buff,
  1665.         (S8*) email_p->inbox_info.read_info.subj_buff,
  1666.         subLenToBeForwarded);
  1667.     /* content */
  1668.     pfnUnicodeStrcpy((S8*) email_p->comp_info.cont_buff, (S8*) email_p->inbox_info.read_info.cont_buff);
  1669.     /* priority, encoding type */
  1670.     email_p->comp_info.priority_indx = email_p->inbox_info.read_info.priority_indx;
  1671. }
  1672. /*****************************************************************************
  1673.  * FUNCTION
  1674.  *  mmi_email_fldr_prepare_edit
  1675.  * DESCRIPTION
  1676.  *  Prepare data to edit a mail
  1677.  * PARAMETERS
  1678.  *  void
  1679.  * RETURNS
  1680.  *  void
  1681.  *****************************************************************************/
  1682. void mmi_email_fldr_prepare_edit(void)
  1683. {
  1684.     /*----------------------------------------------------------------*/
  1685.     /* Local Variables                                                */
  1686.     /*----------------------------------------------------------------*/
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Code Body                                                      */
  1689.     /*----------------------------------------------------------------*/
  1690.     mmi_email_comp_reset_member();
  1691.     memcpy(
  1692.         &email_p->comp_info.addr_list[EMAIL_ADDR_TO],
  1693.         &email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO],
  1694.         sizeof(mmi_email_to_cc_struct));
  1695.     memcpy(
  1696.         &email_p->comp_info.addr_list[EMAIL_ADDR_CC],
  1697.         &email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC],
  1698.         sizeof(mmi_email_to_cc_struct));
  1699.     memcpy(&email_p->comp_info, &email_p->inbox_info.read_info, sizeof(mmi_email_comp_info_struct));
  1700. }
  1701. /*****************************************************************************
  1702.  * FUNCTION
  1703.  *  mmi_email_fldr_get_status_icon
  1704.  * DESCRIPTION
  1705.  *  Get status icon enum of Sent/Unsent/Draft folder.
  1706.  * PARAMETERS
  1707.  *  priority                [IN]        
  1708.  *  totalAttachments        [IN]        
  1709.  * RETURNS
  1710.  *  void
  1711.  *****************************************************************************/
  1712. U16 mmi_email_fldr_get_status_icon(U8 priority, U8 totalAttachments)
  1713. {
  1714.     /*----------------------------------------------------------------*/
  1715.     /* Local Variables                                                */
  1716.     /*----------------------------------------------------------------*/
  1717.     /*----------------------------------------------------------------*/
  1718.     /* Code Body                                                      */
  1719.     /*----------------------------------------------------------------*/
  1720.     if ((priority > MMI_EMAIL_NORMAL_PRIORITY) && (totalAttachments != 0))
  1721.     {
  1722.         return IMG_EMAIL_SENT_LOW_ATTACH_ID;
  1723.     }
  1724.     else if ((priority == MMI_EMAIL_NORMAL_PRIORITY) && (totalAttachments != 0))
  1725.     {
  1726.         return IMG_EMAIL_SENT_NORMAL_ATTACH_ID;
  1727.     }
  1728.     else if ((priority < MMI_EMAIL_NORMAL_PRIORITY) && (totalAttachments != 0))
  1729.     {
  1730.         return IMG_EMAIL_SENT_HIGH_ATTACH_ID;
  1731.     }
  1732.     else if ((priority > MMI_EMAIL_NORMAL_PRIORITY) && (!totalAttachments))
  1733.     {
  1734.         return IMG_EMAIL_SENT_LOW_ID;
  1735.     }
  1736.     else if ((priority == MMI_EMAIL_NORMAL_PRIORITY) && (!totalAttachments))
  1737.     {
  1738.         return IMG_EMAIL_SENT_NORMAL_ID;
  1739.     }
  1740.     else    /* if ( (priority<MMI_EMAIL_NORMAL_PRIORITY) && (!totalAttachments) ) */
  1741.     {
  1742.         return IMG_EMAIL_SENT_HIGH_ID;
  1743.     }
  1744. }
  1745. /*****************************************************************************
  1746.  * FUNCTION
  1747.  *  mmi_email_fldr_is_list_ready
  1748.  * DESCRIPTION
  1749.  *  Function to check if list of items is ready to be displayed.
  1750.  * PARAMETERS
  1751.  *  void
  1752.  * RETURNS
  1753.  *  void
  1754.  *****************************************************************************/
  1755. BOOL mmi_email_fldr_is_list_ready(void)
  1756. {
  1757.     /*----------------------------------------------------------------*/
  1758.     /* Local Variables                                                */
  1759.     /*----------------------------------------------------------------*/
  1760.     mmi_mem_pool_ret_enum ret_result;
  1761.     mmi_email_mail_info_struct *listMsgsStruct[EMAIL_TOTAL_MSG_BUFF];
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Code Body                                                      */
  1764.     /*----------------------------------------------------------------*/
  1765.     ret_result = mmi_mem_get_values(
  1766.                     &email_p->mem_pool_info.mem_container,
  1767.                     (S16) email_p->mem_pool_info.start_indx,
  1768.                     (S16) email_p->mem_pool_info.end_indx,
  1769.                     (void **)listMsgsStruct,
  1770.                     &email_p->mem_pool_info.not_avail_pool);
  1771.     if (ret_result != MEM_CT_SUCCESS)
  1772.     {
  1773.         email_p->fldr_info.curr_page = email_p->mem_pool_info.not_avail_pool + 1;
  1774.         return FALSE;
  1775.     }
  1776.     return TRUE;
  1777. }
  1778. /*****************************************************************************
  1779.  * FUNCTION
  1780.  *  mmi_email_fldr_pre_entry
  1781.  * DESCRIPTION
  1782.  *  Pre-Entry function of folders.
  1783.  * PARAMETERS
  1784.  *  void
  1785.  * RETURNS
  1786.  *  void
  1787.  *****************************************************************************/
  1788. void mmi_email_fldr_pre_entry(void)
  1789. {
  1790.     /*----------------------------------------------------------------*/
  1791.     /* Local Variables                                                */
  1792.     /*----------------------------------------------------------------*/
  1793.     /*----------------------------------------------------------------*/
  1794.     /* Code Body                                                      */
  1795.     /*----------------------------------------------------------------*/
  1796.     email_p->fldr_info.is_list_updated = TRUE;
  1797. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1798.     if (email_p->main_info.entry_src == EMAIL_FROM_IDLE || email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4)
  1799. #else 
  1800.     if (email_p->main_info.entry_src == EMAIL_FROM_IDLE)
  1801. #endif 
  1802.     {
  1803.         email_p->fldr_info.is_list_updated = FALSE;
  1804.     }
  1805.     else
  1806.     {
  1807.         if (!email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails)
  1808.         {
  1809.             DisplayPopup(
  1810.                 (U8*) GetString(STR_GLOBAL_EMPTY),
  1811.                 IMG_GLOBAL_EMPTY,
  1812.                 1,
  1813.                 UI_POPUP_NOTIFYDURATION_TIME,
  1814.                 (U8) EMPTY_LIST_TONE);
  1815.             return;
  1816.         }
  1817.     }
  1818.     email_p->fldr_info.fldr_list.num_msgs = 0;
  1819.     email_p->fldr_info.curr_page = 1;
  1820.     mmi_email_fldr_reset_list_info();
  1821.     mmi_email_fldr_exec_entry();
  1822. }
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  mmi_email_fldr_back_from_history
  1826.  * DESCRIPTION
  1827.  *  Function to be added to history when back to folders.
  1828.  * PARAMETERS
  1829.  *  void
  1830.  * RETURNS
  1831.  *  void
  1832.  *****************************************************************************/
  1833. void mmi_email_fldr_back_from_history(void)
  1834. {
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Local Variables                                                */
  1837.     /*----------------------------------------------------------------*/
  1838.     /*----------------------------------------------------------------*/
  1839.     /* Code Body                                                      */
  1840.     /*----------------------------------------------------------------*/
  1841.     email_p->fldr_info.is_list_updated = TRUE;
  1842.     if (email_p->fldr_info.need_fldr_sel == TRUE)
  1843.     {
  1844.         email_p->fldr_info.is_list_updated = FALSE;
  1845.         mmi_email_fldr_reset_list_info();
  1846.     }
  1847.     mmi_email_fldr_exec_entry();
  1848. }
  1849. /*****************************************************************************
  1850.  * FUNCTION
  1851.  *  mmi_email_fldr_pre_folder_select_req
  1852.  * DESCRIPTION
  1853.  *  Function before sending folder select request to protocol
  1854.  * PARAMETERS
  1855.  *  void
  1856.  * RETURNS
  1857.  *  void
  1858.  *****************************************************************************/
  1859. void mmi_email_fldr_pre_folder_select_req(void)
  1860. {
  1861.     /*----------------------------------------------------------------*/
  1862.     /* Local Variables                                                */
  1863.     /*----------------------------------------------------------------*/
  1864.     /*----------------------------------------------------------------*/
  1865.     /* Code Body                                                      */
  1866.     /*----------------------------------------------------------------*/
  1867.     if (email_p->fldr_info.curr_page < 1)
  1868.     {
  1869.         email_p->fldr_info.curr_page = 1;
  1870.     }
  1871.     //      if (email_p->main_info.curr_menu==MMI_EMAIL_INBOX) 
  1872.     //              email_p->main_info.unread_mails = 0;
  1873.     mmi_email_ps_folder_select_req();
  1874. }
  1875. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1876. /*****************************************************************************
  1877.  * FUNCTION
  1878.  *  mmi_email_hilite_fldr_next_page
  1879.  * DESCRIPTION
  1880.  *  Highlight handler of Each Folder -> Option -> Next page
  1881.  * PARAMETERS
  1882.  *  void
  1883.  * RETURNS
  1884.  *  void
  1885.  *****************************************************************************/
  1886. void mmi_email_hilite_fldr_next_page(void)
  1887. {
  1888.     /*----------------------------------------------------------------*/
  1889.     /* Local Variables                                                */
  1890.     /*----------------------------------------------------------------*/
  1891.     /*----------------------------------------------------------------*/
  1892.     /* Code Body                                                      */
  1893.     /*----------------------------------------------------------------*/
  1894.     SetLeftSoftkeyFunction(mmi_email_fldr_next_page_req, KEY_EVENT_UP);
  1895. }
  1896. /*****************************************************************************
  1897.  * FUNCTION
  1898.  *  mmi_email_hilite_fldr_prev_page
  1899.  * DESCRIPTION
  1900.  *  Highlight handler of Each folder -> Option -> Previous page
  1901.  * PARAMETERS
  1902.  *  void
  1903.  * RETURNS
  1904.  *  void
  1905.  *****************************************************************************/
  1906. void mmi_email_hilite_fldr_prev_page(void)
  1907. {
  1908.     /*----------------------------------------------------------------*/
  1909.     /* Local Variables                                                */
  1910.     /*----------------------------------------------------------------*/
  1911.     /*----------------------------------------------------------------*/
  1912.     /* Code Body                                                      */
  1913.     /*----------------------------------------------------------------*/
  1914.     SetLeftSoftkeyFunction(mmi_email_fldr_prev_page_req, KEY_EVENT_UP);
  1915. }
  1916. /*****************************************************************************
  1917.  * FUNCTION
  1918.  *  mmi_email_hilite_fldr_jump_to_page
  1919.  * DESCRIPTION
  1920.  *  Highlight handler of Inbox -> Option -> Jump to page
  1921.  * PARAMETERS
  1922.  *  void
  1923.  * RETURNS
  1924.  *  void
  1925.  *****************************************************************************/
  1926. void mmi_email_hilite_fldr_jump_to_page(void)
  1927. {
  1928.     /*----------------------------------------------------------------*/
  1929.     /* Local Variables                                                */
  1930.     /*----------------------------------------------------------------*/
  1931.     /*----------------------------------------------------------------*/
  1932.     /* Code Body                                                      */
  1933.     /*----------------------------------------------------------------*/
  1934.     SetLeftSoftkeyFunction(mmi_email_fldr_pre_entry_jump_page, KEY_EVENT_UP);
  1935.     SetKeyHandler(mmi_email_fldr_pre_entry_jump_page, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1936. }
  1937. /*****************************************************************************
  1938.  * FUNCTION
  1939.  *  mmi_email_fldr_pre_entry_jump_page
  1940.  * DESCRIPTION
  1941.  *  Pre-entry fuction of Jump to Page screen
  1942.  * PARAMETERS
  1943.  *  void
  1944.  * RETURNS
  1945.  *  void
  1946.  *****************************************************************************/
  1947. void mmi_email_fldr_pre_entry_jump_page(void)
  1948. {
  1949.     /*----------------------------------------------------------------*/
  1950.     /* Local Variables                                                */
  1951.     /*----------------------------------------------------------------*/
  1952.     /*----------------------------------------------------------------*/
  1953.     /* Code Body                                                      */
  1954.     /*----------------------------------------------------------------*/
  1955.     /* reset input buffer */
  1956.     email_p->fldr_info.jump_page_buff[0] = 0;
  1957.     mmi_email_entry_jump_page();
  1958. }
  1959. /*****************************************************************************
  1960.  * FUNCTION
  1961.  *  mmi_email_fldr_exec_jump_page
  1962.  * DESCRIPTION
  1963.  *  Execute next/prev/jump to operation according to "to-go" page.
  1964.  * PARAMETERS
  1965.  *  void
  1966.  * RETURNS
  1967.  *  void
  1968.  *****************************************************************************/
  1969. void mmi_email_fldr_exec_jump_page(void)
  1970. {
  1971.     /*----------------------------------------------------------------*/
  1972.     /* Local Variables                                                */
  1973.     /*----------------------------------------------------------------*/
  1974.     /*----------------------------------------------------------------*/
  1975.     /* Code Body                                                      */
  1976.     /*----------------------------------------------------------------*/
  1977.     email_p->fldr_info.curr_mail_indx = 0;
  1978.     email_p->fldr_info.fldr_list.num_msgs = 0;
  1979.     mmi_email_fldr_reset_list_info();
  1980.     mmi_email_fldr_pre_folder_select_req();
  1981.     if (email_p->main_info.curr_menu == MMI_EMAIL_INBOX)
  1982.     {
  1983.         DeleteNScrId(SCR_ID_EMAIL_INBOX);
  1984.     }
  1985.     else if (email_p->main_info.curr_menu == MMI_EMAIL_SENT)
  1986.     {
  1987.         DeleteNScrId(SCR_ID_EMAIL_SENT);
  1988.     }
  1989.     else if (email_p->main_info.curr_menu == MMI_EMAIL_DRAFT)
  1990.     {
  1991.         DeleteNScrId(SCR_ID_EMAIL_DRAFT);
  1992.     }
  1993. }
  1994. /*****************************************************************************
  1995.  * FUNCTION
  1996.  *  mmi_email_entry_jump_page
  1997.  * DESCRIPTION
  1998.  *  Entry Jump To Page screen in each folder
  1999.  * PARAMETERS
  2000.  *  void
  2001.  * RETURNS
  2002.  *  void
  2003.  *****************************************************************************/
  2004. void mmi_email_entry_jump_page(void)
  2005. {
  2006.     /*----------------------------------------------------------------*/
  2007.     /* Local Variables                                                */
  2008.     /*----------------------------------------------------------------*/
  2009.     U8 *guiBuffer;
  2010.     U8 *inputBuffer;
  2011.     U16 inputBufferSize;
  2012.     /*----------------------------------------------------------------*/
  2013.     /* Code Body                                                      */
  2014.     /*----------------------------------------------------------------*/
  2015.     EntryNewScreen(SCR_ID_EMAIL_FLDR_JUMP, mmi_email_exit_jump_page, NULL, NULL);
  2016.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_FLDR_JUMP);
  2017.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_FLDR_JUMP, &inputBufferSize);
  2018.     InitializeCategory57Screen();
  2019.     mmi_email_fldr_fill_jump_inline_struct();
  2020.     if (inputBuffer != NULL)
  2021.     {
  2022.         SetCategory57Data(wgui_inline_items, EMAIL_JUMP_PAGE_TOTAL_ITEM, inputBuffer);
  2023.     }
  2024.     DisableCategory57ScreenDone();
  2025.     ShowCategory57Screen(
  2026.         STR_EMAIL_IMAP4_JUMP_TO_PAGE_ID,
  2027.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2028.         STR_GLOBAL_OK,
  2029.         IMG_GLOBAL_OK,
  2030.         STR_GLOBAL_BACK,
  2031.         IMG_GLOBAL_BACK,
  2032.         EMAIL_JUMP_PAGE_TOTAL_ITEM,
  2033.         NULL,
  2034.         wgui_inline_items,
  2035.         0,
  2036.         guiBuffer);
  2037.     SetCategory57RightSoftkeyFunctions(mmi_email_fldr_jump_page_req, GoBackHistory);
  2038.     SetLeftSoftkeyFunction(mmi_email_fldr_jump_page_req, KEY_EVENT_UP);
  2039. }
  2040. /*****************************************************************************
  2041.  * FUNCTION
  2042.  *  mmi_email_exit_jump_page
  2043.  * DESCRIPTION
  2044.  *  Exit function of Jump To Page screen
  2045.  * PARAMETERS
  2046.  *  void
  2047.  * RETURNS
  2048.  *  void
  2049.  *****************************************************************************/
  2050. void mmi_email_exit_jump_page(void)
  2051. {
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Local Variables                                                */
  2054.     /*----------------------------------------------------------------*/
  2055.     /*----------------------------------------------------------------*/
  2056.     /* Code Body                                                      */
  2057.     /*----------------------------------------------------------------*/
  2058.     mmi_email_util_add_n_history(SCR_ID_EMAIL_FLDR_JUMP, mmi_email_entry_jump_page);
  2059. }
  2060. /*****************************************************************************
  2061.  * FUNCTION
  2062.  *  mmi_email_fldr_fill_jump_inline_struct
  2063.  * DESCRIPTION
  2064.  *  Fill inline data structure for Jump to Page screen.
  2065.  * PARAMETERS
  2066.  *  void
  2067.  * RETURNS
  2068.  *  void
  2069.  *****************************************************************************/
  2070. void mmi_email_fldr_fill_jump_inline_struct(void)
  2071. {
  2072.     /*----------------------------------------------------------------*/
  2073.     /* Local Variables                                                */
  2074.     /*----------------------------------------------------------------*/
  2075.     S8 *asciiPageNumberInfoBuff = OslMalloc(EMAIL_MAX_FLDR_CAP_LEN);
  2076.     S8 *ucs2PageNumberInfoBuff = OslMalloc(EMAIL_MAX_FLDR_CAP_LEN * ENCODING_LENGTH);
  2077.     /*----------------------------------------------------------------*/
  2078.     /* Code Body                                                      */
  2079.     /*----------------------------------------------------------------*/
  2080.     /* Caption */
  2081.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  2082.     sprintf((S8*) asciiPageNumberInfoBuff, " [%u/%u]", email_p->fldr_info.curr_page, email_p->fldr_info.total_page);
  2083.     AnsiiToUnicodeString((S8*) ucs2PageNumberInfoBuff, (S8*) asciiPageNumberInfoBuff);
  2084.     pfnUnicodeStrcpy((S8*) email_p->comm_buff, (S8*) GetString(STR_EMAIL_IMAP4_PAGE_NUMBER_ID));
  2085.     pfnUnicodeStrcat((S8*) email_p->comm_buff, (S8*) ucs2PageNumberInfoBuff);
  2086.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) email_p->comm_buff);
  2087.     SetInlineItemFullWidth(&wgui_inline_items[0]);
  2088.     LeftJustifyInlineItem(&wgui_inline_items[0]);
  2089.     /* Page number */
  2090.     SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2091.     sprintf((S8*) asciiPageNumberInfoBuff, "%u", email_p->fldr_info.curr_page);
  2092.     AnsiiToUnicodeString((S8*) email_p->fldr_info.jump_page_buff, (S8*) asciiPageNumberInfoBuff);
  2093.     SetInlineItemTextEdit(
  2094.         &wgui_inline_items[1],
  2095.         (U8*) email_p->fldr_info.jump_page_buff,
  2096.         EMAIL_MAX_JUMP_PAGE_INPUT_LEN + 1,
  2097.         INPUT_TYPE_NUMERIC);
  2098.     RightJustifyInlineItem(&wgui_inline_items[1]);
  2099.     EnableInlineItemBoundary(&wgui_inline_items[1]);
  2100.     SetInlineItemFullWidth(&wgui_inline_items[1]);
  2101.     DisableInlineItemHighlight(&wgui_inline_items[1]);
  2102.     OslMfree(asciiPageNumberInfoBuff);
  2103.     OslMfree(ucs2PageNumberInfoBuff);
  2104. }
  2105. /*****************************************************************************
  2106.  * FUNCTION
  2107.  *  mmi_email_fldr_jump_page_req
  2108.  * DESCRIPTION
  2109.  *  Retrieve data from Jump Page inline editor screen and go to corresponding page
  2110.  * PARAMETERS
  2111.  *  void
  2112.  * RETURNS
  2113.  *  void
  2114.  *****************************************************************************/
  2115. void mmi_email_fldr_jump_page_req(void)
  2116. {
  2117.     /*----------------------------------------------------------------*/
  2118.     /* Local Variables                                                */
  2119.     /*----------------------------------------------------------------*/
  2120.     /*----------------------------------------------------------------*/
  2121.     /* Code Body                                                      */
  2122.     /*----------------------------------------------------------------*/
  2123.     CloseCategory57Screen();
  2124.     if (pfnUnicodeStrlen((S8*) email_p->fldr_info.jump_page_buff))
  2125.     {
  2126.         U16 len;
  2127.         U16 pageNumberT;
  2128.         S8 ansiiPageNumber[EMAIL_MAX_JUMP_PAGE_INPUT_LEN + 1];
  2129.         len = UnicodeNToAnsii(
  2130.                 (S8*) ansiiPageNumber,
  2131.                 (S8*) email_p->fldr_info.jump_page_buff,
  2132.                 (pfnUnicodeStrlen((S8*) email_p->fldr_info.jump_page_buff) * ENCODING_LENGTH));
  2133.         ansiiPageNumber[len] = '';
  2134.         pageNumberT = atoi(ansiiPageNumber);
  2135.         if (pageNumberT > email_p->fldr_info.total_page || pageNumberT < 1)
  2136.         {
  2137.             DisplayPopup(
  2138.                 (U8*) GetString(STR_EMAIL_IMAP4_INVALID_PAGE_NUMBER_ID),
  2139.                 IMG_GLOBAL_UNFINISHED,
  2140.                 1,
  2141.                 UI_POPUP_NOTIFYDURATION_TIME,
  2142.                 (U8) WARNING_TONE);
  2143.         }
  2144.         else
  2145.         {
  2146.             email_p->fldr_info.curr_page = pageNumberT;
  2147.             mmi_email_fldr_exec_jump_page();
  2148.         }
  2149.     }
  2150.     else
  2151.     {
  2152.         DisplayPopup(
  2153.             (U8*) GetString(STR_GLOBAL_EMPTY),
  2154.             IMG_GLOBAL_EMPTY,
  2155.             1,
  2156.             UI_POPUP_NOTIFYDURATION_TIME,
  2157.             (U8) EMPTY_LIST_TONE);
  2158.     }
  2159. }
  2160. /*****************************************************************************
  2161.  * FUNCTION
  2162.  *  mmi_email_fldr_next_page_req
  2163.  * DESCRIPTION
  2164.  *  Get next page index of current page and go to the page
  2165.  * PARAMETERS
  2166.  *  void
  2167.  * RETURNS
  2168.  *  void
  2169.  *****************************************************************************/
  2170. void mmi_email_fldr_next_page_req(void)
  2171. {
  2172.     /*----------------------------------------------------------------*/
  2173.     /* Local Variables                                                */
  2174.     /*----------------------------------------------------------------*/
  2175.     /*----------------------------------------------------------------*/
  2176.     /* Code Body                                                      */
  2177.     /*----------------------------------------------------------------*/
  2178.     email_p->fldr_info.curr_page++;
  2179.     if ((email_p->fldr_info.curr_page > email_p->fldr_info.total_page) || (email_p->fldr_info.curr_page < 1))
  2180.     {
  2181.         email_p->fldr_info.curr_page = 1;
  2182.     }
  2183.     mmi_email_fldr_exec_jump_page();
  2184. }
  2185. /*****************************************************************************
  2186.  * FUNCTION
  2187.  *  mmi_email_fldr_prev_page_req
  2188.  * DESCRIPTION
  2189.  *  Get previous page index of current page and go to the page
  2190.  * PARAMETERS
  2191.  *  void
  2192.  * RETURNS
  2193.  *  void
  2194.  *****************************************************************************/
  2195. void mmi_email_fldr_prev_page_req(void)
  2196. {
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Local Variables                                                */
  2199.     /*----------------------------------------------------------------*/
  2200.     /*----------------------------------------------------------------*/
  2201.     /* Code Body                                                      */
  2202.     /*----------------------------------------------------------------*/
  2203.     email_p->fldr_info.curr_page--;
  2204.     if (email_p->fldr_info.curr_page < 1)
  2205.     {
  2206.         email_p->fldr_info.curr_page = (S8) email_p->fldr_info.total_page;
  2207.     }
  2208.     mmi_email_fldr_exec_jump_page();
  2209. }
  2210. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  2211. /*****************************************************************************
  2212.  * FUNCTION
  2213.  *  mmi_email_fldr_get_num_mails
  2214.  * DESCRIPTION
  2215.  *  Get number of mails to be displayed in current folder.
  2216.  * PARAMETERS
  2217.  *  void
  2218.  * RETURNS
  2219.  *  Number of malis.
  2220.  *****************************************************************************/
  2221. S32 mmi_email_fldr_get_num_mails(void)
  2222. {
  2223.     /*----------------------------------------------------------------*/
  2224.     /* Local Variables                                                */
  2225.     /*----------------------------------------------------------------*/
  2226.     S32 numItems;
  2227.     /*----------------------------------------------------------------*/
  2228.     /* Code Body                                                      */
  2229.     /*----------------------------------------------------------------*/
  2230. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  2231.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4 && email_p->main_info.curr_menu != MMI_EMAIL_UNSENT)
  2232.     {
  2233.         numItems =
  2234.             (!email_p->fldr_info.fldr_list.num_msgs) ? email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].
  2235.             total_mails : email_p->fldr_info.fldr_list.num_msgs;
  2236.         /* IMAP4 is page-based, can display one page per time -- this might be redudant because */
  2237.         numItems = (numItems > MMI_EMAIL_MAX_MSG_PER_PAGE) ? MMI_EMAIL_MAX_MSG_PER_PAGE : numItems;
  2238.     }
  2239.     else
  2240. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  2241.         numItems = email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails;
  2242.     if (email_p->fldr_info.is_list_updated == FALSE && numItems == 0)
  2243.     {
  2244.         numItems = 1;
  2245.     }
  2246.     return numItems;
  2247. }
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  mmi_email_fldr_reset_list_info
  2251.  * DESCRIPTION
  2252.  *  Reset variales before entry a folder.
  2253.  * PARAMETERS
  2254.  *  void
  2255.  * RETURNS
  2256.  *  Number of malis.(?)
  2257.  *****************************************************************************/
  2258. void mmi_email_fldr_reset_list_info(void)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     S16 totalPool;
  2264.     /*----------------------------------------------------------------*/
  2265.     /* Code Body                                                      */
  2266.     /*----------------------------------------------------------------*/
  2267.     email_p->fldr_info.is_list_displayed = FALSE;
  2268.     mmi_email_util_free_container_pool();
  2269. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  2270.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4 && email_p->main_info.curr_menu != MMI_EMAIL_UNSENT)
  2271.     {
  2272.         totalPool = 1;
  2273.     }
  2274.     else
  2275. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  2276.         totalPool = EMAIL_TOTAL_POOL + 1;
  2277.     /* create pool */
  2278.     mmi_mem_create_container(
  2279.         totalPool,
  2280.         MMI_EMAIL_MAX_MSG_PER_PAGE,
  2281.         (void*)email_p->fldr_info.fldr_list.mail_list,
  2282.         sizeof(mmi_email_mail_info_struct),
  2283.         &email_p->mem_pool_info.mem_container);
  2284.     email_p->mem_pool_info.start_indx = 0;
  2285.     /* retreive start/end index of pool */
  2286.     /* for IMAP4 realted folder, because there is only 1 page, the maximal number is 5 (MMI_EMAIL_MAX_MSG_PER_PAGE),
  2287.        for POP3 and Unsent folder, the maximal number depends on maximal size of async pool */
  2288. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  2289.     if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4 && email_p->main_info.curr_menu != MMI_EMAIL_UNSENT)
  2290.     {
  2291.         if (email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails < MMI_EMAIL_MAX_MSG_PER_PAGE)
  2292.         {
  2293.             email_p->mem_pool_info.end_indx =
  2294.                 email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails - 1;
  2295.         }
  2296.         else
  2297.         {
  2298.             email_p->mem_pool_info.end_indx = MMI_EMAIL_MAX_MSG_PER_PAGE - 1;
  2299.         }
  2300.     }
  2301.     else
  2302. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  2303.     {
  2304.         if (email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails < MAX_ASYNCDYNAMIC_ITEMS_BUFF)
  2305.         {
  2306.             email_p->mem_pool_info.end_indx =
  2307.                 email_p->fldr_info.fldr_data[email_p->main_info.curr_menu].total_mails - 1;
  2308.         }
  2309.         else
  2310.         {
  2311.             email_p->mem_pool_info.end_indx = MAX_ASYNCDYNAMIC_ITEMS_BUFF - 1;
  2312.         }
  2313.     }
  2314.     email_p->mem_pool_info.not_avail_pool = 0;
  2315. }
  2316. /*****************************************************************************
  2317.  * FUNCTION
  2318.  *  mmi_email_fldr_reset_cntx
  2319.  * DESCRIPTION
  2320.  *  Reset folder info.
  2321.  * PARAMETERS
  2322.  *  flag        [IN]        Flag to indicate reseting all folder or not
  2323.  * RETURNS
  2324.  *  void
  2325.  *****************************************************************************/
  2326. void mmi_email_fldr_reset_cntx(email_reset_fldr_enum flag)
  2327. {
  2328.     /*----------------------------------------------------------------*/
  2329.     /* Local Variables                                                */
  2330.     /*----------------------------------------------------------------*/
  2331.     /*----------------------------------------------------------------*/
  2332.     /* Code Body                                                      */
  2333.     /*----------------------------------------------------------------*/
  2334.     if (flag == EMAIL_RESET_ALL_FLDR)
  2335.     {
  2336.         memset(&email_p->fldr_info.fldr_data, 0, sizeof(email_folder_info_struct) * EMAIL_FLDR_TOTAL);
  2337.     }
  2338.     else
  2339.     {
  2340.         memset(&email_p->fldr_info.fldr_data[MMI_EMAIL_INBOX], 0, sizeof(email_folder_info_struct));
  2341.         memset(&email_p->fldr_info.fldr_data[MMI_EMAIL_SENT], 0, sizeof(email_folder_info_struct));
  2342.         memset(&email_p->fldr_info.fldr_data[MMI_EMAIL_DRAFT], 0, sizeof(email_folder_info_struct));
  2343.     }
  2344. }
  2345. /*****************************************************************************
  2346.  * FUNCTION
  2347.  *  mmi_email_entry_fldr_corrupt_mail
  2348.  * DESCRIPTION
  2349.  *  Entry function when folder message select failed. Might because of mail corrupted
  2350.  * PARAMETERS
  2351.  *  void
  2352.  * RETURNS
  2353.  *  void
  2354.  *****************************************************************************/
  2355. void mmi_email_entry_fldr_corrupt_mail(void)
  2356. {
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Local Variables                                                */
  2359.     /*----------------------------------------------------------------*/
  2360.     /*----------------------------------------------------------------*/
  2361.     /* Code Body                                                      */
  2362.     /*----------------------------------------------------------------*/
  2363.     EntryNewScreen(SCR_ID_EMAIL_FLDR_CORRUPT_MAIL, mmi_email_exit_fldr_corrupt_mail, NULL, NULL);
  2364.     ShowCategory154Screen(
  2365.         STR_EMAIL_MAIN_ID,
  2366.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2367.         STR_GLOBAL_DELETE,
  2368.         IMG_GLOBAL_OK,
  2369.         STR_GLOBAL_BACK,
  2370.         IMG_GLOBAL_BACK,
  2371.         (U8*) GetString(email_p->inbox_info.read_err_msg),
  2372.         NULL,
  2373.         IMG_EMAIL_SEND_FAIL_ID,
  2374.         NULL);
  2375.     /* LSK == Delete, RSK == Back */
  2376.     SetLeftSoftkeyFunction(mmi_email_del_single_msg_done, KEY_EVENT_UP);
  2377.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2378. }
  2379. /*****************************************************************************
  2380.  * FUNCTION
  2381.  *  mmi_email_exit_fldr_corrupt_mail
  2382.  * DESCRIPTION
  2383.  *  Exit function when folder message select failed.
  2384.  * PARAMETERS
  2385.  *  void
  2386.  * RETURNS
  2387.  *  void
  2388.  *****************************************************************************/
  2389. void mmi_email_exit_fldr_corrupt_mail(void)
  2390. {
  2391.     /*----------------------------------------------------------------*/
  2392.     /* Local Variables                                                */
  2393.     /*----------------------------------------------------------------*/
  2394.     /*----------------------------------------------------------------*/
  2395.     /* Code Body                                                      */
  2396.     /*----------------------------------------------------------------*/
  2397.     mmi_email_util_add_history(SCR_ID_EMAIL_FLDR_CORRUPT_MAIL, mmi_email_entry_fldr_corrupt_mail);
  2398. }
  2399. /*****************************************************************************
  2400.  * FUNCTION
  2401.  *  mmi_email_entry_fldr_progress
  2402.  * DESCRIPTION
  2403.  *  Display progessing screen before entry a folder.
  2404.  * PARAMETERS
  2405.  *  void
  2406.  * RETURNS
  2407.  *  void
  2408.  *****************************************************************************/
  2409. void mmi_email_entry_fldr_progress(void)
  2410. {
  2411.     /*----------------------------------------------------------------*/
  2412.     /* Local Variables                                                */
  2413.     /*----------------------------------------------------------------*/
  2414.     /*----------------------------------------------------------------*/
  2415.     /* Code Body                                                      */
  2416.     /*----------------------------------------------------------------*/
  2417.     if (GetExitScrnID() != SCR_ID_EMAIL_FLDR_LIST_PROGRESS)
  2418.     {
  2419.         /* if (email_p->fldr_info.is_list_displayed) */
  2420.         EntryNewScreen(SCR_ID_EMAIL_FLDR_LIST_PROGRESS, mmi_email_exit_fldr_progress, NULL, NULL);
  2421.         //              else
  2422.         //                      ReplaceNewScreenHandler(SCR_ID_EMAIL_FLDR_LIST_PROGRESS, mmi_email_exit_fldr_progress, NULL);
  2423.         ShowCategory154Screen(
  2424.             STR_EMAIL_COMMON_LOADING_ID,
  2425.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2426.             0,
  2427.             0,
  2428.             mmi_email_util_abort_str(),
  2429.             mmi_email_util_abort_img(),
  2430.             (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  2431.             NULL,
  2432.             IMG_EMAIL_CONNECTING_ID,
  2433.             NULL);
  2434.         SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2435.         SetLeftSoftkeyFunction(NULL, KEY_EVENT_UP);
  2436.         SetKeyHandler(mmi_email_util_get_abort_func(), KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2437.         SetRightSoftkeyFunction(mmi_email_util_get_abort_func(), KEY_EVENT_UP);
  2438.         SetKeyHandler(mmi_email_util_get_abort_func(), KEY_END, KEY_EVENT_DOWN);
  2439.         DeleteScreenIfPresent(SCR_ID_EMAIL_FLDR_LIST_PROGRESS);
  2440.     }
  2441. }
  2442. /*****************************************************************************
  2443.  * FUNCTION
  2444.  *  mmi_email_exit_fldr_progress
  2445.  * DESCRIPTION
  2446.  *  Exit function of folder progressing screen.
  2447.  * PARAMETERS
  2448.  *  void
  2449.  * RETURNS
  2450.  *  void
  2451.  *****************************************************************************/
  2452. void mmi_email_exit_fldr_progress(void)
  2453. {
  2454.     /*----------------------------------------------------------------*/
  2455.     /* Local Variables                                                */
  2456.     /*----------------------------------------------------------------*/
  2457.     /*----------------------------------------------------------------*/
  2458.     /* Code Body                                                      */
  2459.     /*----------------------------------------------------------------*/
  2460.     /* to make sure only 1 progressing screen in history */
  2461.     if (!IsScreenPresent(SCR_ID_EMAIL_FLDR_LIST_PROGRESS))
  2462.     {
  2463.         mmi_email_util_add_history(SCR_ID_EMAIL_FLDR_LIST_PROGRESS, mmi_email_entry_fldr_progress);
  2464.     }
  2465. }
  2466. #define FMGR_EMAIL
  2467. /*****************************************************************************
  2468.  * FUNCTION
  2469.  *  mmi_email_fmgr_free_mem_n_back
  2470.  * DESCRIPTION
  2471.  *  Free allocated memory and go back to previous screen
  2472.  * PARAMETERS
  2473.  *  void
  2474.  * RETURNS
  2475.  *  void
  2476.  *****************************************************************************/
  2477. void mmi_email_fmgr_free_mem_n_back(void)
  2478. {
  2479.     /*----------------------------------------------------------------*/
  2480.     /* Local Variables                                                */
  2481.     /*----------------------------------------------------------------*/
  2482.     /*----------------------------------------------------------------*/
  2483.     /* Code Body                                                      */
  2484.     /*----------------------------------------------------------------*/
  2485.     if (email_p->other_app_info.fmgr_path)
  2486.     {
  2487.         OslMfree(email_p->other_app_info.fmgr_path);
  2488.         email_p->other_app_info.fmgr_path = NULL;
  2489.     }
  2490.     GoBackHistory();
  2491. }
  2492. /*****************************************************************************
  2493.  * FUNCTION
  2494.  *  mmi_email_fmgr_send
  2495.  * DESCRIPTION
  2496.  *  Interface for file manager to send a file.
  2497.  * PARAMETERS
  2498.  *  filePath        [IN]        Complete file path and name of the selected file
  2499.  * RETURNS
  2500.  *  void
  2501.  *****************************************************************************/
  2502. void mmi_email_fmgr_send(S8 *filePath)
  2503. {
  2504.     /*----------------------------------------------------------------*/
  2505.     /* Local Variables                                                */
  2506.     /*----------------------------------------------------------------*/
  2507.     S32 fileLen;
  2508.     S32 f_result;
  2509.     /*----------------------------------------------------------------*/
  2510.     /* Code Body                                                      */
  2511.     /*----------------------------------------------------------------*/
  2512.     if ((email_p->main_info.ready_state & EMAIL_READY) == EMAIL_READY)
  2513.     {
  2514.         if (filePath == NULL)
  2515.         {
  2516.             DisplayPopup(
  2517.                 (U8*) GetString(STR_GLOBAL_EMPTY),
  2518.                 IMG_GLOBAL_EMPTY,
  2519.                 1,
  2520.                 UI_POPUP_NOTIFYDURATION_TIME,
  2521.                 (U8) EMPTY_LIST_TONE);
  2522.         }
  2523.         else if (mmi_email_prof_is_activated() == FALSE)
  2524.         {
  2525.             DisplayPopup(
  2526.                 (U8*) GetString(STR_EMAIL_ERROR_CODE_ACCT_NOT_CONFIG_ID),
  2527.                 IMG_GLOBAL_WARNING,
  2528.                 1,
  2529.                 UI_POPUP_NOTIFYDURATION_TIME,
  2530.                 (U8) WARNING_TONE);
  2531.         }
  2532.         else if (email_p->snr_info.is_auto_chk)
  2533.         {
  2534.             DisplayPopup(
  2535.                 (U8*) GetString(STR_EMAIL_AUTO_CHECK_BUSY_ID),
  2536.                 IMG_GLOBAL_WARNING,
  2537.                 1,
  2538.                 UI_POPUP_NOTIFYDURATION_TIME,
  2539.                 (U8) WARNING_TONE);
  2540.         }
  2541.         else
  2542.         {
  2543.             /* check file size */
  2544.             if ((f_result = mmi_email_util_get_file_size(filePath, &fileLen)) == FS_NO_ERROR)
  2545.             {
  2546.                 // if (fileLen > MMI_EMAIL_MAX_ATTACH_SIZE)
  2547.                 if (fileLen > MMI_EMAIL_TOTAL_MAX_ATTACH_SIZE)
  2548.                 {
  2549.                     DisplayPopup(
  2550.                         (U8*) GetString(STR_EMAIL_SIZE_TOO_LARGE),
  2551.                         IMG_GLOBAL_UNFINISHED,
  2552.                         1,
  2553.                         UI_POPUP_NOTIFYDURATION_TIME,
  2554.                         (U8) WARNING_TONE);
  2555.                 }
  2556.                 else
  2557.                 {
  2558.                     /* proceed adding attachment */
  2559.                     if (email_p->other_app_info.fmgr_path == NULL)
  2560.                     {
  2561.                         email_p->other_app_info.fmgr_path = OslMalloc((FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH);
  2562.                     }
  2563.                     pfnUnicodeStrcpy((S8*) email_p->other_app_info.fmgr_path, (S8*) filePath);
  2564.                     if (mmi_email_comp_get_done_status())
  2565.                     {
  2566.                         mmi_email_display_confirm(
  2567.                             STR_EMAIL_OVERWRITE_WARNING,
  2568.                             mmi_email_fmgr_exec_send,
  2569.                             mmi_email_fmgr_free_mem_n_back);
  2570.                     }
  2571.                     else
  2572.                     {
  2573.                         mmi_email_fmgr_exec_send();
  2574.                     }
  2575.                 }
  2576.             }
  2577.             else
  2578.             {
  2579.                 DisplayPopup(
  2580.                     (U8*) GetString(GetFileSystemErrorString(f_result)),
  2581.                     IMG_GLOBAL_UNFINISHED,
  2582.                     1,
  2583.                     UI_POPUP_NOTIFYDURATION_TIME,
  2584.                     (U8) WARNING_TONE);
  2585.             }
  2586.         }
  2587.     }
  2588.     else    /* email application not ready */
  2589.     {
  2590.     #ifdef __USB_IN_NORMAL_MODE__
  2591.         if (mmi_usb_is_in_mass_storage_mode())
  2592.         {
  2593.             mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
  2594.         }
  2595.         else
  2596.     #endif /* __USB_IN_NORMAL_MODE__ */ 
  2597.         {
  2598.             DisplayPopup(
  2599.                 (U8*) GetString(STR_EMAIL_NOT_READY_ID),
  2600.                 IMG_GLOBAL_WARNING,
  2601.                 1,
  2602.                 UI_POPUP_NOTIFYDURATION_TIME,
  2603.                 (U8) WARNING_TONE);
  2604.         }
  2605.     }
  2606. }
  2607. /*****************************************************************************
  2608.  * FUNCTION
  2609.  *  mmi_email_fmgr_exec_send
  2610.  * DESCRIPTION
  2611.  *  Execute sending of a file.
  2612.  *  Initialize global variable of Write Email screen and send email start request.
  2613.  * PARAMETERS
  2614.  *  void
  2615.  * RETURNS
  2616.  *  void
  2617.  *****************************************************************************/
  2618. void mmi_email_fmgr_exec_send(void)
  2619. {
  2620.     /*----------------------------------------------------------------*/
  2621.     /* Local Variables                                                */
  2622.     /*----------------------------------------------------------------*/
  2623.     S32 dirLen;
  2624.     S8 *fileName;
  2625.     S8 *fileExt;
  2626.     /*----------------------------------------------------------------*/
  2627.     /* Code Body                                                      */
  2628.     /*----------------------------------------------------------------*/
  2629.     /* extract file name and path */
  2630.     dirLen = (S32) mmi_fmgr_get_last_dir_index((S8*) email_p->other_app_info.fmgr_path);
  2631.     fileName = (S8*) email_p->other_app_info.fmgr_path;
  2632.     fileName += dirLen;
  2633.     /* set state of Email */
  2634.     email_p->main_info.entry_src = EMAIL_FROM_APP;
  2635.     /* initialize structure of Write Email screen */
  2636.     mmi_email_comp_reset_member();
  2637.     /* copy file to file buffer */
  2638.     pfnUnicodeStrcpy((S8*) email_p->comp_info.attch_list[0].file_name, (S8*) fileName);
  2639.     /* file extension */
  2640.     fileExt = mmi_email_get_file_ext((S8*) fileName);
  2641.     /* destination file name */
  2642.     mmi_email_util_get_attch_name(1, (S8*) email_p->comp_info.attch_list[0].file_path);
  2643.     pfnUnicodeStrcat((S8*) email_p->comp_info.attch_list[0].file_path, (S8*) fileExt);
  2644.     pfnUnicodeStrcpy((S8*) email_p->comm_buff, (S8*) email_p->other_app_info.fmgr_path);
  2645.     email_p->misc_info.file_copy_state = EMAIL_FILE_FROM_APP;
  2646.     FS_Delete((U16*) email_p->comp_info.attch_list[0].file_path);
  2647.     mmi_fmgr_send_copy_req(
  2648.         FMGR_ACTION_COPY,
  2649.         (U8*) email_p->comm_buff,
  2650.         (U8*) email_p->comp_info.attch_list[0].file_path,
  2651.         mmi_email_comp_attach_copy_callback);
  2652.     mmi_email_pre_entry_progressing(
  2653.         STR_EMAIL_MAIN_ID,
  2654.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2655.         0,
  2656.         0,
  2657.         0,
  2658.         0,
  2659.         (U8*) GetString(STR_EMAIL_COMMON_LOADING_ID),
  2660.         (U8*) NULL,
  2661.         IMG_GLOBAL_PROGRESS,
  2662.         NULL,
  2663.         NULL,
  2664.         NULL,
  2665.         0);
  2666.     OslMfree(email_p->other_app_info.fmgr_path);
  2667.     email_p->other_app_info.fmgr_path = NULL;
  2668. }
  2669. /*****************************************************************************
  2670.  * FUNCTION
  2671.  *  mmi_email_fmgr_reset_status_icon
  2672.  * DESCRIPTION
  2673.  *  When file system formats by file manager, 
  2674.  *  it should call the function to reset email status icon.
  2675.  * PARAMETERS
  2676.  *  void
  2677.  * RETURNS
  2678.  *  void
  2679.  *****************************************************************************/
  2680. void mmi_email_fmgr_reset_status_icon(void)
  2681. {
  2682.     /*----------------------------------------------------------------*/
  2683.     /* Local Variables                                                */
  2684.     /*----------------------------------------------------------------*/
  2685.     /*----------------------------------------------------------------*/
  2686.     /* Code Body                                                      */
  2687.     /*----------------------------------------------------------------*/
  2688.     email_p->main_info.unread_mails = 0;
  2689.     email_p->main_info.is_mem_full = FALSE;
  2690.     HideStatusIcon(STATUS_ICON_UNREAD_EMAIL_L1);
  2691.     UpdateStatusIcons();
  2692. }
  2693. #define PHONEBOOK_EMAIL
  2694. /*****************************************************************************
  2695.  * FUNCTION
  2696.  *  mmi_email_send_from_phb
  2697.  * DESCRIPTION
  2698.  *  Interface for sending from Phonebook module
  2699.  * PARAMETERS
  2700.  *  name        [IN]        Name of selected person
  2701.  *  email       [IN]        Email address of selected person
  2702.  * RETURNS
  2703.  *  void
  2704.  *****************************************************************************/
  2705. void mmi_email_send_from_phb(S8 *name, S8 *email)
  2706. {
  2707.     /*----------------------------------------------------------------*/
  2708.     /* Local Variables                                                */
  2709.     /*----------------------------------------------------------------*/
  2710.     /*----------------------------------------------------------------*/
  2711.     /* Code Body                                                      */
  2712.     /*----------------------------------------------------------------*/
  2713.     if ((email_p->main_info.ready_state & EMAIL_READY) == EMAIL_READY)
  2714.     {
  2715.         email_p->other_app_info.phb_name = name;
  2716.         email_p->other_app_info.phb_email = email;
  2717.         if (!pfnUnicodeStrlen((S8*) email_p->other_app_info.phb_email))
  2718.         {
  2719.             DisplayPopup(
  2720.                 (U8*) GetString(STR_GLOBAL_EMPTY),
  2721.                 IMG_GLOBAL_EMPTY,
  2722.                 1,
  2723.                 UI_POPUP_NOTIFYDURATION_TIME,
  2724.                 (U8) EMPTY_LIST_TONE);
  2725.         }
  2726.         else
  2727.         {
  2728.             if (mmi_email_comp_get_done_status())
  2729.             {
  2730.                 mmi_email_display_confirm(STR_EMAIL_OVERWRITE_WARNING, mmi_email_send_from_phb_done, GoBackHistory);
  2731.             }
  2732.             else
  2733.             {
  2734.                 mmi_email_send_from_phb_done();
  2735.             }
  2736.         }
  2737.     }
  2738.     else    /* email application not ready */
  2739.     {
  2740.     #ifdef __USB_IN_NORMAL_MODE__
  2741.         if (mmi_usb_is_in_mass_storage_mode())
  2742.         {
  2743.             mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
  2744.         }
  2745.         else
  2746.     #endif /* __USB_IN_NORMAL_MODE__ */ 
  2747.         {
  2748.             DisplayPopup(
  2749.                 (U8*) GetString(STR_EMAIL_NOT_READY_ID),
  2750.                 IMG_GLOBAL_WARNING,
  2751.                 1,
  2752.                 UI_POPUP_NOTIFYDURATION_TIME,
  2753.                 (U8) WARNING_TONE);
  2754.         }
  2755.     }
  2756. }
  2757. /*****************************************************************************
  2758.  * FUNCTION
  2759.  *  mmi_email_send_from_phb_done
  2760.  * DESCRIPTION
  2761.  *  Execute send from phonebook
  2762.  * PARAMETERS
  2763.  *  void
  2764.  * RETURNS
  2765.  *  void
  2766.  *****************************************************************************/
  2767. void mmi_email_send_from_phb_done(void)
  2768. {
  2769.     /*----------------------------------------------------------------*/
  2770.     /* Local Variables                                                */
  2771.     /*----------------------------------------------------------------*/
  2772.     /*----------------------------------------------------------------*/
  2773.     /* Code Body                                                      */
  2774.     /*----------------------------------------------------------------*/
  2775.     mmi_email_comp_reset_member();
  2776.     /* copy address to To */
  2777.     pfnUnicodeStrcpy(
  2778.         (S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_mail[0],
  2779.         (S8*) email_p->other_app_info.phb_email);
  2780.     pfnUnicodeStrncpy(
  2781.         (S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_name[0],
  2782.         (S8*) email_p->other_app_info.phb_name,
  2783.         EMAIL_PROF_DISP_NAME_LEN);
  2784.     /* copy name if existing */
  2785.     if (pfnUnicodeStrlen((S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_name[0]))
  2786.     {
  2787.         pfnUnicodeStrcpy((S8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO], (S8*) g_email_subj_left_op);
  2788.         pfnUnicodeStrcat(
  2789.             (S8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO],
  2790.             (S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_name[0]);
  2791.         pfnUnicodeStrcat((S8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO], (S8*) g_email_subj_right_op);
  2792.         pfnUnicodeStrcat(
  2793.             (S8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO],
  2794.             (S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_mail[0]);
  2795.     }
  2796.     else
  2797.     {
  2798.         pfnUnicodeStrcpy(
  2799.             (S8*) email_p->comp_info.addr_disp_buff[EMAIL_ADDR_TO],
  2800.             (S8*) email_p->comp_info.addr_list[EMAIL_ADDR_TO].to_cc_mail[0]);
  2801.     }
  2802.     email_p->main_info.entry_src = EMAIL_FROM_APP;
  2803.     email_p->main_info.curr_menu = MMI_EMAIL_COMP;
  2804.     /* start email module */
  2805.     mmi_email_ps_start_req();
  2806. }
  2807. /*****************************************************************************
  2808.  * FUNCTION
  2809.  *  mmi_email_phb_get_addr_callback
  2810.  * DESCRIPTION
  2811.  *  Callback function for phonebook when finish selecting an Email address
  2812.  * PARAMETERS
  2813.  *  name        [IN]        Name of selected person
  2814.  *  email       [IN]        Email address of selected person
  2815.  * RETURNS
  2816.  *  void
  2817.  *****************************************************************************/
  2818. void mmi_email_phb_get_addr_callback(S8 *name, S8 *email)
  2819. {
  2820.     /*----------------------------------------------------------------*/
  2821.     /* Local Variables                                                */
  2822.     /*----------------------------------------------------------------*/
  2823.     /*----------------------------------------------------------------*/
  2824.     /* Code Body                                                      */
  2825.     /*----------------------------------------------------------------*/
  2826.     if (pfnUnicodeStrlen(email) == 0)
  2827.     {
  2828.         DisplayPopup(
  2829.             (U8*) GetString(STR_EMAIL_EMAIL_ADDRESS_EMPTY),
  2830.             IMG_GLOBAL_ERROR,
  2831.             FALSE,
  2832.             UI_POPUP_NOTIFYDURATION_TIME,
  2833.             ERROR_TONE);
  2834.     }
  2835.     else
  2836.     {
  2837.         pfnUnicodeStrncpy((S8*) email_p->comp_info.phb_name, (S8*) name, EMAIL_PROF_DISP_NAME_LEN);
  2838.         pfnUnicodeStrcpy((S8*) email_p->comp_info.phb_addr, (S8*) email);
  2839.         pfnUnicodeStrcpy((S8*) email_p->comp_info.addr_input_buff, (S8*) email);
  2840.         email_p->comp_info.load_addr_done = TRUE;
  2841.         GoBackHistory();
  2842.     }
  2843. }
  2844. #endif /* __MMI_EMAIL__ */ 
  2845. #endif /* _MMI_EMAILAPPUIINTERFACE_C */ // #ifndef _MMI_EMAILAPPUIINTERFACE_C