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

MTK

开发平台:

C/C++

  1.     mmi_uc_set_processing_screen(
  2.             STR_GLOBAL_ABORTING, 
  3.             STR_UC_PLEASE_WAIT_ID, 
  4.             IMG_GLOBAL_PROGRESS, 
  5.             0);
  6.     
  7.     mmi_uc_entry_processing_generic();        
  8.     mmi_uc_abort_send_mms_req(g_uc_p->send_info.new_msg_id);
  9. }
  10.     
  11. /*****************************************************************************
  12.  * FUNCTION
  13.  *  mmi_uc_abort_send_mms_by_end_key
  14.  * DESCRIPTION
  15.  *  Abort sending MMS by endkey
  16.  * PARAMETERS
  17.  *  void
  18.  * RETURNS
  19.  *  void
  20.  *****************************************************************************/
  21. void mmi_uc_abort_send_mms_by_end_key(void)
  22. {
  23.     /*----------------------------------------------------------------*/
  24.     /* Local Variables                                                */
  25.     /*----------------------------------------------------------------*/
  26.     /*----------------------------------------------------------------*/
  27.     /* Code Body                                                      */
  28.     /*----------------------------------------------------------------*/
  29.     /* Abort MMS sending if not in-call or in csd call for MMS over csd case. */
  30.     if (isInCall() == FALSE || IsWapCallPresent())
  31.     {
  32.         g_uc_p->send_info.abort = MMI_UC_ABORT_BY_END_KEY;        
  33.         mmi_uc_set_processing_screen(
  34.                 STR_GLOBAL_ABORTING, 
  35.                 STR_UC_PLEASE_WAIT_ID, 
  36.                 IMG_GLOBAL_PROGRESS, 
  37.                 0);
  38.         
  39.         mmi_uc_entry_processing_generic();
  40.         DeleteUptoScrID(IDLE_SCREEN_ID);
  41.         
  42.         mmi_uc_abort_send_mms_req(g_uc_p->send_info.new_msg_id);
  43.         ClearInputEventHandler(MMI_DEVICE_ALL);
  44.         ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  45.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  46.         ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  47.         ClearKeyHandler(KEY_END, KEY_REPEAT);
  48.     }
  49.     else
  50.     {
  51.         ExecCurrEndKeyDownHandler();
  52.     }
  53. }
  54. /*****************************************************************************
  55.  * FUNCTION
  56.  *  mmi_uc_highlight_done_opt_send
  57.  * DESCRIPTION
  58.  *  Funtion is called when send menu item selected
  59.  * PARAMETERS
  60.  *  void
  61.  * RETURNS
  62.  *  void
  63.  *****************************************************************************/
  64. void mmi_uc_highlight_done_opt_send(void)
  65. {
  66.     /*----------------------------------------------------------------*/
  67.     /* Local Variables                                                */
  68.     /*----------------------------------------------------------------*/
  69.     /*----------------------------------------------------------------*/
  70.     /* Code Body                                                      */
  71.     /*----------------------------------------------------------------*/
  72.     SetLeftSoftkeyFunction(mmi_uc_process_send, KEY_EVENT_UP);
  73.     SetKeyHandler(mmi_uc_process_send, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  74.     return;
  75. }
  76. /*****************************************************************************
  77.  * FUNCTION
  78.  *  mmi_uc_highlight_done_opt_send_and_save
  79.  * DESCRIPTION
  80.  *  Funtion is called when send and save menu item selected
  81.  * PARAMETERS
  82.  *  void
  83.  * RETURNS
  84.  *  void
  85.  *****************************************************************************/
  86. void mmi_uc_highlight_done_opt_send_and_save(void)
  87. {
  88.     /*----------------------------------------------------------------*/
  89.     /* Local Variables                                                */
  90.     /*----------------------------------------------------------------*/
  91.     /*----------------------------------------------------------------*/
  92.     /* Code Body                                                      */
  93.     /*----------------------------------------------------------------*/
  94.     SetLeftSoftkeyFunction(mmi_uc_process_send_and_save, KEY_EVENT_UP);
  95.     SetKeyHandler(mmi_uc_process_send_and_save, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  96.     return;
  97. }
  98. /*****************************************************************************
  99.  * FUNCTION
  100.  *  mmi_uc_highlight_done_opt_save
  101.  * DESCRIPTION
  102.  *  Funtion is called when save menu item selected
  103.  * PARAMETERS
  104.  *  void
  105.  * RETURNS
  106.  *  void
  107.  *****************************************************************************/
  108. void mmi_uc_highlight_done_opt_save(void)
  109. {
  110.     /*----------------------------------------------------------------*/
  111.     /* Local Variables                                                */
  112.     /*----------------------------------------------------------------*/
  113.     /*----------------------------------------------------------------*/
  114.     /* Code Body                                                      */
  115.     /*----------------------------------------------------------------*/
  116.     SetLeftSoftkeyFunction(mmi_uc_process_save, KEY_EVENT_UP);
  117.     SetKeyHandler(mmi_uc_process_save, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  118.     return;
  119. }
  120. /*****************************************************************************
  121.  * FUNCTION
  122.  *  mmi_uc_highlight_done_opt_back_to_edit
  123.  * DESCRIPTION
  124.  *  Funtion is called when back to edit menu item selected
  125.  * PARAMETERS
  126.  *  void
  127.  * RETURNS
  128.  *  void
  129.  *****************************************************************************/
  130. void mmi_uc_highlight_done_opt_back_to_edit(void)
  131. {
  132.     /*----------------------------------------------------------------*/
  133.     /* Local Variables                                                */
  134.     /*----------------------------------------------------------------*/
  135.     /*----------------------------------------------------------------*/
  136.     /* Code Body                                                      */
  137.     /*----------------------------------------------------------------*/
  138.     SetLeftSoftkeyFunction(mmi_uc_process_back_to_edit, KEY_EVENT_UP);
  139.     SetKeyHandler(mmi_uc_process_back_to_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  140.     return;
  141. }
  142. /*****************************************************************************
  143.  * FUNCTION
  144.  *  mmi_uc_highlight_done_opt_send_opt
  145.  * DESCRIPTION
  146.  *  Funtion is called when send option menu item selected
  147.  * PARAMETERS
  148.  *  void
  149.  * RETURNS
  150.  *  void
  151.  *****************************************************************************/
  152. void mmi_uc_highlight_done_opt_send_opt(void)
  153. {
  154.     /*----------------------------------------------------------------*/
  155.     /* Local Variables                                                */
  156.     /*----------------------------------------------------------------*/
  157.     /*----------------------------------------------------------------*/
  158.     /* Code Body                                                      */
  159.     /*----------------------------------------------------------------*/
  160.     SetLeftSoftkeyFunction(mmi_uc_entry_send_opt, KEY_EVENT_UP);
  161.     SetKeyHandler(mmi_uc_entry_send_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  162.     return;
  163. }
  164. /*****************************************************************************
  165.  * FUNCTION
  166.  *  mmi_uc_highlight_done_opt_exit
  167.  * DESCRIPTION
  168.  *  Funtion is called when exit menu item selected
  169.  * PARAMETERS
  170.  *  void
  171.  * RETURNS
  172.  *  void
  173.  *****************************************************************************/
  174. void mmi_uc_highlight_done_opt_exit(void)
  175. {
  176.     /*----------------------------------------------------------------*/
  177.     /* Local Variables                                                */
  178.     /*----------------------------------------------------------------*/
  179.     /*----------------------------------------------------------------*/
  180.     /* Code Body                                                      */
  181.     /*----------------------------------------------------------------*/ 
  182.     SetLeftSoftkeyFunction(mmi_uc_process_exit, KEY_EVENT_UP);
  183.     SetKeyHandler(mmi_uc_process_exit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  184.     return;
  185. }
  186. /*****************************************************************************
  187.  * FUNCTION
  188.  *  mmi_uc_entry_addr_list
  189.  * DESCRIPTION
  190.  *  Entry function for address list screen
  191.  * PARAMETERS
  192.  *  void
  193.  * RETURNS
  194.  *  void
  195.  *****************************************************************************/
  196. void mmi_uc_entry_addr_list(void)
  197. {
  198.     /*----------------------------------------------------------------*/
  199.     /* Local Variables                                                */
  200.     /*----------------------------------------------------------------*/
  201.     U8 *guiBuffer = NULL;
  202.     S32 hiliteitem = 0;
  203.     S32 numitem = 0;
  204.     U16 title_id = 0;
  205.     /*----------------------------------------------------------------*/
  206.     /* Code Body                                                      */
  207.     /*----------------------------------------------------------------*/    
  208.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  209.                          "*[UnifiedComposerMain.c] mmi_uc_entry_addr_list type=%d *n",
  210.                          g_uc_p->done.current_addr_type));    
  211.     
  212.     switch(g_uc_p->done.current_addr_type)
  213.     {
  214.         case MMI_UC_ADDRESS_GROUP_TYPE_TO:
  215.         {
  216.             numitem = g_uc_p->msg.to_num;
  217.             title_id = STR_UC_TO_ID;
  218.         }
  219.         break;
  220.         case MMI_UC_ADDRESS_GROUP_TYPE_CC:
  221.         {
  222.             numitem = g_uc_p->msg.cc_num;
  223.             title_id = STR_UC_CC_ID;
  224.         }
  225.         break;
  226.         case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
  227.         {
  228.             numitem = g_uc_p->msg.bcc_num;
  229.             title_id = STR_UC_BCC_ID;
  230.         }
  231.         break;
  232.         default:
  233.         {
  234.             MMI_ASSERT(0);
  235.         }
  236.     }
  237.     
  238.     MMI_ASSERT(numitem);
  239.     EntryNewScreen(SCR_ID_UC_OPT_DONE_ADDR_LIST, mmi_uc_exit_generic, mmi_uc_entry_addr_list, NULL);
  240.     
  241.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  242.     RegisterHighlightHandler(mmi_uc_set_addr_index);
  243.     
  244.     if (guiBuffer != NULL)
  245.     {
  246.         hiliteitem = (g_uc_p->done.current_addr_index <= numitem) ? g_uc_p->done.current_addr_index : 0;
  247.         /* change gui buffer content */
  248.         change_cat184_list_menu_history_highlighted_item(hiliteitem, guiBuffer);
  249.     }
  250.     else if (g_uc_p->done.current_addr_index > 0)
  251.     {
  252.         hiliteitem = (g_uc_p->done.current_addr_index <= numitem) ? g_uc_p->done.current_addr_index : 0;
  253.     }
  254.     
  255.     ShowCategory184Screen(
  256.         title_id,
  257.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  258.         STR_GLOBAL_OPTIONS,
  259.         IMG_GLOBAL_OPTIONS,
  260.         STR_GLOBAL_BACK,
  261.         IMG_GLOBAL_BACK,
  262.         numitem,
  263.         mmi_uc_addr_list_get_item,
  264.         NULL,
  265.         hiliteitem,
  266.         guiBuffer);
  267.     SetLeftSoftkeyFunction(mmi_uc_entry_addr_option, KEY_EVENT_UP);
  268.     SetKeyHandler(mmi_uc_entry_addr_option, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  269.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  270.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  271. }
  272. /*****************************************************************************
  273.  * FUNCTION
  274.  *  mmi_uc_set_addr_index
  275.  * DESCRIPTION
  276.  *  Set current highlighted address index
  277.  * PARAMETERS
  278.  *  void
  279.  * RETURNS
  280.  *  void
  281.  *****************************************************************************/
  282. void mmi_uc_set_addr_index(S32 nIndex)
  283. {
  284.     /*----------------------------------------------------------------*/
  285.     /* Local Variables                                                */
  286.     /*----------------------------------------------------------------*/
  287.     /*----------------------------------------------------------------*/
  288.     /* Code Body                                                      */
  289.     /*----------------------------------------------------------------*/
  290.     g_uc_p->done.current_addr_index = nIndex;
  291. }
  292. /*****************************************************************************
  293.  * FUNCTION
  294.  *  mmi_uc_addr_list_get_item
  295.  * DESCRIPTION
  296.  *  Get address list item
  297.  * PARAMETERS
  298.  *  item_index          [IN]            
  299.  *  str_buff            [IN]            
  300.  *  img_buff_p          [?]             
  301.  *  str_img_mask        [IN]            
  302.  *  a(?)                [IN]            Item index
  303.  *  d(?)                [IN/OUT]        String image mask
  304.  *  c(?)                [IN/OUT]        Image buffer
  305.  *  b(?)                [IN/OUT]        String buffer
  306.  * RETURNS
  307.  * TRUE
  308.  *****************************************************************************/
  309. pBOOL mmi_uc_addr_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  310. {
  311.     /*----------------------------------------------------------------*/
  312.     /* Local Variables                                                */
  313.     /*----------------------------------------------------------------*/
  314.     S8 temp[(MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
  315.     S8 *name = NULL;
  316.     U8 i = 0;
  317.     mmi_uc_addr_struct* addr = NULL;
  318.     /*----------------------------------------------------------------*/
  319.     /* Code Body                                                      */
  320.     /*----------------------------------------------------------------*/
  321.     memset(temp, 0, sizeof(temp));
  322.     switch(g_uc_p->done.current_addr_type)
  323.     {
  324.         case MMI_UC_ADDRESS_GROUP_TYPE_TO:
  325.         {
  326.             addr = g_uc_p->msg.to_head;            
  327.             MMI_ASSERT(item_index < g_uc_p->msg.to_num);
  328.         }
  329.         break;
  330.     
  331.         case MMI_UC_ADDRESS_GROUP_TYPE_CC:
  332.         {
  333.             addr = g_uc_p->msg.cc_head;
  334.             MMI_ASSERT(item_index < g_uc_p->msg.cc_num);            
  335.         }
  336.         break;
  337.     
  338.         case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
  339.         {
  340.             addr = g_uc_p->msg.bcc_head;
  341.             MMI_ASSERT(item_index < g_uc_p->msg.bcc_num);
  342.         }
  343.         break;
  344.     
  345.         default:
  346.         {
  347.             MMI_ASSERT(0);
  348.         }
  349.     }    
  350.     for (i = 0; i < item_index; i++)
  351.     {
  352.         addr = addr->next;
  353.         MMI_ASSERT(addr);
  354.     }
  355.     if (addr->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
  356.     {
  357.         AnsiiToUnicodeString(temp, (S8*) addr->addr);
  358.         
  359.         name = lookUpNumber(temp);
  360.         if (name != NULL && pfnUnicodeStrlen(name) > 0)
  361.         {
  362.             pfnUnicodeStrncpy((S8*) str_buff, name, MAX_SUBMENU_CHARACTERS);
  363.         }
  364.         else
  365.         {
  366.             pfnUnicodeStrncpy((S8*) str_buff, temp, MAX_SUBMENU_CHARACTERS);
  367.         }
  368.     }
  369.     else
  370.     {
  371.         pfnUnicodeStrncpy((S8*) str_buff, (S8*) addr->addr, MAX_SUBMENU_CHARACTERS);
  372.     }
  373.     
  374.     *img_buff_p = (PU8) GetImage((U16) (gIndexIconsImageList[item_index]));
  375.     return TRUE;
  376. }
  377. /*****************************************************************************
  378.  * FUNCTION
  379.  *  mmi_uc_entry_addr_option
  380.  * DESCRIPTION
  381.  *  Entry function for address option menu
  382.  * PARAMETERS
  383.  *  void
  384.  * RETURNS
  385.  *  void
  386.  *****************************************************************************/
  387. void mmi_uc_entry_addr_option(void)
  388. {
  389.     /*----------------------------------------------------------------*/
  390.     /* Local Variables                                                */
  391.     /*----------------------------------------------------------------*/
  392.     U8 *guiBuffer = NULL;
  393.     U16 numItems = 0;
  394.     U16 nStrItemList[MAX_SUB_MENUS];
  395.     U16 title_id = 0;
  396.     /*----------------------------------------------------------------*/
  397.     /* Code Body                                                      */
  398.     /*----------------------------------------------------------------*/
  399.     EntryNewScreen(SCR_ID_UC_OPT_DONE_ADDR_OPT, mmi_uc_exit_generic, mmi_uc_entry_addr_option, NULL);
  400.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_addr_option *n"));
  401.     
  402.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_ADDR_OPT);
  403.     if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  404.     {
  405.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_DONE);
  406.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_EDIT);
  407.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_DELETE);
  408.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_DELETE_ALL);
  409.     }
  410.     else
  411.     {    
  412.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_DONE);
  413.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_EDIT);
  414.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_DELETE);
  415.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_DELETE_ALL);
  416.     }
  417.     if ((g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ) < MMI_UC_MAX_ADDRESS_NUM)
  418.     {
  419.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_NUMBER);
  420.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_NUMBER_GROUP);
  421.         if (g_uc_p->msg_type.caller_specific_msg_type != MMI_UC_MSG_TYPE_SMS_ONLY)
  422.         {
  423.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL);        
  424.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL_GROUP);
  425.         }
  426.         else
  427.         {
  428.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL);        
  429.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL_GROUP);        
  430.         }
  431.     }
  432.     else
  433.     {
  434.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_NUMBER);
  435.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_NUMBER_GROUP);
  436.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL);        
  437.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_ADDR_ADD_EMAIL_GROUP);        
  438.     }
  439.     switch(g_uc_p->done.current_addr_type)
  440.     {
  441.         case MMI_UC_ADDRESS_GROUP_TYPE_TO:
  442.         {
  443.             title_id = STR_UC_TO_OPTION_ID;
  444.         }
  445.         break;
  446.         case MMI_UC_ADDRESS_GROUP_TYPE_CC:
  447.         {
  448.             title_id = STR_UC_CC_OPTION_ID;
  449.         }
  450.         break;
  451.         case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
  452.         {
  453.             title_id = STR_UC_BCC_OPTION_ID;
  454.         }
  455.         break;
  456.         default:
  457.         {
  458.             MMI_ASSERT(0);
  459.         }
  460.     }
  461.     numItems = GetNumOfChild_Ext(MENU_ID_UC_OPT_ADDR);
  462.     GetSequenceStringIds_Ext(MENU_ID_UC_OPT_ADDR, nStrItemList);
  463.     SetParentHandler(MENU_ID_UC_OPT_ADDR);
  464.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  465.     ShowCategory52Screen(
  466.         title_id,
  467.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  468.         STR_GLOBAL_OK,
  469.         IMG_GLOBAL_OK,
  470.         STR_GLOBAL_BACK,
  471.         IMG_GLOBAL_BACK,
  472.         numItems,
  473.         nStrItemList,
  474.         (U16*) gIndexIconsImageList,
  475.         NULL,
  476.         0,
  477.         0,
  478.         guiBuffer);
  479.     
  480.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  481.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  482. }
  483. /*****************************************************************************
  484.  * FUNCTION
  485.  *  mmi_uc_highlight_addr_opt_done
  486.  * DESCRIPTION
  487.  *  Funtion is called when addr done menu item selected
  488.  * PARAMETERS
  489.  *  void
  490.  * RETURNS
  491.  *  void
  492.  *****************************************************************************/
  493. void mmi_uc_highlight_addr_opt_done(void)
  494. {
  495.     SetLeftSoftkeyFunction(mmi_uc_go_back_to_done, KEY_EVENT_UP);
  496.     SetKeyHandler(mmi_uc_go_back_to_done, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  497.     return;
  498. }
  499. /*****************************************************************************
  500.  * FUNCTION
  501.  *  mmi_uc_highlight_addr_opt_add_number
  502.  * DESCRIPTION
  503.  *  Funtion is called when addr add number menu item selected
  504.  * PARAMETERS
  505.  *  void
  506.  * RETURNS
  507.  *  void
  508.  *****************************************************************************/
  509. void mmi_uc_highlight_addr_opt_add_number(void)
  510. {    
  511.     /* use g_uc_p->done.to buffer to store phone number */
  512.     memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  513.     g_uc_p->done.state = MMI_UC_DONE_STATE_ADD_NUMBER;
  514.     SetLeftSoftkeyFunction(mmi_uc_entry_add_number, KEY_EVENT_UP);
  515.     SetKeyHandler(mmi_uc_entry_add_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  516.     return;
  517. }
  518. /*****************************************************************************
  519.  * FUNCTION
  520.  *  mmi_uc_highlight_addr_opt_add_email
  521.  * DESCRIPTION
  522.  *  Funtion is called when addr add email menu item selected
  523.  * PARAMETERS
  524.  *  void
  525.  * RETURNS
  526.  *  void
  527.  *****************************************************************************/
  528. void mmi_uc_highlight_addr_opt_add_email(void)
  529. {
  530.     /* use g_uc_p->done.to buffer to store email */
  531.     memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  532.     g_uc_p->done.state = MMI_UC_DONE_STATE_ADD_EMAIL;
  533.     SetLeftSoftkeyFunction(mmi_uc_entry_add_email, KEY_EVENT_UP);
  534.     SetKeyHandler(mmi_uc_entry_add_email, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  535.     return;
  536. }
  537. /*****************************************************************************
  538.  * FUNCTION
  539.  *  mmi_uc_highlight_addr_opt_edit
  540.  * DESCRIPTION
  541.  *  Funtion is called when addr edit menu item selected
  542.  * PARAMETERS
  543.  *  void
  544.  * RETURNS
  545.  *  void
  546.  *****************************************************************************/
  547. void mmi_uc_highlight_addr_opt_edit(void)
  548. {
  549.     /* use g_uc_p->done.to buffer to store edited address */
  550.     memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  551.     SetLeftSoftkeyFunction(mmi_uc_pre_entry_edit_addr, KEY_EVENT_UP);
  552.     SetKeyHandler(mmi_uc_pre_entry_edit_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  553.     return;
  554. }
  555. /*****************************************************************************
  556.  * FUNCTION
  557.  *  mmi_uc_highlight_addr_opt_delete
  558.  * DESCRIPTION
  559.  *  Funtion is called when addr delete menu item selected
  560.  * PARAMETERS
  561.  *  void
  562.  * RETURNS
  563.  *  void
  564.  *****************************************************************************/
  565. void mmi_uc_highlight_addr_opt_delete(void)
  566. {
  567.     SetLeftSoftkeyFunction(mmi_uc_entry_delete_addr, KEY_EVENT_UP);
  568.     SetKeyHandler(mmi_uc_entry_delete_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  569.     return;
  570. }
  571. /*****************************************************************************
  572.  * FUNCTION
  573.  *  mmi_uc_highlight_addr_opt_delete_all
  574.  * DESCRIPTION
  575.  *  Funtion is called when addr delete all menu item selected
  576.  * PARAMETERS
  577.  *  void
  578.  * RETURNS
  579.  *  void
  580.  *****************************************************************************/
  581. void mmi_uc_highlight_addr_opt_delete_all(void)
  582. {
  583.     SetLeftSoftkeyFunction(mmi_uc_entry_delete_all_addr, KEY_EVENT_UP);
  584.     SetKeyHandler(mmi_uc_entry_delete_all_addr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  585.     return;
  586. }
  587. /*****************************************************************************
  588.  * FUNCTION
  589.  *  mmi_uc_highlight_addr_opt_add_number_group
  590.  * DESCRIPTION
  591.  *  Funtion is called when add number by group menu item selected
  592.  * PARAMETERS
  593.  *  void
  594.  * RETURNS
  595.  *  void
  596.  *****************************************************************************/
  597. void mmi_uc_highlight_addr_opt_add_number_group(void)
  598. {
  599.     g_uc_p->done.state = MMI_UC_DONE_STATE_ADD_NUMBER_GROUP;
  600.     SetLeftSoftkeyFunction(mmi_uc_entry_add_addr_group, KEY_EVENT_UP);
  601.     SetKeyHandler(mmi_uc_entry_add_addr_group, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  602.     return;
  603. }
  604. /*****************************************************************************
  605.  * FUNCTION
  606.  *  mmi_uc_highlight_addr_opt_add_email_group
  607.  * DESCRIPTION
  608.  *  Funtion is called when add email address by group menu item selected
  609.  * PARAMETERS
  610.  *  void
  611.  * RETURNS
  612.  *  void
  613.  *****************************************************************************/
  614. void mmi_uc_highlight_addr_opt_add_email_group(void)
  615. {
  616.     g_uc_p->done.state = MMI_UC_DONE_STATE_ADD_EMAIL_GROUP;
  617.     SetLeftSoftkeyFunction(mmi_uc_entry_add_addr_group, KEY_EVENT_UP);
  618.     SetKeyHandler(mmi_uc_entry_add_addr_group, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  619.     return;
  620. }
  621. /*****************************************************************************
  622.  * FUNCTION
  623.  *  mmi_uc_go_back_to_done
  624.  * DESCRIPTION
  625.  *  Entry done screen
  626.  * PARAMETERS
  627.  *  void
  628.  * RETURNS
  629.  *  void
  630.  *****************************************************************************/
  631. void mmi_uc_go_back_to_done(void)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     /*----------------------------------------------------------------*/
  637.     /* Code Body                                                      */
  638.     /*----------------------------------------------------------------*/
  639.     MMI_ASSERT(IsScreenPresent(SCR_ID_UC_OPT_DONE));
  640.     GoBackToHistory(SCR_ID_UC_OPT_DONE);
  641. }
  642. /*****************************************************************************
  643.  * FUNCTION
  644.  *  mmi_uc_entry_add_number
  645.  * DESCRIPTION
  646.  *  Entry msg number screen
  647.  * PARAMETERS
  648.  *  void
  649.  * RETURNS
  650.  *  void
  651.  *****************************************************************************/
  652. void mmi_uc_entry_add_number(void)
  653. {
  654.     /*----------------------------------------------------------------*/
  655.     /* Local Variables                                                */
  656.     /*----------------------------------------------------------------*/
  657.     U8 *guiBuffer;
  658.     /*----------------------------------------------------------------*/
  659.     /* Code Body                                                      */
  660.     /*----------------------------------------------------------------*/
  661.     EntryNewScreen(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_NUMBER, NULL, mmi_uc_entry_add_number, NULL);
  662.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_NUMBER);
  663.     RegisterInputBoxEmptyFunction(mmi_uc_add_number_empty);
  664.     RegisterInputBoxNotEmptyFunction(mmi_uc_add_number_not_empty);
  665.     
  666.     ShowCategory5Screen(
  667.         STR_UC_ADD_NUMBER_ID,
  668.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  669.         STR_GLOBAL_OK,
  670.         0,
  671.         STR_GLOBAL_BACK,
  672.         0,
  673.         INPUT_TYPE_PHONE_NUMBER,
  674.         (U8*) g_uc_p->done.to,  /* use g_uc_p->done.to buffer to store phone number */
  675.         MAX_DIGITS_SMS,
  676.         guiBuffer);
  677.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  678. }
  679. /*****************************************************************************
  680.  * FUNCTION
  681.  *  mmi_uc_add_number_empty
  682.  * DESCRIPTION
  683.  *  LSK handle when number input is empty
  684.  * PARAMETERS
  685.  *  void
  686.  * RETURNS
  687.  *  void
  688.  *****************************************************************************/
  689. void mmi_uc_add_number_empty(void)
  690. {
  691.     /*----------------------------------------------------------------*/
  692.     /* Local Variables                                                */
  693.     /*----------------------------------------------------------------*/
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     ChangeLeftSoftkey(STR_GLOBAL_SEARCH, 0);
  698.     SetLeftSoftkeyFunction(mmi_uc_search_phb_number, KEY_EVENT_UP);
  699. }
  700. /*****************************************************************************
  701.  * FUNCTION
  702.  *  mmi_uc_add_number_not_empty
  703.  * DESCRIPTION
  704.  *  LSK handle when number input is not empty
  705.  * PARAMETERS
  706.  *  void
  707.  * RETURNS
  708.  *  void
  709.  *****************************************************************************/
  710. void mmi_uc_add_number_not_empty(void)
  711. {
  712.     /*----------------------------------------------------------------*/
  713.     /* Local Variables                                                */
  714.     /*----------------------------------------------------------------*/
  715.     /*----------------------------------------------------------------*/
  716.     /* Code Body                                                      */
  717.     /*----------------------------------------------------------------*/
  718.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  719.     SetLeftSoftkeyFunction(mmi_uc_addr_add_number_done, KEY_EVENT_UP);
  720. }
  721. /*****************************************************************************
  722.  * FUNCTION
  723.  *  mmi_uc_search_phb_number
  724.  * DESCRIPTION
  725.  *  Entry phonebook entry list to select phone number
  726.  * PARAMETERS
  727.  *  void
  728.  * RETURNS
  729.  *  void
  730.  *****************************************************************************/
  731. void mmi_uc_search_phb_number(void)
  732. {
  733.     /*----------------------------------------------------------------*/
  734.     /* Local Variables                                                */
  735.     /*----------------------------------------------------------------*/
  736.     /*----------------------------------------------------------------*/
  737.     /* Code Body                                                      */
  738.     /*----------------------------------------------------------------*/
  739.     mmi_phb_list_pre_entry_for_number_and_email(MMI_PHB_ENTRY_FIELD_ALL_NUMBER, mmi_uc_get_address_from_phb);
  740. }
  741. /*****************************************************************************
  742.  * FUNCTION
  743.  *  mmi_uc_get_address_from_phb
  744.  * DESCRIPTION
  745.  *  Get phonebook number
  746.  * PARAMETERS
  747.  *  name        [IN]        Name
  748.  *  number      [IN]        Number
  749.  * RETURNS
  750.  *  void
  751.  *****************************************************************************/
  752. void mmi_uc_get_address_from_phb(S8* name, S8* number)
  753. {
  754.     /*----------------------------------------------------------------*/
  755.     /* Local Variables                                                */
  756.     /*----------------------------------------------------------------*/
  757.     /*----------------------------------------------------------------*/
  758.     /* Code Body                                                      */
  759.     /*----------------------------------------------------------------*/
  760.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_NUMBER ||
  761.         g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_NUMBER)
  762.     {
  763.         if (pfnUnicodeStrlen((PS8) number) > (MAX_DIGITS_SMS - 1))
  764.         {
  765.             DisplayPopup(
  766.                 (PU8) GetString(STR_UC_ADDR_LENGTH_EXCEED_ID),
  767.                 IMG_GLOBAL_UNFINISHED,
  768.                 1,
  769.                 MMI_UC_POPUP_TIME_OUT,
  770.                 (U8) ERROR_TONE);
  771.             return;
  772.         }
  773.     }
  774.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_EMAIL ||
  775.              g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_EMAIL)
  776.     {
  777.         if (pfnUnicodeStrlen((PS8) number) > (MMI_UC_MAX_ADDR_LEN ))
  778.         {
  779.             DisplayPopup(
  780.                 (PU8) GetString(STR_UC_ADDR_LENGTH_EXCEED_ID),
  781.                 IMG_GLOBAL_UNFINISHED,
  782.                 1,
  783.                 MMI_UC_POPUP_TIME_OUT,
  784.                 (U8) ERROR_TONE);
  785.             return;
  786.         }
  787.     }
  788.     memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  789.     if (number)
  790.     {
  791.         pfnUnicodeStrncpy((S8*) g_uc_p->done.to, (PS8) number, MMI_UC_MAX_ADDR_LEN);
  792.     }
  793.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_NUMBER)
  794.     {
  795.         HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_NUMBER, 
  796.                        SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_NUMBER, 
  797.                        mmi_uc_entry_add_number);
  798.         GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_NUMBER);
  799.     }
  800.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_EMAIL)
  801.     {
  802.         HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_EMAIL, 
  803.                        SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_EMAIL, 
  804.                        mmi_uc_entry_add_email);
  805.         GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_EMAIL);
  806.     }    
  807.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_NUMBER ||
  808.              g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_EMAIL)
  809.     {
  810.         HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT_EDIT, 
  811.                        SCR_ID_UC_OPT_DONE_ADDR_OPT_EDIT, 
  812.                        mmi_uc_entry_edit_addr);
  813.         
  814.         GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_OPT_EDIT);
  815.     }
  816.     else
  817.     {
  818.         MMI_ASSERT(0);
  819.     }
  820.     
  821. }
  822. /*****************************************************************************
  823.  * FUNCTION
  824.  *  mmi_uc_addr_add_number_done
  825.  * DESCRIPTION
  826.  *  Get phonebook number
  827.  * PARAMETERS
  828.  *  name        [IN]        Name
  829.  *  number      [IN]        Number
  830.  * RETURNS
  831.  *  void
  832.  *****************************************************************************/
  833. void mmi_uc_addr_add_number_done(void)
  834. {
  835.     /*----------------------------------------------------------------*/
  836.     /* Local Variables                                                */
  837.     /*----------------------------------------------------------------*/
  838.     BOOL result = MMI_FALSE;
  839.     /*----------------------------------------------------------------*/
  840.     /* Code Body                                                      */
  841.     /*----------------------------------------------------------------*/
  842.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_NUMBER)
  843.     {    
  844.         if (mmi_uc_check_duplicate_address(g_uc_p->done.to,
  845.                                MMI_UC_ADDRESS_TYPE_PHONE_NUMBER,
  846.                                g_uc_p->done.current_addr_type) != NULL)
  847.         {
  848.             DisplayPopup(
  849.                     (PU8) GetString(STR_UC_DUPLICATE_ADDRESS_ID),
  850.                     IMG_GLOBAL_UNFINISHED,
  851.                     1,
  852.                     MMI_UC_POPUP_TIME_OUT,
  853.                     (U8) ERROR_TONE);
  854.                     
  855.             DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  856.             return;
  857.         }
  858.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  859.         {
  860.             /* Check if the msg size exceeds the MMS limitation */
  861.             U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  862.             if (mmi_uc_check_if_exceed_MMS_size_limitation(addr_size + g_uc_p->msg.msg_size))
  863.             {
  864.                 mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  865.                 return;
  866.             }
  867.         }       
  868.     
  869.         result = mmi_uc_add_address(g_uc_p->done.to,
  870.                                     MMI_UC_ADDRESS_TYPE_PHONE_NUMBER,
  871.                                    g_uc_p->done.current_addr_type); 
  872.         
  873.         MMI_ASSERT(result);
  874.         /* update the highlighted address to the new one */
  875.         if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_TO)
  876.         {
  877.             g_uc_p->done.current_addr_index = g_uc_p->msg.to_num - 1;
  878.         }
  879.         else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_CC)
  880.         {
  881.             g_uc_p->done.current_addr_index = g_uc_p->msg.cc_num - 1;
  882.         }
  883.         else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_BCC)
  884.         {
  885.             g_uc_p->done.current_addr_index = g_uc_p->msg.bcc_num - 1;
  886.         }
  887.         else
  888.         {
  889.             MMI_ASSERT(0);
  890.         }
  891.     }
  892.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_NUMBER)
  893.     {
  894.         mmi_uc_addr_struct* addr = mmi_uc_get_highlighted_addr();
  895.         U8 ascii_addr[MMI_UC_MAX_ADDR_LEN + 1];
  896.         U8 len = 0;
  897.     
  898.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  899.         {
  900.             /* Check if the msg size exceeds the MMS limitation */
  901.             U8 ori_addr_len = strlen((char*)addr->addr);
  902.             U8* ori_ucs2_addr = OslMalloc((ori_addr_len + 1) * ENCODING_LENGTH);
  903.             U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  904.             U32 ori_addr_size = 0;
  905.             memset(ori_ucs2_addr, 0, (ori_addr_len + 1) * ENCODING_LENGTH);
  906.             AnsiiToUnicodeString((S8*)ori_ucs2_addr, (S8*)addr->addr);
  907.             ori_addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)ori_ucs2_addr);
  908.             OslMfree(ori_ucs2_addr);
  909.             if (mmi_uc_check_if_exceed_MMS_size_limitation(addr_size + g_uc_p->msg.msg_size - ori_addr_size))
  910.             {
  911.                 mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  912.                 return;
  913.             }
  914.         }
  915.         memset(ascii_addr, 0, sizeof(ascii_addr));
  916.         UnicodeNToAnsii((S8*) ascii_addr, (S8*) g_uc_p->done.to, MMI_UC_MAX_ADDR_LEN * ENCODING_LENGTH);
  917.         len = strlen((char*)ascii_addr);
  918.         MMI_ASSERT(len <= MMI_UC_MAX_ADDR_LEN);
  919.         kal_adm_free(g_uc_p->main.mem_pool_id , addr->addr);        
  920.         addr->addr = kal_adm_alloc(g_uc_p->main.mem_pool_id, len + 1);
  921.         MMI_ASSERT(addr->addr);
  922.         
  923.         memset(addr->addr, 0, len + 1);
  924.         memcpy(addr->addr, ascii_addr, len);      
  925.         
  926.     }
  927.     else
  928.     {
  929.         MMI_ASSERT(0);
  930.     }
  931.     if (!IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  932.     {
  933.         result = HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT, SCR_ID_UC_OPT_DONE_ADDR_LIST, mmi_uc_entry_addr_list);
  934.         
  935.         MMI_ASSERT(result);
  936.     }
  937.     
  938.     if (mmi_uc_change_msg_type_if_needed())
  939.     {
  940.         mmi_uc_insert_signature_check();
  941.     }
  942.     
  943.     mmi_uc_update_msg_size();
  944.     
  945.     GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  946. }
  947. /*****************************************************************************
  948.  * FUNCTION
  949.  *  mmi_uc_entry_add_email
  950.  * DESCRIPTION
  951.  *  Entry msg email screen
  952.  * PARAMETERS
  953.  *  void
  954.  * RETURNS
  955.  *  void
  956.  *****************************************************************************/
  957. void mmi_uc_entry_add_email(void)
  958. {
  959.     /*----------------------------------------------------------------*/
  960.     /* Local Variables                                                */
  961.     /*----------------------------------------------------------------*/
  962.     U8 *guiBuffer;
  963.     /*----------------------------------------------------------------*/
  964.     /* Code Body                                                      */
  965.     /*----------------------------------------------------------------*/
  966.     EntryNewScreen(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_EMAIL, NULL, mmi_uc_entry_add_email, NULL);
  967.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_ADDR_OPT_ADD_EMAIL);
  968.     RegisterInputBoxEmptyFunction(mmi_uc_add_email_empty);
  969.     RegisterInputBoxNotEmptyFunction(mmi_uc_add_email_not_empty);
  970.     
  971.     ShowCategory5Screen(
  972.         STR_UC_ADD_EMAIL_ID,
  973.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  974.         STR_GLOBAL_OK,
  975.         0,
  976.         STR_GLOBAL_BACK,
  977.         0,
  978.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  979.         (U8*) g_uc_p->done.to,  /* use g_uc_p->done.to buffer to store email address */
  980.         MMI_UC_MAX_ADDR_LEN + 1,
  981.         guiBuffer);
  982.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  983. }
  984. /*****************************************************************************
  985.  * FUNCTION
  986.  *  mmi_uc_add_email_empty
  987.  * DESCRIPTION
  988.  *  LSK handle when email input is empty
  989.  * PARAMETERS
  990.  *  void
  991.  * RETURNS
  992.  *  void
  993.  *****************************************************************************/
  994. void mmi_uc_add_email_empty(void)
  995. {
  996.     /*----------------------------------------------------------------*/
  997.     /* Local Variables                                                */
  998.     /*----------------------------------------------------------------*/
  999.     /*----------------------------------------------------------------*/
  1000.     /* Code Body                                                      */
  1001.     /*----------------------------------------------------------------*/
  1002.     ChangeLeftSoftkey(STR_GLOBAL_SEARCH, 0);
  1003.     SetLeftSoftkeyFunction(mmi_uc_search_phb_email, KEY_EVENT_UP);
  1004. }
  1005. /*****************************************************************************
  1006.  * FUNCTION
  1007.  *  mmi_uc_add_email_not_empty
  1008.  * DESCRIPTION
  1009.  *  LSK handle when email input is not empty
  1010.  * PARAMETERS
  1011.  *  void
  1012.  * RETURNS
  1013.  *  void
  1014.  *****************************************************************************/
  1015. void mmi_uc_add_email_not_empty(void)
  1016. {
  1017.     /*----------------------------------------------------------------*/
  1018.     /* Local Variables                                                */
  1019.     /*----------------------------------------------------------------*/
  1020.     /*----------------------------------------------------------------*/
  1021.     /* Code Body                                                      */
  1022.     /*----------------------------------------------------------------*/
  1023.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1024.     SetLeftSoftkeyFunction(mmi_uc_addr_add_email_done, KEY_EVENT_UP);
  1025. }
  1026. /*****************************************************************************
  1027.  * FUNCTION
  1028.  *  mmi_uc_search_phb_email
  1029.  * DESCRIPTION
  1030.  *  Entry phonebook entry list to select email
  1031.  * PARAMETERS
  1032.  *  void
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. void mmi_uc_search_phb_email(void)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Code Body                                                      */
  1043.     /*----------------------------------------------------------------*/
  1044.     mmi_phb_list_pre_entry_for_number_and_email(MMI_PHB_ENTRY_FIELD_EMAIL, mmi_uc_get_address_from_phb);
  1045. }
  1046. /*****************************************************************************
  1047.  * FUNCTION
  1048.  *  mmi_uc_addr_add_email_done
  1049.  * DESCRIPTION
  1050.  *  Get phonebook number
  1051.  * PARAMETERS
  1052.  *  void
  1053.  * RETURNS
  1054.  *  void
  1055.  *****************************************************************************/
  1056. void mmi_uc_addr_add_email_done(void)
  1057. {
  1058.     /*----------------------------------------------------------------*/
  1059.     /* Local Variables                                                */
  1060.     /*----------------------------------------------------------------*/
  1061.     BOOL result = MMI_FALSE;
  1062.     /*----------------------------------------------------------------*/
  1063.     /* Code Body                                                      */
  1064.     /*----------------------------------------------------------------*/
  1065.     if (!mmi_uc_is_email_addr_valid(g_uc_p->done.to))
  1066.     {
  1067.         DisplayPopup(
  1068.                 (PU8) GetString(STR_GLOBAL_INVALID),
  1069.                 IMG_GLOBAL_UNFINISHED,
  1070.                 1,
  1071.                 MMI_UC_POPUP_TIME_OUT,
  1072.                 (U8) ERROR_TONE);
  1073.         return;
  1074.     }
  1075.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_EMAIL)
  1076.     {
  1077.         if (mmi_uc_check_duplicate_address(g_uc_p->done.to,
  1078.                                MMI_UC_ADDRESS_TYPE_EMAIL,
  1079.                                g_uc_p->done.current_addr_type) != NULL)
  1080.         {
  1081.             DisplayPopup(
  1082.                     (PU8) GetString(STR_UC_DUPLICATE_ADDRESS_ID),
  1083.                     IMG_GLOBAL_UNFINISHED,
  1084.                     1,
  1085.                     MMI_UC_POPUP_TIME_OUT,
  1086.                     (U8) ERROR_TONE);
  1087.             
  1088.             DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1089.             return;
  1090.         }
  1091.         
  1092.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1093.         {
  1094.             /* Check if the msg size exceeds the MMS limitation */
  1095.             U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  1096.             if (mmi_uc_check_if_exceed_MMS_size_limitation(addr_size + g_uc_p->msg.msg_size))                
  1097.             {
  1098.                 mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  1099.                 return;
  1100.             }
  1101.         }
  1102.         
  1103.         result = mmi_uc_add_address(g_uc_p->done.to,
  1104.                                     MMI_UC_ADDRESS_TYPE_EMAIL,
  1105.                                    g_uc_p->done.current_addr_type); 
  1106.         
  1107.         MMI_ASSERT(result);
  1108.         /* update the highlighted address to the new one */
  1109.         if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_TO)
  1110.         {
  1111.             g_uc_p->done.current_addr_index = g_uc_p->msg.to_num - 1;
  1112.         }
  1113.         else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_CC)
  1114.         {
  1115.             g_uc_p->done.current_addr_index = g_uc_p->msg.cc_num - 1;
  1116.         }
  1117.         else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_BCC)
  1118.         {
  1119.             g_uc_p->done.current_addr_index = g_uc_p->msg.bcc_num - 1;
  1120.         }
  1121.         else
  1122.         {
  1123.             MMI_ASSERT(0);
  1124.         }
  1125.     }
  1126.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_EMAIL)
  1127.     {
  1128.         mmi_uc_addr_struct* addr = mmi_uc_get_highlighted_addr();
  1129.         U8 len = 0;
  1130.     
  1131.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1132.         {
  1133.             /* Check if the msg size exceeds the MMS limitation */
  1134.             U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  1135.             U32 ori_addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)addr->addr);
  1136.             if (mmi_uc_check_if_exceed_MMS_size_limitation((addr_size + g_uc_p->msg.msg_size - ori_addr_size)))
  1137.             {                
  1138.                 mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  1139.                 return;
  1140.             }
  1141.         }
  1142.         len = pfnUnicodeStrlen((char*)g_uc_p->done.to);
  1143.         MMI_ASSERT(len <= MMI_UC_MAX_ADDR_LEN);
  1144.         kal_adm_free(g_uc_p->main.mem_pool_id , addr->addr);        
  1145.         addr->addr = kal_adm_alloc(g_uc_p->main.mem_pool_id, (len + 1) * ENCODING_LENGTH);
  1146.         MMI_ASSERT(addr->addr);
  1147.         
  1148.         memset(addr->addr, 0, (len + 1) * ENCODING_LENGTH);
  1149.         memcpy(addr->addr, g_uc_p->done.to, (len * ENCODING_LENGTH));      
  1150.         
  1151.     }
  1152.     else
  1153.     {
  1154.         MMI_ASSERT(0);
  1155.     }    
  1156.     if (!IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1157.     {
  1158.         result = HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT, SCR_ID_UC_OPT_DONE_ADDR_LIST, mmi_uc_entry_addr_list);
  1159.         
  1160.         MMI_ASSERT(result);
  1161.     }
  1162.     
  1163.     if (mmi_uc_change_msg_type_if_needed())
  1164.     {
  1165.         mmi_uc_insert_signature_check();
  1166.     }
  1167.     
  1168.     mmi_uc_update_msg_size();
  1169.     
  1170.     GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1171. }
  1172.    
  1173. /*****************************************************************************
  1174.  * FUNCTION
  1175.  *  mmi_uc_get_group_addr_callback
  1176.  * DESCRIPTION
  1177.  *  Add address group from phonebook callback
  1178.  * PARAMETERS
  1179.  *  void
  1180.  * RETURNS
  1181.  *  void
  1182.  *****************************************************************************/
  1183. void mmi_uc_get_group_addr_callback (U16 cnt, U16 *PhbIndex)
  1184. {    
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Local Variables                                                */
  1187.     /*----------------------------------------------------------------*/
  1188.     U32 index = 0;
  1189.     BOOL result = MMI_TRUE;
  1190.     /*----------------------------------------------------------------*/
  1191.     /* Code Body                                                      */
  1192.     /*----------------------------------------------------------------*/
  1193.     if (cnt == 0)
  1194.     {
  1195.         DisplayPopup(
  1196.             (PU8) GetString(STR_GLOBAL_EMPTY),
  1197.             IMG_GLOBAL_UNFINISHED,
  1198.             1,
  1199.             MMI_UC_POPUP_TIME_OUT,
  1200.             (U8) ERROR_TONE);
  1201.          
  1202.         return;
  1203.     }
  1204.     
  1205.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_NUMBER_GROUP)
  1206.     {
  1207.         U8 PhbNum[MAX_DIGITS + 2];        
  1208.         
  1209.         for (; index < cnt; index++)
  1210.         {        
  1211.             U8 type = 0;
  1212.             if ((g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1213.             {
  1214.                  DisplayPopup(
  1215.                     (PU8) GetString(STR_UC_ADDRESS_NUMBER_EXCEED_ID),
  1216.                     IMG_GLOBAL_UNFINISHED,
  1217.                     1,
  1218.                     MMI_UC_POPUP_TIME_OUT,
  1219.                     (U8) ERROR_TONE);
  1220.                  
  1221.                 if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1222.                 {
  1223.                     DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1224.                 }
  1225.                 else if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT))
  1226.                 {
  1227.                     DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_OPT);                 
  1228.                 }
  1229.                 else
  1230.                 {
  1231.                     MMI_ASSERT(0);
  1232.                 }                
  1233.                 return;
  1234.             }
  1235.                     
  1236.             memset(PhbNum, 0, MAX_DIGITS + 2);
  1237.             mmi_phb_convert_to_digit((U8*) PhbNum, (U8*) PhoneBook[PhbIndex[index]].tel.number, MAX_DIGITS + 2);
  1238.             
  1239.             memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  1240.             if (PhoneBook[PhbIndex[index]].tel.type == CSMCC_INTERNATIONAL_ADDR)
  1241.             {
  1242.                 type = 1;
  1243.                 AnsiiToUnicodeString((S8*) g_uc_p->done.to, "+");
  1244.             }
  1245.             AnsiiNToUnicodeString(
  1246.                 (S8*) &g_uc_p->done.to[type * ENCODING_LENGTH], 
  1247.                 (S8*) PhbNum, 
  1248.                 PhoneBook[PhbIndex[index]].tel.length);
  1249.             
  1250.             if ( pfnUnicodeStrlen((S8*)g_uc_p->done.to) > (MAX_DIGITS_SMS - 1))
  1251.             {
  1252.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_get_group_addr_callback number length too long *n"));
  1253.                 continue;
  1254.             }
  1255.             if (mmi_uc_check_duplicate_address(g_uc_p->done.to,
  1256.                                MMI_UC_ADDRESS_TYPE_PHONE_NUMBER,
  1257.                                g_uc_p->done.current_addr_type) != NULL)
  1258.             {
  1259.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_get_group_addr_callback duplicate addr *n"));
  1260.                 continue;
  1261.             }
  1262.             
  1263.             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1264.             {
  1265.                 /* Check if the msg size exceeds the MMS limitation */
  1266.                 U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  1267.                 if (mmi_uc_check_if_exceed_MMS_size_limitation(addr_size + g_uc_p->msg.msg_size))
  1268.                 {
  1269.                     mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  1270.                     if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1271.                     {
  1272.                         DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1273.                     }
  1274.                     else if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT))
  1275.                     {
  1276.                         DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_OPT);                 
  1277.                     }
  1278.                     else
  1279.                     {
  1280.                         MMI_ASSERT(0);
  1281.                     }                
  1282.                     return;
  1283.                 }
  1284.             }
  1285.     
  1286.             result = mmi_uc_add_address(g_uc_p->done.to,
  1287.                                         MMI_UC_ADDRESS_TYPE_PHONE_NUMBER,
  1288.                                        g_uc_p->done.current_addr_type);         
  1289.             MMI_ASSERT(result);
  1290.             
  1291.             /* update the highlighted address to the new one */
  1292.             if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_TO)
  1293.             {
  1294.                 g_uc_p->done.current_addr_index = g_uc_p->msg.to_num - 1;
  1295.             }
  1296.             else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_CC)
  1297.             {
  1298.                 g_uc_p->done.current_addr_index = g_uc_p->msg.cc_num - 1;
  1299.             }
  1300.             else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_BCC)
  1301.             {
  1302.                 g_uc_p->done.current_addr_index = g_uc_p->msg.bcc_num - 1;
  1303.             }
  1304.             else
  1305.             {
  1306.                 MMI_ASSERT(0);
  1307.             }
  1308.             if (!IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1309.             {
  1310.                 result = HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT, SCR_ID_UC_OPT_DONE_ADDR_LIST, mmi_uc_entry_addr_list);
  1311.                 
  1312.                 MMI_ASSERT(result);
  1313.             }
  1314.             if (mmi_uc_change_msg_type_if_needed())
  1315.             {
  1316.                 mmi_uc_insert_signature_check();
  1317.             }
  1318.             
  1319.             mmi_uc_update_msg_size();
  1320.         }        
  1321.     }
  1322.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_EMAIL_GROUP)
  1323.     {
  1324.         U8* email_addr;
  1325.         U8 addr_length;
  1326.                 
  1327.         for (; index < cnt; index++)
  1328.         {        
  1329.             if ((g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1330.             {
  1331.                  DisplayPopup(
  1332.                     (PU8) GetString(STR_UC_ADDRESS_NUMBER_EXCEED_ID),
  1333.                     IMG_GLOBAL_UNFINISHED,
  1334.                     1,
  1335.                     MMI_UC_POPUP_TIME_OUT,
  1336.                     (U8) ERROR_TONE);
  1337.                 if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1338.                 {
  1339.                     DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1340.                 }
  1341.                 else if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT))
  1342.                 {
  1343.                     DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_OPT);                 
  1344.                 }
  1345.                 else
  1346.                 {
  1347.                     MMI_ASSERT(0);
  1348.                 }                              
  1349.                 return;
  1350.             }
  1351.             email_addr = mmi_phb_get_email_p(PhbIndex[index], &addr_length);
  1352.             if ( addr_length > MMI_UC_MAX_ADDR_LEN)
  1353.             {
  1354.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_get_group_addr_callback email addr length too long *n"));
  1355.                 continue;
  1356.             }
  1357.             
  1358.             memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);            
  1359.             AnsiiNToUnicodeString((S8*) g_uc_p->done.to, (S8*) email_addr, addr_length);
  1360.             if (!mmi_uc_is_email_addr_valid(g_uc_p->done.to))
  1361.             {
  1362.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_get_group_addr_callback invalid email addr *n"));
  1363.                 continue;
  1364.             }
  1365.             if (mmi_uc_check_duplicate_address(g_uc_p->done.to,
  1366.                                MMI_UC_ADDRESS_TYPE_EMAIL,
  1367.                                g_uc_p->done.current_addr_type) != NULL)
  1368.             {
  1369.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_get_group_addr_callback duplicate addr *n"));
  1370.                 continue;
  1371.             }
  1372.             
  1373.             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1374.             {
  1375.                 /* Check if the msg size exceeds the MMS limitation */
  1376.                 U32 addr_size = wap_mma_uc_calc_header_attribute_size(MMA_HEADER_ADDRESS, (const kal_wchar *)g_uc_p->done.to);
  1377.                 if (mmi_uc_check_if_exceed_MMS_size_limitation(addr_size + g_uc_p->msg.msg_size))                
  1378.                 {
  1379.                     mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  1380.                     if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1381.                     {
  1382.                         DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1383.                     }
  1384.                     else if (IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT))
  1385.                     {
  1386.                         DeleteUptoScrID(SCR_ID_UC_OPT_DONE_ADDR_OPT);                 
  1387.                     }
  1388.                     else
  1389.                     {
  1390.                         MMI_ASSERT(0);
  1391.                     }                              
  1392.                     return;
  1393.                 }
  1394.             }
  1395.             
  1396.             result = mmi_uc_add_address(g_uc_p->done.to,
  1397.                                         MMI_UC_ADDRESS_TYPE_EMAIL,
  1398.                                        g_uc_p->done.current_addr_type); 
  1399.             
  1400.             MMI_ASSERT(result);
  1401.             /* update the highlighted address to the new one */
  1402.             if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_TO)
  1403.             {
  1404.                 g_uc_p->done.current_addr_index = g_uc_p->msg.to_num - 1;
  1405.             }
  1406.             else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_CC)
  1407.             {
  1408.                 g_uc_p->done.current_addr_index = g_uc_p->msg.cc_num - 1;
  1409.             }
  1410.             else if (g_uc_p->done.current_addr_type == MMI_UC_ADDRESS_GROUP_TYPE_BCC)
  1411.             {
  1412.                 g_uc_p->done.current_addr_index = g_uc_p->msg.bcc_num - 1;
  1413.             }
  1414.             else
  1415.             {
  1416.                 MMI_ASSERT(0);
  1417.             }
  1418.             
  1419.             if (!IsScreenPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST))
  1420.             {
  1421.                 result = HistoryReplace(SCR_ID_UC_OPT_DONE_ADDR_OPT, SCR_ID_UC_OPT_DONE_ADDR_LIST, mmi_uc_entry_addr_list);
  1422.                 
  1423.                 MMI_ASSERT(result);
  1424.             }
  1425.             if (mmi_uc_change_msg_type_if_needed())
  1426.             {
  1427.                 mmi_uc_insert_signature_check();
  1428.             }
  1429.             
  1430.             mmi_uc_update_msg_size();
  1431.         }      
  1432.     }
  1433.     else
  1434.     {
  1435.         MMI_ASSERT(0);
  1436.     }
  1437.         
  1438.     GoBackToHistory(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1439. }
  1440. /*****************************************************************************
  1441.  * FUNCTION
  1442.  *  mmi_uc_pre_entry_edit_addr
  1443.  * DESCRIPTION
  1444.  *  Entry function for add address group
  1445.  * PARAMETERS
  1446.  *  void
  1447.  * RETURNS
  1448.  *  void
  1449.  *****************************************************************************/
  1450. void mmi_uc_entry_add_addr_group(void)
  1451. {    
  1452.     /*----------------------------------------------------------------*/
  1453.     /* Local Variables                                                */
  1454.     /*----------------------------------------------------------------*/
  1455.     /*----------------------------------------------------------------*/
  1456.     /* Code Body                                                      */
  1457.     /*----------------------------------------------------------------*/
  1458.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_NUMBER_GROUP)
  1459.     {        
  1460.         mmi_phb_get_address_from_caller_group(MMI_PHB_ENTRY_FIELD_NUMBER, mmi_uc_get_group_addr_callback);
  1461.     }
  1462.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_ADD_EMAIL_GROUP)
  1463.     {
  1464.         mmi_phb_get_address_from_caller_group(MMI_PHB_ENTRY_FIELD_EMAIL, mmi_uc_get_group_addr_callback);
  1465.     }
  1466.     else
  1467.     {
  1468.         MMI_ASSERT(0);
  1469.     }
  1470. }
  1471. /*****************************************************************************
  1472.  * FUNCTION
  1473.  *  mmi_uc_pre_entry_edit_addr
  1474.  * DESCRIPTION
  1475.  *  Pre-Entry function for edit address
  1476.  * PARAMETERS
  1477.  *  void
  1478.  * RETURNS
  1479.  *  void
  1480.  *****************************************************************************/
  1481. void mmi_uc_pre_entry_edit_addr(void)
  1482. {    
  1483.     /*----------------------------------------------------------------*/
  1484.     /* Local Variables                                                */
  1485.     /*----------------------------------------------------------------*/
  1486.     mmi_uc_addr_struct* addr = mmi_uc_get_highlighted_addr();
  1487.     /*----------------------------------------------------------------*/
  1488.     /* Code Body                                                      */
  1489.     /*----------------------------------------------------------------*/
  1490.     if (addr->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
  1491.     {
  1492.         g_uc_p->done.state = MMI_UC_DONE_STATE_EDIT_NUMBER;        
  1493.         AnsiiNToUnicodeString((S8*) g_uc_p->done.to, (S8*) addr->addr, MMI_UC_MAX_ADDR_LEN);            
  1494.     }
  1495.     else if (addr->type == MMI_UC_ADDRESS_TYPE_EMAIL)
  1496.     {
  1497.         g_uc_p->done.state = MMI_UC_DONE_STATE_EDIT_EMAIL;
  1498.         pfnUnicodeStrncpy((S8*)g_uc_p->done.to, (S8*) addr->addr, MMI_UC_MAX_ADDR_LEN);
  1499.     }
  1500.     else
  1501.     {
  1502.         MMI_ASSERT(0);
  1503.     }
  1504.     mmi_uc_entry_edit_addr();
  1505. }
  1506. /*****************************************************************************
  1507.  * FUNCTION
  1508.  *  mmi_uc_entry_edit_addr
  1509.  * DESCRIPTION
  1510.  *  Entry function for edit address
  1511.  * PARAMETERS
  1512.  *  void
  1513.  * RETURNS
  1514.  *  void
  1515.  *****************************************************************************/
  1516. void mmi_uc_entry_edit_addr(void)
  1517. {    
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Local Variables                                                */
  1520.     /*----------------------------------------------------------------*/
  1521.     U8* guiBuffer = NULL;
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Code Body                                                      */
  1524.     /*----------------------------------------------------------------*/
  1525.     EntryNewScreen(SCR_ID_UC_OPT_DONE_ADDR_OPT_EDIT, NULL, mmi_uc_entry_edit_addr, NULL);
  1526.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_ADDR_OPT_EDIT);
  1527.     if (g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_NUMBER)
  1528.     {
  1529.         RegisterInputBoxEmptyFunction(mmi_uc_add_number_empty);
  1530.         RegisterInputBoxNotEmptyFunction(mmi_uc_add_number_not_empty);
  1531.         
  1532.         ShowCategory5Screen(
  1533.             STR_GLOBAL_EDIT,
  1534.             IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1535.             STR_GLOBAL_OK,
  1536.             0,
  1537.             STR_GLOBAL_BACK,
  1538.             0,
  1539.             INPUT_TYPE_PHONE_NUMBER,
  1540.             (U8*) g_uc_p->done.to,  /* use g_uc_p->done.to buffer to store phone number */
  1541.             MAX_DIGITS_SMS,
  1542.             guiBuffer);
  1543.     }
  1544.     else if (g_uc_p->done.state == MMI_UC_DONE_STATE_EDIT_EMAIL)
  1545.     {
  1546.         RegisterInputBoxEmptyFunction(mmi_uc_add_email_empty);
  1547.         RegisterInputBoxNotEmptyFunction(mmi_uc_add_email_not_empty);
  1548.         ShowCategory5Screen(
  1549.             STR_GLOBAL_EDIT,
  1550.             IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1551.             STR_GLOBAL_OK,
  1552.             0,
  1553.             STR_GLOBAL_BACK,
  1554.             0,
  1555.             INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  1556.             (U8*) g_uc_p->done.to,  /* use g_uc_p->done.to buffer to store email address */
  1557.             MMI_UC_MAX_ADDR_LEN + 1,
  1558.             guiBuffer);
  1559.     }
  1560.     else
  1561.     {
  1562.         MMI_ASSERT(0);
  1563.     }
  1564.     
  1565.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1566.     
  1567. }
  1568. /*****************************************************************************
  1569.  * FUNCTION
  1570.  *  mmi_uc_entry_delete_addr
  1571.  * DESCRIPTION
  1572.  *  Entry function for delete address
  1573.  * PARAMETERS
  1574.  *  void
  1575.  * RETURNS
  1576.  *  void
  1577.  *****************************************************************************/
  1578. void mmi_uc_entry_delete_addr(void)
  1579. {
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Local Variables                                                */
  1582.     /*----------------------------------------------------------------*/
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Code Body                                                      */
  1585.     /*----------------------------------------------------------------*/
  1586.     DisplayConfirm(
  1587.             STR_GLOBAL_YES,
  1588.             IMG_GLOBAL_YES,
  1589.             STR_GLOBAL_NO,
  1590.             IMG_GLOBAL_NO,
  1591.             get_string(STR_GLOBAL_DELETE),
  1592.             IMG_GLOBAL_QUESTION,
  1593.             WARNING_TONE);
  1594.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1595.     SetLeftSoftkeyFunction(mmi_uc_process_delete_addr, KEY_EVENT_UP);
  1596. }
  1597. /*****************************************************************************
  1598.  * FUNCTION
  1599.  *  mmi_uc_process_delete_addr
  1600.  * DESCRIPTION
  1601.  *  Delete current highlighted address
  1602.  * PARAMETERS
  1603.  *  void
  1604.  * RETURNS
  1605.  *  void
  1606.  *****************************************************************************/
  1607. void mmi_uc_process_delete_addr(void)
  1608. {
  1609.     /*----------------------------------------------------------------*/
  1610.     /* Local Variables                                                */
  1611.     /*----------------------------------------------------------------*/
  1612.     mmi_uc_addr_struct* addr = mmi_uc_get_highlighted_addr();
  1613.     /*----------------------------------------------------------------*/
  1614.     /* Code Body                                                      */
  1615.     /*----------------------------------------------------------------*/
  1616.     DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT);
  1617.     switch (g_uc_p->done.current_addr_type)
  1618.     {
  1619.         case MMI_UC_ADDRESS_GROUP_TYPE_TO:
  1620.         {
  1621.             if (g_uc_p->msg.to_num == 1)
  1622.             {
  1623.                 DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1624.             }
  1625.         }
  1626.         break;
  1627.         case MMI_UC_ADDRESS_GROUP_TYPE_CC:
  1628.         {
  1629.             if (g_uc_p->msg.cc_num == 1)
  1630.             {
  1631.                 DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1632.             }
  1633.         }
  1634.         break;
  1635.         
  1636.         case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
  1637.         {
  1638.             if (g_uc_p->msg.bcc_num == 1)
  1639.             {
  1640.                 DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1641.             }
  1642.         }
  1643.         break;
  1644.         default:
  1645.         {
  1646.             MMI_ASSERT(0);
  1647.         }
  1648.         break;        
  1649.     } 
  1650.     mmi_uc_delete_addr(addr);
  1651.     if (mmi_uc_change_msg_type_if_needed())
  1652.     {
  1653.         mmi_uc_insert_signature_check();
  1654.     }
  1655.     mmi_uc_update_msg_size();
  1656.     GoBackHistory();
  1657. }
  1658. /*****************************************************************************
  1659.  * FUNCTION
  1660.  *  mmi_uc_entry_delete_all_addr
  1661.  * DESCRIPTION
  1662.  *  Entry function for delete all address of some group
  1663.  * PARAMETERS
  1664.  *  void
  1665.  * RETURNS
  1666.  *  void
  1667.  *****************************************************************************/
  1668. void mmi_uc_entry_delete_all_addr(void)
  1669. {
  1670.     /*----------------------------------------------------------------*/
  1671.     /* Local Variables                                                */
  1672.     /*----------------------------------------------------------------*/
  1673.     /*----------------------------------------------------------------*/
  1674.     /* Code Body                                                      */
  1675.     /*----------------------------------------------------------------*/
  1676.     DisplayConfirm(
  1677.             STR_GLOBAL_YES,
  1678.             IMG_GLOBAL_YES,
  1679.             STR_GLOBAL_NO,
  1680.             IMG_GLOBAL_NO,
  1681.             get_string(STR_GLOBAL_DELETE_ALL),
  1682.             IMG_GLOBAL_QUESTION,
  1683.             WARNING_TONE);
  1684.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1685.     SetLeftSoftkeyFunction(mmi_uc_process_delete_all_addr, KEY_EVENT_UP);
  1686. }
  1687. /*****************************************************************************
  1688.  * FUNCTION
  1689.  *  mmi_uc_process_delete_all_addr
  1690.  * DESCRIPTION
  1691.  *  Delete current highlighted group addresses
  1692.  * PARAMETERS
  1693.  *  void
  1694.  * RETURNS
  1695.  *  void
  1696.  *****************************************************************************/
  1697. void mmi_uc_process_delete_all_addr(void)
  1698. {
  1699.     /*----------------------------------------------------------------*/
  1700.     /* Local Variables                                                */
  1701.     /*----------------------------------------------------------------*/
  1702.     /*----------------------------------------------------------------*/
  1703.     /* Code Body                                                      */
  1704.     /*----------------------------------------------------------------*/
  1705.     DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_OPT);
  1706.     DeleteScreenIfPresent(SCR_ID_UC_OPT_DONE_ADDR_LIST);
  1707.     mmi_uc_delete_all_addr(g_uc_p->done.current_addr_type);
  1708.     if (mmi_uc_change_msg_type_if_needed())
  1709.     {
  1710.         mmi_uc_insert_signature_check();
  1711.     }
  1712.     mmi_uc_update_msg_size();
  1713.     GoBackHistory();
  1714. }
  1715. /*****************************************************************************
  1716.  * FUNCTION
  1717.  *  mmi_uc_entry_msg_detail
  1718.  * DESCRIPTION
  1719.  *  Entry function for message detail screen
  1720.  * PARAMETERS
  1721.  *  void
  1722.  * RETURNS
  1723.  *  void
  1724.  *****************************************************************************/
  1725. void mmi_uc_entry_msg_detail(void)
  1726. {
  1727.     /*----------------------------------------------------------------*/
  1728.     /* Local Variables                                                */
  1729.     /*----------------------------------------------------------------*/
  1730.     U8 *guiBuffer, *info;
  1731.     /*----------------------------------------------------------------*/
  1732.     /* Code Body                                                      */
  1733.     /*----------------------------------------------------------------*/
  1734.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_MSG_DETAIL);
  1735.     info = (PU8) subMenuData;
  1736.     info[0] = 0;
  1737.     info[1] = 0;
  1738.             
  1739.     EntryNewScreen(SCR_ID_UC_MSG_DETAIL, mmi_uc_exit_generic,  mmi_uc_entry_msg_detail, NULL);
  1740.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_msg_detail *n"));
  1741.     mmi_uc_msg_detail_fill_info(info);
  1742.     
  1743.     ShowCategory74Screen(
  1744.         STR_UC_MESSAGE_DETAIL_ID,
  1745.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1746.         0,
  1747.         0,
  1748.         STR_GLOBAL_BACK,
  1749.         IMG_GLOBAL_BACK,
  1750.         (PU8) subMenuData,
  1751.         MAX_SUB_MENUS * MAX_SUB_MENU_SIZE,
  1752.         guiBuffer);
  1753.     
  1754.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1755.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1756. }
  1757.     
  1758. /*****************************************************************************
  1759.  * FUNCTION
  1760.  *  mmi_uc_msg_detail_fill_info
  1761.  * DESCRIPTION
  1762.  *  Fill msg detail info
  1763.  * PARAMETERS
  1764.  *  void
  1765.  * RETURNS
  1766.  *  void
  1767.  *****************************************************************************/
  1768. void mmi_uc_msg_detail_fill_info(U8* information)
  1769. {
  1770.     /*----------------------------------------------------------------*/
  1771.     /* Local Variables                                                */
  1772.     /*----------------------------------------------------------------*/
  1773.     U8* info = information;    
  1774.     U32 temp_string_len = 30;
  1775.     U8 temp_string[30];
  1776.     U8 temp_ucs2_string[30 * ENCODING_LENGTH];
  1777.     /*----------------------------------------------------------------*/
  1778.     /* Code Body                                                      */
  1779.     /*----------------------------------------------------------------*/
  1780.     /* temp_string_len should be the same as length of temp_string[] and temp_ucs2_string[] */
  1781.     MMI_ASSERT(temp_string_len == 30);
  1782.     
  1783.     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1784.     {
  1785.         U32 page;
  1786.         U32 total_msg;
  1787.         U32 recipient;
  1788.         
  1789.         page = mmi_uc_get_sms_segment_number();
  1790.         recipient = g_uc_p->msg.to_num;
  1791.         total_msg = page * recipient;
  1792.         
  1793.         /* Msg type caption */
  1794.         pfnUnicodeStrcpy((PS8) info, (PS8) GetString(STR_GLOBAL_1));
  1795.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1796.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_MESSAGE_TYPE_ID));
  1797.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1798.         
  1799.         /* Msg type */
  1800.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1801.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_TEXT_MESSAGE_ID));
  1802.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1803.         /* Msg page caption */
  1804.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_2));
  1805.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1806.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_PAGES_ID));
  1807.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1808.         
  1809.         /* Msg page */
  1810.         memset(temp_string, 0, temp_string_len);
  1811.         memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1812.         sprintf((char*)temp_string, "%d", page);
  1813.         AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len);
  1814.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1815.         pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1816.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1817.         /* Recipient caption */
  1818.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_3));
  1819.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1820.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_MSG_DETAIL_RECIPIENTS_ID));
  1821.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1822.         
  1823.         /* Recipient */
  1824.         memset(temp_string, 0, temp_string_len);
  1825.         memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1826.         sprintf((char*)temp_string, "%d", recipient);
  1827.         AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len);
  1828.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1829.         pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1830.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1831.         /* Total msg caption */
  1832.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_4));
  1833.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1834.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_TOTAL_MESSAGES_ID));
  1835.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1836.         
  1837.         /* Total msg */
  1838.         memset(temp_string, 0, temp_string_len);
  1839.         memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1840.         sprintf((char*)temp_string, "%d", total_msg);
  1841.         AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len);
  1842.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1843.         pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1844.         
  1845.     }
  1846.     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1847.     {
  1848.         FLOAT size = 0;
  1849.         U32 att_num = 1;
  1850.         U32 recipient;
  1851.         mmi_uc_attachment_info_struct* attach = g_uc_p->msg.attachment_head;
  1852.         
  1853.         recipient = g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ;
  1854.         size = (FLOAT)g_uc_p->msg.msg_size / (FLOAT) 1024.0;
  1855.           
  1856.         /* Msg type caption */
  1857.         pfnUnicodeStrcpy((PS8) info, (PS8) GetString(STR_GLOBAL_1));
  1858.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1859.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_MESSAGE_TYPE_ID));
  1860.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1861.         
  1862.         /* Msg type */
  1863.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1864.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_MULTIMEDIA_MESSAGE_ID));
  1865.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1866.         
  1867.         /* Msg size caption */
  1868.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_2));
  1869.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1870.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_SIZE_ID));
  1871.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1872.         
  1873.         /* Msg size */
  1874.         memset(temp_string, 0, temp_string_len);
  1875.         memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1876.         sprintf((char*)temp_string, "%.1f Kb", size);
  1877.         AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len);
  1878.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1879.         pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1880.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1881.         /* Recipient caption */
  1882.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_3));
  1883.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1884.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_MSG_DETAIL_RECIPIENTS_ID));
  1885.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1886.         
  1887.         /* Recipient */
  1888.         memset(temp_string, 0, temp_string_len);
  1889.         memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1890.         sprintf((char*)temp_string, "%d", recipient);
  1891.         AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len);
  1892.         pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1893.         pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1894.         pfnUnicodeStrcat((PS8) info, (PS8) L"nn");
  1895.         /* Attachment caption */
  1896.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_GLOBAL_4));
  1897.         pfnUnicodeStrcat((PS8) info, (PS8) L". ");
  1898.         pfnUnicodeStrcat((PS8) info, (PS8) GetString(STR_UC_ATTACHMENT_ID));
  1899.         pfnUnicodeStrcat((PS8) info, (PS8) L":n");
  1900.         
  1901.         /* Attachments  */
  1902.         if (g_uc_p->msg.total_attachment_num == 0)
  1903.         {            
  1904.             pfnUnicodeStrcat((PS8) info, (PS8) L"n");
  1905.         }
  1906.         else
  1907.         {
  1908.             for (; att_num <= g_uc_p->msg.total_attachment_num ; att_num++)
  1909.             {
  1910.                 U32 attach_size = attach->object->size / 1024;
  1911.                 MMI_ASSERT(att_num <= MMI_UC_MAX_ATTACHMENT_NUM);
  1912.                 MMI_ASSERT(att_num);
  1913.                 
  1914.                 memset(temp_string, 0, temp_string_len);                
  1915.                 memset(temp_ucs2_string, 0, temp_string_len * ENCODING_LENGTH);        
  1916.                 if (attach->object->size % 1024)
  1917.                 {
  1918.                     attach_size++;
  1919.                 }
  1920.                 sprintf((char*)temp_string, " (%d Kb)", attach_size);                
  1921.                 AnsiiNToUnicodeString((S8*)temp_ucs2_string, (S8*)temp_string, temp_string_len - 1);
  1922.                 
  1923.                 pfnUnicodeStrcat((PS8) info, (PS8) L"   ");
  1924.                 pfnUnicodeStrcat((PS8) info, (PS8) attach->object->file_name);
  1925.                 pfnUnicodeStrcat((PS8) info, (PS8) temp_ucs2_string);
  1926.                 pfnUnicodeStrcat((PS8) info, (PS8) L"n");
  1927.                 attach = attach->next;
  1928.             }
  1929.         }        
  1930.     }
  1931. }
  1932. /*****************************************************************************
  1933.  * FUNCTION
  1934.  *  mmi_uc_entry_insert
  1935.  * DESCRIPTION
  1936.  *  Entry function for insert type list
  1937.  * PARAMETERS
  1938.  *  void
  1939.  * RETURNS
  1940.  *  void
  1941.  *****************************************************************************/
  1942. void mmi_uc_entry_insert(void)
  1943. {
  1944.     /*----------------------------------------------------------------*/
  1945.     /* Local Variables                                                */
  1946.     /*----------------------------------------------------------------*/
  1947.     U8 *guiBuffer = NULL;
  1948.     U16 numItems = 0;
  1949.     U16 nStrItemList[MAX_SUB_MENUS];
  1950.     /*----------------------------------------------------------------*/
  1951.     /* Code Body                                                      */
  1952.     /*----------------------------------------------------------------*/
  1953.     EntryNewScreen(SCR_ID_UC_OPT_INSERT, mmi_uc_exit_generic, mmi_uc_entry_insert, NULL);
  1954.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_insert *n"));
  1955.     
  1956.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_INSERT);
  1957.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1958.     {
  1959.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_IMAGE);
  1960.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_AUDIO);
  1961.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_VIDEO);
  1962.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_ATTACHMENT);
  1963.     }
  1964.     else
  1965.     {    
  1966.         if (g_uc_p->msg.total_slide_num == MMI_UC_MAX_MMS_SLIDE_NUM)
  1967.         {
  1968.             if (g_uc_p->msg.current_slide->image.object != NULL ||
  1969.                 g_uc_p->msg.current_slide->video.object != NULL)
  1970.             {
  1971.                 mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_IMAGE);
  1972.             }
  1973.             else
  1974.             {
  1975.                 mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_IMAGE);
  1976.             }
  1977.             if (g_uc_p->msg.current_slide->audio.object != NULL ||
  1978.                 g_uc_p->msg.current_slide->video.object != NULL)
  1979.             {
  1980.                 mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_AUDIO);
  1981.             }
  1982.             else
  1983.             {
  1984.                 mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_AUDIO);
  1985.             }
  1986.             
  1987.             if (g_uc_p->msg.current_slide->video.object != NULL ||
  1988.                 g_uc_p->msg.current_slide->image.object != NULL ||
  1989.                 g_uc_p->msg.current_slide->audio.object != NULL)
  1990.             {
  1991.                 mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_VIDEO);
  1992.             }
  1993.             else
  1994.             {
  1995.                 mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_VIDEO);
  1996.             }
  1997.         }
  1998.         else
  1999.         {
  2000.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_IMAGE);
  2001.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_AUDIO);
  2002.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_VIDEO);        
  2003.         }
  2004.         if (g_uc_p->msg.total_attachment_num == MMI_UC_MAX_ATTACHMENT_NUM)
  2005.         {
  2006.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_INSERT_ATTACHMENT);
  2007.         }
  2008.         else
  2009.         {
  2010.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_INSERT_ATTACHMENT);  
  2011.         }              
  2012.     }
  2013.     numItems = GetNumOfChild_Ext(MENU_ID_UC_OPT_INSERT);
  2014.     GetSequenceStringIds_Ext(MENU_ID_UC_OPT_INSERT, nStrItemList);
  2015.     SetParentHandler(MENU_ID_UC_OPT_INSERT);
  2016.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2017.     ShowCategory52Screen(
  2018.         STR_UC_INSERT_ID,
  2019.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  2020.         STR_GLOBAL_OK,
  2021.         IMG_GLOBAL_OK,
  2022.         STR_GLOBAL_BACK,
  2023.         IMG_GLOBAL_BACK,
  2024.         numItems,
  2025.         nStrItemList,
  2026.         (U16*) gIndexIconsImageList,
  2027.         NULL,
  2028.         0,
  2029.         0,
  2030.         guiBuffer);
  2031.     
  2032.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2033.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2034. }
  2035. /*****************************************************************************
  2036.  * FUNCTION
  2037.  *  mmi_uc_highlight_insert_image
  2038.  * DESCRIPTION
  2039.  *  Funtion is called when insert image menu item selected
  2040.  * PARAMETERS
  2041.  *  void
  2042.  * RETURNS
  2043.  *  void
  2044.  *****************************************************************************/
  2045. void mmi_uc_highlight_insert_image(void)
  2046. {
  2047.     /*----------------------------------------------------------------*/
  2048.     /* Local Variables                                                */
  2049.     /*----------------------------------------------------------------*/
  2050.     /*----------------------------------------------------------------*/
  2051.     /* Code Body                                                      */
  2052.     /*----------------------------------------------------------------*/
  2053.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_IMAGE;
  2054.     
  2055.     SetLeftSoftkeyFunction(mmi_uc_select_fmgr_object, KEY_EVENT_UP);
  2056.     SetKeyHandler(mmi_uc_select_fmgr_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2057.     return;
  2058. }
  2059. /*****************************************************************************
  2060.  * FUNCTION
  2061.  *  mmi_uc_highlight_insert_audio
  2062.  * DESCRIPTION
  2063.  *  Funtion is called when insert audio menu item selected
  2064.  * PARAMETERS
  2065.  *  void
  2066.  * RETURNS
  2067.  *  void
  2068.  *****************************************************************************/
  2069. void mmi_uc_highlight_insert_audio(void)
  2070. {
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Local Variables                                                */
  2073.     /*----------------------------------------------------------------*/
  2074.     /*----------------------------------------------------------------*/
  2075.     /* Code Body                                                      */
  2076.     /*----------------------------------------------------------------*/
  2077.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_AUDIO;
  2078.     
  2079.     SetLeftSoftkeyFunction(mmi_uc_select_fmgr_object, KEY_EVENT_UP);
  2080.     SetKeyHandler(mmi_uc_select_fmgr_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2081.     return;
  2082. }
  2083. /*****************************************************************************
  2084.  * FUNCTION
  2085.  *  mmi_uc_highlight_insert_video
  2086.  * DESCRIPTION
  2087.  *  Funtion is called when insert video menu item selected
  2088.  * PARAMETERS
  2089.  *  void
  2090.  * RETURNS
  2091.  *  void
  2092.  *****************************************************************************/
  2093. void mmi_uc_highlight_insert_video(void)
  2094. {
  2095.     /*----------------------------------------------------------------*/
  2096.     /* Local Variables                                                */
  2097.     /*----------------------------------------------------------------*/
  2098.     /*----------------------------------------------------------------*/
  2099.     /* Code Body                                                      */
  2100.     /*----------------------------------------------------------------*/
  2101.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_VIDEO;
  2102.     
  2103.     SetLeftSoftkeyFunction(mmi_uc_select_fmgr_object, KEY_EVENT_UP);
  2104.     SetKeyHandler(mmi_uc_select_fmgr_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2105.     return;
  2106. }
  2107. /*****************************************************************************
  2108.  * FUNCTION
  2109.  *  mmi_uc_highlight_insert_attachment
  2110.  * DESCRIPTION
  2111.  *  Funtion is called when insert attachment menu item selected
  2112.  * PARAMETERS
  2113.  *  void
  2114.  * RETURNS
  2115.  *  void
  2116.  *****************************************************************************/
  2117. void mmi_uc_highlight_insert_attachment(void)
  2118. {
  2119.     /*----------------------------------------------------------------*/
  2120.     /* Local Variables                                                */
  2121.     /*----------------------------------------------------------------*/
  2122.     /*----------------------------------------------------------------*/
  2123.     /* Code Body                                                      */
  2124.     /*----------------------------------------------------------------*/
  2125.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_ATTACHMENT;
  2126.     
  2127.     SetLeftSoftkeyFunction(mmi_uc_select_fmgr_object, KEY_EVENT_UP);
  2128.     SetKeyHandler(mmi_uc_select_fmgr_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2129.     return;
  2130. }
  2131. /*****************************************************************************
  2132.  * FUNCTION
  2133.  *  mmi_uc_highlight_insert_bookmark
  2134.  * DESCRIPTION
  2135.  *  Funtion is called when insert bookmark menu item selected
  2136.  * PARAMETERS
  2137.  *  void
  2138.  * RETURNS
  2139.  *  void
  2140.  *****************************************************************************/
  2141. void mmi_uc_highlight_insert_bookmark(void)
  2142. {
  2143.     /*----------------------------------------------------------------*/
  2144.     /* Local Variables                                                */
  2145.     /*----------------------------------------------------------------*/
  2146.     /*----------------------------------------------------------------*/
  2147.     /* Code Body                                                      */
  2148.     /*----------------------------------------------------------------*/
  2149.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_TEXT;
  2150.     
  2151.     SetLeftSoftkeyFunction(mmi_uc_entry_insert_bookmark, KEY_EVENT_UP);
  2152.     SetKeyHandler(mmi_uc_entry_insert_bookmark, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2153.     return;
  2154. }
  2155. /*****************************************************************************
  2156.  * FUNCTION
  2157.  *  mmi_uc_highlight_insert_text_template
  2158.  * DESCRIPTION
  2159.  *  Funtion is called when insert attachment menu item selected
  2160.  * PARAMETERS
  2161.  *  void
  2162.  * RETURNS
  2163.  *  void
  2164.  *****************************************************************************/
  2165. void mmi_uc_highlight_insert_text_template(void)
  2166. {
  2167.     /*----------------------------------------------------------------*/
  2168.     /* Local Variables                                                */
  2169.     /*----------------------------------------------------------------*/
  2170.     /*----------------------------------------------------------------*/
  2171.     /* Code Body                                                      */
  2172.     /*----------------------------------------------------------------*/
  2173.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_TEXT;
  2174.     
  2175.     SetLeftSoftkeyFunction(mmi_msg_entry_template_list, KEY_EVENT_UP);
  2176.     SetKeyHandler(mmi_msg_entry_template_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2177.     return;
  2178. }
  2179. /*****************************************************************************
  2180.  * FUNCTION
  2181.  *  mmi_uc_highlight_insert_phb_number
  2182.  * DESCRIPTION
  2183.  *  Funtion is called when insert phb number menu item selected
  2184.  * PARAMETERS
  2185.  *  void
  2186.  * RETURNS
  2187.  *  void
  2188.  *****************************************************************************/
  2189. void mmi_uc_highlight_insert_phb_number(void)
  2190. {
  2191.     /*----------------------------------------------------------------*/
  2192.     /* Local Variables                                                */
  2193.     /*----------------------------------------------------------------*/
  2194.     /*----------------------------------------------------------------*/
  2195.     /* Code Body                                                      */
  2196.     /*----------------------------------------------------------------*/
  2197.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_TEXT;
  2198.     
  2199.     SetLeftSoftkeyFunction(mmi_uc_entry_insert_phb_number, KEY_EVENT_UP);
  2200.     SetKeyHandler(mmi_uc_entry_insert_phb_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2201.     return;
  2202. }
  2203. /*****************************************************************************
  2204.  * FUNCTION
  2205.  *  mmi_uc_highlight_insert_phb_name
  2206.  * DESCRIPTION
  2207.  *  Funtion is called when insert phb name menu item selected
  2208.  * PARAMETERS
  2209.  *  void
  2210.  * RETURNS
  2211.  *  void
  2212.  *****************************************************************************/
  2213. void mmi_uc_highlight_insert_phb_name(void)
  2214. {
  2215.     /*----------------------------------------------------------------*/
  2216.     /* Local Variables                                                */
  2217.     /*----------------------------------------------------------------*/
  2218.     /*----------------------------------------------------------------*/
  2219.     /* Code Body                                                      */
  2220.     /*----------------------------------------------------------------*/
  2221.     g_uc_p->main.highlighted_object_type = MMI_UC_OBJECT_TYPE_TEXT;
  2222.     
  2223.     SetLeftSoftkeyFunction(mmi_uc_entry_insert_phb_name, KEY_EVENT_UP);
  2224.     SetKeyHandler(mmi_uc_entry_insert_phb_name, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2225.     return;
  2226. }
  2227. /*****************************************************************************
  2228.  * FUNCTION
  2229.  *  mmi_uc_select_fmgr_object
  2230.  * DESCRIPTION
  2231.  *  Function for users to select inserted object according to selected type
  2232.  * PARAMETERS
  2233.  *  void
  2234.  * RETURNS
  2235.  *  void
  2236.  *****************************************************************************/
  2237. void mmi_uc_select_fmgr_object(void)
  2238. {
  2239.     /*----------------------------------------------------------------*/
  2240.     /* Local Variables                                                */
  2241.     /*----------------------------------------------------------------*/
  2242.     FMGR_FILTER filter;
  2243.     /*----------------------------------------------------------------*/
  2244.     /* Code Body                                                      */
  2245.     /*----------------------------------------------------------------*/
  2246.     FMGR_FILTER_INIT(&filter);
  2247.     
  2248.     switch (g_uc_p->main.highlighted_object_type)
  2249.     {
  2250.         case MMI_UC_OBJECT_TYPE_IMAGE:
  2251.         {
  2252.             if (g_uc_p->mms_info.creation_mode == MMA_CREATION_MODE_RESTRICTED)
  2253.             {
  2254.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_RESTRICTED_IMAGE_TYPES);
  2255.             }
  2256.             else
  2257.             {
  2258.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_IMAGE_TYPES);
  2259.             }                
  2260.         }
  2261.         break;
  2262.         case MMI_UC_OBJECT_TYPE_AUDIO:
  2263.         {
  2264.             if (g_uc_p->mms_info.creation_mode == MMA_CREATION_MODE_RESTRICTED)
  2265.             {
  2266.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_RESTRICTED_AUDIO_TYPES);
  2267.             }
  2268.             else
  2269.             {
  2270.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_AUDIO_TYPES);
  2271.             }                
  2272.         }
  2273.         break;
  2274.         case MMI_UC_OBJECT_TYPE_VIDEO:
  2275.         {
  2276.             if (g_uc_p->mms_info.creation_mode == MMA_CREATION_MODE_RESTRICTED)
  2277.             {
  2278.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_RESTRICTED_VIDEO_TYPES);
  2279.             }
  2280.             else
  2281.             {
  2282.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_VIDEO_TYPES);
  2283.             }                
  2284.         }
  2285.         break;
  2286.         case MMI_UC_OBJECT_TYPE_ATTACHMENT:
  2287.         {
  2288.             if (g_uc_p->mms_info.creation_mode == MMA_CREATION_MODE_RESTRICTED)
  2289.             {
  2290.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_RESTRICTED_ATTACHMENT_TYPES);
  2291.             }
  2292.             else
  2293.             {
  2294.                 mmi_uc_set_file_mgr_filter(&filter, MMA_OPEN_ATTACHMENT_TYPES);
  2295.             }                
  2296.         }
  2297.         break;
  2298.         default:
  2299.         {
  2300.             MMI_ASSERT(0);
  2301.         }
  2302.         break;
  2303.     }
  2304.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  2305.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  2306.     if (GetExitScrnID() == SCR_ID_UC_OPT_INSERT)
  2307.     {
  2308.         mmi_fmgr_select_path_and_enter(
  2309.                     APP_MESSAGES,
  2310.                     FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2311.                     filter,
  2312.                     (S8*) L"root",
  2313.                     (PsExtFuncPtr) mmi_uc_select_object_from_fm_to_insert);
  2314.     }
  2315.     else if (GetExitScrnID() == SCR_ID_UC_OPT_REPLACE ||
  2316.              GetExitScrnID() == SCR_ID_UC_OPT_ATTACHMENT_LIST)
  2317.     {
  2318.         mmi_fmgr_select_path_and_enter(
  2319.                     APP_MESSAGES,
  2320.                     FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2321.                     filter,
  2322.                     (S8*) L"root",
  2323.                     (PsExtFuncPtr) mmi_uc_select_object_from_fm_to_replace);
  2324.     }
  2325.     else 
  2326.     {
  2327.         MMI_ASSERT(0);
  2328.     }
  2329. }
  2330. /*****************************************************************************
  2331.  * FUNCTION
  2332.  *  mmi_uc_select_object_from_fm_to_insert
  2333.  * DESCRIPTION
  2334.  *  Select object from file manager
  2335.  * PARAMETERS
  2336.  *  filePath        [IN]        
  2337.  *  is_short        [IN]        
  2338.  * RETURNS
  2339.  *  void
  2340.  *****************************************************************************/
  2341. void mmi_uc_select_object_from_fm_to_insert(PU16 filePath, S32 is_short)
  2342. {
  2343.     /*----------------------------------------------------------------*/
  2344.     /* Local Variables                                                */
  2345.     /*----------------------------------------------------------------*/
  2346.     U8 mmi_uc_image_path[MMI_UC_MAX_TEMP_FILE_LEN];
  2347.     mmi_uc_result result;
  2348.     U32 new_slide_size = 0;
  2349.     mma_insert_check_struct check_result;
  2350.     mmi_uc_slide_struct* slide = g_uc_p->msg.current_slide;
  2351.     mmi_uc_object_struct* object = NULL;
  2352.     mmi_uc_attachment_info_struct* att;
  2353.     mma_insert_type_enum mms_type = mmi_uc_convert_to_mms_insert_type(g_uc_p->main.highlighted_object_type);
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Code Body                                                      */
  2356.     /*----------------------------------------------------------------*/
  2357.     memset(&check_result, 0, sizeof(mma_insert_check_struct));
  2358.     memset(mmi_uc_image_path, 0, MMI_UC_MAX_TEMP_FILE_LEN);        
  2359.     
  2360.     if (filePath == NULL)
  2361.     {
  2362.         GoBackToHistory(SCR_ID_UC_OPT_INSERT);
  2363.         return;
  2364.     }
  2365.     mmi_uc_set_processing_screen(STR_UC_INSERT_ID, STR_UC_PLEASE_WAIT_ID, IMG_GLOBAL_PROGRESS, 0);
  2366.     mmi_uc_entry_processing_generic();
  2367.     switch (g_uc_p->main.highlighted_object_type)
  2368.     {
  2369.         case MMI_UC_OBJECT_TYPE_IMAGE:
  2370.         {
  2371.             if (g_uc_p->msg.current_slide->image.object != NULL ||
  2372.                 g_uc_p->msg.current_slide->video.object != NULL)
  2373.             {
  2374.                 new_slide_size = wap_mma_uc_calc_object_smil_size(MMA_INSERT_EMPTY_SLIDE, NULL);
  2375.             }
  2376.         }
  2377.         break;
  2378.         case MMI_UC_OBJECT_TYPE_AUDIO:
  2379.         {
  2380.             if (g_uc_p->msg.current_slide->audio.object != NULL ||
  2381.                 g_uc_p->msg.current_slide->video.object != NULL)
  2382.             {
  2383.                 new_slide_size = wap_mma_uc_calc_object_smil_size(MMA_INSERT_EMPTY_SLIDE, NULL);
  2384.             }
  2385.         }
  2386.         break;
  2387.         case MMI_UC_OBJECT_TYPE_VIDEO:
  2388.         {
  2389.             if (g_uc_p->msg.current_slide->video.object != NULL ||
  2390.                 g_uc_p->msg.current_slide->image.object != NULL ||
  2391.                 g_uc_p->msg.current_slide->audio.object != NULL)
  2392.             {
  2393.                 new_slide_size = wap_mma_uc_calc_object_smil_size(MMA_INSERT_EMPTY_SLIDE, NULL);
  2394.             }
  2395.         }
  2396.         break;
  2397.         
  2398.         default:
  2399.         {
  2400.             ;
  2401.         }
  2402.         break;
  2403.     }
  2404.     if (g_uc_p->main.highlighted_object_type == MMI_UC_OBJECT_TYPE_IMAGE &&
  2405.         g_uc_p->mms_info.image_resize.enable)
  2406.     {        
  2407.         S32 resize_result;
  2408.         MMI_UC_MAKE_IMAGE_FILE_PATH(mmi_uc_image_path, ++g_uc_p->main.image_no);
  2409.         resize_result = mmi_uc_resize_image(
  2410.                                 (U8*) filePath, 
  2411.                                 mmi_uc_image_path, 
  2412.                                 g_uc_p->mms_info.image_resize.width,
  2413.                                 g_uc_p->mms_info.image_resize.height);
  2414.         /* Error ! */
  2415.         if (resize_result < 0)
  2416.         {
  2417.             /* Check if it is DRM file */
  2418.             wap_mma_uc_insert_object_check(filePath, 
  2419.                                            mms_type, 
  2420.                                            g_uc_p->msg.msg_size, 
  2421.                                            g_uc_p->mms_info.max_mms_size,
  2422.                                            &check_result);
  2423.             if (check_result.result == MMI_TRUE && check_result.drm_type == MMA_DRM_SD_NO_RIGHT)
  2424.             {
  2425.                 /* allows inserted but display default image for thumbnail. */
  2426.             }
  2427.             else
  2428.             {            
  2429.                 mmi_uc_display_resize_result_popup(resize_result);
  2430.                 DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2431.                 return;
  2432.             }
  2433.             memset(&check_result, 0, sizeof(mma_insert_check_struct));
  2434.         }
  2435.         /* resized */
  2436.         else if (resize_result)
  2437.         {
  2438.             filePath = (PU16)mmi_uc_image_path;
  2439.         }
  2440.         /* resize_result == 0 means no need to resize */
  2441.     }
  2442.     object = mmi_uc_check_duplicate_object(filePath);
  2443.     if (g_uc_p->main.highlighted_object_type != MMI_UC_OBJECT_TYPE_ATTACHMENT &&
  2444.         object &&
  2445.         object->type != MMI_UC_OBJECT_TYPE_ATTACHMENT)
  2446.     {        
  2447.         U32 obj_smil_size = wap_mma_uc_calc_object_smil_size(mms_type, filePath);
  2448.         
  2449.         if (!mmi_uc_check_if_exceed_MMS_size_limitation(obj_smil_size + new_slide_size + g_uc_p->msg.msg_size))
  2450.         {
  2451.             if (new_slide_size > 0)
  2452.             {
  2453.                 slide = mmi_uc_insert_slide(g_uc_p->msg.current_slide);
  2454.                 g_uc_p->msg.current_slide = slide;
  2455.                 g_uc_p->msg.current_slide_num = slide->slide_num;                
  2456.             }
  2457.             mmi_uc_insert_object_to_slide(object, slide, g_uc_p->main.highlighted_object_type);
  2458.         }
  2459.         else
  2460.         {
  2461.             mmi_uc_display_popup(MMI_UC_SIZE_EXCEEDS);
  2462.             return;
  2463.         }
  2464.     }
  2465.     else
  2466.     {
  2467.         wap_mma_uc_insert_object_check(filePath, 
  2468.                                        mms_type, 
  2469.                                        (g_uc_p->msg.msg_size + new_slide_size), 
  2470.                                        g_uc_p->mms_info.max_mms_size,
  2471.                                        &check_result);
  2472.         
  2473.         if (!(check_result.result))
  2474.         {
  2475.             result = mmi_uc_convert_mms_check_result(&check_result);
  2476.             mmi_uc_display_popup(result);
  2477.             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2478.             if (pfnUnicodeStrlen((S8*)mmi_uc_image_path))
  2479.             {
  2480.                 FS_Delete((WCHAR*)mmi_uc_image_path);
  2481.             }
  2482.             return;
  2483.         }
  2484.         if (new_slide_size > 0)
  2485.         {
  2486.             slide = mmi_uc_insert_slide(g_uc_p->msg.current_slide);
  2487.             g_uc_p->msg.current_slide = slide;
  2488.             g_uc_p->msg.current_slide_num = slide->slide_num;
  2489.         }
  2490.         object = mmi_uc_insert_object((S8*) filePath, g_uc_p->main.highlighted_object_type);
  2491.         object->drm_type = check_result.drm_type;
  2492.         if (g_uc_p->main.highlighted_object_type == MMI_UC_OBJECT_TYPE_ATTACHMENT)
  2493.         {
  2494.             att = mmi_uc_insert_attachment();
  2495.             mmi_uc_insert_object_to_attachment(object, att);
  2496.         }
  2497.         else
  2498.         {
  2499.             mmi_uc_insert_object_to_slide(object, slide, g_uc_p->main.highlighted_object_type);
  2500.         }       
  2501.     }
  2502.     fmgr_reset_app_select();        
  2503.     /* Determine layout */
  2504.     if (g_uc_p->main.highlighted_object_type == MMI_UC_OBJECT_TYPE_IMAGE ||
  2505.         g_uc_p->main.highlighted_object_type == MMI_UC_OBJECT_TYPE_VIDEO)
  2506.     {
  2507.         if (g_uc_p->msg.layout == MMI_UC_LAYOUT_DEFAULT)
  2508.         {
  2509.             if (g_uc_p->msg.current_slide->text.char_count)
  2510.             {
  2511.                 g_uc_p->msg.layout = MMI_UC_LAYOUT_THUMBNAIL_AT_BOTTOM;
  2512.             }
  2513.             else
  2514.             {
  2515.                 g_uc_p->msg.layout = MMI_UC_LAYOUT_THUMBNAIL_AT_TOP;
  2516.             }
  2517.         }
  2518.     }   
  2519.     
  2520.     if (mmi_uc_change_msg_type_if_needed())
  2521.     {
  2522.         mmi_uc_insert_signature_check();
  2523.     }
  2524.     
  2525.     mmi_uc_update_msg_size();
  2526.     
  2527.     if (new_slide_size)
  2528.     {
  2529.         mmi_uc_switch_slide(g_uc_p->msg.current_slide);
  2530.     }
  2531.     else
  2532.     {
  2533.         mmi_uc_editor_initialize();
  2534.         mmi_uc_set_editor_info(g_uc_p->msg.current_slide);
  2535.     }
  2536.     if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  2537.     {
  2538.         GoBackToHistory(SCR_ID_UC_EDITOR);
  2539.     }
  2540.     else
  2541.     {
  2542.         DeleteBetweenScreen(SCR_ID_UC_PROCESSING, SCR_ID_UC_OPT);
  2543.     }
  2544.     return;
  2545. }
  2546. /*****************************************************************************
  2547.  * FUNCTION
  2548.  *  mmi_uc_insert_text_template
  2549.  * DESCRIPTION
  2550.  *  Insert template
  2551.  * PARAMETERS
  2552.  *  void
  2553.  * RETURNS
  2554.  *  void
  2555.  *****************************************************************************/
  2556. void mmi_uc_insert_text_template(void)
  2557. {
  2558.     /*----------------------------------------------------------------*/
  2559.     /* Local Variables                                                */
  2560.     /*----------------------------------------------------------------*/
  2561.     S8 *templ;
  2562.     historyNode *History;
  2563.     U16 templateCharNum = 0;    
  2564.     U8 result = 1;    
  2565.     /*----------------------------------------------------------------*/
  2566.     /* Code Body                                                      */
  2567.     /*----------------------------------------------------------------*/
  2568.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_insert_text_template *n"));
  2569.     templ = g_msg_cntx.templates[g_msg_cntx.currHiliteIndex];
  2570.     if (templ)
  2571.     {
  2572.         templateCharNum = pfnUnicodeStrlen((PS8) templ);
  2573.         if (GetHistoryScrID(SCR_ID_UC_EDITOR, &History) == ST_SUCCESS)
  2574.         {
  2575.             result = wgui_uce_insert_text_template ((U8*) templ, templateCharNum, History->guiBuffer);
  2576.         }
  2577.         else
  2578.         {
  2579.             MMI_ASSERT(0);
  2580.         }
  2581.     }
  2582.     GoBackToHistory(SCR_ID_UC_EDITOR);
  2583.     
  2584.     if (result == 0 && templateCharNum != 0)
  2585.     {
  2586.         mmi_uc_display_popup(MMI_UC_NO_SPACE);
  2587.     }
  2588.     
  2589.     DeInitTemplates();
  2590. }
  2591. /*****************************************************************************
  2592.  * FUNCTION
  2593.  *  mmi_uc_entry_insert_bookmark
  2594.  * DESCRIPTION
  2595.  *  Entry bookmark list
  2596.  * PARAMETERS
  2597.  *  void
  2598.  * RETURNS
  2599.  *  void
  2600.  *****************************************************************************/
  2601. void mmi_uc_entry_insert_bookmark(void)
  2602. {
  2603.     /*----------------------------------------------------------------*/
  2604.     /* Local Variables                                                */
  2605.     /*----------------------------------------------------------------*/
  2606.     /*----------------------------------------------------------------*/
  2607.     /* Code Body                                                      */
  2608.     /*----------------------------------------------------------------*/
  2609.     SetProtocolEventHandler(mmi_uc_handle_select_bookmark_rsp, MSG_ID_WAP_SELECT_BOOKMARK_RSP);
  2610.     wap_entry_select_bookmark();
  2611. }
  2612. /*****************************************************************************
  2613.  * FUNCTION
  2614.  *  mmi_uc_handle_select_bookmark_rsp
  2615.  * DESCRIPTION
  2616.  *  
  2617.  * PARAMETERS
  2618.  *  inMsg       [?]     
  2619.  * RETURNS
  2620.  *  void
  2621.  *****************************************************************************/
  2622. void mmi_uc_handle_select_bookmark_rsp(void *inMsg)
  2623. {
  2624.     /*----------------------------------------------------------------*/
  2625.     /* Local Variables                                                */
  2626.     /*----------------------------------------------------------------*/
  2627.     wap_select_bookmark_rsp_struct *msg_rsp = (wap_select_bookmark_rsp_struct*) (inMsg);
  2628.     /*----------------------------------------------------------------*/
  2629.     /* Code Body                                                      */
  2630.     /*----------------------------------------------------------------*/
  2631.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_handle_select_bookmark_rsp *n"));
  2632.     
  2633.     if (msg_rsp->result == 1)
  2634.     {
  2635.         historyNode *History;
  2636.         U16 chars_num = strlen((S8*)msg_rsp->url);
  2637.         U8 result = 0;
  2638.         if (chars_num > 0)
  2639.         {
  2640.             U8* ucs2_buffer = OslMalloc((chars_num + 1) * ENCODING_LENGTH);
  2641.             memset(ucs2_buffer, 0x00, (chars_num + 1) * ENCODING_LENGTH);
  2642.             AnsiiNToUnicodeString((S8*) ucs2_buffer, (S8*) msg_rsp->url, chars_num);
  2643.             
  2644.             if (GetHistoryScrID(SCR_ID_UC_EDITOR, &History) == ST_SUCCESS)
  2645.             {
  2646.                 result = wgui_uce_insert_text_template ((U8*) ucs2_buffer, chars_num, History->guiBuffer);
  2647.             }
  2648.             else
  2649.             {
  2650.                 MMI_ASSERT(0);
  2651.             }
  2652.             OslMfree(ucs2_buffer);
  2653.             
  2654.             if (MMI_TRUE == mmi_msg_check_interrupt())
  2655.             {                
  2656.                 if (IsScreenPresent(SCR_ID_UC_EDITOR))
  2657.                 {
  2658.                     DeleteUptoScrID(SCR_ID_UC_EDITOR);
  2659.                 }
  2660.                 else
  2661.                 {
  2662.                     MMI_ASSERT(0);
  2663.                 }
  2664.             }
  2665.             else
  2666.             {