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

MTK

开发平台:

C/C++

  1.     }
  2.     else
  3.     {
  4.         if ((f_result = mmi_email_util_get_file_size((S8*) filePath, &fileLen)) == FS_NO_ERROR)
  5.         {
  6.             if (email_p->comp_info.attch_list[i].attch_present == TRUE)
  7.             {
  8.                 /* calculate original file size */
  9.                 mmi_email_util_get_file_size((S8*) email_p->comp_info.attch_list[i].file_path, &origLen);
  10.             }
  11.             else
  12.             {
  13.                 origLen = 0;
  14.             }
  15.             
  16.             /* ensure previous total attachment size + current attachment size no greater than 90K */
  17.             // if (fileLen > MMI_EMAIL_MAX_ATTACH_SIZE)
  18.             if (email_p->comp_info.total_attch_size - origLen + fileLen > MMI_EMAIL_TOTAL_MAX_ATTACH_SIZE)
  19.             {
  20.                 DisplayPopup(
  21.                     (U8*) GetString(STR_EMAIL_SIZE_TOO_LARGE),
  22.                     IMG_GLOBAL_UNFINISHED,
  23.                     1,
  24.                     UI_POPUP_NOTIFYDURATION_TIME,
  25.                     (U8) WARNING_TONE);
  26.                 DeleteUptoScrID(SCR_ID_EMAIL_COMP_ATTCH);
  27.                 return;
  28.             }
  29.         }
  30.         else
  31.         {
  32.             DisplayPopup(
  33.                 (U8*) GetString(GetFileSystemErrorString(f_result)),
  34.                 IMG_GLOBAL_UNFINISHED,
  35.                 1,
  36.                 UI_POPUP_NOTIFYDURATION_TIME,
  37.                 (U8) ERROR_TONE);
  38.             DeleteUptoScrID(SCR_ID_EMAIL_COMP_ATTCH);
  39.             return;
  40.         }
  41.         /* construct file name and path for file buffer */
  42.         dirLen = (S32) mmi_fmgr_get_last_dir_index((S8*) filePath);
  43.         fileName += dirLen;
  44.         /* file extension */
  45.         fileExt = mmi_email_get_file_ext((S8*) filePath);
  46.         /* destination file name */
  47.         mmi_email_util_get_attch_name((U8) (i + 1), (S8*) email_p->comp_info.attch_list[i].file_path);
  48.         pfnUnicodeStrcat((S8*) email_p->comp_info.attch_list[i].file_path, (S8*) fileExt);
  49.         pfnUnicodeStrcpy((S8*) email_p->comp_info.attch_list[i].file_name, (S8*) fileName);
  50.         /* copy source file path+name */
  51.         pfnUnicodeStrcpy((S8*) email_p->comm_buff, (S8*) filePath);
  52.         email_p->misc_info.file_copy_state = EMAIL_FILE_ADD_ATTCH;
  53.         mmi_email_pre_entry_progressing(
  54.             STR_EMAIL_MAIN_ID,
  55.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  56.             0,
  57.             0,
  58.             0,
  59.             0,
  60.             (U8*) GetString(STR_GLOBAL_SAVING),
  61.             (U8*) NULL,
  62.             IMG_GLOBAL_SAVE,
  63.             NULL,
  64.             NULL,
  65.             NULL,
  66.             0);
  67.         DeleteUptoScrID(SCR_ID_EMAIL_COMP_ATTCH);
  68.         email_p->comp_info.total_attch_size -= origLen;
  69.         PRINT_INFORMATION(("n[mmi_email_comp_add_attach_callback] File Size: %d, Updated Total Size: %dn", origLen, email_p->comp_info.total_attch_size));
  70.         FS_Delete((U16*) email_p->comp_info.attch_list[i].file_path);
  71.         mmi_fmgr_send_copy_req(
  72.             FMGR_ACTION_COPY,
  73.             (U8*) email_p->comm_buff,
  74.             (U8*) email_p->comp_info.attch_list[i].file_path,
  75.             mmi_email_comp_attach_copy_callback);
  76.     }
  77. }
  78. /*****************************************************************************
  79.  * FUNCTION
  80.  *  mmi_email_comp_attach_copy_callback
  81.  * DESCRIPTION
  82.  *  Callback function for add attachment in Write Email screen.
  83.  * PARAMETERS
  84.  *  info        [IN]        Variable stores the result of copy
  85.  * RETURNS
  86.  *  void
  87.  *****************************************************************************/
  88. void mmi_email_comp_attach_copy_callback(void *info)
  89. {
  90.     /*----------------------------------------------------------------*/
  91.     /* Local Variables                                                */
  92.     /*----------------------------------------------------------------*/
  93.     S32 i;
  94.     S32 fileLen;
  95.     mmi_fmt_copy_rsp_strcut *msgPtr;
  96.     /*----------------------------------------------------------------*/
  97.     /* Code Body                                                      */
  98.     /*----------------------------------------------------------------*/
  99.     msgPtr = (mmi_fmt_copy_rsp_strcut*) info;
  100.     if (mmi_email_util_is_call_interrupt_allow() && GetExitScrnID() != SCR_ID_EMAIL_PROGRESS)
  101.     {
  102.         /* delete progressing screen */
  103.         DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  104.         return;
  105.     }
  106.     if (msgPtr->result >= 0)
  107.     {
  108.         if (email_p->misc_info.file_copy_state == EMAIL_FILE_ADD_ATTCH)
  109.         {
  110.             /* add attach into email app */
  111.             i = email_p->misc_info.curr_hilite_attch;
  112.             if (!email_p->comp_info.attch_list[i].attch_present)
  113.             {
  114.                 email_p->comp_info.total_attch++;
  115.             }
  116.             /* calculate added file size */
  117.             mmi_email_util_get_file_size((S8*) email_p->comp_info.attch_list[i].file_path, &fileLen);
  118.             /* update total attachment size */
  119.             email_p->comp_info.total_attch_size += fileLen;
  120.             PRINT_INFORMATION(("n[mmi_email_comp_attach_copy_callback] File Size: %d, Updated Total Size: %dn", fileLen, email_p->comp_info.total_attch_size));
  121.             
  122.             email_p->comp_info.attch_list[i].attch_present = TRUE;
  123.             mmi_email_util_get_mine_type(
  124.                 (S8*) email_p->comp_info.attch_list[i].file_name,
  125.                 &email_p->comp_info.attch_list[i].attch_type,
  126.                 &email_p->comp_info.attch_list[i].attch_subtype);
  127.             DisplayPopup(
  128.                 (PU8) GetString(STR_GLOBAL_DONE),
  129.                 IMG_GLOBAL_ACTIVATED,
  130.                 0,
  131.                 UI_POPUP_NOTIFYDURATION_TIME,
  132.                 SUCCESS_TONE);
  133.             DeleteUptoScrID(SCR_ID_EMAIL_COMP_ATTCH);
  134.         }
  135.         else if (email_p->misc_info.file_copy_state == EMAIL_FILE_ADD_SIG)
  136.         {
  137.             i = (MMI_EMAIL_MAX_NUM_ATTACH - 1);
  138.             /* get mine type */
  139.             pfnUnicodeStrcpy(
  140.                 (S8*) email_p->comp_info.attch_list[i].file_name,
  141.                 (S8*) email_p->prof_info.act_prof.sig_img);
  142.             mmi_email_util_get_mine_type(
  143.                 (S8*) email_p->comp_info.attch_list[i].file_name,
  144.                 &email_p->comp_info.attch_list[i].attch_type,
  145.                 &email_p->comp_info.attch_list[i].attch_subtype);
  146.             /* attach present in this index */
  147.             email_p->comp_info.attch_list[i].attch_present = TRUE;
  148.             email_p->comp_info.total_attch++;            
  149.             /* calculate added file size */
  150.             mmi_email_util_get_file_size((S8*) email_p->comp_info.attch_list[i].file_path, &fileLen);
  151.             /* update total attachment size */
  152.             email_p->comp_info.total_attch_size += fileLen;
  153.             PRINT_INFORMATION(("n[mmi_email_comp_attach_copy_callback] File Size: %d, Updated Total Size: %dn", fileLen, email_p->comp_info.total_attch_size));
  154.             mmi_email_entry_comp();
  155.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  156.         }
  157.         else    /* if (email_p->misc_info.file_copy_state == EMAIL_FILE_FROM_APP) */
  158.         {   /* if it's from other application like file manager */
  159.             i = 0;
  160.             
  161.             email_p->comp_info.total_attch = 1;            
  162.             /* calculate added file size */
  163.             mmi_email_util_get_file_size((S8*) email_p->comp_info.attch_list[i].file_path, &fileLen);
  164.             /* update total attachment size */
  165.             email_p->comp_info.total_attch_size = fileLen;
  166.             PRINT_INFORMATION(("n[mmi_email_comp_attach_copy_callback] File Size: %d, Updated Total Size: %dn", fileLen, email_p->comp_info.total_attch_size));
  167.             email_p->comp_info.attch_list[i].attch_present = TRUE;
  168.             mmi_email_util_get_mine_type(
  169.                 (S8*) email_p->comp_info.attch_list[i].file_name,
  170.                 &email_p->comp_info.attch_list[i].attch_type,
  171.                 &email_p->comp_info.attch_list[i].attch_subtype);
  172.             /* start email module */
  173.             email_p->main_info.curr_menu = MMI_EMAIL_COMP;
  174.             mmi_email_ps_start_req();
  175.         }
  176.     }
  177.     else
  178.     {
  179.         if (email_p->misc_info.file_copy_state == EMAIL_FILE_FROM_APP)
  180.         {
  181.             i = 0;
  182.             DisplayPopup(
  183.                 (PU8) GetString(GetFileSystemErrorString(msgPtr->result)),
  184.                 IMG_GLOBAL_ERROR,
  185.                 0,
  186.                 1000,
  187.                 ERROR_TONE);
  188.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  189.         }
  190.         else if (email_p->misc_info.file_copy_state == EMAIL_FILE_ADD_ATTCH)
  191.         {
  192.             i = email_p->misc_info.curr_hilite_attch;
  193.             DisplayPopup(
  194.                 (PU8) GetString(GetFileSystemErrorString(msgPtr->result)),
  195.                 IMG_GLOBAL_ERROR,
  196.                 0,
  197.                 1000,
  198.                 ERROR_TONE);
  199.             DeleteUptoScrID(SCR_ID_EMAIL_COMP_ATTCH);
  200.         }
  201.         else    /* if (email_p->misc_info.file_copy_state == EMAIL_FILE_ADD_SIG) */
  202.         {
  203.             i = (MMI_EMAIL_MAX_NUM_ATTACH - 1);
  204.             mmi_email_entry_comp();
  205.             DeleteScreenIfPresent(SCR_ID_EMAIL_PROGRESS);
  206.             DisplayPopup(
  207.                 (PU8) GetString(GetFileSystemErrorString(msgPtr->result)),
  208.                 IMG_GLOBAL_ERROR,
  209.                 0,
  210.                 1000,
  211.                 ERROR_TONE);
  212.         }
  213.         if (email_p->comp_info.attch_list[i].attch_present && email_p->comp_info.total_attch)
  214.         {
  215.             email_p->comp_info.total_attch--;
  216.         }
  217.         /* wgui_inline_item will be reset when entering email compose screen */
  218.         // ClearAttachmentImage(&wgui_inline_items[3], i);
  219.         memset(&email_p->comp_info.attch_list[i], 0, sizeof(mmi_email_attch_info_struct));
  220.         pfnUnicodeStrcpy((S8*) email_p->comp_info.attch_list[i].file_name, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  221.         email_p->comp_info.attch_icon[i].image1 = NULL;
  222.     }
  223.     /* reset state */
  224.     email_p->misc_info.file_copy_state = EMAIL_FILE_ADD_ATTCH;
  225. }
  226. /*****************************************************************************
  227.  * FUNCTION
  228.  *  mmi_email_comp_pre_entry_addr
  229.  * DESCRIPTION
  230.  *  Pre-Entry function of Write Email -> To/CC.
  231.  *  If no address in the list, display option screen; otherwise, display address list
  232.  * PARAMETERS
  233.  *  void
  234.  * RETURNS
  235.  *  void
  236.  *****************************************************************************/
  237. void mmi_email_comp_pre_entry_addr(void)
  238. {
  239.     /*----------------------------------------------------------------*/
  240.     /* Local Variables                                                */
  241.     /*----------------------------------------------------------------*/
  242.     /*----------------------------------------------------------------*/
  243.     /* Code Body                                                      */
  244.     /*----------------------------------------------------------------*/
  245.     email_p->misc_info.curr_hilite_attch = 0;
  246.     if (email_p->comp_info.addr_list[email_p->comp_info.curr_addr_type].num_addr == 0)
  247.     {
  248.         mmi_email_entry_comp_addr_opt();
  249.     }
  250.     else
  251.     {
  252.         mmi_email_entry_comp_addr();
  253.     }
  254. }
  255. /*****************************************************************************
  256.  * FUNCTION
  257.  *  mmi_email_comp_get_addr_opt_menu
  258.  * DESCRIPTION
  259.  *  Get menu id of To/CC option according to # of address.
  260.  * PARAMETERS
  261.  *  void
  262.  * RETURNS
  263.  *  void
  264.  *****************************************************************************/
  265. U16 mmi_email_comp_get_addr_opt_menu(void)
  266. {
  267.     /*----------------------------------------------------------------*/
  268.     /* Local Variables                                                */
  269.     /*----------------------------------------------------------------*/
  270.     /*----------------------------------------------------------------*/
  271.     /* Code Body                                                      */
  272.     /*----------------------------------------------------------------*/
  273.     switch (email_p->comp_info.addr_list[email_p->comp_info.curr_addr_type].num_addr)
  274.     {
  275.         case 0:
  276.             return MENU_ID_EMAIL_COMP_ADDR_OPT1;
  277.         case 1:
  278.             return MENU_ID_EMAIL_COMP_ADDR_OPT2;
  279.         case 2:
  280.             return MENU_ID_EMAIL_COMP_ADDR_OPT3;
  281.         default:
  282.             return MENU_ID_EMAIL_COMP_ADDR_OPT4;
  283.     }
  284. }
  285. /*****************************************************************************
  286.  * FUNCTION
  287.  *  mmi_email_entry_comp_addr
  288.  * DESCRIPTION
  289.  *  Entry function of To/CC list in Write Email
  290.  * PARAMETERS
  291.  *  void
  292.  * RETURNS
  293.  *  void
  294.  *****************************************************************************/
  295. void mmi_email_entry_comp_addr(void)
  296. {
  297.     /*----------------------------------------------------------------*/
  298.     /* Local Variables                                                */
  299.     /*----------------------------------------------------------------*/
  300.     BOOL emptyList = FALSE;
  301.     U16 numItems;
  302.     U16 capStrId;
  303.     U16 lskStrId = STR_GLOBAL_OPTIONS;
  304.     U8 *nStrMainItemList[MMI_EMAIL_MAX_LEN_ADDR_LIST];
  305.     U8 *nStrPopupItemList[MMI_EMAIL_MAX_LEN_ADDR_LIST];
  306.     U8 *guiBuffer;
  307.     /*----------------------------------------------------------------*/
  308.     /* Code Body                                                      */
  309.     /*----------------------------------------------------------------*/
  310.     EntryNewScreen(SCR_ID_EMAIL_COMP_ADDR, mmi_email_exit_comp_addr, NULL, NULL);
  311.     capStrId = (email_p->comp_info.curr_addr_type == EMAIL_ADDR_TO) ? STR_EMAIL_TO_ID : STR_EMAIL_CC_ID;
  312.     numItems = mmi_email_comp_get_addr_info(nStrMainItemList, nStrPopupItemList);
  313.     if (numItems == 0)
  314.     {
  315.         emptyList = TRUE;
  316.         numItems = 1;
  317.         lskStrId = STR_GLOBAL_ADD;
  318.         nStrMainItemList[0] = (U8*) GetString(STR_GLOBAL_EMPTY_LIST);
  319.         nStrPopupItemList[0] = NULL;
  320.     }
  321.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ADDR);
  322.     ShowCategory53Screen(
  323.         capStrId,
  324.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  325.         lskStrId,
  326.         IMG_GLOBAL_OK,
  327.         STR_GLOBAL_BACK,
  328.         IMG_GLOBAL_BACK,
  329.         numItems,
  330.         nStrMainItemList,
  331.         (U16*) gIndexIconsImageList,
  332.         nStrPopupItemList,
  333.         0,
  334.         email_p->misc_info.curr_hilite_attch,
  335.         guiBuffer);
  336.     if (emptyList)
  337.     {
  338.         SetLeftSoftkeyFunction(mmi_email_comp_addr_pre_add, KEY_EVENT_UP);
  339.         SetKeyHandler(mmi_email_comp_addr_pre_add, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  340.     }
  341.     else
  342.     {
  343.         SetLeftSoftkeyFunction(mmi_email_entry_comp_addr_opt, KEY_EVENT_UP);
  344.         SetKeyHandler(mmi_email_entry_comp_addr_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  345.     }
  346.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  347.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  348. }
  349. /*****************************************************************************
  350.  * FUNCTION
  351.  *  mmi_email_exit_comp_addr
  352.  * DESCRIPTION
  353.  *  Exit function of To/CC list in Write Email
  354.  * PARAMETERS
  355.  *  void
  356.  * RETURNS
  357.  *  void
  358.  *****************************************************************************/
  359. void mmi_email_exit_comp_addr(void)
  360. {
  361.     /*----------------------------------------------------------------*/
  362.     /* Local Variables                                                */
  363.     /*----------------------------------------------------------------*/
  364.     /*----------------------------------------------------------------*/
  365.     /* Code Body                                                      */
  366.     /*----------------------------------------------------------------*/
  367.     mmi_email_util_add_history(SCR_ID_EMAIL_COMP_ADDR, mmi_email_entry_comp_addr);
  368.     email_p->misc_info.curr_hilite_attch = GetHighlightedItem();
  369. }
  370. /*****************************************************************************
  371.  * FUNCTION
  372.  *  mmi_email_comp_get_addr_info
  373.  * DESCRIPTION
  374.  *  Retrieve information for To/CC address
  375.  * PARAMETERS
  376.  *  nStrMainItemList        [IN/OUT]        String pointer to store address list
  377.  *  nStrPopupItemList       [IN/OUT]        String pointer to display name list
  378.  * RETURNS
  379.  *  void
  380.  *****************************************************************************/
  381. U16 mmi_email_comp_get_addr_info(U8 **nStrMainItemList, U8 **nStrPopupItemList)
  382. {
  383.     /*----------------------------------------------------------------*/
  384.     /* Local Variables                                                */
  385.     /*----------------------------------------------------------------*/
  386.     S32 i;
  387.     U8 index = email_p->comp_info.curr_addr_type;
  388.     /*----------------------------------------------------------------*/
  389.     /* Code Body                                                      */
  390.     /*----------------------------------------------------------------*/
  391.     for (i = 0; i < email_p->comp_info.addr_list[index].num_addr; i++)
  392.     {
  393.         nStrMainItemList[i] = (U8*) email_p->comp_info.addr_list[index].to_cc_mail[i];
  394.         if (!pfnUnicodeStrlen((S8*) email_p->comp_info.addr_list[index].to_cc_name[i]))
  395.         {
  396.             nStrPopupItemList[i] = NULL;
  397.         }
  398.         else
  399.         {
  400.             nStrPopupItemList[i] = (U8*) email_p->comp_info.addr_list[index].to_cc_name[i];
  401.         }
  402.     }
  403.     return email_p->comp_info.addr_list[index].num_addr;
  404. }
  405. /*****************************************************************************
  406.  * FUNCTION
  407.  *  mmi_email_entry_comp_addr_opt
  408.  * DESCRIPTION
  409.  *  Display option screen of Write Email -> To/CC
  410.  * PARAMETERS
  411.  *  void
  412.  * RETURNS
  413.  *  void
  414.  *****************************************************************************/
  415. void mmi_email_entry_comp_addr_opt(void)
  416. {
  417.     /*----------------------------------------------------------------*/
  418.     /* Local Variables                                                */
  419.     /*----------------------------------------------------------------*/
  420.     U16 numItems;
  421.     U16 parentMenuId;
  422.     U16 nStrItemList[MAX_SUB_MENUS];
  423.     U8 *guiBuffer;
  424.     /*----------------------------------------------------------------*/
  425.     /* Code Body                                                      */
  426.     /*----------------------------------------------------------------*/
  427.     EntryNewScreen(SCR_ID_EMAIL_COMP_ADDR_OPT, NULL, mmi_email_entry_comp_addr_opt, NULL);
  428.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ADDR_OPT);
  429.     parentMenuId = mmi_email_comp_get_addr_opt_menu();
  430.     SetParentHandler(parentMenuId);
  431.     numItems = GetNumOfChild(parentMenuId);
  432.     GetSequenceStringIds(parentMenuId, nStrItemList);
  433.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  434.     ShowCategory52Screen(
  435.         STR_GLOBAL_OPTIONS,
  436.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  437.         STR_GLOBAL_OK,
  438.         IMG_GLOBAL_OK,
  439.         STR_GLOBAL_BACK,
  440.         IMG_GLOBAL_BACK,
  441.         numItems,
  442.         nStrItemList,
  443.         (U16*) gIndexIconsImageList,
  444.         NULL,
  445.         0,
  446.         0,
  447.         guiBuffer);
  448.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  449.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  450. }
  451. /*****************************************************************************
  452.  * FUNCTION
  453.  *  mmi_email_comp_addr_pre_add
  454.  * DESCRIPTION
  455.  *  Prepare data for add new address
  456.  * PARAMETERS
  457.  *  void
  458.  * RETURNS
  459.  *  void
  460.  *****************************************************************************/
  461. void mmi_email_comp_addr_pre_add(void)
  462. {
  463.     /*----------------------------------------------------------------*/
  464.     /* Local Variables                                                */
  465.     /*----------------------------------------------------------------*/
  466.     /*----------------------------------------------------------------*/
  467.     /* Code Body                                                      */
  468.     /*----------------------------------------------------------------*/
  469.     memset(email_p->comp_info.addr_input_buff, 0, ENCODING_LENGTH);
  470.     memset(email_p->comp_info.phb_addr, 0, ENCODING_LENGTH);
  471.     memset(email_p->comp_info.phb_name, 0, ENCODING_LENGTH);
  472.     /* add new entry */
  473.     email_p->comp_info.new_addr = TRUE;
  474.     mmi_email_entry_comp_addr_input();
  475. }
  476. /*****************************************************************************
  477.  * FUNCTION
  478.  *  mmi_email_comp_addr_pre_edit
  479.  * DESCRIPTION
  480.  *  Prepare data for edit current selected address
  481.  * PARAMETERS
  482.  *  void
  483.  * RETURNS
  484.  *  void
  485.  *****************************************************************************/
  486. void mmi_email_comp_addr_pre_edit(void)
  487. {
  488.     /*----------------------------------------------------------------*/
  489.     /* Local Variables                                                */
  490.     /*----------------------------------------------------------------*/
  491.     S32 i = email_p->comp_info.curr_addr_type;
  492.     S32 j = email_p->misc_info.curr_hilite_attch;
  493.     /*----------------------------------------------------------------*/
  494.     /* Code Body                                                      */
  495.     /*----------------------------------------------------------------*/
  496.     pfnUnicodeStrcpy((S8*) email_p->comp_info.addr_input_buff, (S8*) email_p->comp_info.addr_list[i].to_cc_mail[j]);
  497.     pfnUnicodeStrcpy((S8*) email_p->comp_info.phb_name, (S8*) email_p->comp_info.addr_list[i].to_cc_name[j]);
  498.     pfnUnicodeStrcpy((S8*) email_p->comp_info.phb_addr, (S8*) email_p->comp_info.addr_list[i].to_cc_mail[j]);
  499.     /* edit an existing entry */
  500.     email_p->comp_info.new_addr = FALSE;
  501.     mmi_email_entry_comp_addr_input();
  502. }
  503. /*****************************************************************************
  504.  * FUNCTION
  505.  *  mmi_email_entry_comp_addr_input
  506.  * DESCRIPTION
  507.  *  Display full screen editor for Write Email -> To/CC -> Edit/Add
  508.  * PARAMETERS
  509.  *  void
  510.  * RETURNS
  511.  *  void
  512.  *****************************************************************************/
  513. void mmi_email_entry_comp_addr_input(void)
  514. {
  515.     /*----------------------------------------------------------------*/
  516.     /* Local Variables                                                */
  517.     /*----------------------------------------------------------------*/
  518.     U8 *guiBuffer;
  519.     /*----------------------------------------------------------------*/
  520.     /* Code Body                                                      */
  521.     /*----------------------------------------------------------------*/
  522.     EntryNewScreen(SCR_ID_EMAIL_COMP_ADDR_INPUT, NULL, mmi_email_entry_comp_addr_input, NULL);
  523.     if (pfnUnicodeStrlen((S8*) email_p->comp_info.phb_addr) && email_p->comp_info.load_addr_done)
  524.     {
  525.         guiBuffer = NULL;
  526.         email_p->comp_info.load_addr_done = FALSE;
  527.     }
  528.     else
  529.     {
  530.         guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ADDR_INPUT);
  531.     }
  532.     RegisterInputBoxEmptyFunction(mmi_email_comp_addr_empty_lsk_hdlr);
  533.     RegisterInputBoxNotEmptyFunction(mmi_email_comp_addr_no_empty_lsk_hdlr);
  534. #if 0
  535. /* under construction !*/
  536. /* under construction !*/
  537. /* under construction !*/
  538. /* under construction !*/
  539. /* under construction !*/
  540. /* under construction !*/
  541. /* under construction !*/
  542. /* under construction !*/
  543. /* under construction !*/
  544. /* under construction !*/
  545. /* under construction !*/
  546. #endif
  547.     ShowCategory5Screen_ext(
  548.         STR_EMAIL_INPUT_ADDRESS_ID, 
  549.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN), 
  550.         STR_GLOBAL_OPTIONS, 
  551.         IMG_GLOBAL_OPTIONS, 
  552.         STR_GLOBAL_BACK, 
  553.         IMG_GLOBAL_BACK, 
  554.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, 
  555.         (U8*)email_p->comp_info.addr_input_buff, 
  556.         MMI_EMAIL_MAX_LEN_EMAIL_ADDRESS + 1, 
  557.         guiBuffer, 
  558.         INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL,
  559.         NULL,
  560.         NULL);
  561. #ifdef __MMI_TOUCH_SCREEN__
  562.     mmi_pen_editor_set_vk_keys(MMI_FALSE, NULL, g_email_disable_new_line);
  563. #endif
  564.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  565. }
  566. /*****************************************************************************
  567.  * FUNCTION
  568.  *  mmi_email_comp_addr_empty_lsk_hdlr
  569.  * DESCRIPTION
  570.  *  Register LSK handler for Address input screen when the editor is empty.
  571.  * PARAMETERS
  572.  *  void
  573.  * RETURNS
  574.  *  void
  575.  *****************************************************************************/
  576. void mmi_email_comp_addr_empty_lsk_hdlr(void)
  577. {
  578.     /*----------------------------------------------------------------*/
  579.     /* Local Variables                                                */
  580.     /*----------------------------------------------------------------*/
  581.     /*----------------------------------------------------------------*/
  582.     /* Code Body                                                      */
  583.     /*----------------------------------------------------------------*/
  584.     ChangeLeftSoftkey(STR_SMS_COMMON_SEARCH, IMG_GLOBAL_OPTIONS);
  585.     SetLeftSoftkeyFunction(mmi_phb_email_enter_list, KEY_EVENT_UP);
  586. }
  587. /*****************************************************************************
  588.  * FUNCTION
  589.  *  mmi_email_comp_addr_no_empty_lsk_hdlr
  590.  * DESCRIPTION
  591.  *  Register LSK handler for Address input screen when the editor is not empty.
  592.  * PARAMETERS
  593.  *  void
  594.  * RETURNS
  595.  *  void
  596.  *****************************************************************************/
  597. void mmi_email_comp_addr_no_empty_lsk_hdlr(void)
  598. {
  599.     /*----------------------------------------------------------------*/
  600.     /* Local Variables                                                */
  601.     /*----------------------------------------------------------------*/
  602.     /*----------------------------------------------------------------*/
  603.     /* Code Body                                                      */
  604.     /*----------------------------------------------------------------*/
  605.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  606.     SetLeftSoftkeyFunction(mmi_email_entry_comp_addr_input_opt, KEY_EVENT_UP);
  607. }
  608. /*****************************************************************************
  609.  * FUNCTION
  610.  *  mmi_email_entry_comp_addr_input_opt
  611.  * DESCRIPTION
  612.  *  Entry Write Email -> To/CC -> Edit -> Option screen
  613.  * PARAMETERS
  614.  *  void
  615.  * RETURNS
  616.  *  void
  617.  *****************************************************************************/
  618. void mmi_email_entry_comp_addr_input_opt(void)
  619. {
  620.     /*----------------------------------------------------------------*/
  621.     /* Local Variables                                                */
  622.     /*----------------------------------------------------------------*/
  623.     U16 numItems;
  624.     U16 nStrItemList[2];    /* only Done and Input Method */
  625.     U8 *guiBuffer;
  626.     /*----------------------------------------------------------------*/
  627.     /* Code Body                                                      */
  628.     /*----------------------------------------------------------------*/
  629.     EntryNewScreen(SCR_ID_EMAIL_COMP_ADDR_INPUT_OPT, NULL, mmi_email_entry_comp_addr_input_opt, NULL);
  630.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ADDR_INPUT_OPT);
  631.     SetParentHandler(MENU_ID_EMAIL_COMP_ADDR_EDIT_OPT);
  632.     numItems = GetNumOfChild(MENU_ID_EMAIL_COMP_ADDR_EDIT_OPT);
  633.     GetSequenceStringIds(MENU_ID_EMAIL_COMP_ADDR_EDIT_OPT, nStrItemList);
  634.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  635.     ShowCategory52Screen(
  636.         STR_GLOBAL_OPTIONS,
  637.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  638.         STR_GLOBAL_OK,
  639.         IMG_GLOBAL_OK,
  640.         STR_GLOBAL_BACK,
  641.         IMG_GLOBAL_BACK,
  642.         numItems,
  643.         nStrItemList,
  644.         (U16*) gIndexIconsImageList,
  645.         NULL,
  646.         0,
  647.         0,
  648.         guiBuffer);
  649.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  650.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  651. }
  652. /*****************************************************************************
  653.  * FUNCTION
  654.  *  mmi_email_comp_addr_input_done
  655.  * DESCRIPTION
  656.  *  Handler when finished editing email address.
  657.  * PARAMETERS
  658.  *  void
  659.  * RETURNS
  660.  *  void
  661.  *****************************************************************************/
  662. void mmi_email_comp_addr_input_done(void)
  663. {
  664.     /*----------------------------------------------------------------*/
  665.     /* Local Variables                                                */
  666.     /*----------------------------------------------------------------*/
  667.     /*----------------------------------------------------------------*/
  668.     /* Code Body                                                      */
  669.     /*----------------------------------------------------------------*/
  670.     if (pfnUnicodeStrlen((S8*) email_p->comp_info.addr_input_buff) &&
  671.         mmi_email_util_chk_addr((U8*) email_p->comp_info.addr_input_buff))
  672.     {
  673.         U8 index;
  674.         S32 i = email_p->comp_info.curr_addr_type;
  675.         if ((email_p->comp_info.addr_list[i].num_addr == 0) && (IsScreenPresent(SCR_ID_EMAIL_COMP_ADDR_OPT)))
  676.         {
  677.             ReplaceNewScreenHandler(SCR_ID_EMAIL_COMP_ADDR_INPUT_OPT, NULL, NULL);
  678.             DeleteNScrId(SCR_ID_EMAIL_COMP_ADDR_OPT);
  679.             mmi_email_exit_comp_addr(); /* add "TO" list screen into history */
  680.         }
  681.         /* get current editing cursor of address list */
  682.         index =
  683.             (email_p->comp_info.new_addr) ? email_p->comp_info.addr_list[i].num_addr : email_p->misc_info.
  684.             curr_hilite_attch;
  685.         pfnUnicodeStrcpy(
  686.             (S8*) email_p->comp_info.addr_list[i].to_cc_mail[index],
  687.             (S8*) email_p->comp_info.addr_input_buff);
  688.         if (!pfnUnicodeStrcmp((S8*) email_p->comp_info.phb_addr, (S8*) email_p->comp_info.addr_input_buff))
  689.         {
  690.             pfnUnicodeStrcpy(
  691.                 (S8*) email_p->comp_info.addr_list[i].to_cc_name[index],
  692.                 (S8*) email_p->comp_info.phb_name);
  693.         }
  694.         else
  695.         {
  696.             memset(
  697.                 email_p->comp_info.addr_list[i].to_cc_name[index],
  698.                 0,
  699.                 sizeof(email_p->comp_info.addr_list[i].to_cc_name[index]));
  700.         }
  701.         /* add new address */
  702.         if (email_p->comp_info.new_addr)
  703.         {
  704.             email_p->comp_info.addr_list[i].num_addr++;
  705.         }
  706.         /* update inline buffer */
  707.         mmi_email_comp_update_addr_buff();
  708.         email_p->comp_info.done_flag = TRUE;
  709.         GoBackToHistory(SCR_ID_EMAIL_COMP_ADDR);
  710.     }
  711.     else
  712.     {
  713.         DisplayPopup(
  714.             (U8*) GetString(STR_EMAIL_ERROR_CODE_INVALID_EMAIL_ADDR_ID),
  715.             IMG_GLOBAL_EMPTY,
  716.             1,
  717.             UI_POPUP_NOTIFYDURATION_TIME,
  718.             (U8) EMPTY_LIST_TONE);
  719.         DeleteNScrId(SCR_ID_EMAIL_COMP_ADDR_INPUT_OPT);
  720.     }
  721. }
  722. /*****************************************************************************
  723.  * FUNCTION
  724.  *  mmi_email_comp_addr_del
  725.  * DESCRIPTION
  726.  *  Display confirmation screen for deleting address
  727.  * PARAMETERS
  728.  *  void
  729.  * RETURNS
  730.  *  void
  731.  *****************************************************************************/
  732. void mmi_email_comp_addr_del(void)
  733. {
  734.     /*----------------------------------------------------------------*/
  735.     /* Local Variables                                                */
  736.     /*----------------------------------------------------------------*/
  737.     /*----------------------------------------------------------------*/
  738.     /* Code Body                                                      */
  739.     /*----------------------------------------------------------------*/
  740.     mmi_email_display_confirm(STR_GLOBAL_DELETE, mmi_email_comp_addr_del_yes, mmi_email_comp_addr_del_no);
  741. }
  742. /*****************************************************************************
  743.  * FUNCTION
  744.  *  mmi_email_comp_addr_del_no
  745.  * DESCRIPTION
  746.  *  Canceling deleting address
  747.  * PARAMETERS
  748.  *  void
  749.  * RETURNS
  750.  *  void
  751.  *****************************************************************************/
  752. void mmi_email_comp_addr_del_no(void)
  753. {
  754.     /*----------------------------------------------------------------*/
  755.     /* Local Variables                                                */
  756.     /*----------------------------------------------------------------*/
  757.     /*----------------------------------------------------------------*/
  758.     /* Code Body                                                      */
  759.     /*----------------------------------------------------------------*/
  760.     mmi_email_comp_addr_hist_del();
  761.     GoBackHistory();
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  mmi_email_comp_addr_del_yes
  766.  * DESCRIPTION
  767.  *  Proceed deleting address
  768.  * PARAMETERS
  769.  *  void
  770.  * RETURNS
  771.  *  void
  772.  *****************************************************************************/
  773. void mmi_email_comp_addr_del_yes(void)
  774. {
  775.     /*----------------------------------------------------------------*/
  776.     /* Local Variables                                                */
  777.     /*----------------------------------------------------------------*/
  778.     S32 index;
  779.     S32 i = email_p->comp_info.curr_addr_type;
  780.     /*----------------------------------------------------------------*/
  781.     /* Code Body                                                      */
  782.     /*----------------------------------------------------------------*/
  783.     for (index = email_p->misc_info.curr_hilite_attch; index < email_p->comp_info.addr_list[i].num_addr - 1; index++)
  784.     {
  785.         pfnUnicodeStrcpy(
  786.             (S8*) email_p->comp_info.addr_list[i].to_cc_mail[index],
  787.             (S8*) email_p->comp_info.addr_list[i].to_cc_mail[index + 1]);
  788.         pfnUnicodeStrcpy(
  789.             (S8*) email_p->comp_info.addr_list[i].to_cc_name[index],
  790.             (S8*) email_p->comp_info.addr_list[i].to_cc_name[index + 1]);
  791.     }
  792.     /*  reset null last entry */
  793.     memset(
  794.         email_p->comp_info.addr_list[i].to_cc_mail[index],
  795.         0,
  796.         sizeof(email_p->comp_info.addr_list[i].to_cc_mail[index]));
  797.     memset(
  798.         email_p->comp_info.addr_list[i].to_cc_name[index],
  799.         0,
  800.         sizeof(email_p->comp_info.addr_list[i].to_cc_name[index]));
  801.     email_p->comp_info.addr_list[i].num_addr--;
  802.     mmi_email_comp_update_addr_buff();
  803.     email_p->comp_info.done_flag = TRUE;
  804.     DisplayPopup(
  805.         (U8*) GetString(STR_GLOBAL_DONE),
  806.         IMG_GLOBAL_ACTIVATED,
  807.         1,
  808.         UI_POPUP_NOTIFYDURATION_TIME,
  809.         (U8) SUCCESS_TONE);
  810.     mmi_email_comp_addr_hist_del();
  811. }
  812. /*****************************************************************************
  813.  * FUNCTION
  814.  *  mmi_email_comp_addr_hist_del
  815.  * DESCRIPTION
  816.  *  Common function to delete history node when cancel deleting address.
  817.  * PARAMETERS
  818.  *  void
  819.  * RETURNS
  820.  *  void
  821.  *****************************************************************************/
  822. void mmi_email_comp_addr_hist_del(void)
  823. {
  824.     /*----------------------------------------------------------------*/
  825.     /* Local Variables                                                */
  826.     /*----------------------------------------------------------------*/
  827.     /*----------------------------------------------------------------*/
  828.     /* Code Body                                                      */
  829.     /*----------------------------------------------------------------*/
  830.     if (IsScreenPresent(SCR_ID_EMAIL_COMP_ADDR_OPT))
  831.     {
  832.         DeleteNScrId(SCR_ID_EMAIL_COMP_ADDR_OPT);
  833.     }
  834.     else if (IsScreenPresent(SCR_ID_EMAIL_COMP_ADDR_INPUT))
  835.     {
  836.         DeleteNScrId(SCR_ID_EMAIL_COMP_ADDR_INPUT);
  837.     }
  838. }
  839. /*****************************************************************************
  840.  * FUNCTION
  841.  *  mmi_email_comp_addr_del_all
  842.  * DESCRIPTION
  843.  *  Display confirmation screen for deleting all addresses
  844.  * PARAMETERS
  845.  *  void
  846.  * RETURNS
  847.  *  void
  848.  *****************************************************************************/
  849. void mmi_email_comp_addr_del_all(void)
  850. {
  851.     /*----------------------------------------------------------------*/
  852.     /* Local Variables                                                */
  853.     /*----------------------------------------------------------------*/
  854.     /*----------------------------------------------------------------*/
  855.     /* Code Body                                                      */
  856.     /*----------------------------------------------------------------*/
  857.     mmi_email_display_confirm(STR_GLOBAL_DELETE_ALL, mmi_email_comp_addr_del_all_yes, mmi_email_comp_addr_del_all_no);
  858. }
  859. /*****************************************************************************
  860.  * FUNCTION
  861.  *  mmi_email_comp_addr_del_all_no
  862.  * DESCRIPTION
  863.  *  Cancel deleting all addresses
  864.  * PARAMETERS
  865.  *  void
  866.  * RETURNS
  867.  *  void
  868.  *****************************************************************************/
  869. void mmi_email_comp_addr_del_all_no(void)
  870. {
  871.     /*----------------------------------------------------------------*/
  872.     /* Local Variables                                                */
  873.     /*----------------------------------------------------------------*/
  874.     /*----------------------------------------------------------------*/
  875.     /* Code Body                                                      */
  876.     /*----------------------------------------------------------------*/
  877.     mmi_email_comp_addr_hist_del();
  878.     GoBackHistory();
  879. }
  880. /*****************************************************************************
  881.  * FUNCTION
  882.  *  mmi_email_comp_addr_del_all_yes
  883.  * DESCRIPTION
  884.  *  Proceed deleting all addresses
  885.  * PARAMETERS
  886.  *  void
  887.  * RETURNS
  888.  *  void
  889.  *****************************************************************************/
  890. void mmi_email_comp_addr_del_all_yes(void)
  891. {
  892.     /*----------------------------------------------------------------*/
  893.     /* Local Variables                                                */
  894.     /*----------------------------------------------------------------*/
  895.     S32 i = email_p->comp_info.curr_addr_type;
  896.     /*----------------------------------------------------------------*/
  897.     /* Code Body                                                      */
  898.     /*----------------------------------------------------------------*/
  899.     memset(&email_p->comp_info.addr_list[i], 0, sizeof(mmi_email_to_cc_struct));
  900.     memset(email_p->comp_info.addr_disp_buff[i], 0, sizeof(email_p->comp_info.addr_disp_buff[i]));
  901.     email_p->comp_info.done_flag = TRUE;
  902.     DisplayPopup(
  903.         (U8*) GetString(STR_GLOBAL_DONE),
  904.         IMG_GLOBAL_ACTIVATED,
  905.         1,
  906.         UI_POPUP_NOTIFYDURATION_TIME,
  907.         (U8) SUCCESS_TONE);
  908.     mmi_email_comp_addr_hist_del();
  909. }
  910. /*****************************************************************************
  911.  * FUNCTION
  912.  *  mmi_email_comp_update_addr_buff
  913.  * DESCRIPTION
  914.  *  Update address displayed buffer in inline editor screen.
  915.  * PARAMETERS
  916.  *  void
  917.  * RETURNS
  918.  *  void
  919.  *****************************************************************************/
  920. void mmi_email_comp_update_addr_buff(void)
  921. {
  922.     /*----------------------------------------------------------------*/
  923.     /* Local Variables                                                */
  924.     /*----------------------------------------------------------------*/
  925.     S32 i = email_p->comp_info.curr_addr_type;
  926.     /*----------------------------------------------------------------*/
  927.     /* Code Body                                                      */
  928.     /*----------------------------------------------------------------*/
  929.     if (email_p->comp_info.addr_list[i].num_addr != 0)
  930.     {
  931.         if (pfnUnicodeStrlen((S8*) email_p->comp_info.addr_list[i].to_cc_name[0]))
  932.         {
  933.             pfnUnicodeStrcpy((S8*) email_p->comp_info.addr_disp_buff[i], (S8*) g_email_subj_left_op);
  934.             pfnUnicodeStrcat(
  935.                 (S8*) email_p->comp_info.addr_disp_buff[i],
  936.                 (S8*) email_p->comp_info.addr_list[i].to_cc_name[0]);
  937.             pfnUnicodeStrcat((S8*) email_p->comp_info.addr_disp_buff[i], (S8*) g_email_subj_right_op);
  938.             pfnUnicodeStrcat(
  939.                 (S8*) email_p->comp_info.addr_disp_buff[i],
  940.                 (S8*) email_p->comp_info.addr_list[i].to_cc_mail[0]);
  941.         }
  942.         else
  943.         {
  944.             pfnUnicodeStrcpy(
  945.                 (S8*) email_p->comp_info.addr_disp_buff[i],
  946.                 (S8*) email_p->comp_info.addr_list[i].to_cc_mail[0]);
  947.         }
  948.         if (email_p->comp_info.addr_list[i].num_addr > 1)
  949.         {
  950.             pfnUnicodeStrcat((S8*) email_p->comp_info.addr_disp_buff[i], (S8*) g_email_3dots);
  951.         }
  952.     }
  953.     else
  954.     {
  955.         email_p->comp_info.addr_disp_buff[i][0] = 0x0000;
  956.     }
  957. }
  958. /*****************************************************************************
  959.  * FUNCTION
  960.  *  mmi_email_entry_comp_attch
  961.  * DESCRIPTION
  962.  *  Display list of attachment
  963.  * PARAMETERS
  964.  *  void
  965.  * RETURNS
  966.  *  void
  967.  *****************************************************************************/
  968. void mmi_email_entry_comp_attch(void)
  969. {
  970.     /*----------------------------------------------------------------*/
  971.     /* Local Variables                                                */
  972.     /*----------------------------------------------------------------*/
  973.     S32 i;
  974.     U8 *nStrAttachmentItemList[MMI_EMAIL_MAX_NUM_ATTACH];
  975.     U8 *guiBuffer;
  976.     /*----------------------------------------------------------------*/
  977.     /* Code Body                                                      */
  978.     /*----------------------------------------------------------------*/
  979.     EntryNewScreen(SCR_ID_EMAIL_COMP_ATTCH, NULL, mmi_email_entry_comp_attch, NULL);
  980.     for (i = 0; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  981.     {
  982.         nStrAttachmentItemList[i] = (U8*) email_p->comp_info.attch_list[i].file_name;
  983.     }
  984.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ATTCH);
  985.     RegisterHighlightHandler(mmi_email_hilite_comp_attch);
  986.     ShowCategory53Screen(
  987.         STR_EMAIL_ATTACHMENT_LIST_ID,
  988.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  989.         STR_GLOBAL_OPTIONS,
  990.         IMG_GLOBAL_OPTIONS,
  991.         STR_GLOBAL_BACK,
  992.         IMG_GLOBAL_BACK,
  993.         MMI_EMAIL_MAX_NUM_ATTACH,
  994.         nStrAttachmentItemList,
  995.         (U16*) gIndexIconsImageList,
  996.         NULL,
  997.         0,
  998.         email_p->misc_info.curr_hilite_attch,
  999.         guiBuffer);
  1000.     SetLeftSoftkeyFunction(mmi_email_entry_comp_attch_opt, KEY_EVENT_UP);
  1001.     SetKeyHandler(mmi_email_entry_comp_attch_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1002.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1003.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1004. }
  1005. /*****************************************************************************
  1006.  * FUNCTION
  1007.  *  mmi_email_hilite_comp_attch
  1008.  * DESCRIPTION
  1009.  *  Highlight handler of attachment list in Write Email-> Attachment screen.
  1010.  * PARAMETERS
  1011.  *  index       [IN]        Index of current highlighting item
  1012.  * RETURNS
  1013.  *  void
  1014.  *****************************************************************************/
  1015. void mmi_email_hilite_comp_attch(S32 index)
  1016. {
  1017.     /*----------------------------------------------------------------*/
  1018.     /* Local Variables                                                */
  1019.     /*----------------------------------------------------------------*/
  1020.     /*----------------------------------------------------------------*/
  1021.     /* Code Body                                                      */
  1022.     /*----------------------------------------------------------------*/
  1023.     email_p->misc_info.curr_hilite_attch = index;
  1024. }
  1025. /*****************************************************************************
  1026.  * FUNCTION
  1027.  *  mmi_email_entry_comp_attch_opt
  1028.  * DESCRIPTION
  1029.  *  Entry function for Write Email -> Attachment -> Option screen.
  1030.  * PARAMETERS
  1031.  *  void
  1032.  * RETURNS
  1033.  *  void
  1034.  *****************************************************************************/
  1035. void mmi_email_entry_comp_attch_opt(void)
  1036. {
  1037.     /*----------------------------------------------------------------*/
  1038.     /* Local Variables                                                */
  1039.     /*----------------------------------------------------------------*/
  1040.     U16 numItems;
  1041.     U16 nStrItemList[3];    /* only Edit/View/Delete */
  1042.     U8 *guiBuffer;
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Code Body                                                      */
  1045.     /*----------------------------------------------------------------*/
  1046.     EntryNewScreen(SCR_ID_EMAIL_COMP_ATTCH_OPT, NULL, mmi_email_entry_comp_attch_opt, NULL);
  1047.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_ATTCH_OPT);
  1048.     SetParentHandler(MENU_ID_EMAIL_COMP_ATTCH_OPT);
  1049.     numItems = GetNumOfChild(MENU_ID_EMAIL_COMP_ATTCH_OPT);
  1050.     GetSequenceStringIds(MENU_ID_EMAIL_COMP_ATTCH_OPT, nStrItemList);
  1051.     if (email_p->comp_info.attch_list[email_p->misc_info.curr_hilite_attch].attch_present == FALSE)
  1052.     {
  1053.         numItems = 1;
  1054.     }
  1055.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1056.     ShowCategory52Screen(
  1057.         STR_EMAIL_ATTACH_OPTION_ID,
  1058.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1059.         STR_GLOBAL_OK,
  1060.         IMG_GLOBAL_OK,
  1061.         STR_GLOBAL_BACK,
  1062.         IMG_GLOBAL_BACK,
  1063.         numItems,
  1064.         nStrItemList,
  1065.         (U16*) gIndexIconsImageList,
  1066.         NULL,
  1067.         0,
  1068.         0,
  1069.         guiBuffer);
  1070.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1071.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1072. }
  1073. /*****************************************************************************
  1074.  * FUNCTION
  1075.  *  mmi_email_comp_pre_entry_view_attach
  1076.  * DESCRIPTION
  1077.  *  Pre-Entry function of view attachment.
  1078.  *  Execute entry function according to type of attachment.
  1079.  * PARAMETERS
  1080.  *  void
  1081.  * RETURNS
  1082.  *  void
  1083.  *****************************************************************************/
  1084. void mmi_email_comp_pre_entry_view_attach(void)
  1085. {
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Local Variables                                                */
  1088.     /*----------------------------------------------------------------*/
  1089.     S32 i = email_p->misc_info.curr_hilite_attch;
  1090.     U8 fileType;
  1091.     /*----------------------------------------------------------------*/
  1092.     /* Code Body                                                      */
  1093.     /*----------------------------------------------------------------*/
  1094.     /* add one more check for file type */
  1095.     fileType = mmi_fmgr_get_file_group((S8*) email_p->comp_info.attch_list[i].file_path);
  1096.     if (fileType == FMGR_GROUP_IMAGE)
  1097.     {
  1098.         mmi_email_entry_comp_view_image();
  1099.     }
  1100.     else if (fileType == FMGR_GROUP_AUDIO)
  1101.     {
  1102.         mmi_audply_single_play((UI_string_type) email_p->comp_info.attch_list[i].file_path, NULL);
  1103.     }
  1104. #ifdef __MMI_VIDEO_PLAYER__
  1105.     else if (fileType == FMGR_GROUP_VIDEO)
  1106.     {
  1107.         mmi_vdoply_entry_player_screen_from_file((S8*) email_p->comp_info.attch_list[i].file_path, FALSE);
  1108.     }
  1109. #endif /* __MMI_VIDEO_PLAYER__ */ 
  1110.     else
  1111.     {
  1112.         DisplayPopup(
  1113.             (U8*) GetString(STR_EMAIL_NOT_SUPPORT_ID),
  1114.             IMG_GLOBAL_UNFINISHED,
  1115.             1,
  1116.             UI_POPUP_NOTIFYDURATION_TIME,
  1117.             (U8) WARNING_TONE);
  1118.     }
  1119. }
  1120. /*****************************************************************************
  1121.  * FUNCTION
  1122.  *  mmi_email_entry_comp_view_image
  1123.  * DESCRIPTION
  1124.  *  View image attachment.
  1125.  * PARAMETERS
  1126.  *  void
  1127.  * RETURNS
  1128.  *  void
  1129.  *****************************************************************************/
  1130. void mmi_email_entry_comp_view_image(void)
  1131. {
  1132.     /*----------------------------------------------------------------*/
  1133.     /* Local Variables                                                */
  1134.     /*----------------------------------------------------------------*/
  1135.     S8 *fileExtPtr = mmi_email_get_file_ext((S8*) email_p->comp_info.attch_list[email_p->misc_info.curr_hilite_attch].file_name);
  1136.     S8 *fileExt = OslMalloc((FMGR_MAX_EXT_LEN + 1) * ENCODING_LENGTH);
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140.     if (fileExtPtr)
  1141.     {
  1142.         /* neglect "." */
  1143.         fileExtPtr = fileExtPtr + 2;
  1144.         UnicodeToAnsii(fileExt, fileExtPtr);
  1145.     }
  1146.     EntryNewScreen(SCR_ID_EMAIL_COMP_VIEW_IMAGE, NULL, mmi_email_entry_comp_view_image, NULL);
  1147.     if (mmi_email_uti_strnicmp("ems", fileExt, strlen(fileExt)) == 0)
  1148.     {
  1149.         ShowCategory144Screen(
  1150.             (U8*) GetString(STR_GLOBAL_VIEW),
  1151.             GetRootTitleIcon(MAIN_MENU_FILE_MNGR_MENUID),
  1152.             0,
  1153.             0,
  1154.             STR_GLOBAL_BACK,
  1155.             IMG_GLOBAL_BACK,
  1156.             EMS_OBJECT_MY_PICTURE_STATE | CATEGORY144_FMGR_PREVIEW | CATEGORY144_EMAIL_PREVIEW,
  1157.             1,
  1158.             NULL,
  1159.             (U16*) email_p->comp_info.attch_list[email_p->misc_info.curr_hilite_attch].file_path,
  1160.             FALSE,
  1161.             NULL,
  1162.             0,
  1163.             NULL);
  1164.     }
  1165.     else if (mmi_email_uti_strnicmp("anm", fileExt, strlen(fileExt)) == 0)
  1166.     {
  1167.         ShowCategory144Screen(
  1168.             (U8*) GetString(STR_GLOBAL_VIEW),
  1169.             GetRootTitleIcon(MAIN_MENU_FILE_MNGR_MENUID),
  1170.             0,
  1171.             0,
  1172.             STR_GLOBAL_BACK,
  1173.             IMG_GLOBAL_BACK,
  1174.             EMS_OBJECT_MY_ANIMATION_STATE | CATEGORY144_FMGR_PREVIEW | CATEGORY144_EMAIL_PREVIEW,
  1175.             1,
  1176.             NULL,
  1177.             (U16*) email_p->comp_info.attch_list[email_p->misc_info.curr_hilite_attch].file_path,
  1178.             FALSE,
  1179.             NULL,
  1180.             0,
  1181.             NULL);
  1182.     }
  1183.     else
  1184.     {
  1185.         ShowCategory222Screen(
  1186.             STR_GLOBAL_VIEW,
  1187.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1188.             0,
  1189.             0,
  1190.             STR_GLOBAL_BACK,
  1191.             IMG_GLOBAL_BACK,
  1192.             GDI_COLOR_WHITE,
  1193.             NULL,
  1194.             (S8*) email_p->comp_info.attch_list[email_p->misc_info.curr_hilite_attch].file_path,
  1195.             FALSE,
  1196.             NULL);
  1197.     }
  1198.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1199.     OslMfree(fileExt);
  1200. }
  1201. /*****************************************************************************
  1202.  * FUNCTION
  1203.  *  mmi_email_comp_attch_del
  1204.  * DESCRIPTION
  1205.  *  Display confirmation screen for Write Email->Attachment->Delete option
  1206.  * PARAMETERS
  1207.  *  void
  1208.  * RETURNS
  1209.  *  void
  1210.  *****************************************************************************/
  1211. void mmi_email_comp_attch_del(void)
  1212. {
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Local Variables                                                */
  1215.     /*----------------------------------------------------------------*/
  1216.     /*----------------------------------------------------------------*/
  1217.     /* Code Body                                                      */
  1218.     /*----------------------------------------------------------------*/
  1219.     mmi_email_display_confirm(STR_GLOBAL_DELETE, mmi_email_comp_attch_del_done, GoBackHistory);
  1220. }
  1221. /*****************************************************************************
  1222.  * FUNCTION
  1223.  *  mmi_email_comp_attch_del_done
  1224.  * DESCRIPTION
  1225.  *  Execute Write Email->Attachment->Delete option
  1226.  * PARAMETERS
  1227.  *  void
  1228.  * RETURNS
  1229.  *  void
  1230.  *****************************************************************************/
  1231. void mmi_email_comp_attch_del_done(void)
  1232. {
  1233.     /*----------------------------------------------------------------*/
  1234.     /* Local Variables                                                */
  1235.     /*----------------------------------------------------------------*/
  1236.     S32 i = email_p->misc_info.curr_hilite_attch;
  1237.     S32 fileLen;
  1238.     /*----------------------------------------------------------------*/
  1239.     /* Code Body                                                      */
  1240.     /*----------------------------------------------------------------*/
  1241.     /* wgui_inline_item will be reset when entering email compose screen */
  1242.     // ClearAttachmentImage(&wgui_inline_items[3], i);
  1243.     
  1244.     /* calculate deleted file size */
  1245.     mmi_email_util_get_file_size((S8*) email_p->comp_info.attch_list[i].file_path, &fileLen);
  1246.     
  1247.     memset(&email_p->comp_info.attch_list[i], 0, sizeof(mmi_email_attch_info_struct));
  1248.     pfnUnicodeStrcpy((S8*) email_p->comp_info.attch_list[i].file_name, (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  1249.     email_p->comp_info.attch_icon[i].image1 = NULL;
  1250.     email_p->comp_info.total_attch--;
  1251.     /* update total attachment size */
  1252.     email_p->comp_info.total_attch_size -= fileLen;
  1253.     PRINT_INFORMATION(("n[mmi_email_comp_attch_del_done] File Size: %d, Updated Total Size: %dn", fileLen, email_p->comp_info.total_attch_size));
  1254.     
  1255.     DisplayPopup(
  1256.         (U8*) GetString(STR_GLOBAL_DONE),
  1257.         IMG_GLOBAL_ACTIVATED,
  1258.         1,
  1259.         UI_POPUP_NOTIFYDURATION_TIME,
  1260.         (U8) SUCCESS_TONE);
  1261.     if (IsScreenPresent(SCR_ID_EMAIL_COMP_ATTCH_OPT))
  1262.     {
  1263.         DeleteNScrId(SCR_ID_EMAIL_COMP_ATTCH_OPT);
  1264.     }
  1265. }
  1266. /*****************************************************************************
  1267.  * FUNCTION
  1268.  *  mmi_email_entry_comp_opt
  1269.  * DESCRIPTION
  1270.  *  Entry function of option screen of Write Email
  1271.  * PARAMETERS
  1272.  *  void
  1273.  * RETURNS
  1274.  *  void
  1275.  *****************************************************************************/
  1276. void mmi_email_entry_comp_opt(void)
  1277. {
  1278.     /*----------------------------------------------------------------*/
  1279.     /* Local Variables                                                */
  1280.     /*----------------------------------------------------------------*/
  1281.     U16 numItems;
  1282.     U16 nStrItemList[4];    /* only 4 items */
  1283.     U8 *guiBuffer;
  1284.     /*----------------------------------------------------------------*/
  1285.     /* Code Body                                                      */
  1286.     /*----------------------------------------------------------------*/
  1287.     EntryNewScreen(SCR_ID_EMAIL_COMP_OPT, NULL, mmi_email_entry_comp_opt, NULL);
  1288.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_OPT);
  1289.     SetParentHandler(MENU_ID_EMAIL_COMP_OPT);
  1290.     numItems = GetNumOfChild(MENU_ID_EMAIL_COMP_OPT);
  1291.     GetSequenceStringIds(MENU_ID_EMAIL_COMP_OPT, nStrItemList);
  1292.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1293.     ShowCategory52Screen(
  1294.         STR_EMAIL_EMAIL_OPTION_ID,
  1295.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1296.         STR_GLOBAL_OK,
  1297.         IMG_GLOBAL_OK,
  1298.         STR_GLOBAL_BACK,
  1299.         IMG_GLOBAL_BACK,
  1300.         numItems,
  1301.         nStrItemList,
  1302.         (U16*) gIndexIconsImageList,
  1303.         NULL,
  1304.         0,
  1305.         0,
  1306.         guiBuffer);
  1307.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1308.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1309. }
  1310. /*****************************************************************************
  1311.  * FUNCTION
  1312.  *  mmi_email_comp_opt_quit
  1313.  * DESCRIPTION
  1314.  *  Execute Quit Without Saving option, display confirmation screen.
  1315.  * PARAMETERS
  1316.  *  void
  1317.  * RETURNS
  1318.  *  void
  1319.  *****************************************************************************/
  1320. void mmi_email_comp_opt_quit(void)
  1321. {
  1322.     /*----------------------------------------------------------------*/
  1323.     /* Local Variables                                                */
  1324.     /*----------------------------------------------------------------*/
  1325.     /*----------------------------------------------------------------*/
  1326.     /* Code Body                                                      */
  1327.     /*----------------------------------------------------------------*/
  1328.     mmi_email_display_confirm(STR_EMAIL_COMMON_QUIT_WITHOUT_SAVING_ID, mmi_email_comp_opt_quit_yes, GoBackHistory);
  1329. }
  1330. /*****************************************************************************
  1331.  * FUNCTION
  1332.  *  mmi_email_comp_opt_quit_yes
  1333.  * DESCRIPTION
  1334.  *  Reset screen variables in Write Email screen and go back to Email main menu.
  1335.  * PARAMETERS
  1336.  *  void
  1337.  * RETURNS
  1338.  *  void
  1339.  *****************************************************************************/
  1340. void mmi_email_comp_opt_quit_yes(void)
  1341. {
  1342.     /*----------------------------------------------------------------*/
  1343.     /* Local Variables                                                */
  1344.     /*----------------------------------------------------------------*/
  1345.     /*----------------------------------------------------------------*/
  1346.     /* Code Body                                                      */
  1347.     /*----------------------------------------------------------------*/
  1348.     mmi_email_comp_reset_member();
  1349.     if (email_p->main_info.entry_src == EMAIL_FROM_APP)
  1350.     {
  1351.         mmi_email_main_quit_email();
  1352.         DeleteScreenIfPresent(SCR_ID_EMAIL_COMP);
  1353.         DeleteScreenIfPresent(SCR_ID_EMAIL_COMP_OPT);
  1354.     }
  1355.     else
  1356.     {
  1357.         DeleteBetweenScreen(mmi_email_fldr_get_start_scr(), GetCurrScrnId());
  1358.         GoBackHistory();
  1359.     }
  1360. }
  1361. /*****************************************************************************
  1362.  * FUNCTION
  1363.  *  mmi_email_entry_comp_cont
  1364.  * DESCRIPTION
  1365.  *  Entry Write Email-> Content screen.
  1366.  * PARAMETERS
  1367.  *  void
  1368.  * RETURNS
  1369.  *  void
  1370.  *****************************************************************************/
  1371. void mmi_email_entry_comp_cont(void)
  1372. {
  1373.     /*----------------------------------------------------------------*/
  1374.     /* Local Variables                                                */
  1375.     /*----------------------------------------------------------------*/
  1376.     U8 *guiBuffer;
  1377.     /*----------------------------------------------------------------*/
  1378.     /* Code Body                                                      */
  1379.     /*----------------------------------------------------------------*/
  1380.     EntryNewScreen(SCR_ID_EMAIL_COMP_CONT_INPUT, NULL, mmi_email_entry_comp_cont, NULL);
  1381.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_CONT_INPUT);
  1382.     ShowCategory5Screen(
  1383.         STR_EMAIL_CONTENT_ID,
  1384.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1385.         STR_GLOBAL_OPTIONS,
  1386.         IMG_GLOBAL_OPTIONS,
  1387.         STR_GLOBAL_BACK,
  1388.         IMG_GLOBAL_BACK,
  1389.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1390.         (U8*) email_p->misc_info.cont_inline_buff,
  1391.         (EMAIL_MAX_CONT_LEN + 1),
  1392.         guiBuffer);
  1393.     SetLeftSoftkeyFunction(mmi_email_entry_comp_subj_opt, KEY_EVENT_UP);
  1394.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1395. }
  1396. /*****************************************************************************
  1397.  * FUNCTION
  1398.  *  mmi_email_entry_comp_subj
  1399.  * DESCRIPTION
  1400.  *  Entry Write Email-> Subject screen.
  1401.  * PARAMETERS
  1402.  *  void
  1403.  * RETURNS
  1404.  *  void
  1405.  *****************************************************************************/
  1406. void mmi_email_entry_comp_subj(void)
  1407. {
  1408.     /*----------------------------------------------------------------*/
  1409.     /* Local Variables                                                */
  1410.     /*----------------------------------------------------------------*/
  1411.     U8 *guiBuffer;
  1412.     /*----------------------------------------------------------------*/
  1413.     /* Code Body                                                      */
  1414.     /*----------------------------------------------------------------*/
  1415.     EntryNewScreen(SCR_ID_EMAIL_COMP_SUBJ_INPUT, NULL, mmi_email_entry_comp_subj, NULL);
  1416.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_COMP_SUBJ_INPUT);
  1417.     ShowCategory5Screen(
  1418.         STR_EMAIL_SUBJECT_ID,
  1419.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1420.         STR_GLOBAL_OPTIONS,
  1421.         IMG_GLOBAL_OPTIONS,
  1422.         STR_GLOBAL_BACK,
  1423.         IMG_GLOBAL_BACK,
  1424.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1425.         (U8*) email_p->misc_info.subj_inline_buff,
  1426.         EMAIL_COMP_SUBJ_LEN + 1,
  1427.         guiBuffer);
  1428.     SetLeftSoftkeyFunction(mmi_email_entry_comp_subj_opt, KEY_EVENT_UP);
  1429.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1430. }
  1431. /*****************************************************************************
  1432.  * FUNCTION
  1433.  *  mmi_email_comp_subj_cont_done
  1434.  * DESCRIPTION
  1435.  *  Handler for Write Email -> Subject/Content -> Done
  1436.  * PARAMETERS
  1437.  *  void
  1438.  * RETURNS
  1439.  *  void
  1440.  *****************************************************************************/
  1441. void mmi_email_comp_subj_cont_done(void)
  1442. {
  1443.     /*----------------------------------------------------------------*/
  1444.     /* Local Variables                                                */
  1445.     /*----------------------------------------------------------------*/
  1446.     /*----------------------------------------------------------------*/
  1447.     /* Code Body                                                      */
  1448.     /*----------------------------------------------------------------*/
  1449.     /* editing subject */
  1450.     if (email_p->comp_info.curr_inline_item == EMAIL_COMP_SUBJ)
  1451.     {
  1452.         pfnUnicodeStrcpy((S8*) email_p->comp_info.subj_buff, (S8*) email_p->misc_info.subj_inline_buff);
  1453.     }
  1454.     else
  1455.     {   /* editing content */
  1456.         pfnUnicodeStrcpy((S8*) email_p->comp_info.cont_buff, (S8*) email_p->misc_info.cont_inline_buff);
  1457.         set_inscreen_multi_line_input_box_changed();
  1458.     }
  1459.     email_p->comp_info.done_flag = TRUE;
  1460.     GoBackToHistory(SCR_ID_EMAIL_COMP);
  1461. }
  1462. #define INBOX_EMAIL
  1463. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1464. /*****************************************************************************
  1465.  * FUNCTION
  1466.  *  mmi_email_hilite_inbox_read
  1467.  * DESCRIPTION
  1468.  *  Highlight handler of Inbox -> Option -> Read
  1469.  * PARAMETERS
  1470.  *  void
  1471.  * RETURNS
  1472.  *  void
  1473.  *****************************************************************************/
  1474. void mmi_email_hilite_inbox_read(void)
  1475. {
  1476.     /*----------------------------------------------------------------*/
  1477.     /* Local Variables                                                */
  1478.     /*----------------------------------------------------------------*/
  1479.     /*----------------------------------------------------------------*/
  1480.     /* Code Body                                                      */
  1481.     /*----------------------------------------------------------------*/
  1482.     SetLeftSoftkeyFunction(mmi_email_ps_folder_msg_select_req, KEY_EVENT_UP);
  1483.     SetKeyHandler(mmi_email_ps_folder_msg_select_req, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1484. }
  1485. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1486. /*****************************************************************************
  1487.  * FUNCTION
  1488.  *  mmi_email_hilite_read_addr_save_phb
  1489.  * DESCRIPTION
  1490.  *  Handler for Read Email -> Address -> Save to Phonebook
  1491.  * PARAMETERS
  1492.  *  void
  1493.  * RETURNS
  1494.  *  void
  1495.  *****************************************************************************/
  1496. void mmi_email_hilite_read_addr_save_phb(void)
  1497. {
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     /*----------------------------------------------------------------*/
  1502.     /* Code Body                                                      */
  1503.     /*----------------------------------------------------------------*/
  1504.     SetLeftSoftkeyFunction(mmi_email_read_addr_save, KEY_EVENT_UP);
  1505.     SetKeyHandler(mmi_email_read_addr_save, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1506. }
  1507. /*****************************************************************************
  1508.  * FUNCTION
  1509.  *  mmi_email_hilite_read_addr_send
  1510.  * DESCRIPTION
  1511.  *  Handler for Read Email -> Address -> Send
  1512.  * PARAMETERS
  1513.  *  void
  1514.  * RETURNS
  1515.  *  void
  1516.  *****************************************************************************/
  1517. void mmi_email_hilite_read_addr_send(void)
  1518. {
  1519.     /*----------------------------------------------------------------*/
  1520.     /* Local Variables                                                */
  1521.     /*----------------------------------------------------------------*/
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Code Body                                                      */
  1524.     /*----------------------------------------------------------------*/
  1525.     SetLeftSoftkeyFunction(mmi_email_read_addr_send, KEY_EVENT_UP);
  1526.     SetKeyHandler(mmi_email_read_addr_send, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1527. }
  1528. /*****************************************************************************
  1529.  * FUNCTION
  1530.  *  mmi_email_hilite_read_attach_view
  1531.  * DESCRIPTION
  1532.  *  Handler for Read Email -> Attachment -> View
  1533.  * PARAMETERS
  1534.  *  void
  1535.  * RETURNS
  1536.  *  void
  1537.  *****************************************************************************/
  1538. void mmi_email_hilite_read_attach_view(void)
  1539. {
  1540.     /*----------------------------------------------------------------*/
  1541.     /* Local Variables                                                */
  1542.     /*----------------------------------------------------------------*/
  1543.     /*----------------------------------------------------------------*/
  1544.     /* Code Body                                                      */
  1545.     /*----------------------------------------------------------------*/
  1546.     SetLeftSoftkeyFunction(mmi_email_entry_read_attch_view, KEY_EVENT_UP);
  1547.     SetKeyHandler(mmi_email_entry_read_attch_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1548. }
  1549. /*****************************************************************************
  1550.  * FUNCTION
  1551.  *  mmi_email_hilite_read_attach_save
  1552.  * DESCRIPTION
  1553.  *  Handler for Read Email -> Attachment -> Save
  1554.  * PARAMETERS
  1555.  *  void
  1556.  * RETURNS
  1557.  *  void
  1558.  *****************************************************************************/
  1559. void mmi_email_hilite_read_attach_save(void)
  1560. {
  1561.     /*----------------------------------------------------------------*/
  1562.     /* Local Variables                                                */
  1563.     /*----------------------------------------------------------------*/
  1564.     /*----------------------------------------------------------------*/
  1565.     /* Code Body                                                      */
  1566.     /*----------------------------------------------------------------*/
  1567.     SetLeftSoftkeyFunction(mmi_email_read_attach_save, KEY_EVENT_UP);
  1568.     SetKeyHandler(mmi_email_read_attach_save, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1569. }
  1570. /*****************************************************************************
  1571.  * FUNCTION
  1572.  *  mmi_email_hilite_read_attach_save_done
  1573.  * DESCRIPTION
  1574.  *  Handler for Read Email -> Attachment -> Save -> Done
  1575.  * PARAMETERS
  1576.  *  void
  1577.  * RETURNS
  1578.  *  void
  1579.  *****************************************************************************/
  1580. void mmi_email_hilite_read_attach_save_done(void)
  1581. {
  1582.     /*----------------------------------------------------------------*/
  1583.     /* Local Variables                                                */
  1584.     /*----------------------------------------------------------------*/
  1585.     /*----------------------------------------------------------------*/
  1586.     /* Code Body                                                      */
  1587.     /*----------------------------------------------------------------*/
  1588.     SetLeftSoftkeyFunction(mmi_email_read_save_attch, KEY_EVENT_UP);
  1589. }
  1590. /*****************************************************************************
  1591.  * FUNCTION
  1592.  *  mmi_email_hilite_read_attach_save_input_meth
  1593.  * DESCRIPTION
  1594.  *  Handler for Read Email -> Attachment -> Save -> Input Method
  1595.  * PARAMETERS
  1596.  *  void
  1597.  * RETURNS
  1598.  *  void
  1599.  *****************************************************************************/
  1600. void mmi_email_hilite_read_attach_save_input_meth(void)
  1601. {
  1602.     /*----------------------------------------------------------------*/
  1603.     /* Local Variables                                                */
  1604.     /*----------------------------------------------------------------*/
  1605.     /*----------------------------------------------------------------*/
  1606.     /* Code Body                                                      */
  1607.     /*----------------------------------------------------------------*/
  1608.     SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
  1609.     SetKeyHandler(EntryInputMethodScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1610.     RegisterInputMethodScreenCloseFunction(mmi_email_util_go_back_2_hist);
  1611. }
  1612. /*****************************************************************************
  1613.  * FUNCTION
  1614.  *  mmi_email_hilite_read_reply
  1615.  * DESCRIPTION
  1616.  *  Handler for Read Email -> Reply
  1617.  * PARAMETERS
  1618.  *  void
  1619.  * RETURNS
  1620.  *  void
  1621.  *****************************************************************************/
  1622. void mmi_email_hilite_read_reply(void)
  1623. {
  1624.     /*----------------------------------------------------------------*/
  1625.     /* Local Variables                                                */
  1626.     /*----------------------------------------------------------------*/
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Code Body                                                      */
  1629.     /*----------------------------------------------------------------*/
  1630.     SetLeftSoftkeyFunction(mmi_email_read_reply, KEY_EVENT_UP);
  1631.     SetKeyHandler(mmi_email_read_reply, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1632. }
  1633. /*****************************************************************************
  1634.  * FUNCTION
  1635.  *  mmi_email_hilite_read_reply_without
  1636.  * DESCRIPTION
  1637.  *  Handler for Read Email -> Reply Without Content
  1638.  * PARAMETERS
  1639.  *  void
  1640.  * RETURNS
  1641.  *  void
  1642.  *****************************************************************************/
  1643. void mmi_email_hilite_read_reply_without(void)
  1644. {
  1645.     /*----------------------------------------------------------------*/
  1646.     /* Local Variables                                                */
  1647.     /*----------------------------------------------------------------*/
  1648.     /*----------------------------------------------------------------*/
  1649.     /* Code Body                                                      */
  1650.     /*----------------------------------------------------------------*/
  1651.     SetLeftSoftkeyFunction(mmi_email_read_reply_without, KEY_EVENT_UP);
  1652.     SetKeyHandler(mmi_email_read_reply_without, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1653. }
  1654. /*****************************************************************************
  1655.  * FUNCTION
  1656.  *  mmi_email_hilite_read_reply_all
  1657.  * DESCRIPTION
  1658.  *  Handler for Read Email -> Reply All
  1659.  * PARAMETERS
  1660.  *  void
  1661.  * RETURNS
  1662.  *  void
  1663.  *****************************************************************************/
  1664. void mmi_email_hilite_read_reply_all(void)
  1665. {
  1666.     /*----------------------------------------------------------------*/
  1667.     /* Local Variables                                                */
  1668.     /*----------------------------------------------------------------*/
  1669.     /*----------------------------------------------------------------*/
  1670.     /* Code Body                                                      */
  1671.     /*----------------------------------------------------------------*/
  1672.     SetLeftSoftkeyFunction(mmi_email_read_reply_all, KEY_EVENT_UP);
  1673.     SetKeyHandler(mmi_email_read_reply_all, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1674. }
  1675. /*****************************************************************************
  1676.  * FUNCTION
  1677.  *  mmi_email_hilite_read_reply_all_without
  1678.  * DESCRIPTION
  1679.  *  Handler for Read Email -> Reply All Without Content
  1680.  * PARAMETERS
  1681.  *  void
  1682.  * RETURNS
  1683.  *  void
  1684.  *****************************************************************************/
  1685. void mmi_email_hilite_read_reply_all_without(void)
  1686. {
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Local Variables                                                */
  1689.     /*----------------------------------------------------------------*/
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Code Body                                                      */
  1692.     /*----------------------------------------------------------------*/
  1693.     SetLeftSoftkeyFunction(mmi_email_read_reply_all_without, KEY_EVENT_UP);
  1694.     SetKeyHandler(mmi_email_read_reply_all_without, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1695. }
  1696. /*****************************************************************************
  1697.  * FUNCTION
  1698.  *  mmi_email_hilite_read_forward
  1699.  * DESCRIPTION
  1700.  *  Handler for Read Email -> Forward
  1701.  * PARAMETERS
  1702.  *  void
  1703.  * RETURNS
  1704.  *  void
  1705.  *****************************************************************************/
  1706. void mmi_email_hilite_read_forward(void)
  1707. {
  1708.     /*----------------------------------------------------------------*/
  1709.     /* Local Variables                                                */
  1710.     /*----------------------------------------------------------------*/
  1711.     /*----------------------------------------------------------------*/
  1712.     /* Code Body                                                      */
  1713.     /*----------------------------------------------------------------*/
  1714.     SetLeftSoftkeyFunction(mmi_email_read_forward, KEY_EVENT_UP);
  1715.     SetKeyHandler(mmi_email_read_forward, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1716. }
  1717. /*****************************************************************************
  1718.  * FUNCTION
  1719.  *  mmi_email_inbox_pre_entry
  1720.  * DESCRIPTION
  1721.  *  Pre-Entry function of Inbox.
  1722.  * PARAMETERS
  1723.  *  void
  1724.  * RETURNS
  1725.  *  void
  1726.  *****************************************************************************/
  1727. void mmi_email_inbox_pre_entry(void)
  1728. {
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Local Variables                                                */
  1731.     /*----------------------------------------------------------------*/
  1732.     /*----------------------------------------------------------------*/
  1733.     /* Code Body                                                      */
  1734.     /*----------------------------------------------------------------*/
  1735. #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  1736.     email_p->snr_info.new_mail_ind = FALSE;
  1737. #endif 
  1738.     mmi_email_fldr_pre_entry();
  1739. }
  1740. /*****************************************************************************
  1741.  * FUNCTION
  1742.  *  mmi_email_entry_inbox
  1743.  * DESCRIPTION
  1744.  *  Entry function of Inbox.
  1745.  * PARAMETERS
  1746.  *  void
  1747.  * RETURNS
  1748.  *  void
  1749.  *****************************************************************************/
  1750. void mmi_email_entry_inbox(void)
  1751. {
  1752.     /*----------------------------------------------------------------*/
  1753.     /* Local Variables                                                */
  1754.     /*----------------------------------------------------------------*/
  1755.     S32 numItems;
  1756.     /*----------------------------------------------------------------*/
  1757.     /* Code Body                                                      */
  1758.     /*----------------------------------------------------------------*/
  1759.     numItems = mmi_email_fldr_get_num_mails();
  1760.     if (numItems)
  1761.     {
  1762.         U16 lskStrId;
  1763.         U8 *guiBuffer;
  1764.         S32 list_not_ready;
  1765.         EntryNewScreen(SCR_ID_EMAIL_INBOX, mmi_email_exit_inbox, NULL, NULL);
  1766.         email_p->fldr_info.need_fldr_sel = FALSE;
  1767.         guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_INBOX);
  1768.         RegisterHighlightHandler(mmi_email_hilite_inbox_item);
  1769.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1770.         /* set LSK string according to current state */
  1771.         if ((email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4) && (email_p->fldr_info.total_page > 1))
  1772.         {
  1773.             lskStrId = STR_GLOBAL_OPTIONS;
  1774.         }
  1775.         else
  1776.     #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1777.             lskStrId = STR_EMAIL_READ_ID;
  1778.         /* to prevent the selected mail being deleted */
  1779.         if (email_p->fldr_info.curr_mail_indx >= numItems)
  1780.         {
  1781.             email_p->fldr_info.curr_mail_indx = numItems - 1;
  1782.         }
  1783.         ShowCategory261Screen(
  1784.             mmi_email_util_folder_select_cap_str(STR_EMAIL_INBOX_ID),
  1785.             GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  1786.             lskStrId,
  1787.             IMG_GLOBAL_OPTIONS,
  1788.             STR_GLOBAL_BACK,
  1789.             IMG_GLOBAL_BACK,
  1790.             numItems,
  1791.             mmi_email_inbox_get_async_items,
  1792.             NULL,
  1793.             email_p->fldr_info.curr_mail_indx,
  1794.             IMG_EMAIL_READ_NORMAL_ID,
  1795.             IMG_EMAIL_ATTACH_IMAGE_ID,
  1796.             guiBuffer,
  1797.             2 /* no_of_string */ ,
  1798.             4 /* no_of_icons */ ,
  1799.             &list_not_ready);
  1800.         /* if data in dynamic list is not ready */
  1801.         if (list_not_ready)
  1802.         {
  1803.             mmi_email_fldr_pre_folder_select_req();
  1804.         }
  1805.         else
  1806.         {
  1807.             /* to indicate folder list is really displayed */
  1808.             email_p->fldr_info.is_list_displayed = TRUE;
  1809.             SetLeftSoftkeyFunction(mmi_email_inbox_lsk_hdlr, KEY_EVENT_UP);
  1810.             SetKeyHandler(mmi_email_inbox_lsk_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1811.             SetRightSoftkeyFunction(mmi_email_inbox_rsk_hdlr, KEY_EVENT_UP);
  1812.             SetKeyHandler(mmi_email_inbox_rsk_hdlr, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1813.         #if !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__)
  1814.             /* delete auto check indication screen for auto-check case */
  1815.             DeleteScreenIfPresent(SCR_ID_EMAIL_NEW_MAIL_IND);
  1816.         #endif /* !defined(__MMI_SLIM_EMAIL_NO_AUTO_CHECK__) */ 
  1817.         }
  1818.     }
  1819.     else    /* because the is_list_displayed flag is FALSE, the folder screen is not in history */
  1820.     {
  1821.         DisplayPopup(
  1822.             (U8*) GetString(STR_GLOBAL_EMPTY),
  1823.             IMG_GLOBAL_EMPTY,
  1824.             1,
  1825.             UI_POPUP_NOTIFYDURATION_TIME,
  1826.             (U8) EMPTY_LIST_TONE);
  1827.         if (email_p->main_info.entry_src == EMAIL_FROM_IDLE)
  1828.         {
  1829.             mmi_email_ps_stop_req();
  1830.         }
  1831.     }
  1832. }
  1833. /*****************************************************************************
  1834.  * FUNCTION
  1835.  *  mmi_email_exit_inbox
  1836.  * DESCRIPTION
  1837.  *  Exit function of Inbox.
  1838.  * PARAMETERS
  1839.  *  void
  1840.  * RETURNS
  1841.  *  void
  1842.  *****************************************************************************/
  1843. void mmi_email_exit_inbox(void)
  1844. {
  1845.     /*----------------------------------------------------------------*/
  1846.     /* Local Variables                                                */
  1847.     /*----------------------------------------------------------------*/
  1848.     /*----------------------------------------------------------------*/
  1849.     /* Code Body                                                      */
  1850.     /*----------------------------------------------------------------*/
  1851.     mmi_email_util_add_history(SCR_ID_EMAIL_INBOX, mmi_email_fldr_back_from_history);
  1852. }
  1853. /*****************************************************************************
  1854.  * FUNCTION
  1855.  *  mmi_email_inbox_lsk_hdlr
  1856.  * DESCRIPTION
  1857.  *  Left softkey handler of Inbox.
  1858.  *  If current protocol is IMAP4, will entry option screen first.
  1859.  * PARAMETERS
  1860.  *  void
  1861.  * RETURNS
  1862.  *  void
  1863.  *****************************************************************************/
  1864. void mmi_email_inbox_lsk_hdlr(void)
  1865. {
  1866. #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  1867.     /*----------------------------------------------------------------*/
  1868.     /* Local Variables                                                */
  1869.     /*----------------------------------------------------------------*/
  1870.     /*----------------------------------------------------------------*/
  1871.     /* Code Body                                                      */
  1872.     /*----------------------------------------------------------------*/
  1873.     /* if protocol == IMAP4 and total page > 1, will go to option screen of Inbox; otherwise will read the mail */
  1874.     if ((email_p->prof_info.act_prof.in_prot == EMAIL_PROT_IMAP4) && (email_p->fldr_info.total_page > 1))
  1875.     {
  1876.         mmi_email_entry_inbox_opt();
  1877.     }
  1878.     else
  1879. #endif /* !defined(__MMI_SLIM_EMAIL_NO_IMAP4__) */ 
  1880.         mmi_email_ps_folder_msg_select_req();
  1881. }
  1882. /*****************************************************************************
  1883.  * FUNCTION
  1884.  *  mmi_email_inbox_rsk_hdlr
  1885.  * DESCRIPTION
  1886.  *  Right softkey handler of Inbox.
  1887.  *  If Inbox is entry from IDLE screen, shall send quit email request.
  1888.  * PARAMETERS
  1889.  *  void
  1890.  * RETURNS
  1891.  *  void
  1892.  *****************************************************************************/
  1893. void mmi_email_inbox_rsk_hdlr(void)
  1894. {
  1895.     /*----------------------------------------------------------------*/
  1896.     /* Local Variables                                                */
  1897.     /*----------------------------------------------------------------*/
  1898.     /*----------------------------------------------------------------*/
  1899.     /* Code Body                                                      */
  1900.     /*----------------------------------------------------------------*/
  1901.     if (email_p->main_info.entry_src != EMAIL_FROM_IDLE)        // #ifdef __MMI_SLIM_EMAIL_NO_AUTO_CHECK__
  1902.     {
  1903.         GoBackHistory();
  1904.     }
  1905.     else
  1906.     {
  1907.         mmi_email_main_quit_email();
  1908.     }
  1909. }
  1910. /*****************************************************************************
  1911.  * FUNCTION
  1912.  *  mmi_email_hilite_inbox_item
  1913.  * DESCRIPTION
  1914.  *  Highlight handler of Inbox list
  1915.  * PARAMETERS
  1916.  *  index       [IN]        Index of highlighted item
  1917.  * RETURNS
  1918.  *  void
  1919.  *****************************************************************************/
  1920. void mmi_email_hilite_inbox_item(S32 index)
  1921. {
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Local Variables                                                */
  1924.     /*----------------------------------------------------------------*/
  1925.     mmi_email_mail_info_struct *listMsgsStruct[EMAIL_TOTAL_MSG_BUFF];
  1926.     mmi_email_mail_info_struct *temp;
  1927.     /*----------------------------------------------------------------*/
  1928.     /* Code Body                                                      */
  1929.     /*----------------------------------------------------------------*/
  1930.     mmi_mem_get_values(
  1931.         &email_p->mem_pool_info.mem_container,
  1932.         (S16) index,
  1933.         (S16) index,
  1934.         (void **)listMsgsStruct,
  1935.         &email_p->mem_pool_info.not_avail_pool);
  1936.     temp = listMsgsStruct[0];
  1937.     email_p->fldr_info.curr_mail_indx = index;
  1938.     email_p->fldr_info.curr_mail_uid = temp->mail_uid;
  1939. }
  1940. /*****************************************************************************
  1941.  * FUNCTION
  1942.  *  mmi_email_inbox_update_mail_state
  1943.  * DESCRIPTION
  1944.  *  Update read/unread state of a mail.
  1945.  * PARAMETERS
  1946.  *  index       [IN]        Mail id of the mail
  1947.  * RETURNS
  1948.  *  void
  1949.  *****************************************************************************/
  1950. void mmi_email_inbox_update_mail_state(S32 index)
  1951. {
  1952.     /*----------------------------------------------------------------*/
  1953.     /* Local Variables                                                */
  1954.     /*----------------------------------------------------------------*/
  1955.     mmi_email_mail_info_struct *listMsgsStruct[EMAIL_TOTAL_MSG_BUFF];
  1956.     mmi_email_mail_info_struct *temp;
  1957.     /*----------------------------------------------------------------*/
  1958.     /* Code Body                                                      */
  1959.     /*----------------------------------------------------------------*/
  1960.     mmi_mem_get_values(
  1961.         &email_p->mem_pool_info.mem_container,
  1962.         (S16) index,
  1963.         (S16) index,
  1964.         (void **)listMsgsStruct,
  1965.         &email_p->mem_pool_info.not_avail_pool);
  1966.     temp = listMsgsStruct[0];
  1967.     email_p->fldr_info.curr_mail_indx = index;
  1968.     if (!temp->is_read)
  1969.     {
  1970.         temp->is_read = TRUE;
  1971.         /* update idle screen icon status after read one email */
  1972.         if (email_p->main_info.unread_mails != 0)
  1973.         {
  1974.             email_p->main_info.unread_mails--;
  1975.             mmi_email_util_update_status_icon();
  1976.         }
  1977.     }
  1978. }
  1979. /*****************************************************************************
  1980.  * FUNCTION
  1981.  *  mmi_email_inbox_get_status_icon
  1982.  * DESCRIPTION
  1983.  *  Get status icon of a mail in Inbox list
  1984.  * PARAMETERS
  1985.  *  priority        [IN]        Priority of the mail.
  1986.  *  is_read         [IN]        
  1987.  *  readFlg(?)      [IN]        The read/unread state of the mail
  1988.  * RETURNS
  1989.  *  image id of the status icon
  1990.  *****************************************************************************/
  1991. U16 mmi_email_inbox_get_status_icon(U8 priority, BOOL is_read)
  1992. {
  1993.     /*----------------------------------------------------------------*/
  1994.     /* Local Variables                                                */
  1995.     /*----------------------------------------------------------------*/
  1996.     /*----------------------------------------------------------------*/
  1997.     /* Code Body                                                      */
  1998.     /*----------------------------------------------------------------*/
  1999.     if (is_read)
  2000.     {
  2001.         if (priority > MMI_EMAIL_NORMAL_PRIORITY)
  2002.         {
  2003.             return IMG_EMAIL_READ_LOW_ID;
  2004.         }
  2005.         else if (priority < MMI_EMAIL_NORMAL_PRIORITY)
  2006.         {
  2007.             return IMG_EMAIL_READ_HIGH_ID;
  2008.         }
  2009.         else    /* (priority==MMI_EMAIL_NORMAL_PRIORITY) */
  2010.         {
  2011.             return IMG_EMAIL_READ_NORMAL_ID;
  2012.         }
  2013.     }
  2014.     else
  2015.     {
  2016.         if (priority > MMI_EMAIL_NORMAL_PRIORITY)
  2017.         {
  2018.             return IMG_EMAIL_UNREAD_LOW_ID;
  2019.         }
  2020.         else if (priority < MMI_EMAIL_NORMAL_PRIORITY)
  2021.         {
  2022.             return IMG_EMAIL_UNREAD_HIGH_ID;
  2023.         }
  2024.         else    /* (priority==MMI_EMAIL_NORMAL_PRIORITY) */
  2025.         {
  2026.             return IMG_EMAIL_UNREAD_NORMAL_ID;
  2027.         }
  2028.     }
  2029. }
  2030. /*****************************************************************************
  2031.  * FUNCTION
  2032.  *  mmi_email_inbox_get_attch_icon
  2033.  * DESCRIPTION
  2034.  *  Get status icon of a mail in Inbox list
  2035.  * PARAMETERS
  2036.  *  attachNum           [IN]        Number of attachments
  2037.  *  attch_type          [IN]        Mine type of attacments
  2038.  *  attachImageList     [OUT]       Image list of attachments
  2039.  * RETURNS
  2040.  *  void
  2041.  *****************************************************************************/
  2042. void mmi_email_inbox_get_attch_icon(U8 attachNum, U8 *attch_type, U16 *attachImageList)
  2043. {
  2044.     /*----------------------------------------------------------------*/
  2045.     /* Local Variables                                                */
  2046.     /*----------------------------------------------------------------*/
  2047.     S32 i;
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Code Body                                                      */
  2050.     /*----------------------------------------------------------------*/
  2051.     for (i = 0; i < attachNum; i++)
  2052.     {
  2053.         if (attch_type[i] == MIME_TYPE_IMAGE)
  2054.         {
  2055.             attachImageList[i] = IMG_EMAIL_ATTACH_IMAGE_ID;
  2056.         }
  2057.         else if (attch_type[i] == MIME_TYPE_AUDIO)
  2058.         {
  2059.             attachImageList[i] = IMG_EMAIL_ATTACH_AUDIO_ID;
  2060.         }
  2061.         else if (attch_type[i] == MIME_TYPE_VIDEO)
  2062.         {
  2063.             attachImageList[i] = IMG_EMAIL_ATTACH_VIDEO_ID;
  2064.         }
  2065.         else
  2066.         {
  2067.             attachImageList[i] = IMG_EMAIL_ATTACH_UNKNOWN_ID;
  2068.         }
  2069.     }
  2070. }
  2071. /*****************************************************************************
  2072.  * FUNCTION
  2073.  *  mmi_email_inbox_get_async_items
  2074.  * DESCRIPTION
  2075.  *  Fill dynamic list items of inbox
  2076.  * PARAMETERS
  2077.  *  start_indx      [IN]            Start index of item to be retrieved.
  2078.  *  menuData        [IN/OUT]        UI structure to store the list data.
  2079.  *  num_item        [IN]            Number of items revrieved.
  2080.  * RETURNS
  2081.  *  number of items can be retrieved.
  2082.  *****************************************************************************/
  2083. S32 mmi_email_inbox_get_async_items(S32 start_indx, gui_iconlist_menu_item *menuData, S32 num_item)
  2084. {
  2085.     /*----------------------------------------------------------------*/
  2086.     /* Local Variables                                                */
  2087.     /*----------------------------------------------------------------*/
  2088.     S32 i, j;
  2089.     mmi_mem_pool_ret_enum ret_result;
  2090.     mmi_email_mail_info_struct *listMsgsStruct[EMAIL_TOTAL_MSG_BUFF];
  2091.     /*----------------------------------------------------------------*/
  2092.     /* Code Body                                                      */
  2093.     /*----------------------------------------------------------------*/
  2094.     email_p->mem_pool_info.start_indx = start_indx;
  2095.     email_p->mem_pool_info.end_indx = (start_indx + num_item) - 1;
  2096.     ret_result = mmi_mem_get_values(
  2097.                     &email_p->mem_pool_info.mem_container,
  2098.                     (S16) email_p->mem_pool_info.start_indx,
  2099.                     (S16) email_p->mem_pool_info.end_indx,
  2100.                     (void **)listMsgsStruct,
  2101.                     &email_p->mem_pool_info.not_avail_pool);
  2102.     if (ret_result != MEM_CT_SUCCESS)
  2103.     {
  2104.     #if !defined(__MMI_SLIM_EMAIL_NO_IMAP4__)
  2105.         if (email_p->prof_info.act_prof.in_prot == EMAIL_PROT_POP3 || email_p->main_info.curr_menu == MMI_EMAIL_UNSENT)
  2106.     #endif 
  2107.             email_p->fldr_info.curr_page = email_p->mem_pool_info.not_avail_pool + 1;
  2108.         if (email_p->fldr_info.is_list_displayed)
  2109.         {
  2110.             mmi_email_fldr_pre_folder_select_req();
  2111.         }
  2112.         return 0;   /* no items available */
  2113.     }
  2114.     /* fill data */
  2115.     for (j = 0; j < num_item; j++)
  2116.     {
  2117.         U16 status_img;
  2118.         U16 attch_img[MMI_EMAIL_MAX_NUM_ATTACH];
  2119.         mmi_email_mail_info_struct *temp = listMsgsStruct[j];
  2120.         if (!pfnUnicodeStrlen((S8*) temp->subject))
  2121.         {
  2122.             pfnUnicodeStrncpy(
  2123.                 (S8*) menuData[j].item_list[0],
  2124.                 (S8*) GetString(STR_EMAIL_COMMON_NO_SUBJECT_ID),
  2125.                 EMAIL_MAX_SUBJ_DISPLAY_STR_LEN);
  2126.         }
  2127.         else
  2128.         {
  2129.             pfnUnicodeStrncpy((S8*) menuData[j].item_list[0], (S8*) temp->subject, EMAIL_MAX_SUBJ_DISPLAY_STR_LEN);
  2130.         }
  2131.         pfnUnicodeStrcpy((S8*) menuData[j].item_list[1], (S8*) temp->dt_buff);
  2132.         /*  fill status icon */
  2133.         status_img = mmi_email_inbox_get_status_icon(temp->priority, temp->is_read);
  2134.         menuData[j].image_list[0] = (PU8) GetImage(status_img);
  2135.         mmi_email_inbox_get_attch_icon(temp->attch_num, temp->attch_type, attch_img);
  2136.         for (i = 0; i < temp->attch_num; i++)
  2137.         {
  2138.             menuData[j].image_list[i + 1] = (PU8) GetImage(attch_img[i]);
  2139.         }
  2140.         /* fill null pointer to prevent abnormal cases */
  2141.         for (; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  2142.         {
  2143.             menuData[j].image_list[i + 1] = NULL;
  2144.         }
  2145.     }
  2146.     return num_item;
  2147. }
  2148. /*****************************************************************************
  2149.  * FUNCTION
  2150.  *  mmi_email_entry_read
  2151.  * DESCRIPTION
  2152.  *  Entry Read Email screen.
  2153.  * PARAMETERS
  2154.  *  void
  2155.  * RETURNS
  2156.  *  void
  2157.  *****************************************************************************/
  2158. void mmi_email_entry_read(void)
  2159. {
  2160.     /*----------------------------------------------------------------*/
  2161.     /* Local Variables                                                */
  2162.     /*----------------------------------------------------------------*/
  2163.     U16 emailEmailReadEditorIcons[EMAIL_READ_TOTAL] = 
  2164.     {
  2165.         IMG_EMAIL_READ_FROM_ID, IMG_EMAIL_READ_TO_ID,
  2166.         IMG_EMAIL_READ_CC_ID, IMG_EMAIL_READ_SUBJECT_ID,
  2167.         IMG_EMAIL_READ_ATTACHMENT_ID, 0
  2168.     };
  2169.     U8 *guiBuffer;
  2170.     U8 *inputBuffer;
  2171.     U16 inputBufferSize;
  2172.     /*----------------------------------------------------------------*/
  2173.     /* Code Body                                                      */
  2174.     /*----------------------------------------------------------------*/
  2175.     EntryNewScreen(SCR_ID_EMAIL_READ, mmi_email_exit_read, NULL, NULL);
  2176.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_READ);
  2177.     inputBuffer = GetCurrNInputBuffer(SCR_ID_EMAIL_READ, &inputBufferSize);
  2178.     InitializeCategory57Screen();
  2179.     mmi_email_read_fill_inline_struct();
  2180.     RegisterHighlightHandler(mmi_email_hilite_read_item);
  2181.     if (inputBuffer != NULL)
  2182.     {
  2183.         SetCategory57Data(wgui_inline_items, EMAIL_READ_TOTAL, inputBuffer);
  2184.     }
  2185.     /* sync current highlight item as normal email */
  2186. #if 0
  2187. /* under construction !*/
  2188. /* under construction !*/
  2189. /* under construction !*/
  2190. /* under construction !*/
  2191. #endif /* 0 */ 
  2192.     ShowCategory57Screen(
  2193.         STR_EMAIL_FROM_ID,
  2194.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2195.         STR_GLOBAL_OPTIONS,
  2196.         IMG_GLOBAL_OK,
  2197.         STR_GLOBAL_BACK,
  2198.         IMG_GLOBAL_BACK,
  2199.         EMAIL_READ_TOTAL,
  2200.         (U16*) emailEmailReadEditorIcons,
  2201.         wgui_inline_items,
  2202.         (S32) email_p->inbox_info.read_info.curr_inline_item,
  2203.         guiBuffer);
  2204.     SetCategory57RightSoftkeyFunctions(mmi_email_entry_read_opt, GoBackHistory);
  2205.     if (email_p->inbox_info.read_info.cont_exceed)
  2206.     {
  2207.         email_p->inbox_info.read_info.cont_exceed = FALSE;
  2208.         DisplayPopup(
  2209.             (U8*) GetString(STR_EMAIL_CONTENT_MESSAGE_TOO_ID),
  2210.             IMG_GLOBAL_EMPTY,
  2211.             1,
  2212.             UI_POPUP_NOTIFYDURATION_TIME,
  2213.             (U8) EMPTY_LIST_TONE);
  2214.     }
  2215. }
  2216. /*****************************************************************************
  2217.  * FUNCTION
  2218.  *  mmi_email_exit_read
  2219.  * DESCRIPTION
  2220.  *  Exit Read Email screen.
  2221.  * PARAMETERS
  2222.  *  void
  2223.  * RETURNS
  2224.  *  void
  2225.  *****************************************************************************/
  2226. void mmi_email_exit_read(void)
  2227. {
  2228.     /*----------------------------------------------------------------*/
  2229.     /* Local Variables                                                */
  2230.     /*----------------------------------------------------------------*/
  2231.     /*----------------------------------------------------------------*/
  2232.     /* Code Body                                                      */
  2233.     /*----------------------------------------------------------------*/
  2234.     mmi_email_util_add_n_history(SCR_ID_EMAIL_READ, mmi_email_entry_read);
  2235. }
  2236. /*****************************************************************************
  2237.  * FUNCTION
  2238.  *  mmi_email_read_fill_inline_struct
  2239.  * DESCRIPTION
  2240.  *  Fill inline structure for Read Email screen
  2241.  * PARAMETERS
  2242.  *  void
  2243.  * RETURNS
  2244.  *  void
  2245.  *****************************************************************************/
  2246. void mmi_email_read_fill_inline_struct(void)
  2247. {
  2248.     /*----------------------------------------------------------------*/
  2249.     /* Local Variables                                                */
  2250.     /*----------------------------------------------------------------*/
  2251.     PU8 rightArrowImage;
  2252.     /*----------------------------------------------------------------*/
  2253.     /* Code Body                                                      */
  2254.     /*----------------------------------------------------------------*/
  2255.     /* "FROM" */
  2256.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  2257.     SetInlineItemImageText(
  2258.         &(wgui_inline_items[0]),
  2259.         (U8*) email_p->inbox_info.read_info.from_addr,
  2260.         (PU8) GetImage(IMG_EMAIL_READ_FROM_ID),
  2261.         NULL,
  2262.         (PU8) GetImage(RIGHT_RED_ARROW),
  2263.         sizeof(email_p->inbox_info.read_info.from_addr),
  2264.         STR_EMAIL_FROM_ID,
  2265.         0,
  2266.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2267.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[0]), mmi_email_entry_read_opt);
  2268. #ifdef __MMI_TOUCH_SCREEN__
  2269.     SetInlineImageTextPenHandler(&(wgui_inline_items[0]), NULL, mmi_email_read_goto_addr);
  2270. #endif 
  2271.     ShowAsControl(&(wgui_inline_items[0]));
  2272.     /* "TO" */
  2273.     rightArrowImage = NULL;
  2274.     SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
  2275.     if (pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_TO]))
  2276.     {
  2277.         rightArrowImage = (PU8) GetImage(RIGHT_RED_ARROW);
  2278.     }
  2279.     SetInlineItemImageText(
  2280.         &(wgui_inline_items[1]),
  2281.         (U8*) email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_TO],
  2282.         (PU8) GetImage(IMG_EMAIL_READ_TO_ID),
  2283.         NULL,
  2284.         rightArrowImage,
  2285.         sizeof(email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_TO]),
  2286.         STR_EMAIL_TO_ID,
  2287.         0,
  2288.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2289.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[1]), mmi_email_entry_read_opt);
  2290. #ifdef __MMI_TOUCH_SCREEN__
  2291.     SetInlineImageTextPenHandler(&(wgui_inline_items[1]), NULL, mmi_email_read_goto_addr);
  2292. #endif 
  2293.     ShowAsControl(&(wgui_inline_items[1]));
  2294.     /* "CC" */
  2295.     rightArrowImage = NULL;
  2296.     if (pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_CC]))
  2297.     {
  2298.         rightArrowImage = (PU8) GetImage(RIGHT_RED_ARROW);
  2299.     }
  2300.     SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
  2301.     SetInlineItemImageText(
  2302.         &(wgui_inline_items[2]),
  2303.         (U8*) email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_CC],
  2304.         (PU8) GetImage(IMG_EMAIL_READ_CC_ID),
  2305.         NULL,
  2306.         rightArrowImage,
  2307.         sizeof(email_p->inbox_info.read_info.addr_disp_buff[EMAIL_ADDR_CC]),
  2308.         STR_EMAIL_CC_ID,
  2309.         0,
  2310.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2311.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[2]), mmi_email_entry_read_opt);
  2312. #ifdef __MMI_TOUCH_SCREEN__
  2313.     SetInlineImageTextPenHandler(&(wgui_inline_items[2]), NULL, mmi_email_read_goto_addr);
  2314. #endif 
  2315.     ShowAsControl(&(wgui_inline_items[2]));
  2316.     /* "SUBJECT" */
  2317.     SetInlineItemActivation(&wgui_inline_items[3], KEY_LSK, KEY_EVENT_UP);
  2318.     SetInlineItemImageText(
  2319.         &(wgui_inline_items[3]),
  2320.         (U8*) email_p->inbox_info.read_info.subj_buff,
  2321.         (PU8) GetImage(IMG_EMAIL_READ_SUBJECT_ID),
  2322.         NULL,
  2323.         NULL,
  2324.         sizeof(email_p->inbox_info.read_info.subj_buff),
  2325.         STR_EMAIL_SUBJECT_ID,
  2326.         0,
  2327.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2328.     SetInlineFullScreenEditCustomFunctionImageText(&(wgui_inline_items[3]), mmi_email_entry_read_opt);
  2329.     ShowAsControl(&(wgui_inline_items[3]));
  2330.     /* "ATTACHMENT" */
  2331.     SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
  2332.     SetInlineItemImageAttachment(
  2333.         &wgui_inline_items[4],
  2334.         (PU8) GetImage(IMG_EMAIL_READ_ATTACHMENT_ID),
  2335.         NULL,
  2336.         NULL,
  2337.         STR_EMAIL_ATTACHMENT_ID,
  2338.         0,
  2339.         email_p->misc_info.curr_hilite_attch);
  2340.     RegisterAttachmentHighlightedFunction(&wgui_inline_items[4], mmi_email_hilite_read_attch);
  2341.     RegisterAttachmentLskFunction(&wgui_inline_items[4], mmi_email_read_attch_lsk);
  2342.     RegisterAttachmentRskFunction(&wgui_inline_items[4], mmi_email_read_attch_rsk);
  2343.     mmi_email_read_fill_attch_icon();
  2344.     /* "CONTENT" */
  2345.     SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2346.     SetInlineMultiLineRdOnly(
  2347.         &wgui_inline_items[5],
  2348.         (U8*) email_p->inbox_info.read_info.cont_buff,
  2349.         pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.cont_buff),
  2350.         INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2351.         7);
  2352. }
  2353. /*****************************************************************************
  2354.  * FUNCTION
  2355.  *  mmi_email_read_fill_attch_icon
  2356.  * DESCRIPTION
  2357.  *  Fill attachment icons according to their types.
  2358.  * PARAMETERS
  2359.  *  void
  2360.  * RETURNS
  2361.  *  void
  2362.  *****************************************************************************/
  2363. void mmi_email_read_fill_attch_icon(void)
  2364. {
  2365.     /*----------------------------------------------------------------*/
  2366.     /* Local Variables                                                */
  2367.     /*----------------------------------------------------------------*/
  2368.     S32 i;
  2369.     U16 img_id;
  2370.     /*----------------------------------------------------------------*/
  2371.     /* Code Body                                                      */
  2372.     /*----------------------------------------------------------------*/
  2373.     ClearAllAttachmentImages(&wgui_inline_items[4], MMI_EMAIL_MAX_NUM_ATTACH);
  2374.     for (i = 0; i < MMI_EMAIL_MAX_NUM_ATTACH; i++)
  2375.     {
  2376.         if (!email_p->inbox_info.read_info.attch_list[i].attch_present)
  2377.         {
  2378.             continue;
  2379.         }
  2380.         img_id = mmi_email_util_get_attch_icon((S8*) email_p->inbox_info.read_info.attch_list[i].file_path);
  2381.         email_p->inbox_info.read_info.attch_icon[i].image1 = (PU8) GetImage(img_id);
  2382.     }
  2383.     AddEmailImageAttachmentUI(
  2384.         &wgui_inline_items[4],
  2385.         (wgui_inline_images_detail*) email_p->inbox_info.read_info.attch_icon);
  2386. }
  2387. /*****************************************************************************
  2388.  * FUNCTION
  2389.  *  mmi_email_read_attch_lsk
  2390.  * DESCRIPTION
  2391.  *  LSK handler of Inbox->Read->Attachment
  2392.  * PARAMETERS
  2393.  *  image       [IN]        Currently no use.
  2394.  *  str         [IN]        Currently no use.
  2395.  * RETURNS
  2396.  *  void
  2397.  *****************************************************************************/
  2398. void mmi_email_read_attch_lsk(PU8 image, UI_string_type str)
  2399. {
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Local Variables                                                */
  2402.     /*----------------------------------------------------------------*/
  2403.     /*----------------------------------------------------------------*/
  2404.     /* Code Body                                                      */
  2405.     /*----------------------------------------------------------------*/
  2406.     if (email_p->inbox_info.read_info.total_attch != 0)
  2407.     {
  2408.         mmi_email_entry_read_attch();
  2409.     }
  2410.     else
  2411.     {
  2412.         mmi_email_entry_read_opt();
  2413.     }
  2414. }
  2415. /*****************************************************************************
  2416.  * FUNCTION
  2417.  *  mmi_email_read_attch_rsk
  2418.  * DESCRIPTION
  2419.  *  RSK handler of Inbox->Read->Attachment
  2420.  * PARAMETERS
  2421.  *  image       [IN]        Currently no use.
  2422.  *  str         [IN]        Currently no use.
  2423.  * RETURNS
  2424.  *  void
  2425.  *****************************************************************************/
  2426. void mmi_email_read_attch_rsk(PU8 image, UI_string_type str)
  2427. {
  2428.     /*----------------------------------------------------------------*/
  2429.     /* Local Variables                                                */
  2430.     /*----------------------------------------------------------------*/
  2431.     /*----------------------------------------------------------------*/
  2432.     /* Code Body                                                      */
  2433.     /*----------------------------------------------------------------*/
  2434.     GoBackHistory();
  2435. }
  2436. /*****************************************************************************
  2437.  * FUNCTION
  2438.  *  mmi_email_hilite_read_item
  2439.  * DESCRIPTION
  2440.  *  Highlight handler of inline items in Read email screen
  2441.  * PARAMETERS
  2442.  *  index       [IN]        Index of highlight item
  2443.  * RETURNS
  2444.  *  void
  2445.  *****************************************************************************/
  2446. void mmi_email_hilite_read_item(S32 index)
  2447. {
  2448.     /*----------------------------------------------------------------*/
  2449.     /* Local Variables                                                */
  2450.     /*----------------------------------------------------------------*/
  2451.     /*----------------------------------------------------------------*/
  2452.     /* Code Body                                                      */
  2453.     /*----------------------------------------------------------------*/
  2454.     email_p->comp_info.curr_addr_type = EMAIL_ADDR_NONE;
  2455.     email_p->inbox_info.read_info.curr_inline_item = (U8) index;
  2456.     switch (index)
  2457.     {
  2458.         case EMAIL_READ_FROM:
  2459.             email_p->comp_info.curr_addr_type = EMAIL_ADDR_FROM;
  2460.             mmi_email_util_change_title(STR_EMAIL_FROM_ID);
  2461.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2462.             SetKeyHandler(mmi_email_read_goto_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2463.             SetLeftSoftkeyFunction(mmi_email_entry_read_opt, KEY_EVENT_UP);
  2464.             break;
  2465.         case EMAIL_READ_TO:
  2466.             email_p->comp_info.curr_addr_type = EMAIL_ADDR_TO;
  2467.             mmi_email_util_change_title(STR_EMAIL_TO_ID);
  2468.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2469.             SetKeyHandler(mmi_email_read_goto_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2470.             SetLeftSoftkeyFunction(mmi_email_entry_read_opt, KEY_EVENT_UP);
  2471.             break;
  2472.         case EMAIL_READ_CC:
  2473.             email_p->comp_info.curr_addr_type = EMAIL_ADDR_CC;
  2474.             mmi_email_util_change_title(STR_EMAIL_CC_ID);
  2475.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2476.             SetKeyHandler(mmi_email_read_goto_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2477.             SetLeftSoftkeyFunction(mmi_email_entry_read_opt, KEY_EVENT_UP);
  2478.             break;
  2479.         case EMAIL_READ_SUBJ:
  2480.             mmi_email_util_change_title(STR_EMAIL_SUBJECT_ID);
  2481.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2482.             ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2483.             SetLeftSoftkeyFunction(mmi_email_entry_read_opt, KEY_EVENT_UP);
  2484.             break;
  2485.         case EMAIL_READ_ATTCH:
  2486.             mmi_email_util_change_title(STR_EMAIL_ATTACHMENT_ID);
  2487.             ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2488.             if (email_p->inbox_info.read_info.total_attch != 0)
  2489.             {
  2490.                 ChangeLeftSoftkey(STR_GLOBAL_VIEW, IMG_GLOBAL_OK);
  2491.             }
  2492.             else
  2493.             {
  2494.                 ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2495.             }
  2496.             break;
  2497.         case EMAIL_READ_CONT:
  2498.             mmi_email_util_change_title(STR_EMAIL_CONTENT_ID);
  2499.             ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OK);
  2500.             SetLeftSoftkeyFunction(mmi_email_entry_read_opt, KEY_EVENT_UP);
  2501.             ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2502.             break;
  2503.     }
  2504. }
  2505. /*****************************************************************************
  2506.  * FUNCTION
  2507.  *  mmi_email_read_goto_addr
  2508.  * DESCRIPTION
  2509.  *  Right arrow key handler for Read-> Address list
  2510.  * PARAMETERS
  2511.  *  void
  2512.  * RETURNS
  2513.  *  void
  2514.  *****************************************************************************/
  2515. void mmi_email_read_goto_addr(void)
  2516. {
  2517.     /*----------------------------------------------------------------*/
  2518.     /* Local Variables                                                */
  2519.     /*----------------------------------------------------------------*/
  2520.     S8 isEmpty = FALSE;
  2521.     /*----------------------------------------------------------------*/
  2522.     /* Code Body                                                      */
  2523.     /*----------------------------------------------------------------*/
  2524.     switch (email_p->comp_info.curr_addr_type)
  2525.     {
  2526.         case EMAIL_ADDR_FROM:
  2527.             if (pfnUnicodeStrlen((S8*) email_p->inbox_info.from_info.from_addr) == 0)
  2528.             {
  2529.                 isEmpty = TRUE;
  2530.             }
  2531.             break;
  2532.         case EMAIL_ADDR_TO:
  2533.             if (email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].num_addr == 0)
  2534.             {
  2535.                 isEmpty = TRUE;
  2536.             }
  2537.             break;
  2538.         case EMAIL_ADDR_CC:
  2539.             if (email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].num_addr == 0)
  2540.             {
  2541.                 isEmpty = TRUE;
  2542.             }
  2543.             break;
  2544.     }
  2545.     if (isEmpty)
  2546.     {
  2547.         DisplayPopup(
  2548.             (U8*) GetString(STR_GLOBAL_EMPTY),
  2549.             IMG_GLOBAL_EMPTY,
  2550.             1,
  2551.             UI_POPUP_NOTIFYDURATION_TIME,
  2552.             (U8) EMPTY_LIST_TONE);
  2553.     }
  2554.     else
  2555.     {
  2556.         mmi_email_entry_read_addr();
  2557.     }
  2558. }
  2559. /*****************************************************************************
  2560.  * FUNCTION
  2561.  *  mmi_email_entry_read_addr
  2562.  * DESCRIPTION
  2563.  *  Entry address list of Read email screen
  2564.  * PARAMETERS
  2565.  *  void
  2566.  * RETURNS
  2567.  *  void
  2568.  *****************************************************************************/
  2569. void mmi_email_entry_read_addr(void)
  2570. {
  2571.     /*----------------------------------------------------------------*/
  2572.     /* Local Variables                                                */
  2573.     /*----------------------------------------------------------------*/
  2574.     U16 numItems;
  2575.     U8 *nStrMainItemList[MMI_EMAIL_MAX_LEN_ADDR_LIST];
  2576.     U8 *nStrPopupItemList[MMI_EMAIL_MAX_LEN_ADDR_LIST];
  2577.     U8 *guiBuffer;
  2578.     /*----------------------------------------------------------------*/
  2579.     /* Code Body                                                      */
  2580.     /*----------------------------------------------------------------*/
  2581.     EntryNewScreen(SCR_ID_EMAIL_READ_ADDR, mmi_email_exit_read_addr, mmi_email_entry_read_addr, NULL);
  2582.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_READ_ADDR);
  2583.     numItems = mmi_email_read_get_addr_list(nStrMainItemList, nStrPopupItemList);
  2584.     ShowCategory53Screen(
  2585.         STR_EMAIL_ADDRESS_LIST_ID,
  2586.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2587.         STR_GLOBAL_OPTIONS,
  2588.         IMG_GLOBAL_OPTIONS,
  2589.         STR_GLOBAL_BACK,
  2590.         IMG_GLOBAL_BACK,
  2591.         numItems,
  2592.         nStrMainItemList,
  2593.         (U16*) gIndexIconsImageList,
  2594.         nStrPopupItemList,
  2595.         0,
  2596.         email_p->misc_info.curr_hilite_attch,
  2597.         guiBuffer);
  2598.     SetLeftSoftkeyFunction(mmi_email_entry_read_addr_opt, KEY_EVENT_UP);
  2599.     SetKeyHandler(mmi_email_entry_read_addr_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2600.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2601.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2602. }
  2603. /*****************************************************************************
  2604.  * FUNCTION
  2605.  *  mmi_email_exit_read_addr
  2606.  * DESCRIPTION
  2607.  *  Exit function of address list in Read email screen
  2608.  * PARAMETERS
  2609.  *  void
  2610.  * RETURNS
  2611.  *  void
  2612.  *****************************************************************************/
  2613. void mmi_email_exit_read_addr(void)
  2614. {
  2615.     /*----------------------------------------------------------------*/
  2616.     /* Local Variables                                                */
  2617.     /*----------------------------------------------------------------*/
  2618.     /*----------------------------------------------------------------*/
  2619.     /* Code Body                                                      */
  2620.     /*----------------------------------------------------------------*/
  2621.     email_p->misc_info.curr_hilite_attch = GetHighlightedItem();
  2622. }
  2623. /*****************************************************************************
  2624.  * FUNCTION
  2625.  *  mmi_email_read_get_addr_list
  2626.  * DESCRIPTION
  2627.  *  Get address list of Read Email screen
  2628.  * PARAMETERS
  2629.  *  nStrMainItemList        [IN]        
  2630.  *  nStrPopupItemList       [IN]        
  2631.  * RETURNS
  2632.  *  void
  2633.  *****************************************************************************/
  2634. U16 mmi_email_read_get_addr_list(U8 **nStrMainItemList, U8 **nStrPopupItemList)
  2635. {
  2636.     /*----------------------------------------------------------------*/
  2637.     /* Local Variables                                                */
  2638.     /*----------------------------------------------------------------*/
  2639.     S32 index;
  2640.     /*----------------------------------------------------------------*/
  2641.     /* Code Body                                                      */
  2642.     /*----------------------------------------------------------------*/
  2643.     switch (email_p->comp_info.curr_addr_type)
  2644.     {
  2645.         case EMAIL_ADDR_FROM:
  2646.             nStrMainItemList[0] = (U8*) email_p->inbox_info.from_info.from_addr;
  2647.             if (pfnUnicodeStrlen((S8*) email_p->inbox_info.from_info.from_name))
  2648.             {
  2649.                 nStrPopupItemList[0] = (U8*) email_p->inbox_info.from_info.from_name;
  2650.             }
  2651.             else
  2652.             {
  2653.                 nStrPopupItemList[0] = NULL;
  2654.             }
  2655.             return 1;
  2656.         case EMAIL_ADDR_TO:
  2657.             for (index = 0; index < email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].num_addr; index++)
  2658.             {
  2659.                 nStrMainItemList[index] =
  2660.                     (U8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].to_cc_mail[index];
  2661.                 if (pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].to_cc_name[index]))
  2662.                 {
  2663.                     nStrPopupItemList[index] =
  2664.                         (U8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].to_cc_name[index];
  2665.                 }
  2666.                 else
  2667.                 {
  2668.                     nStrPopupItemList[index] = NULL;
  2669.                 }
  2670.             }
  2671.             return email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_TO].num_addr;
  2672.         default:    /* case EMAIL_ADDR_CC:   */
  2673.             for (index = 0; index < email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].num_addr; index++)
  2674.             {
  2675.                 nStrMainItemList[index] =
  2676.                     (U8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].to_cc_mail[index];
  2677.                 if (pfnUnicodeStrlen((S8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].to_cc_name[index]))
  2678.                 {
  2679.                     nStrPopupItemList[index] =
  2680.                         (U8*) email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].to_cc_name[index];
  2681.                 }
  2682.                 else
  2683.                 {
  2684.                     nStrPopupItemList[index] = NULL;
  2685.                 }
  2686.             }
  2687.             return email_p->inbox_info.read_info.addr_list[EMAIL_ADDR_CC].num_addr;
  2688.     }
  2689. }
  2690. /*****************************************************************************
  2691.  * FUNCTION
  2692.  *  mmi_email_entry_read_addr_opt
  2693.  * DESCRIPTION
  2694.  *  Entry option screen for Read->Address List
  2695.  * PARAMETERS
  2696.  *  void
  2697.  * RETURNS
  2698.  *  void
  2699.  *****************************************************************************/
  2700. void mmi_email_entry_read_addr_opt(void)
  2701. {
  2702.     /*----------------------------------------------------------------*/
  2703.     /* Local Variables                                                */
  2704.     /*----------------------------------------------------------------*/
  2705.     U16 numItems;
  2706.     U16 nStrItemList[2];    /* only save to phb ann send */
  2707.     U8 *guiBuffer;
  2708.     /*----------------------------------------------------------------*/
  2709.     /* Code Body                                                      */
  2710.     /*----------------------------------------------------------------*/
  2711.     EntryNewScreen(SCR_ID_EMAIL_READ_ADDR_OPT, NULL, mmi_email_entry_read_addr_opt, NULL);
  2712.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_READ_ADDR_OPT);
  2713.     SetParentHandler(MENU_ID_EMAIL_INBOX_ADDR_OPT);
  2714.     numItems = GetNumOfChild(MENU_ID_EMAIL_INBOX_ADDR_OPT);
  2715.     GetSequenceStringIds(MENU_ID_EMAIL_INBOX_ADDR_OPT, nStrItemList);
  2716.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2717.     ShowCategory52Screen(
  2718.         STR_EMAIL_ADDRESS_LIST_ID,
  2719.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2720.         STR_GLOBAL_OK,
  2721.         IMG_GLOBAL_OK,
  2722.         STR_GLOBAL_BACK,
  2723.         IMG_GLOBAL_BACK,
  2724.         numItems,
  2725.         nStrItemList,
  2726.         (U16*) gIndexIconsImageList,
  2727.         NULL,
  2728.         0,
  2729.         0,
  2730.         guiBuffer);
  2731.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2732.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2733. }
  2734. /*****************************************************************************
  2735.  * FUNCTION
  2736.  *  mmi_email_entry_read_attch
  2737.  * DESCRIPTION
  2738.  *  Entry attachment list in Read Email screen
  2739.  * PARAMETERS
  2740.  *  void
  2741.  * RETURNS
  2742.  *  void
  2743.  *****************************************************************************/
  2744. void mmi_email_entry_read_attch(void)
  2745. {
  2746.     /*----------------------------------------------------------------*/
  2747.     /* Local Variables                                                */
  2748.     /*----------------------------------------------------------------*/
  2749.     S8 index;
  2750.     U8 *nStrItemList[MMI_EMAIL_MAX_NUM_ATTACH];
  2751.     U8 *guiBuffer;
  2752.     /*----------------------------------------------------------------*/
  2753.     /* Code Body                                                      */
  2754.     /*----------------------------------------------------------------*/
  2755.     EntryNewScreen(SCR_ID_EMAIL_READ_ATTCH, mmi_email_exit_read_attch, mmi_email_entry_read_attch, NULL);
  2756.     guiBuffer = GetCurrGuiBuffer(SCR_ID_EMAIL_READ_ATTCH);
  2757.     for (index = 0; index < email_p->inbox_info.read_info.total_attch; index++)
  2758.     {
  2759.         nStrItemList[index] = (U8*) email_p->inbox_info.read_info.attch_list[index].file_name;
  2760.     }
  2761.     RegisterHighlightHandler(mmi_email_hilite_read_attch_item);
  2762.     ShowCategory53Screen(
  2763.         STR_EMAIL_ATTACHMENT_ID,
  2764.         GetRootTitleIcon(MENU_ID_EMAIL_MAIN),
  2765.         STR_GLOBAL_OPTIONS,
  2766.         IMG_GLOBAL_OPTIONS,
  2767.         STR_GLOBAL_BACK,
  2768.         IMG_GLOBAL_BACK,
  2769.         (U16) email_p->inbox_info.read_info.total_attch,
  2770.         nStrItemList,
  2771.         (U16*) gIndexIconsImageList,
  2772.         NULL,
  2773.         0,
  2774.         email_p->misc_info.curr_hilite_attch,
  2775.         guiBuffer);
  2776.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2777.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2778. }
  2779. /*****************************************************************************
  2780.  * FUNCTION
  2781.  *  mmi_email_exit_read_attch
  2782.  * DESCRIPTION
  2783.  *  Exit function for attachment list in Read Email screen.
  2784.  * PARAMETERS
  2785.  *  void
  2786.  * RETURNS
  2787.  *  void
  2788.  *****************************************************************************/
  2789. void mmi_email_exit_read_attch(void)
  2790. {
  2791.     /*----------------------------------------------------------------*/
  2792.     /* Local Variables                                                */
  2793.     /*----------------------------------------------------------------*/
  2794.     /*----------------------------------------------------------------*/
  2795.     /* Code Body                                                      */
  2796.     /*----------------------------------------------------------------*/
  2797.     /* store current highlighted index for the usage of Read Email screen */
  2798.     email_p->misc_info.curr_hilite_attch = GetHighlightedItem();
  2799. }
  2800. /*****************************************************************************
  2801.  * FUNCTION
  2802.  *  mmi_email_hilite_read_attch
  2803.  * DESCRIPTION
  2804.  *  Callback function of RegisterAttachmentHighlightedFunction
  2805.  *  to set current highlight attachment index
  2806.  * PARAMETERS
  2807.  *  index       [IN]        Index of current highlighted item
  2808.  * RETURNS
  2809.  *  void
  2810.  *****************************************************************************/
  2811. void mmi_email_hilite_read_attch(S32 index)
  2812. {
  2813.     /*----------------------------------------------------------------*/
  2814.     /* Local Variables                                                */
  2815.     /*----------------------------------------------------------------*/
  2816.     /*----------------------------------------------------------------*/
  2817.     /* Code Body                                                      */
  2818.     /*----------------------------------------------------------------*/
  2819.     email_p->misc_info.curr_hilite_attch = (U8) index;
  2820. }
  2821. /*****************************************************************************
  2822.  * FUNCTION
  2823.  *  mmi_email_hilite_read_attch_item
  2824.  * DESCRIPTION
  2825.  *  Highlight handler of attachment in Read email screen
  2826.  * PARAMETERS
  2827.  *  index       [IN]        Index of current highlighted item
  2828.  * RETURNS
  2829.  *  void
  2830.  *****************************************************************************/
  2831. void mmi_email_hilite_read_attch_item(S32 index)
  2832. {
  2833.     /*----------------------------------------------------------------*/
  2834.     /* Local Variables                                                */
  2835.     /*----------------------------------------------------------------*/
  2836.     U8 fileType;
  2837.     /*----------------------------------------------------------------*/
  2838.     /* Code Body                                                      */
  2839.     /*----------------------------------------------------------------*/
  2840.     email_p->misc_info.curr_hilite_attch = (U8) index;
  2841.     fileType = mmi_fmgr_get_file_group((S8*) email_p->inbox_info.read_info.attch_list[index].file_path);
  2842.     if ((fileType == FMGR_GROUP_IMAGE) || (fileType == FMGR_GROUP_AUDIO) || (fileType == FMGR_GROUP_VIDEO))
  2843.     {
  2844.         ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  2845.         SetLeftSoftkeyFunction(mmi_email_entry_read_attch_opt, KEY_EVENT_UP);
  2846.         SetKeyHandler(mmi_email_entry_read_attch_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2847.     }
  2848.     else
  2849.     {
  2850.         /* unknown attachment types */
  2851.         ChangeLeftSoftkey(STR_GLOBAL_SAVE, IMG_GLOBAL_OK);
  2852.         SetLeftSoftkeyFunction(mmi_email_read_attach_save, KEY_EVENT_UP);
  2853.     }
  2854. }
  2855. /*****************************************************************************
  2856.  * FUNCTION
  2857.  *  mmi_email_entry_read_attch_opt
  2858.  * DESCRIPTION
  2859.  *  Entry option screen in Inbox->Read->Attachment
  2860.  * PARAMETERS
  2861.  *  void