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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * UnifiedComposerMain.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements main utilities for Unified Composer.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  *------------------------------------------------------------------------------
  128.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  129.  *============================================================================
  130.  ****************************************************************************/
  131. #ifndef _MMI_UNIFIED_COMPOSER_MAIN_C
  132. #define _MMI_UNIFIED_COMPOSER_MAIN_C
  133. #include "MMI_features.h"
  134. #ifdef __MMI_UNIFIED_COMPOSER__
  135. #include "stdC.h"
  136. #include "L4Dr1.h"
  137. #include "FileSystemDef.h"
  138. #include "FileMgr.h"
  139. #include "FileManagerGprot.h"
  140. #include "mdi_datatype.h"
  141. #include "mdi_audio.h"
  142. /* micha1230 */
  143. #include "custom_nvram_editor_data_item.h"
  144. #include "custom_data_account.h"
  145. #include "NVRAMEnum.h"
  146. #include "NVRAMProt.h"
  147. #include "NVRAMType.h"
  148. #include "MessagesExDcl.h"
  149. #include "MessagesResourceData.h"
  150. #include "KeyBrd.h"
  151. #include "USBDeviceGprot.h"
  152. #include "GlobalDefs.h"
  153. #include "DebugInitDef.h"
  154. #include "GlobalConstants.h"
  155. #include "FrameworkStruct.h"
  156. #include "EventsGprot.h"
  157. #include "HistoryGprot.h"
  158. #include "wgui_categories.h"
  159. #include "wgui_status_icons.h"
  160. #include "CommonScreens.h"
  161. #include "CustDataRes.h"
  162. #include "SettingProfile.h"
  163. #include "ProfileGprots.h"
  164. #include "SubLCDHistoryGprot.h"
  165. #include "PhoneBookGprot.h"
  166. #include "TimerEvents.h"
  167. #include "PhoneBookDef.h"
  168. #include "PhonebookTypes.h"
  169. #include "FileSystemDef.h"
  170. #include "FileSystemGProt.h"
  171. #include "Conversions.h"
  172. #include "MemPoolContainerProt.h"
  173. #include "wgui_asyncdynamic_menuitems.h"
  174. #include "Wgui_categories_inputs.h"
  175. #include "Wgui_categories_defs.h"
  176. #include "wgui_categories_UCE.h"
  177. #include "GlobalScrEnum.h"
  178. #include "Gdi_include.h"
  179. #include "Wgui_categories_multimedia.h"
  180. #include "Wgui_categories_popup.h"
  181. #include "AudioPlayerProt.h"
  182. #include "VdoPlyGProt.h"
  183. #include "CallManagementGprot.h"
  184. #include "mmi_trc.h"    /* debug info */
  185. #include "CommonScreens.h"
  186. #include "fmt_struct.h"
  187. #include "DateTimeGprot.h"
  188. #include "MessagesMiscell.h"
  189. #include "SmsGuiInterfaceProt.h"
  190. #include "EventsDef.h"
  191. #include "wgui_categories_email.h"
  192. #include "wapadp.h"
  193. #include "mmsadp.h"
  194. #include "wap_ps_struct.h"
  195. #include "custom_wap_config.h"
  196. #include "App_mem.h"
  197. #include "customer_ps_inc.h"
  198. #include "mmi_msg_context.h"
  199. #include "MessagesL4Def.h"
  200. #include "MessagesResourceData.h"
  201. #include "MessagesMiscell.h"
  202. #include "MessagesExDcl.h"
  203. #include "SmsGuiInterfaceProt.h"
  204. #include "SMsGuiInterfaceType.h"
  205. #include "SmsPsHandler.h"
  206. #include "SMSApi.h"
  207. #include "SMSStruct.h"
  208. #include "SMSFunc.h"
  209. #include "IdleAppDef.h"
  210. #include "xml_def.h"
  211. #include "app_asyncfile.h"
  212. #include "UnifiedMessageGProt.h"
  213. #include "custom_uc_config.h"
  214. #include "UnifiedComposerDef.h"
  215. #include "UnifiedComposerGProt.h"
  216. #include "UnifiedComposerProt.h"
  217. mmi_uc_context_struct g_uc_cntx;    /* global context of uc */
  218. mmi_uc_context_struct *g_uc_p = &g_uc_cntx;
  219. extern MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[];
  220. extern U8 mmi_phb_convert_to_digit(U8 *dest, U8 *source, U8 max_dest_len);
  221. extern int wap_entry_select_bookmark(void);
  222. /*****************************************************************************
  223.  * FUNCTION
  224.  *  mmi_uc_init
  225.  * DESCRIPTION
  226.  *  Initialize Unified Composer application
  227.  * PARAMETERS
  228.  *  void
  229.  * RETURNS
  230.  *  void
  231.  *****************************************************************************/
  232. void mmi_uc_init(void)
  233. {
  234.     /*----------------------------------------------------------------*/
  235.     /* Local Variables                                                */
  236.     /*----------------------------------------------------------------*/
  237.     /*----------------------------------------------------------------*/
  238.     /* Code Body                                                      */
  239.     /*----------------------------------------------------------------*/
  240.     mmi_uc_init_context();
  241.     mmi_uc_set_protocol_event_handler();
  242.     mmi_uc_create_adm_mem();
  243.     mmi_uc_set_highlight_handler();
  244.     mmi_uc_init_uc_folder();
  245.     mmi_uc_init_setting();       
  246. }
  247. /*****************************************************************************
  248.  * FUNCTION
  249.  *  mmi_uc_set_highlight_handler
  250.  * DESCRIPTION
  251.  *  Set highlight handler for uc app.
  252.  * PARAMETERS
  253.  *  void
  254.  * RETURNS
  255.  *  void
  256.  *****************************************************************************/
  257. void mmi_uc_set_highlight_handler(void)
  258. {
  259.     /*----------------------------------------------------------------*/
  260.     /* Local Variables                                                */
  261.     /*----------------------------------------------------------------*/
  262.     /*----------------------------------------------------------------*/
  263.     /* Code Body                                                      */
  264.     /*----------------------------------------------------------------*/
  265.     /* set the option menu highlight handlers */
  266.     SetHiliteHandler(MENU_ID_UC_OPT_DONE, mmi_uc_highlight_opt_done);
  267.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT, mmi_uc_highlight_opt_insert);
  268.     SetHiliteHandler(MENU_ID_UC_OPT_REMOVE, mmi_uc_highlight_opt_remove);
  269.     SetHiliteHandler(MENU_ID_UC_OPT_REPLACE, mmi_uc_highlight_opt_replace);
  270.     SetHiliteHandler(MENU_ID_UC_OPT_PREVIEW, mmi_uc_highlight_opt_preview);
  271.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT, mmi_uc_highlight_opt_slide_opt);
  272.     SetHiliteHandler(MENU_ID_UC_OPT_MSG_TYPE_OPT, mmi_uc_highlight_opt_msg_type);    
  273.     SetHiliteHandler(MENU_ID_UC_OPT_SEND_OPT, mmi_uc_highlight_opt_send_opt);
  274.     SetHiliteHandler(MENU_ID_UC_OPT_MSG_DETAIL, mmi_uc_highlight_opt_msg_detail);
  275.     SetHiliteHandler(MENU_ID_UC_OPT_INPUT_METHOD, mmi_uc_highlight_opt_input_method);    
  276.     /* set address option menu highlight handlers */
  277.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_DONE, mmi_uc_highlight_addr_opt_done);
  278.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_ADD_NUMBER, mmi_uc_highlight_addr_opt_add_number);
  279.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_ADD_EMAIL, mmi_uc_highlight_addr_opt_add_email);
  280.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_EDIT, mmi_uc_highlight_addr_opt_edit);
  281.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_DELETE, mmi_uc_highlight_addr_opt_delete);
  282.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_DELETE_ALL, mmi_uc_highlight_addr_opt_delete_all);
  283.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_ADD_NUMBER_GROUP, mmi_uc_highlight_addr_opt_add_number_group);
  284.     SetHiliteHandler(MENU_ID_UC_OPT_ADDR_ADD_EMAIL_GROUP, mmi_uc_highlight_addr_opt_add_email_group);
  285.     /* set insert menu highlight handlers */
  286.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_IMAGE, mmi_uc_highlight_insert_image);
  287.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_AUDIO, mmi_uc_highlight_insert_audio);
  288.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_VIDEO, mmi_uc_highlight_insert_video);
  289.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_TEXT_TEMPLATE, mmi_uc_highlight_insert_text_template);
  290.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_ATTACHMENT, mmi_uc_highlight_insert_attachment);
  291.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_PHB_NUMBER, mmi_uc_highlight_insert_phb_number);
  292.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_PHB_NAME, mmi_uc_highlight_insert_phb_name);
  293.     SetHiliteHandler(MENU_ID_UC_OPT_INSERT_BOOKMARK, mmi_uc_highlight_insert_bookmark);    
  294.     /* set remove menu highlight handlers */
  295.     SetHiliteHandler(MENU_ID_UC_OPT_REMOVE_IMAGE, mmi_uc_highlight_remove_image);
  296.     SetHiliteHandler(MENU_ID_UC_OPT_REMOVE_AUDIO, mmi_uc_highlight_remove_audio);
  297.     SetHiliteHandler(MENU_ID_UC_OPT_REMOVE_VIDEO, mmi_uc_highlight_remove_video);
  298.     SetHiliteHandler(MENU_ID_UC_OPT_REMOVE_ATTACHMENT, mmi_uc_highlight_remove_attachment);
  299.     /* set replace menu highlight handlers */
  300.     SetHiliteHandler(MENU_ID_UC_OPT_REPLACE_IMAGE, mmi_uc_highlight_replace_image);
  301.     SetHiliteHandler(MENU_ID_UC_OPT_REPLACE_AUDIO, mmi_uc_highlight_replace_audio);
  302.     SetHiliteHandler(MENU_ID_UC_OPT_REPLACE_VIDEO, mmi_uc_highlight_replace_video);
  303.     SetHiliteHandler(MENU_ID_UC_OPT_REPLACE_ATTACHMENT, mmi_uc_highlight_replace_attachment);
  304.     /* set slide option menu highlight handlers */
  305.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_INSERT, mmi_uc_highlight_slide_opt_insert);
  306.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_DELETE, mmi_uc_highlight_slide_opt_delete);
  307.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_PREVIOUS, mmi_uc_highlight_slide_opt_previous);
  308.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_NEXT, mmi_uc_highlight_slide_opt_next);
  309.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_GO_TO, mmi_uc_highlight_slide_opt_goto);        
  310.     SetHiliteHandler(MENU_ID_UC_OPT_SLIDE_OPT_TIMING, mmi_uc_highlight_slide_opt_timing);
  311.     /* set slide option menu highlight handlers */
  312.     SetHiliteHandler(MENU_ID_UC_SETTING_PREFERRED_TYPE, mmi_uc_highlight_preferred_type);
  313.     
  314.     /* set done option menu highlight handlers */
  315.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_SEND, mmi_uc_highlight_done_opt_send);
  316.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_SEND_AND_SAVE, mmi_uc_highlight_done_opt_send_and_save);
  317.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_SAVE, mmi_uc_highlight_done_opt_save);
  318.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_BACK_TO_EDIT_MSG, mmi_uc_highlight_done_opt_back_to_edit);
  319.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_MSG_TYPE, mmi_uc_highlight_opt_msg_type);
  320.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_SEND_OPT, mmi_uc_highlight_done_opt_send_opt);
  321.     SetHiliteHandler(MENU_ID_UC_OPT_DONE_EXIT, mmi_uc_highlight_done_opt_exit);
  322.     /* set remove menu highlight handlers */
  323.     SetHiliteHandler(MENU_ID_UC_EXIT_OPT_SAVE, mmi_uc_highlight_exit_opt_save);
  324.     SetHiliteHandler(MENU_ID_UC_EXIT_OPT_EXIT, mmi_uc_highlight_exit_opt_exit);
  325.     
  326.     return;
  327. }
  328. /*****************************************************************************
  329.  * FUNCTION
  330.  *  mmi_uc_pre_entry_write_msg
  331.  * DESCRIPTION
  332.  *  Pre entry function of unified composer
  333.  * PARAMETERS
  334.  *  void
  335.  * RETURNS
  336.  *  void
  337.  *****************************************************************************/
  338. void mmi_uc_pre_entry_write_msg(void)
  339. {
  340.     /*----------------------------------------------------------------*/
  341.     /* Local Variables                                                */
  342.     /*----------------------------------------------------------------*/
  343.     /*----------------------------------------------------------------*/
  344.     /* Code Body                                                      */
  345.     /*----------------------------------------------------------------*/
  346.     if (!mmi_um_check_ready())
  347.     {
  348.         DisplayPopup(
  349.             (PU8) GetString(STR_GLOBAL_NOT_AVAILABLE),
  350.             IMG_GLOBAL_ERROR,
  351.             1,
  352.             MMI_UC_POPUP_TIME_OUT,
  353.             (U8) ERROR_TONE);            
  354.         
  355.         return;
  356.     }
  357.     
  358. #ifdef __USB_IN_NORMAL_MODE__
  359.     if (mmi_usb_is_in_mass_storage_mode())
  360.     {
  361.         /* in mass storage mode */
  362.         if (mmi_usb_check_path_exported((PS8) MMI_UC_FOLDER_DRV))
  363.         {
  364.             /* MMI public drive is exported, cannot use this app */
  365.             mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
  366.             return;
  367.         }
  368.     }
  369. #endif /* __USB_IN_NORMAL_MODE__ */
  370.     if (g_uc_p->send_info.action != MMI_UC_ACTION_IDLE)
  371.     {
  372.         DisplayPopup(
  373.             (PU8) GetString(STR_GLOBAL_NOT_AVAILABLE),
  374.             IMG_GLOBAL_ERROR,
  375.             1,
  376.             MMI_UC_POPUP_TIME_OUT,
  377.             (U8) ERROR_TONE);            
  378.         
  379.         return;
  380.     }
  381.     
  382.     g_uc_p->main.state = MMI_UC_STATE_WRITE_NEW_MSG;
  383.     if (g_uc_p->msg.total_slide_num > 0 &&
  384.         IsScreenPresent(SCR_ID_UC_EDITOR))
  385.     {
  386.         /* UC in entered by other apps, ex, bar code reader. And then MT call. Optionmessage centerwrite message */
  387.         MMI_ASSERT(isInCall());
  388.         
  389.         DisplayConfirm(
  390.             STR_GLOBAL_YES,
  391.             IMG_GLOBAL_YES,
  392.             STR_GLOBAL_NO,
  393.             IMG_GLOBAL_NO,
  394.             get_string(STR_UC_DISCARD_EDITED_MSG_ID),
  395.             IMG_GLOBAL_QUESTION,
  396.             WARNING_TONE);
  397.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  398.         SetLeftSoftkeyFunction(mmi_uc_discard_msg_before_enter_write_msg, KEY_EVENT_UP);
  399.     
  400.     }
  401.     else
  402.     {
  403.         mmi_uc_reset_msg();
  404.         
  405.         g_uc_p->msg_type.setting_msg_type = mmi_uc_get_setting_msg_type();
  406.         g_uc_p->msg_type.curr_msg_type = g_uc_p->msg_type.setting_msg_type;
  407.         g_uc_p->msg_type.caller_specific_msg_type = MMI_UC_MSG_TYPE_DEFAULT;
  408.         g_uc_p->msg_type.backup_msg_type = MMI_UC_MSG_TYPE_DEFAULT;
  409.         
  410.         mmi_uc_process_entry_write_msg();
  411.     }
  412. }
  413. /*****************************************************************************
  414.  * FUNCTION
  415.  *  mmi_uc_discard_msg_before_enter_write_msg
  416.  * DESCRIPTION
  417.  *  Discard previous edited msg before entering write msg
  418.  * PARAMETERS
  419.  *  void
  420.  * RETURNS
  421.  *  void
  422.  *****************************************************************************/
  423. void mmi_uc_discard_msg_before_enter_write_msg(void)
  424. {
  425.     /*----------------------------------------------------------------*/
  426.     /* Local Variables                                                */
  427.     /*----------------------------------------------------------------*/
  428.     U16 startScrnId = SCR_ID_UC_EDITOR;
  429.     U16 endScrnId = 0;
  430.     /*----------------------------------------------------------------*/
  431.     /* Code Body                                                      */
  432.     /*----------------------------------------------------------------*/    
  433.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  434.                          "*---[UnifiedComposerMain.c] mmi_uc_discard_msg_before_enter_write_msg ---*n"));
  435.     
  436.     mmi_uc_reset_msg();
  437.     
  438.     /* UC in entered by other apps, ex, bar code reader. And then MT call. Optionmessage centerwrite message */
  439.     MMI_ASSERT(isInCall());
  440.     if (IsScreenPresent(startScrnId))
  441.     {
  442.         GetPreviousScrnIdOf(GetCmMarkerScrnID(), &endScrnId);
  443.         if (endScrnId)
  444.         {
  445.             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  446.                                  "*---[UnifiedComposerMain.c] End scrn id to be deleteted %d ---*n", endScrnId));
  447.             if (DeleteBetweenScreen(startScrnId, endScrnId))
  448.             {
  449.                 PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  450.                                      "*---[UnifiedComposerMain.c] Deleteted scrn id from %d to %d ---*n",
  451.                                      startScrnId, endScrnId));
  452.             }
  453.         }
  454.         else
  455.         {
  456.             MMI_ASSERT(0);
  457.         }
  458.     }
  459.     else
  460.     {
  461.         MMI_ASSERT(0);
  462.     }
  463.     
  464.     g_uc_p->msg_type.setting_msg_type = mmi_uc_get_setting_msg_type();
  465.     g_uc_p->msg_type.curr_msg_type = g_uc_p->msg_type.setting_msg_type;
  466.     g_uc_p->msg_type.caller_specific_msg_type = MMI_UC_MSG_TYPE_DEFAULT;
  467.     g_uc_p->msg_type.backup_msg_type = MMI_UC_MSG_TYPE_DEFAULT;    
  468.     
  469.     mmi_uc_process_entry_write_msg();
  470. }
  471. /*****************************************************************************
  472.  * FUNCTION
  473.  *  mmi_uc_process_entry_write_msg
  474.  * DESCRIPTION
  475.  *  Process function of entering unified composer
  476.  * PARAMETERS
  477.  *  void
  478.  * RETURNS
  479.  *  void
  480.  *****************************************************************************/
  481. void mmi_uc_process_entry_write_msg(void)
  482. {
  483.     /*----------------------------------------------------------------*/
  484.     /* Local Variables                                                */
  485.     /*----------------------------------------------------------------*/
  486.     U16 title_id = 0;
  487.     /*----------------------------------------------------------------*/
  488.     /* Code Body                                                      */
  489.     /*----------------------------------------------------------------*/
  490.     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  491.     {    
  492.         title_id = STR_UC_FORWARD_ID;
  493.     }
  494.     else if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  495.     {    
  496.         title_id = STR_UC_SEND_ID;
  497.     }
  498.     else
  499.     {
  500.         title_id = STR_UC_WRITE_MSG_ID;
  501.     }
  502.     
  503.     mmi_uc_set_processing_screen(title_id, 
  504.                                  STR_UC_PLEASE_WAIT_ID, 
  505.                                  IMG_GLOBAL_PROGRESS, 
  506.                                  0);
  507.     mmi_uc_entry_processing_generic();
  508.     /* need EMS library support  */
  509.     mmi_uc_get_sms_setting();
  510.     /* send get setting request to MMS */
  511.     mmi_uc_get_mms_setting_req();    
  512. }
  513. /*****************************************************************************
  514.  * FUNCTION
  515.  *  mmi_uc_write_msg_end_key_hdlr
  516.  * DESCRIPTION
  517.  *  End key handler for unified composer editor screen
  518.  * PARAMETERS
  519.  *  void
  520.  * RETURNS
  521.  *  void
  522.  *****************************************************************************/
  523. void mmi_uc_write_msg_end_key_hdlr(void)
  524. {
  525.     /*----------------------------------------------------------------*/
  526.     /* Local Variables                                                */
  527.     /*----------------------------------------------------------------*/
  528.     /*----------------------------------------------------------------*/
  529.     /* Code Body                                                      */
  530.     /*----------------------------------------------------------------*/
  531.     if (!isInCall())
  532.     {
  533.         mmi_uc_handle_text_in_current_slide();
  534.         /* mmi_uc_write_msg_delete_history_hdlr would be called in ExecuteRootMainHistoryScreen */
  535.         //mmi_uc_write_msg_delete_history_hdlr(NULL);
  536.     }
  537.     
  538.     ExecCurrEndKeyDownHandler();    
  539. }
  540. /*****************************************************************************
  541.  * FUNCTION
  542.  *  mmi_uc_exit_write_msg
  543.  * DESCRIPTION
  544.  *  Exit function from write msg
  545.  * PARAMETERS
  546.  *  void
  547.  * RETURNS
  548.  *  void
  549.  *****************************************************************************/
  550. void mmi_uc_exit_write_msg(void)
  551. {
  552.     /*----------------------------------------------------------------*/
  553.     /* Local Variables                                                */
  554.     /*----------------------------------------------------------------*/
  555.     S32 result = FS_NO_ERROR;
  556.     /*----------------------------------------------------------------*/
  557.     /* Code Body                                                      */
  558.     /*----------------------------------------------------------------*/
  559.     
  560.     /* If press RSK in uc screen to exit editor, msg would be reset in RSK handler mmi_uc_go_back_from_write_msg */
  561.     if (g_uc_p->msg.current_slide)
  562.     {
  563.         result = mmi_uc_handle_text_in_current_slide();
  564.         g_uc_p->main.current_text_file_save_result = result;
  565.     }    
  566. }
  567. /*****************************************************************************
  568.  * FUNCTION
  569.  *  mmi_uc_entry_write_msg
  570.  * DESCRIPTION
  571.  *  Entry function of unified composer
  572.  * PARAMETERS
  573.  *  void
  574.  * RETURNS
  575.  *  void
  576.  *****************************************************************************/
  577. void mmi_uc_entry_write_msg(void)
  578. {
  579.     /*----------------------------------------------------------------*/
  580.     /* Local Variables                                                */
  581.     /*----------------------------------------------------------------*/
  582.     U8 *guiBuffer = NULL;
  583.     /*----------------------------------------------------------------*/
  584.     /* Code Body                                                      */
  585.     /*----------------------------------------------------------------*/
  586.     /* disallow re-entering SMS application when there is a pending SMS job running in the background */
  587.     if (mmi_frm_sms_check_action_pending())
  588.     {
  589.         DisplayPopup(
  590.             (PU8) GetString(STR_GLOBAL_NOT_AVAILABLE),
  591.             IMG_GLOBAL_UNFINISHED,
  592.             1,
  593.             MESSAGES_POPUP_TIME_OUT,
  594.             (U8) ERROR_TONE);
  595.         DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);        
  596.         return;
  597.     }
  598.     
  599.     EntryNewScreen(SCR_ID_UC_EDITOR, mmi_uc_exit_write_msg, mmi_uc_entry_write_msg, NULL);
  600.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_write_msg*n"));
  601.     
  602.     AlmDisableSPOF();
  603.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_EDITOR);
  604.     GetCurrEndKeyDownHandler();
  605.     /* reset */
  606.     g_uc_p->send_info.action = MMI_UC_ACTION_IDLE;
  607.     g_uc_p->send_info.abort = MMI_UC_ABORT_NONE;
  608.    
  609.     ShowCategory280Screen(STR_UC_WRITE_MSG_ID,
  610.                          IMG_UC_ENTRY_SCRN_CAPTION_ID,
  611.                          STR_GLOBAL_OPTIONS,
  612.                          IMG_GLOBAL_OPTIONS,
  613.                          STR_UC_EXIT_ID,
  614.                          IMG_GLOBAL_BACK,
  615.                          mmi_uc_convert_to_editor_msg_type(g_uc_p->msg_type.curr_msg_type),
  616.                          INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  617.                          guiBuffer);
  618.     SetLeftSoftkeyFunction(mmi_uc_pre_entry_option, KEY_EVENT_UP);
  619.     SetKeyHandler(mmi_uc_pre_entry_option, KEY_SEND, KEY_EVENT_UP);
  620.     RegisterInputMethodScreenCloseFunction(mmi_uc_go_back_from_write_msg);
  621.     SetCategory280RightSoftkeyFunction(mmi_uc_go_back_from_write_msg, KEY_EVENT_UP);
  622.     SetKeyHandler(mmi_uc_write_msg_end_key_hdlr, KEY_END, KEY_EVENT_DOWN);
  623.     DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  624.     SetDelScrnIDCallbackHandler(SCR_ID_UC_EDITOR, (HistoryDelCBPtr) mmi_uc_write_msg_delete_history_hdlr);
  625.     if (g_uc_p->msg.fail_to_insert_signature)
  626.     {
  627.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  628.         {
  629.             DisplayPopup((PU8) GetString(STR_UC_FAIL_TO_INSERT_SIGNATURE_ID),
  630.                  IMG_GLOBAL_UNFINISHED,
  631.                  1,
  632.                  MMI_UC_POPUP_TIME_OUT,
  633.                  (U8) ERROR_TONE);
  634.        }
  635.         g_uc_p->msg.fail_to_insert_signature = MMI_FALSE;
  636.     }
  637. }
  638. /*****************************************************************************
  639.  * FUNCTION
  640.  *  mmi_uc_write_msg_delete_history_hdlr
  641.  * DESCRIPTION
  642.  *  
  643.  * PARAMETERS
  644.  *  in_param        [?]     
  645.  * RETURNS
  646.  *  U8
  647.  *****************************************************************************/
  648. U8 mmi_uc_write_msg_delete_history_hdlr(void *in_param)
  649. {
  650.     /*----------------------------------------------------------------*/
  651.     /* Local Variables                                                */
  652.     /*----------------------------------------------------------------*/
  653.     S32 result = 0;
  654.     /*----------------------------------------------------------------*/
  655.     /* Code Body                                                      */
  656.     /*----------------------------------------------------------------*/
  657.     if (g_uc_p->send_info.action == MMI_UC_ACTION_IDLE && mmi_uc_is_pending_content())
  658.     {
  659.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_write_msg_delete_history_hdlr save in background *n"));
  660.     
  661.         g_uc_p->send_info.action = MMI_UC_ACTION_SAVE_IN_BACKGROUND;
  662.         /* Save the edited msg. */
  663.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  664.         {
  665.             mmi_uc_save_sms_req();
  666.         }
  667.         else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  668.         {
  669.            result = mmi_uc_create_mms_xml_description_file();
  670.            if (result == FS_NO_ERROR)
  671.            {
  672.                mmi_uc_create_mms_req();
  673.            }
  674.            else
  675.            {
  676.                mmi_uc_reset_msg();
  677.            }
  678.         }
  679.     }
  680.     else
  681.     {
  682.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_write_msg_delete_history_hdlr Do Nothing *n"));    
  683.         
  684.         /* Disable following actions in mmi_uc_action_fsm() */
  685.         //g_uc_p->send_info.action = MMI_UC_ACTION_IDLE;
  686.     }
  687.     
  688.     return FALSE;
  689. }
  690. /*****************************************************************************
  691.  * FUNCTION
  692.  *  mmi_uc_entry_exit_option
  693.  * DESCRIPTION
  694.  *  Entry function of unified composer exit option
  695.  * PARAMETERS
  696.  *  void
  697.  * RETURNS
  698.  *  void
  699.  *****************************************************************************/
  700. void mmi_uc_entry_exit_option(void)
  701. {
  702.     /*----------------------------------------------------------------*/
  703.     /* Local Variables                                                */
  704.     /*----------------------------------------------------------------*/
  705.     U8 *guiBuffer = NULL;
  706.     U16 numItems = 0;
  707.     U16 nStrItemList[MAX_SUB_MENUS];
  708.     /*----------------------------------------------------------------*/
  709.     /* Code Body                                                      */
  710.     /*----------------------------------------------------------------*/
  711.     EntryNewScreen(SCR_ID_UC_EXIT_OPT, mmi_uc_exit_generic, mmi_uc_entry_exit_option, NULL);
  712.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_exit_option *n"));
  713.     
  714.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_EXIT_OPT);
  715.     numItems = GetNumOfChild_Ext(MENU_ID_UC_EXIT_OPT);
  716.     GetSequenceStringIds_Ext(MENU_ID_UC_EXIT_OPT, nStrItemList);
  717.     SetParentHandler(MENU_ID_UC_EXIT_OPT);
  718.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  719.     ShowCategory52Screen(
  720.         STR_GLOBAL_OPTIONS,
  721.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  722.         STR_GLOBAL_OK,
  723.         IMG_GLOBAL_OK,
  724.         STR_GLOBAL_BACK,
  725.         IMG_GLOBAL_BACK,
  726.         numItems,
  727.         nStrItemList,
  728.         (U16*) gIndexIconsImageList,
  729.         NULL,
  730.         0,
  731.         0,
  732.         guiBuffer);
  733.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  734.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  735.         
  736. }
  737. /*****************************************************************************
  738.  * FUNCTION
  739.  *  mmi_uc_highlight_exit_opt_save
  740.  * DESCRIPTION
  741.  *  Funtion is called when save item selected
  742.  * PARAMETERS
  743.  *  void
  744.  * RETURNS
  745.  *  void
  746.  *****************************************************************************/
  747. void mmi_uc_highlight_exit_opt_save(void)
  748. {
  749.     /*----------------------------------------------------------------*/
  750.     /* Local Variables                                                */
  751.     /*----------------------------------------------------------------*/
  752.     /*----------------------------------------------------------------*/
  753.     /* Code Body                                                      */
  754.     /*----------------------------------------------------------------*/
  755.     SetLeftSoftkeyFunction(mmi_uc_save_msg_before_exit_write_msg, KEY_EVENT_UP);
  756.     SetKeyHandler(mmi_uc_save_msg_before_exit_write_msg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  757.     return;
  758. }
  759. /*****************************************************************************
  760.  * FUNCTION
  761.  *  mmi_uc_highlight_exit_opt_exit
  762.  * DESCRIPTION
  763.  *  Funtion is called when exit item selected
  764.  * PARAMETERS
  765.  *  void
  766.  * RETURNS
  767.  *  void
  768.  *****************************************************************************/
  769. void mmi_uc_highlight_exit_opt_exit(void)
  770. {
  771.     /*----------------------------------------------------------------*/
  772.     /* Local Variables                                                */
  773.     /*----------------------------------------------------------------*/
  774.     /*----------------------------------------------------------------*/
  775.     /* Code Body                                                      */
  776.     /*----------------------------------------------------------------*/
  777.     SetLeftSoftkeyFunction(mmi_uc_discard_msg_before_exit_write_msg, KEY_EVENT_UP);
  778.     SetKeyHandler(mmi_uc_discard_msg_before_exit_write_msg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  779.     return;
  780. }
  781. /*****************************************************************************
  782.  * FUNCTION
  783.  *  mmi_uc_go_back_from_write_msg
  784.  * DESCRIPTION
  785.  *  Go back function from write msg
  786.  * PARAMETERS
  787.  *  void
  788.  * RETURNS
  789.  *  void
  790.  *****************************************************************************/
  791. void mmi_uc_go_back_from_write_msg(void)
  792. {
  793.     /*----------------------------------------------------------------*/
  794.     /* Local Variables                                                */
  795.     /*----------------------------------------------------------------*/
  796.     /*----------------------------------------------------------------*/
  797.     /* Code Body                                                      */
  798.     /*----------------------------------------------------------------*/
  799.     mmi_uc_exit_write_msg();
  800.     if (mmi_uc_is_pending_content())
  801.     {        
  802.         mmi_uc_entry_exit_option();                
  803.     }
  804.     else
  805.     {
  806.         mmi_uc_reset_msg();
  807.         GoBackHistory();
  808.     }
  809.     
  810. }
  811. /*****************************************************************************
  812.  * FUNCTION
  813.  *  mmi_uc_discard_msg_before_exit_write_msg
  814.  * DESCRIPTION
  815.  *  Go back function from write msg
  816.  * PARAMETERS
  817.  *  void
  818.  * RETURNS
  819.  *  void
  820.  *****************************************************************************/
  821. void mmi_uc_discard_msg_before_exit_write_msg(void)
  822. {
  823.     /*----------------------------------------------------------------*/
  824.     /* Local Variables                                                */
  825.     /*----------------------------------------------------------------*/
  826.     /*----------------------------------------------------------------*/
  827.     /* Code Body                                                      */
  828.     /*----------------------------------------------------------------*/
  829.     mmi_uc_reset_msg();
  830.     DeleteScreenIfPresent(SCR_ID_UC_EDITOR);
  831.     GoBackHistory();
  832. }
  833. /*****************************************************************************
  834.  * FUNCTION
  835.  *  mmi_uc_save_msg_before_exit_write_msg
  836.  * DESCRIPTION
  837.  *  Go back function from write msg
  838.  * PARAMETERS
  839.  *  void
  840.  * RETURNS
  841.  *  void
  842.  *****************************************************************************/
  843. void mmi_uc_save_msg_before_exit_write_msg(void)
  844. {
  845.     /*----------------------------------------------------------------*/
  846.     /* Local Variables                                                */
  847.     /*----------------------------------------------------------------*/
  848.     /*----------------------------------------------------------------*/
  849.     /* Code Body                                                      */
  850.     /*----------------------------------------------------------------*/
  851.     if (g_uc_p->main.current_text_file_save_result == FS_NO_ERROR)
  852.     {
  853.         mmi_uc_process_save();
  854.     }
  855.     else
  856.     {                
  857.         DisplayConfirm(
  858.                        STR_GLOBAL_OK,
  859.                        IMG_GLOBAL_OK,
  860.                        0,
  861.                        0,
  862.                        get_string(STR_UC_STORAGE_FULL_MSG_CONTENT_LOSS_ID),
  863.                        IMG_GLOBAL_INFO,
  864.                        WARNING_TONE);
  865.             
  866.         SetLeftSoftkeyFunction(mmi_uc_process_save, KEY_EVENT_UP);
  867.     }
  868. }
  869. /*****************************************************************************
  870.  * FUNCTION
  871.  *  mmi_uc_pre_entry_option
  872.  * DESCRIPTION
  873.  *  Pre-entry function of unified composer option
  874.  * PARAMETERS
  875.  *  void
  876.  * RETURNS
  877.  *  void
  878.  *****************************************************************************/
  879. void mmi_uc_pre_entry_option(void)
  880. {
  881.     /*----------------------------------------------------------------*/
  882.     /* Local Variables                                                */
  883.     /*----------------------------------------------------------------*/
  884.     /*----------------------------------------------------------------*/
  885.     /* Code Body                                                      */
  886.     /*----------------------------------------------------------------*/
  887.     mmi_uc_exit_write_msg();
  888.     mmi_uc_update_msg_size();
  889.     if (g_uc_p->main.current_text_file_save_result == FS_NO_ERROR)
  890.     {
  891.         mmi_uc_entry_option();
  892.     }
  893.     else
  894.     {
  895.         if (g_uc_p->main.current_text_file_save_result == FS_DISK_FULL)
  896.         {
  897.             DisplayPopup(
  898.                 (PU8)GetString(STR_UC_STORAGE_FULL_DELETE_FILE_ID),
  899.                 IMG_GLOBAL_UNFINISHED,
  900.                 1,
  901.                 MMI_UC_POPUP_TIME_OUT,
  902.                 (U8) ERROR_TONE);         
  903.         }
  904.         else
  905.         {
  906.             DisplayPopup(
  907.                 (PU8)GetString(GetFileSystemErrorString(g_uc_p->main.current_text_file_save_result)),
  908.                 IMG_GLOBAL_UNFINISHED,
  909.                 1,
  910.                 MMI_UC_POPUP_TIME_OUT,
  911.                 (U8) ERROR_TONE);                        
  912.         }
  913.     }
  914. }
  915. /*****************************************************************************
  916.  * FUNCTION
  917.  *  mmi_uc_entry_option
  918.  * DESCRIPTION
  919.  *  Entry function of unified composer option
  920.  * PARAMETERS
  921.  *  void
  922.  * RETURNS
  923.  *  void
  924.  *****************************************************************************/
  925. void mmi_uc_entry_option(void)
  926. {
  927.     /*----------------------------------------------------------------*/
  928.     /* Local Variables                                                */
  929.     /*----------------------------------------------------------------*/
  930.     U8 *guiBuffer = NULL;
  931.     U16 numItems = 0;
  932.     U16 nStrItemList[MAX_SUB_MENUS];
  933.     /*----------------------------------------------------------------*/
  934.     /* Code Body                                                      */
  935.     /*----------------------------------------------------------------*/
  936.     EntryNewScreen(SCR_ID_UC_OPT, mmi_uc_exit_generic, mmi_uc_entry_option, NULL);
  937.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_option *n"));
  938.     
  939.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT);
  940.     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  941.     {
  942.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_REMOVE);
  943.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_REPLACE);
  944.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_PREVIEW);
  945.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_SEND_OPT);                
  946.     }
  947.     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER )
  948.     {
  949.         if (g_uc_p->msg.current_slide->image.object ||
  950.             g_uc_p->msg.current_slide->audio.object ||
  951.             g_uc_p->msg.current_slide->video.object ||
  952.             g_uc_p->msg.total_attachment_num)
  953.         {
  954.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_REMOVE);
  955.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_REPLACE);
  956.         }
  957.         else
  958.         {
  959.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_REMOVE);
  960.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_REPLACE);
  961.         }
  962.         
  963.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_PREVIEW);
  964.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_SEND_OPT);
  965.     }
  966.     else
  967.     {
  968.         MMI_ASSERT(0);
  969.     }
  970.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  971.     {
  972.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_SLIDE_OPT);
  973.     }
  974.     else
  975.     {
  976.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_SLIDE_OPT);
  977.     }
  978.     
  979.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY ||
  980.         g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_MMS_ONLY ||
  981.         mmi_uc_determine_msg_type_by_content() == MMI_UC_MSG_TYPE_MMS_PREFER)
  982.     {
  983.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_MSG_TYPE_OPT);
  984.     }
  985.     else
  986.     {
  987.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_MSG_TYPE_OPT);
  988.     }
  989.     numItems = GetNumOfChild_Ext(MENU_ID_UC_OPT);
  990.     GetSequenceStringIds_Ext(MENU_ID_UC_OPT, nStrItemList);
  991.     SetParentHandler(MENU_ID_UC_OPT);
  992.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  993.     ShowCategory52Screen(
  994.         STR_GLOBAL_OPTIONS,
  995.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  996.         STR_GLOBAL_OK,
  997.         IMG_GLOBAL_OK,
  998.         STR_GLOBAL_BACK,
  999.         IMG_GLOBAL_BACK,
  1000.         numItems,
  1001.         nStrItemList,
  1002.         (U16*) gIndexIconsImageList,
  1003.         NULL,
  1004.         0,
  1005.         0,
  1006.         guiBuffer);
  1007.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1008.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1009.     
  1010. }
  1011. /*****************************************************************************
  1012.  * FUNCTION
  1013.  *  mmi_uc_entry_done
  1014.  * DESCRIPTION
  1015.  *  Entry function of done
  1016.  * PARAMETERS
  1017.  *  void
  1018.  * RETURNS
  1019.  *  void
  1020.  *****************************************************************************/
  1021. void mmi_uc_entry_done(void)
  1022. {
  1023.     /*----------------------------------------------------------------*/
  1024.     /* Local Variables                                                */
  1025.     /*----------------------------------------------------------------*/
  1026.     U8 *guiBuffer;
  1027.     U8 *inputBuffer;        /* added for inline edit history */
  1028.     S32 items_num = 0;
  1029.     U16 inputBufferSize;    /* added for inline edit history */
  1030.     U16 image_list[MMI_UC_DONE_TOTAL_NUM] = {0};
  1031.     U16 title_id = 0;
  1032.     /*----------------------------------------------------------------*/
  1033.     /* Code Body                                                      */
  1034.     /*----------------------------------------------------------------*/ 
  1035.     EntryNewScreen(SCR_ID_UC_OPT_DONE, mmi_uc_exit_done, NULL, NULL);
  1036.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_done *n"));
  1037.     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  1038.     {    
  1039.         title_id = STR_UC_FORWARD_ID;
  1040.     }
  1041.     else if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  1042.     {    
  1043.         title_id = STR_UC_SEND_ID;
  1044.     }
  1045.     else
  1046.     {
  1047.         title_id = STR_GLOBAL_OPTIONS;
  1048.     }
  1049.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1050.     {
  1051.         items_num = MMI_UC_DONE_SMS_ONLY_TOTAL_NUM;
  1052.     }
  1053.     else
  1054.     {
  1055.         items_num = MMI_UC_DONE_TOTAL_NUM;
  1056.     }
  1057.    
  1058.     mmi_uc_update_msg_size();
  1059.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE);
  1060.     InitializeCategory57Screen();
  1061.     mmi_uc_done_fill_inline_struct(image_list);
  1062.     RegisterHighlightHandler(mmi_uc_done_highlight_hdlr);
  1063.     inputBuffer = GetCurrNInputBuffer(SCR_ID_UC_OPT_DONE, &inputBufferSize); /* added for inline edit history */
  1064.     if (inputBuffer)    /* added for inline edit history */
  1065.     {
  1066.         SetCategory57Data(wgui_inline_items, MMI_UC_DONE_TOTAL_NUM, inputBuffer);      /* sets the data */
  1067.     }
  1068.     
  1069.     DisableCategory57ScreenDone();
  1070.     /* reset */
  1071.     g_uc_p->send_info.action = MMI_UC_ACTION_IDLE;
  1072.     g_uc_p->send_info.abort = MMI_UC_ABORT_NONE;
  1073.     ShowCategory57Screen(
  1074.         title_id,
  1075.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1076.         0,
  1077.         0,
  1078.         STR_GLOBAL_DONE,
  1079.         0,
  1080.         items_num,
  1081.         image_list,
  1082.         wgui_inline_items,
  1083.         0,
  1084.         guiBuffer);
  1085.     SetCategory57RightSoftkeyFunctions(mmi_uc_entry_done_option, mmi_uc_entry_done_option);
  1086.     SetDelScrnIDCallbackHandler(SCR_ID_UC_OPT_DONE, (HistoryDelCBPtr) mmi_uc_done_delete_history_hdlr);
  1087.     StartTimer(UC_MSG_TYPE_CHECK_TIMER_ID, MMI_UC_MSG_TYPE_CHECK_TIME, mmi_uc_handle_msg_type_check);
  1088. }
  1089. /*****************************************************************************
  1090.  * FUNCTION
  1091.  *  mmi_uc_done_delete_history_hdlr
  1092.  * DESCRIPTION
  1093.  *  
  1094.  * PARAMETERS
  1095.  *  in_param        [?]     
  1096.  * RETURNS
  1097.  *  U8
  1098.  *****************************************************************************/
  1099. U8 mmi_uc_done_delete_history_hdlr(void *in_param)
  1100. {
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Local Variables                                                */
  1103.     /*----------------------------------------------------------------*/
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Code Body                                                      */
  1106.     /*----------------------------------------------------------------*/               
  1107.     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  1108.         g_uc_p->main.state == MMI_UC_STATE_SEND)
  1109.     {
  1110.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_done_delete_history_hdlr *n")); 
  1111.         
  1112.         MMI_ASSERT(IsScreenPresent(SCR_ID_UC_EDITOR) != MMI_TRUE);
  1113.         
  1114.         /* Disable following actions in mmi_uc_action_fsm() */
  1115.         //g_uc_p->send_info.action = MMI_UC_ACTION_IDLE;
  1116.     }
  1117.     return FALSE;
  1118. }
  1119. /*****************************************************************************
  1120.  * FUNCTION
  1121.  *  mmi_uc_done_highlight_hdlr
  1122.  * DESCRIPTION
  1123.  *  Highligth handler for done menu
  1124.  * PARAMETERS
  1125.  *  void
  1126.  * RETURNS
  1127.  *  void
  1128.  *****************************************************************************/
  1129. void mmi_uc_done_highlight_hdlr(S32 index)
  1130. {    
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Local Variables                                                */
  1133.     /*----------------------------------------------------------------*/
  1134.     /*----------------------------------------------------------------*/
  1135.     /* Code Body                                                      */
  1136.     /*----------------------------------------------------------------*/
  1137.     g_uc_p->done.current_addr_index = 0;
  1138.     
  1139.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1140.     {
  1141.         switch (index)
  1142.         {
  1143.             case MMI_UC_DONE_SMS_ONLY_TO:
  1144.             {
  1145.                 g_uc_p->done.current_addr_type = MMI_UC_ADDRESS_GROUP_TYPE_TO;
  1146.                 if (g_uc_p->msg.to_num == 0)
  1147.                 {
  1148.                     if ((g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1149.                     {
  1150.                         ChangeLeftSoftkey(0, 0);
  1151.                     }
  1152.                     else
  1153.                     {            
  1154.                         ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);                                    
  1155.                         SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_option);
  1156.                     }
  1157.                 }
  1158.                 else
  1159.                 {
  1160.                     ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);            
  1161.                     SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_list);
  1162.                 }            
  1163.             }
  1164.             break;            
  1165.             case MMI_UC_DONE_SMS_ONLY_MSG_DETAIL_CAPTION:
  1166.             {
  1167.                 ChangeLeftSoftkey(STR_GLOBAL_VIEW, 0);
  1168.                 SetCategory57LeftSoftkeyFunction(mmi_uc_entry_msg_detail);
  1169.             }
  1170.             break;
  1171.             default:
  1172.             {
  1173.                 MMI_ASSERT(0);
  1174.             }
  1175.             break;
  1176.         }        
  1177.     }
  1178.     else
  1179.     {
  1180.         switch (index)
  1181.         {
  1182.             case MMI_UC_DONE_TO:
  1183.             {
  1184.                 g_uc_p->done.current_addr_type = MMI_UC_ADDRESS_GROUP_TYPE_TO;
  1185.                 if (g_uc_p->msg.to_num == 0)
  1186.                 {
  1187.                     if ((g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1188.                     {
  1189.                         ChangeLeftSoftkey(0, 0);
  1190.                     }
  1191.                     else
  1192.                     {            
  1193.                         ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);            
  1194.                         SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_option);
  1195.                     }
  1196.                 }
  1197.                 else
  1198.                 {
  1199.                     ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);            
  1200.                     SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_list);
  1201.                 }            
  1202.             }
  1203.             break;
  1204.             
  1205.             case MMI_UC_DONE_CC:
  1206.             {
  1207.                 g_uc_p->done.current_addr_type = MMI_UC_ADDRESS_GROUP_TYPE_CC;
  1208.                 if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1209.                 {
  1210.                     ASSERT(0);
  1211.                 }
  1212.                 else
  1213.                 {
  1214.                     if (g_uc_p->msg.cc_num == 0)
  1215.                     {                
  1216.                         if ((g_uc_p->msg.to_num + g_uc_p->msg.bcc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1217.                         {
  1218.                             ChangeLeftSoftkey(0, 0);
  1219.                         }
  1220.                         else
  1221.                         {            
  1222.                             ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  1223.                             SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_option);
  1224.                         }
  1225.                         
  1226.                     }
  1227.                     else
  1228.                     {
  1229.                         ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  1230.                         SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_list);
  1231.                     }
  1232.                 }
  1233.             }
  1234.             break;
  1235.             
  1236.             case MMI_UC_DONE_BCC:
  1237.             {
  1238.                 g_uc_p->done.current_addr_type = MMI_UC_ADDRESS_GROUP_TYPE_BCC;
  1239.                 if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1240.                 {
  1241.                     ASSERT(0);
  1242.                 }
  1243.                 else
  1244.                 {
  1245.                     if (g_uc_p->msg.bcc_num == 0)
  1246.                     {                
  1247.                         if ((g_uc_p->msg.to_num + g_uc_p->msg.cc_num ) >= MMI_UC_MAX_ADDRESS_NUM)
  1248.                         {
  1249.                             ChangeLeftSoftkey(0, 0);
  1250.                         }
  1251.                         else
  1252.                         {     
  1253.                             ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  1254.                             SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_option);
  1255.                         }
  1256.                         
  1257.                     }
  1258.                     else
  1259.                     {
  1260.                         ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  1261.                         SetCategory57LeftSoftkeyFunction(mmi_uc_entry_addr_list);
  1262.                     }            
  1263.                 }
  1264.             }
  1265.             break;
  1266.             case MMI_UC_DONE_SUBJECT:
  1267.             {
  1268.                 if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1269.                 {
  1270.                     ASSERT(0);
  1271.                 }
  1272.                 else
  1273.                 {
  1274.                     ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  1275.                 }
  1276.             }
  1277.             break;
  1278.             case MMI_UC_DONE_MSG_DETAIL_CAPTION:
  1279.             {
  1280.                 ChangeLeftSoftkey(STR_GLOBAL_VIEW, 0);
  1281.                 SetCategory57LeftSoftkeyFunction(mmi_uc_entry_msg_detail);
  1282.             }
  1283.             break;
  1284.             default:
  1285.             {
  1286.                 MMI_ASSERT(0);
  1287.             }
  1288.             break;
  1289.         }    
  1290.     }
  1291.     
  1292.     ChangeRightSoftkey(STR_GLOBAL_DONE, 0);
  1293. }
  1294. /*****************************************************************************
  1295.  * FUNCTION
  1296.  *  mmi_uc_done_fill_inline_struct
  1297.  * DESCRIPTION
  1298.  *  Fill inline item of done menu
  1299.  * PARAMETERS
  1300.  *  void
  1301.  * RETURNS
  1302.  *  void
  1303.  *****************************************************************************/
  1304. void mmi_uc_done_fill_inline_struct(U16* image_list)
  1305. {
  1306.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1307.     {
  1308.         image_list[MMI_UC_DONE_SMS_ONLY_TO_CAPTION] = IMG_UC_TO_ID;
  1309.         image_list[MMI_UC_DONE_SMS_ONLY_TO] = 0;
  1310.         image_list[MMI_UC_DONE_SMS_ONLY_MSG_DETAIL_CAPTION] = IMG_UC_MSG_DETAIL_ID;
  1311.     }
  1312.     else
  1313.     {
  1314.         image_list[MMI_UC_DONE_TO_CAPTION] = IMG_UC_TO_ID;
  1315.         image_list[MMI_UC_DONE_TO] = 0;    
  1316.         image_list[MMI_UC_DONE_CC_CAPTION] = IMG_UC_CC_ID;
  1317.         image_list[MMI_UC_DONE_CC] = 0;
  1318.         image_list[MMI_UC_DONE_BCC_CAPTION] = IMG_UC_BCC_ID;
  1319.         image_list[MMI_UC_DONE_BCC] = 0;
  1320.         image_list[MMI_UC_DONE_SUBJECT_CAPTION] = IMG_UC_SUBJECT_ID;
  1321.         image_list[MMI_UC_DONE_SUBJECT] = 0;
  1322.         image_list[MMI_UC_DONE_MSG_DETAIL_CAPTION] = IMG_UC_MSG_DETAIL_ID;
  1323.     }
  1324.     /* To caption */
  1325.     SetInlineItemCaption(&wgui_inline_items[MMI_UC_DONE_TO_CAPTION], (U8*) GetString(STR_UC_TO_ID));
  1326.     /* To address */
  1327.     //SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_TO], KEY_LSK, KEY_EVENT_UP);
  1328.     memset(g_uc_p->done.to, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  1329.     if (g_uc_p->msg.to_num == 0)
  1330.     {
  1331.         /* display empty in the field */
  1332.     }
  1333.     else if (g_uc_p->msg.to_num == 1)
  1334.     {
  1335.         if (g_uc_p->msg.to_head->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
  1336.         {                
  1337.             S8 *name = NULL;
  1338.             S8 temp[(MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
  1339.             memset(temp, 0, sizeof(temp));
  1340.             AnsiiToUnicodeString(temp, (S8*) g_uc_p->msg.to_head->addr);
  1341.             
  1342.             name = lookUpNumber(temp);
  1343.             if (name != NULL && pfnUnicodeStrlen(name) > 0)
  1344.             {
  1345.                 pfnUnicodeStrncpy((S8*) g_uc_p->done.to, name, MMI_UC_MAX_ADDR_LEN);
  1346.             }
  1347.             else
  1348.             {
  1349.                 pfnUnicodeStrncpy((S8*) g_uc_p->done.to, temp, MMI_UC_MAX_ADDR_LEN);
  1350.             }
  1351.         }
  1352.         else if (g_uc_p->msg.to_head->type == MMI_UC_ADDRESS_TYPE_EMAIL)
  1353.         {
  1354.             pfnUnicodeStrncpy((S8*) g_uc_p->done.to,(S8*) g_uc_p->msg.to_head->addr, MMI_UC_MAX_ADDR_LEN);
  1355.         }
  1356.         else
  1357.         {
  1358.             MMI_ASSERT(0);
  1359.         }        
  1360.     }
  1361.     else
  1362.     {
  1363.         U8 ascii_recipient_number[16];
  1364.         memset(ascii_recipient_number, 0, sizeof(ascii_recipient_number));
  1365.         sprintf((char*)ascii_recipient_number, "%d ", g_uc_p->msg.to_num);
  1366.         AnsiiToUnicodeString((PS8) g_uc_p->done.to, (PS8) ascii_recipient_number);
  1367.         pfnUnicodeStrncat((S8*) g_uc_p->done.to, 
  1368.                           (const S8*)GetString(STR_UC_RECIPIENTS_ID), 
  1369.                           MMI_UC_MAX_ADDR_LEN - pfnUnicodeStrlen((PS8) GetString(STR_UC_RECIPIENTS_ID)));        
  1370.     }
  1371.     SetInlineItemDisplayOnly(&wgui_inline_items[MMI_UC_DONE_TO], (U8*) (g_uc_p->done.to));
  1372.     if (g_uc_p->msg_type.caller_specific_msg_type != MMI_UC_MSG_TYPE_SMS_ONLY)
  1373.     {
  1374.         /* Cc caption */
  1375.         SetInlineItemCaption(&wgui_inline_items[MMI_UC_DONE_CC_CAPTION], (U8*) GetString(STR_UC_CC_ID));
  1376.         /* Cc address */
  1377.         //SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_CC], KEY_LSK, KEY_EVENT_UP);
  1378.         memset(g_uc_p->done.cc, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  1379.         if (g_uc_p->msg.cc_num == 0)
  1380.         {
  1381.             /* display empty in the field */
  1382.         }
  1383.         else if (g_uc_p->msg.cc_num == 1)
  1384.         {
  1385.             if (g_uc_p->msg.cc_head->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
  1386.             {                
  1387.                 S8 *name = NULL;
  1388.                 S8 temp[(MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
  1389.                 memset(temp, 0, sizeof(temp));
  1390.                 AnsiiToUnicodeString(temp, (S8*) g_uc_p->msg.cc_head->addr);
  1391.                 
  1392.                 name = lookUpNumber(temp);
  1393.                 if (name != NULL && pfnUnicodeStrlen(name) > 0)
  1394.                 {
  1395.                     pfnUnicodeStrncpy((S8*) g_uc_p->done.cc, name, MMI_UC_MAX_ADDR_LEN);
  1396.                 }
  1397.                 else
  1398.                 {
  1399.                     pfnUnicodeStrncpy((S8*) g_uc_p->done.cc, temp, MMI_UC_MAX_ADDR_LEN);
  1400.                 }
  1401.             }
  1402.             else if (g_uc_p->msg.cc_head->type == MMI_UC_ADDRESS_TYPE_EMAIL)
  1403.             {
  1404.                 pfnUnicodeStrncpy((S8*) g_uc_p->done.cc, (S8*)g_uc_p->msg.cc_head->addr, MMI_UC_MAX_ADDR_LEN);
  1405.             }
  1406.             else
  1407.             {
  1408.                 MMI_ASSERT(0);
  1409.             }        
  1410.         }
  1411.         else
  1412.         {
  1413.             U8 ascii_recipient_number[16];
  1414.             memset(ascii_recipient_number, 0, sizeof(ascii_recipient_number));
  1415.             sprintf((char*)ascii_recipient_number, "%d ", g_uc_p->msg.cc_num);
  1416.             AnsiiToUnicodeString((PS8) g_uc_p->done.cc, (PS8) ascii_recipient_number);
  1417.             pfnUnicodeStrncat((S8*) g_uc_p->done.cc, 
  1418.                               (const S8*)GetString(STR_UC_RECIPIENTS_ID), 
  1419.                               MMI_UC_MAX_ADDR_LEN - pfnUnicodeStrlen((PS8) GetString(STR_UC_RECIPIENTS_ID)));        
  1420.         }
  1421.         SetInlineItemDisplayOnly(&wgui_inline_items[MMI_UC_DONE_CC], (U8*) (g_uc_p->done.cc));
  1422.         /* Bcc caption */
  1423.         SetInlineItemCaption(&wgui_inline_items[MMI_UC_DONE_BCC_CAPTION], (U8*) GetString(STR_UC_BCC_ID));
  1424.         /* Bcc address */
  1425.         //SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_BCC], KEY_LSK, KEY_EVENT_UP);
  1426.         memset(g_uc_p->done.bcc, 0, (MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH);
  1427.         if (g_uc_p->msg.bcc_num == 0)
  1428.         {
  1429.             /* display empty in the field */
  1430.         }
  1431.         else if (g_uc_p->msg.bcc_num == 1)
  1432.         {
  1433.             if (g_uc_p->msg.bcc_head->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
  1434.             {                
  1435.                 S8 *name = NULL;
  1436.                 S8 temp[(MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
  1437.                 memset(temp, 0, sizeof(temp));
  1438.                 AnsiiToUnicodeString(temp, (S8*) g_uc_p->msg.bcc_head->addr);
  1439.                 
  1440.                 name = lookUpNumber(temp);
  1441.                 if (name != NULL && pfnUnicodeStrlen(name) > 0)
  1442.                 {
  1443.                     pfnUnicodeStrncpy((S8*) g_uc_p->done.bcc, name, MMI_UC_MAX_ADDR_LEN);
  1444.                 }
  1445.                 else
  1446.                 {
  1447.                     pfnUnicodeStrncpy((S8*) g_uc_p->done.bcc, temp, MMI_UC_MAX_ADDR_LEN);
  1448.                 }
  1449.             }
  1450.             else if (g_uc_p->msg.bcc_head->type == MMI_UC_ADDRESS_TYPE_EMAIL)
  1451.             {
  1452.                 pfnUnicodeStrncpy((S8*) g_uc_p->done.bcc, (S8*) g_uc_p->msg.bcc_head->addr, MMI_UC_MAX_ADDR_LEN);
  1453.             }
  1454.             else
  1455.             {
  1456.                 MMI_ASSERT(0);
  1457.             }        
  1458.         }
  1459.         else
  1460.         {
  1461.             U8 ascii_recipient_number[16];
  1462.             memset(ascii_recipient_number, 0, sizeof(ascii_recipient_number));
  1463.             sprintf((char*) ascii_recipient_number, "%d ", g_uc_p->msg.bcc_num);
  1464.             AnsiiToUnicodeString((PS8) g_uc_p->done.bcc, (PS8) ascii_recipient_number);
  1465.             pfnUnicodeStrncat((S8*) g_uc_p->done.bcc, 
  1466.                               (const S8*)GetString(STR_UC_RECIPIENTS_ID), 
  1467.                               MMI_UC_MAX_ADDR_LEN - pfnUnicodeStrlen((PS8) GetString(STR_UC_RECIPIENTS_ID)));        
  1468.         }
  1469.         SetInlineItemDisplayOnly(&wgui_inline_items[MMI_UC_DONE_BCC], (U8*) (g_uc_p->done.bcc));
  1470.         /* Subject caption */
  1471.         SetInlineItemCaption(&wgui_inline_items[MMI_UC_DONE_SUBJECT_CAPTION], (U8*) GetString(STR_UC_SUBJECT_ID));
  1472.        
  1473.         /* Subject */
  1474.         SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_SUBJECT], KEY_LSK, KEY_EVENT_UP);
  1475.         SetInlineItemFullScreenEdit(
  1476.             &wgui_inline_items[MMI_UC_DONE_SUBJECT],
  1477.             STR_UC_SUBJECT_ID,
  1478.             IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1479.             (PU8) g_uc_p->msg.subject,
  1480.             MMI_UC_MAX_SUBJECT_LEN + 1,
  1481.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  1482.         
  1483.         SetInlineFullScreenEditCustomFunction(
  1484.             &wgui_inline_items[MMI_UC_DONE_SUBJECT],
  1485.             mmi_uc_inline_generic_custom_function);
  1486.     }
  1487.     /* Message detail caption */
  1488.     if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY)
  1489.     {
  1490.         //SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_SMS_ONLY_MSG_DETAIL_CAPTION], KEY_LSK, KEY_EVENT_UP);
  1491.         SetInlineItemDisplayOnly(&wgui_inline_items[MMI_UC_DONE_SMS_ONLY_MSG_DETAIL_CAPTION], (U8*)GetString(STR_UC_MESSAGE_DETAIL_ID));    
  1492.     }
  1493.     else
  1494.     {
  1495.         //SetInlineItemActivation(&wgui_inline_items[MMI_UC_DONE_MSG_DETAIL_CAPTION], KEY_LSK, KEY_EVENT_UP);
  1496.         SetInlineItemDisplayOnly(&wgui_inline_items[MMI_UC_DONE_MSG_DETAIL_CAPTION], (U8*)GetString(STR_UC_MESSAGE_DETAIL_ID));
  1497.     }
  1498. }
  1499. /*****************************************************************************
  1500.  * FUNCTION
  1501.  *  mmi_uc_inline_generic_custom_function
  1502.  * DESCRIPTION
  1503.  *  Set LSK handle for inline full screen edit
  1504.  * PARAMETERS
  1505.  *  void
  1506.  * RETURNS
  1507.  *  void
  1508.  *****************************************************************************/
  1509. void mmi_uc_inline_generic_custom_function(void)
  1510. {
  1511.     /*----------------------------------------------------------------*/
  1512.     /* Local Variables                                                */
  1513.     /*----------------------------------------------------------------*/
  1514.     /*----------------------------------------------------------------*/
  1515.     /* Code Body                                                      */
  1516.     /*----------------------------------------------------------------*/
  1517.     SetInputMethodAndDoneCaptionIcon(IMG_UC_ENTRY_SCRN_CAPTION_ID);
  1518.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  1519.     SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);    
  1520. }
  1521. /*****************************************************************************
  1522.  * FUNCTION
  1523.  *  mmi_uc_exit_done
  1524.  * DESCRIPTION
  1525.  *  Exit function of done
  1526.  * PARAMETERS
  1527.  *  void
  1528.  * RETURNS
  1529.  *  void
  1530.  *****************************************************************************/
  1531. void mmi_uc_exit_done(void)
  1532. {
  1533.     /*----------------------------------------------------------------*/
  1534.     /* Local Variables                                                */
  1535.     /*----------------------------------------------------------------*/
  1536.     history currHistory;
  1537.     U16 inputBufferSize = 0;
  1538.     S16 nHistory = 0;
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Code Body                                                      */
  1541.     /*----------------------------------------------------------------*/
  1542.     CloseCategory57Screen();
  1543.     currHistory.scrnID = SCR_ID_UC_OPT_DONE;
  1544.     currHistory.entryFuncPtr = mmi_uc_entry_done;
  1545.     pfnUnicodeStrcpy((S8*) currHistory.inputBuffer, (S8*) & nHistory);
  1546.     GetCategory57History(currHistory.guiBuffer);
  1547.     inputBufferSize = (U16) GetCategory57DataSize();
  1548.     GetCategory57Data((U8*) currHistory.inputBuffer);
  1549.     AddNHistory(currHistory, inputBufferSize);
  1550. }
  1551. /*****************************************************************************
  1552.  * FUNCTION
  1553.  *  mmi_uc_entry_done_option
  1554.  * DESCRIPTION
  1555.  *  Entry function for done option
  1556.  * PARAMETERS
  1557.  *  void
  1558.  * RETURNS
  1559.  *  void
  1560.  *****************************************************************************/
  1561. void mmi_uc_entry_done_option(void)
  1562. {
  1563.     /*----------------------------------------------------------------*/
  1564.     /* Local Variables                                                */
  1565.     /*----------------------------------------------------------------*/
  1566.     U8 *guiBuffer = NULL;
  1567.     U16 numItems = 0;
  1568.     U16 nStrItemList[MAX_SUB_MENUS];
  1569.     U16 title_id = STR_GLOBAL_OPTIONS;
  1570.     /*----------------------------------------------------------------*/
  1571.     /* Code Body                                                      */
  1572.     /*----------------------------------------------------------------*/
  1573.     EntryNewScreen(SCR_ID_UC_OPT_DONE_OPT, mmi_uc_exit_generic, mmi_uc_entry_done_option, NULL);
  1574.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[UnifiedComposerMain.c] mmi_uc_entry_done_option *n"));
  1575.     
  1576.     guiBuffer = GetCurrGuiBuffer(SCR_ID_UC_OPT_DONE_OPT);
  1577.     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  1578.     {    
  1579.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_SAVE);
  1580.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_BACK_TO_EDIT_MSG);
  1581.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_EXIT);
  1582.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1583.         {
  1584.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_SEND_OPT);
  1585.         }
  1586.         else
  1587.         {
  1588.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_SEND_OPT);
  1589.         }
  1590.         if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY ||
  1591.             g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_MMS_ONLY ||
  1592.             mmi_uc_determine_msg_type_by_content() == MMI_UC_MSG_TYPE_MMS_PREFER)
  1593.         {
  1594.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_MSG_TYPE);
  1595.         }
  1596.         else
  1597.         {
  1598.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_MSG_TYPE);
  1599.         }
  1600.     }
  1601.     else if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  1602.     {    
  1603.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_SAVE);
  1604.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_BACK_TO_EDIT_MSG);
  1605.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_EXIT);
  1606.         
  1607.         if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1608.         {
  1609.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_SEND_OPT);
  1610.         }
  1611.         else
  1612.         {
  1613.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_SEND_OPT);
  1614.         }
  1615.         if (g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_SMS_ONLY ||
  1616.             g_uc_p->msg_type.caller_specific_msg_type == MMI_UC_MSG_TYPE_MMS_ONLY ||
  1617.             mmi_uc_determine_msg_type_by_content() == MMI_UC_MSG_TYPE_MMS_PREFER)
  1618.         {
  1619.             mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_MSG_TYPE);
  1620.         }
  1621.         else
  1622.         {
  1623.             mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_MSG_TYPE);
  1624.         }
  1625.     }
  1626.     else
  1627.     {
  1628.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_SAVE);
  1629.         mmi_frm_unhide_menu_item(MENU_ID_UC_OPT_DONE_BACK_TO_EDIT_MSG);
  1630.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_MSG_TYPE);
  1631.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_SEND_OPT);
  1632.         mmi_frm_hide_menu_item(MENU_ID_UC_OPT_DONE_EXIT);    
  1633.     }
  1634.     numItems = GetNumOfChild_Ext(MENU_ID_UC_OPT_DONE_OPT);
  1635.     GetSequenceStringIds_Ext(MENU_ID_UC_OPT_DONE_OPT, nStrItemList);
  1636.     SetParentHandler(MENU_ID_UC_OPT_DONE_OPT);
  1637.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1638.     ShowCategory52Screen(
  1639.         title_id,
  1640.         IMG_UC_ENTRY_SCRN_CAPTION_ID,
  1641.         STR_GLOBAL_OK,
  1642.         IMG_GLOBAL_OK,
  1643.         STR_GLOBAL_BACK,
  1644.         IMG_GLOBAL_BACK,
  1645.         numItems,
  1646.         nStrItemList,
  1647.         (U16*) gIndexIconsImageList,
  1648.         NULL,
  1649.         0,
  1650.         0,
  1651.         guiBuffer);
  1652.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1653.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1654. }
  1655. /*****************************************************************************
  1656.  * FUNCTION
  1657.  *  mmi_uc_process_back_to_edit
  1658.  * DESCRIPTION
  1659.  *  Process back to editor
  1660.  * PARAMETERS
  1661.  *  void
  1662.  * RETURNS
  1663.  *  void
  1664.  *****************************************************************************/
  1665. void mmi_uc_process_back_to_edit(void)
  1666. {
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     /*----------------------------------------------------------------*/
  1671.     /* Code Body                                                      */
  1672.     /*----------------------------------------------------------------*/
  1673.     if (IsScreenPresent(SCR_ID_UC_EDITOR))
  1674.     {
  1675.         GoBackToHistory(SCR_ID_UC_EDITOR);
  1676.     }
  1677.     else
  1678.     {
  1679.         MMI_ASSERT(0);
  1680.     }
  1681. }
  1682. /*****************************************************************************
  1683.  * FUNCTION
  1684.  *  mmi_uc_process_exit
  1685.  * DESCRIPTION
  1686.  *  Process Exit msg
  1687.  * PARAMETERS
  1688.  *  void
  1689.  * RETURNS
  1690.  *  void
  1691.  *****************************************************************************/
  1692. void mmi_uc_process_exit(void)
  1693. {
  1694.     /*----------------------------------------------------------------*/
  1695.     /* Local Variables                                                */
  1696.     /*----------------------------------------------------------------*/
  1697.     U16 screen_id;
  1698.     /*----------------------------------------------------------------*/
  1699.     /* Code Body                                                      */
  1700.     /*----------------------------------------------------------------*/    
  1701.     if (GetPreviousScrnIdOf(SCR_ID_UC_OPT_DONE, &screen_id))
  1702.     {
  1703.         mmi_uc_reset_msg();
  1704.         GoBackToHistory(screen_id);
  1705.     }
  1706.     else
  1707.     {
  1708.         MMI_ASSERT(0);
  1709.     }
  1710. }
  1711. /*****************************************************************************
  1712.  * FUNCTION
  1713.  *  mmi_uc_process_send
  1714.  * DESCRIPTION
  1715.  *  Process Send msg
  1716.  * PARAMETERS
  1717.  *  void
  1718.  * RETURNS
  1719.  *  void
  1720.  *****************************************************************************/
  1721. void mmi_uc_process_send(void)
  1722. {
  1723.     /*----------------------------------------------------------------*/
  1724.     /* Local Variables                                                */
  1725.     /*----------------------------------------------------------------*/
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Code Body                                                      */
  1728.     /*----------------------------------------------------------------*/    
  1729.     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1730.     {
  1731.         if (g_uc_p->msg.to_num == 0)
  1732.         {
  1733.             DisplayPopup(
  1734.                     (PU8) GetString(STR_UC_NO_RECEPIENT_ADDR_ID),
  1735.                     IMG_GLOBAL_ERROR,
  1736.                     1,
  1737.                     MMI_UC_POPUP_TIME_OUT,
  1738.                     (U8) ERROR_TONE);            
  1739.         }
  1740.         else
  1741.         {
  1742.             g_uc_p->send_info.action = MMI_UC_ACTION_SEND;    
  1743.             g_uc_p->send_info.curr_send_number = 0;
  1744.             mmi_uc_send_sms();
  1745.         }    
  1746.     }
  1747.     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1748.     {
  1749.         if (g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num  == 0)
  1750.         {
  1751.             DisplayPopup(
  1752.                     (PU8) GetString(STR_UC_NO_RECEPIENT_ADDR_ID),
  1753.                     IMG_GLOBAL_ERROR,
  1754.                     1,
  1755.                     MMI_UC_POPUP_TIME_OUT,
  1756.                     (U8) ERROR_TONE);            
  1757.         }
  1758.         else
  1759.         {
  1760.             g_uc_p->send_info.action = MMI_UC_ACTION_SEND;
  1761.             mmi_uc_create_mms();
  1762.         }        
  1763.     }
  1764.     else
  1765.     {
  1766.         MMI_ASSERT(0);
  1767.     }
  1768. }
  1769. /*****************************************************************************
  1770.  * FUNCTION
  1771.  *  mmi_uc_process_send
  1772.  * DESCRIPTION
  1773.  *  Process Send msg
  1774.  * PARAMETERS
  1775.  *  void
  1776.  * RETURNS
  1777.  *  void
  1778.  *****************************************************************************/
  1779. void mmi_uc_process_send_and_save(void)
  1780. {
  1781.     /*----------------------------------------------------------------*/
  1782.     /* Local Variables                                                */
  1783.     /*----------------------------------------------------------------*/
  1784.     /*----------------------------------------------------------------*/
  1785.     /* Code Body                                                      */
  1786.     /*----------------------------------------------------------------*/    
  1787.     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1788.     {
  1789.         if (g_uc_p->msg.to_num == 0)
  1790.         {
  1791.             DisplayPopup(
  1792.                     (PU8) GetString(STR_UC_NO_RECEPIENT_ADDR_ID),
  1793.                     IMG_GLOBAL_ERROR,
  1794.                     1,
  1795.                     MMI_UC_POPUP_TIME_OUT,
  1796.                     (U8) ERROR_TONE);            
  1797.         }
  1798.         else
  1799.         {
  1800.             g_uc_p->send_info.action = MMI_UC_ACTION_SEND_AND_SAVE;    
  1801.             g_uc_p->send_info.curr_send_number = 0;
  1802.             mmi_uc_send_sms();
  1803.         }    
  1804.     }
  1805.     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1806.     {
  1807.         if (g_uc_p->msg.to_num + g_uc_p->msg.cc_num + g_uc_p->msg.bcc_num  == 0)
  1808.         {
  1809.             DisplayPopup(
  1810.                     (PU8) GetString(STR_UC_NO_RECEPIENT_ADDR_ID),
  1811.                     IMG_GLOBAL_ERROR,
  1812.                     1,
  1813.                     MMI_UC_POPUP_TIME_OUT,
  1814.                     (U8) ERROR_TONE);            
  1815.         }
  1816.         else
  1817.         {
  1818.             g_uc_p->send_info.action = MMI_UC_ACTION_SEND_AND_SAVE;
  1819.             mmi_uc_create_mms();
  1820.         }        
  1821.     }
  1822.     else
  1823.     {
  1824.         MMI_ASSERT(0);
  1825.     }
  1826. }
  1827. /*****************************************************************************
  1828.  * FUNCTION
  1829.  *  mmi_uc_process_save
  1830.  * DESCRIPTION
  1831.  *  Process Save msg
  1832.  * PARAMETERS
  1833.  *  void
  1834.  * RETURNS
  1835.  *  void
  1836.  *****************************************************************************/
  1837. void mmi_uc_process_save(void)
  1838. {
  1839.     /*----------------------------------------------------------------*/
  1840.     /* Local Variables                                                */
  1841.     /*----------------------------------------------------------------*/
  1842.     UmMsgBoxType msg_box = mmi_um_get_current_msg_box_type();
  1843.     /*----------------------------------------------------------------*/
  1844.     /* Code Body                                                      */
  1845.     /*----------------------------------------------------------------*/        
  1846.     g_uc_p->send_info.action = MMI_UC_ACTION_SAVE;
  1847.     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1848.     {
  1849.         if (msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1850.         {
  1851.             mmi_uc_set_processing_screen(
  1852.                         STR_GLOBAL_SAVING, 
  1853.                         STR_UC_PLEASE_WAIT_ID, 
  1854.                         IMG_GLOBAL_PROGRESS, 
  1855.                         0);
  1856.             
  1857.             mmi_uc_entry_processing_generic();
  1858.             /* save msg from SMS to SMS. Delete original one and then save new one. */
  1859.             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1860.             {
  1861.                 mmi_frm_sms_delete_sms(
  1862.                     mmi_uc_delete_sms_callback, 
  1863.                     MOD_MMI, 
  1864.                     MMI_FRM_SMS_DRAFTS, 
  1865.                     g_uc_p->send_info.existed_msg_id );
  1866.             }
  1867.             /* save msg from MMS to SMS. Save new one and then delete original one. */
  1868.             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1869.             {
  1870.                 mmi_uc_save_sms_req();
  1871.                 
  1872.             }
  1873.             else
  1874.             {
  1875.                 MMI_ASSERT(0);
  1876.             }            
  1877.             mmi_um_set_highlight_msg(0);
  1878.         }
  1879.         else if (msg_box == UM_MSG_BOX_TYPE_UNSENT && g_uc_p->msg.to_num > 0)
  1880.         {
  1881.             mmi_uc_set_processing_screen(
  1882.                         STR_GLOBAL_SAVING, 
  1883.                         STR_UC_PLEASE_WAIT_ID, 
  1884.                         IMG_GLOBAL_PROGRESS, 
  1885.                         0);
  1886.             
  1887.             mmi_uc_entry_processing_generic();
  1888.            /* save msg from SMS to SMS. Delete original one and then save new one. */
  1889.             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1890.             {
  1891.                 mmi_frm_sms_delete_sms(
  1892.                     mmi_uc_delete_sms_callback, 
  1893.                     MOD_MMI, 
  1894.                     MMI_FRM_SMS_UNSENT, 
  1895.                     g_uc_p->send_info.existed_msg_id );
  1896.             }
  1897.             /* save msg from MMS to SMS. Save new one and then delete original one. */
  1898.             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1899.             {
  1900.                 mmi_uc_save_sms_req();
  1901.             }
  1902.             else
  1903.             {
  1904.                 MMI_ASSERT(0);
  1905.             }            
  1906.             mmi_um_set_highlight_msg(0);
  1907.         }
  1908.         else
  1909.         {    
  1910.             mmi_uc_save_sms();
  1911.         }
  1912.     }
  1913.     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1914.     {
  1915.         /* The original mms msg would be deleted after mms creation if it belongs to draft folder */    
  1916.         mmi_uc_create_mms();
  1917.     }
  1918.     else
  1919.     {
  1920.         MMI_ASSERT(0);
  1921.     }
  1922. }
  1923. /*****************************************************************************
  1924.  * FUNCTION
  1925.  *  mmi_uc_send_sms
  1926.  * DESCRIPTION
  1927.  *  Send SMS msg
  1928.  * PARAMETERS
  1929.  *  void
  1930.  * RETURNS
  1931.  *  void
  1932.  *****************************************************************************/
  1933. void mmi_uc_send_sms(void)
  1934. {
  1935.     /*----------------------------------------------------------------*/
  1936.     /* Local Variables                                                */
  1937.     /*----------------------------------------------------------------*/
  1938.     
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Code Body                                                      */
  1941.     /*----------------------------------------------------------------*/
  1942.     mmi_uc_entry_sending_sms();
  1943.     mmi_uc_send_sms_req();
  1944. }
  1945. /*****************************************************************************
  1946.  * FUNCTION
  1947.  *  mmi_uc_save_sms
  1948.  * DESCRIPTION
  1949.  *  Send SMS msg
  1950.  * PARAMETERS
  1951.  *  void
  1952.  * RETURNS
  1953.  *  void
  1954.  *****************************************************************************/
  1955. void mmi_uc_save_sms(void)
  1956. {
  1957.     /*----------------------------------------------------------------*/
  1958.     /* Local Variables                                                */
  1959.     /*----------------------------------------------------------------*/
  1960.     
  1961.     /*----------------------------------------------------------------*/
  1962.     /* Code Body                                                      */
  1963.     /*----------------------------------------------------------------*/
  1964.     mmi_uc_set_processing_screen(
  1965.                 STR_GLOBAL_SAVING, 
  1966.                 STR_UC_PLEASE_WAIT_ID, 
  1967.                 IMG_GLOBAL_PROGRESS, 
  1968.                 0);
  1969.     
  1970.     mmi_uc_entry_processing_generic();        
  1971.     mmi_uc_save_sms_req();
  1972. }
  1973. /*****************************************************************************
  1974.  * FUNCTION
  1975.  *  mmi_uc_send_sms_req
  1976.  * DESCRIPTION
  1977.  *  Send SMS msg
  1978.  * PARAMETERS
  1979.  *  void
  1980.  * RETURNS
  1981.  *  void
  1982.  *****************************************************************************/
  1983. void mmi_uc_send_sms_req(void)
  1984. {
  1985.     /*----------------------------------------------------------------*/
  1986.     /* Local Variables                                                */
  1987.     /*----------------------------------------------------------------*/
  1988.     mmi_frm_sms_send_struct *sendData = NULL;
  1989.     mmi_uc_addr_struct* addr;
  1990.     U8 *handled_buffer = NULL;
  1991.     U16 handled_buffer_size = 0;
  1992.     /*----------------------------------------------------------------*/
  1993.     /* Code Body                                                      */
  1994.     /*----------------------------------------------------------------*/
  1995.     sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  1996.     memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
  1997.     if (g_uc_p->send_info.curr_send_number == 0)
  1998.     {        
  1999.         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2000.         if (g_uc_p->msg.current_slide->text.UCS2_count)
  2001.         {
  2002.             sendData->dcs = SMSAL_UCS2_DCS;
  2003.             handled_buffer_size = ( g_uc_p->msg.current_slide->text.char_count + 1) * ENCODING_LENGTH;
  2004.             MMI_ASSERT( handled_buffer_size <= MMI_UC_UTF8_TEXT_BUFFER_SIZE);
  2005.             handled_buffer = (U8*)applib_mem_screen_alloc((U16)handled_buffer_size);            
  2006.             memset((S8*) handled_buffer, 0, handled_buffer_size);
  2007.             memcpy((S8*) handled_buffer, 
  2008.                    (S8*) g_uc_p->main.text_buffer, 
  2009.                    g_uc_p->msg.current_slide->text.char_count * ENCODING_LENGTH);
  2010.             
  2011.         }
  2012.         else
  2013.         {
  2014.             sendData->dcs = SMSAL_DEFAULT_DCS;
  2015.             
  2016.             handled_buffer_size = ( g_uc_p->msg.current_slide->text.char_count + 
  2017.                                     g_uc_p->msg.current_slide->text.extension_char_count 
  2018.                                     + 1) * ENCODING_LENGTH;
  2019.             MMI_ASSERT( handled_buffer_size <= MMI_UC_UTF8_TEXT_BUFFER_SIZE);
  2020.         
  2021.             handled_buffer = (U8*)applib_mem_screen_alloc(handled_buffer_size);
  2022.             memset((S8*) handled_buffer, 0, handled_buffer_size);
  2023.             
  2024.             
  2025.             mmi_frm_sms_add_escape_symbol_for_extension_char(
  2026.                 (U16*) handled_buffer,
  2027.                 (U16*) g_uc_p->main.text_buffer,
  2028.                 g_uc_p->msg.current_slide->text.char_count);
  2029.         }     
  2030.         MMI_ASSERT(mmi_frm_sms_fill_in_edit_buffer(handled_buffer, 
  2031.                                                    (U16)((handled_buffer_size / ENCODING_LENGTH) - 1), 
  2032.                                                    sendData->dcs, 
  2033.                                                    MMI_TRUE));
  2034.         applib_mem_screen_free(handled_buffer);
  2035.     }
  2036.     
  2037.     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);
  2038.     strncpy((S8*) sendData->number, (S8*) addr->addr,MAX_DIGITS_SMS - 1);
  2039.     sendData->sendrequire |= MMI_FRM_SMS_SAVE_AFTER_FAIL;
  2040.     if (g_uc_p->main.state == MMI_UC_STATE_REPLY)
  2041.     {
  2042.         sendData->sendrequire |= MMI_FRM_SMS_REPLY;
  2043.         sendData->replyindex = g_uc_p->send_info.existed_msg_id;
  2044.     }
  2045.     
  2046.     sendData->sendcheck |= MMI_FRM_SMS_SCR;
  2047.     mmi_frm_sms_send_sms(mmi_uc_send_sms_rsp, MOD_MMI, sendData);
  2048.     OslMfree(sendData);
  2049. }
  2050. /*****************************************************************************
  2051.  * FUNCTION
  2052.  *  mmi_uc_send_sms_rsp
  2053.  * DESCRIPTION
  2054.  *  Send SMS msg response
  2055.  * PARAMETERS
  2056.  *  void
  2057.  * RETURNS
  2058.  *  void
  2059.  *****************************************************************************/
  2060. void mmi_uc_send_sms_rsp(void *number, module_type mod, U16 result)
  2061. {
  2062.     /*----------------------------------------------------------------*/
  2063.     /* Local Variables                                                */
  2064.     /*----------------------------------------------------------------*/
  2065.     /*----------------------------------------------------------------*/
  2066.     /* Code Body                                                      */
  2067.     /*----------------------------------------------------------------*/
  2068.     if (result == MMI_FRM_SMS_OK)
  2069.     {
  2070.         g_uc_p->send_info.curr_send_number++;
  2071.         if (g_uc_p->send_info.curr_send_number < g_uc_p->msg.to_num)
  2072.         {
  2073.             mmi_uc_send_sms_req();
  2074.             return;
  2075.         }
  2076.     }
  2077.     g_uc_p->send_info.send_result = result;
  2078.     mmi_uc_action_fsm(MMI_UC_ACTION_SEND, result);
  2079.     return;
  2080. }
  2081. /*****************************************************************************
  2082.  * FUNCTION
  2083.  *  mmi_uc_save_sms_req
  2084.  * DESCRIPTION
  2085.  *  save SMS msg
  2086.  * PARAMETERS
  2087.  *  void
  2088.  * RETURNS
  2089.  *  void
  2090.  *****************************************************************************/
  2091. void mmi_uc_save_sms_req(void)
  2092. {
  2093.     /*----------------------------------------------------------------*/
  2094.     /* Local Variables                                                */
  2095.     /*----------------------------------------------------------------*/
  2096.     mmi_frm_sms_send_struct *sendData = NULL;
  2097.     mmi_uc_addr_struct* addr;
  2098.     U8 *handled_buffer = NULL;
  2099.     U16 handled_buffer_size = 0;
  2100.     /*----------------------------------------------------------------*/
  2101.     /* Code Body                                                      */
  2102.     /*----------------------------------------------------------------*/
  2103.     sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  2104.     memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
  2105.     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2106.     if (g_uc_p->msg.current_slide->text.UCS2_count)
  2107.     {
  2108.         sendData->dcs = SMSAL_UCS2_DCS;
  2109.         handled_buffer_size = ( g_uc_p->msg.current_slide->text.char_count + 1) * ENCODING_LENGTH;
  2110.         MMI_ASSERT( handled_buffer_size <= MMI_UC_UTF8_TEXT_BUFFER_SIZE);
  2111.         
  2112.         handled_buffer = (U8*)applib_mem_screen_alloc(handled_buffer_size);        
  2113.         memset((S8*) handled_buffer, 0, handled_buffer_size);
  2114.         memcpy((S8*) handled_buffer, 
  2115.                (S8*) g_uc_p->main.text_buffer, 
  2116.                g_uc_p->msg.current_slide->text.char_count * ENCODING_LENGTH);
  2117.         
  2118.     }
  2119.     else
  2120.     {
  2121.         sendData->dcs = SMSAL_DEFAULT_DCS;
  2122.         
  2123.         handled_buffer_size = ( g_uc_p->msg.current_slide->text.char_count + 
  2124.                                 g_uc_p->msg.current_slide->text.extension_char_count 
  2125.                                 + 1) * ENCODING_LENGTH;
  2126.         MMI_ASSERT( handled_buffer_size <= MMI_UC_UTF8_TEXT_BUFFER_SIZE);
  2127.     
  2128.         handled_buffer = (U8*)applib_mem_screen_alloc((U16)handled_buffer_size);
  2129.         memset((S8*) handled_buffer, 0, handled_buffer_size);
  2130.         
  2131.         mmi_frm_sms_add_escape_symbol_for_extension_char(
  2132.             (U16*) handled_buffer,
  2133.             (U16*) g_uc_p->main.text_buffer,
  2134.             g_uc_p->msg.current_slide->text.char_count);
  2135.     }     
  2136.     MMI_ASSERT(mmi_frm_sms_fill_in_edit_buffer(handled_buffer, 
  2137.                                                (U16)((handled_buffer_size / ENCODING_LENGTH) - 1), 
  2138.                                                sendData->dcs, 
  2139.                                                KAL_TRUE));
  2140.     applib_mem_screen_free(handled_buffer);
  2141.     if (g_uc_p->msg.to_num)
  2142.     {
  2143.         addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, 0);
  2144.         
  2145.         strncpy((S8*) sendData->number, (S8*) addr->addr,MAX_DIGITS_SMS - 1);
  2146.     }
  2147.     sendData->status = SMSAL_STO_UNSENT;
  2148.     mmi_frm_sms_save_sms(mmi_uc_save_sms_rsp, MOD_MMI, sendData);
  2149.     OslMfree(sendData);
  2150. }
  2151. /*****************************************************************************
  2152.  * FUNCTION
  2153.  *  mmi_uc_save_sms_rsp
  2154.  * DESCRIPTION
  2155.  *  Save SMS msg response
  2156.  * PARAMETERS
  2157.  *  void
  2158.  * RETURNS
  2159.  *  void
  2160.  *****************************************************************************/
  2161. void mmi_uc_save_sms_rsp(void *status, module_type mod, U16 result)
  2162. {
  2163.     /*----------------------------------------------------------------*/
  2164.     /* Local Variables                                                */
  2165.     /*----------------------------------------------------------------*/
  2166.     /*----------------------------------------------------------------*/
  2167.     /* Code Body                                                      */
  2168.     /*----------------------------------------------------------------*/
  2169.     g_uc_p->send_info.save_result = result;
  2170.     mmi_uc_action_fsm(MMI_UC_ACTION_SAVE, result);
  2171.     return;
  2172. }
  2173. /*****************************************************************************
  2174.  * FUNCTION
  2175.  *  mmi_uc_delete_sms_callback
  2176.  * DESCRIPTION
  2177.  *  Delete SMS msg response
  2178.  * PARAMETERS
  2179.  *  void
  2180.  * RETURNS
  2181.  *  void
  2182.  *****************************************************************************/
  2183. void mmi_uc_delete_sms_callback(void *dummy, module_type mod, U16 result)
  2184. {
  2185.     /*----------------------------------------------------------------*/
  2186.     /* Local Variables                                                */
  2187.     /*----------------------------------------------------------------*/
  2188.     /*----------------------------------------------------------------*/
  2189.     /* Code Body                                                      */
  2190.     /*----------------------------------------------------------------*/    
  2191.     mmi_uc_action_fsm(MMI_UC_ACTION_DELETE, result);    
  2192. }
  2193.     
  2194. /*****************************************************************************
  2195.  * FUNCTION
  2196.  *  mmi_uc_entry_sending_sms
  2197.  * DESCRIPTION
  2198.  *  Entry function of sending sms
  2199.  * PARAMETERS
  2200.  *  void
  2201.  * RETURNS
  2202.  *  void
  2203.  *****************************************************************************/
  2204. void mmi_uc_entry_sending_sms(void)
  2205. {
  2206.     /*----------------------------------------------------------------*/
  2207.     /* Local Variables                                                */
  2208.     /*----------------------------------------------------------------*/
  2209.     /*----------------------------------------------------------------*/
  2210.     /* Code Body                                                      */
  2211.     /*----------------------------------------------------------------*/
  2212.     EntryNewScreen(SCR_ID_UC_SENDING, NULL, mmi_uc_entry_sending_sms, NULL);
  2213.     
  2214.     ShowCategory8Screen(
  2215.         STR_SENDING_SMS,
  2216.         0,
  2217.         0,
  2218.         0,
  2219.         STR_GLOBAL_ABORT,
  2220.         IMG_SMS_COMMON_NOIMAGE,
  2221.         STR_SENDIING_SMS_BODY,
  2222.         IMG_NEW_SMS_SEND,
  2223.         NULL);
  2224.     
  2225.     GetCurrEndKeyDownHandler();
  2226.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2227.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  2228.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2229.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  2230.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  2231.     
  2232.     SetKeyHandler(mmi_uc_abort_send_sms_by_end_key, KEY_END, KEY_EVENT_DOWN);
  2233.     SetRightSoftkeyFunction(mmi_uc_abort_send_sms, KEY_EVENT_UP);
  2234. }
  2235. /*****************************************************************************
  2236.  * FUNCTION
  2237.  *  mmi_uc_abort_send_sms
  2238.  * DESCRIPTION
  2239.  *  Abort sending SMS by RSK
  2240.  * PARAMETERS
  2241.  *  void
  2242.  * RETURNS
  2243.  *  void
  2244.  *****************************************************************************/
  2245. void mmi_uc_abort_send_sms(void)
  2246. {
  2247.     /*----------------------------------------------------------------*/
  2248.     /* Local Variables                                                */
  2249.     /*----------------------------------------------------------------*/
  2250.     /*----------------------------------------------------------------*/
  2251.     /* Code Body                                                      */
  2252.     /*----------------------------------------------------------------*/
  2253.     g_uc_p->send_info.abort = MMI_UC_ABORT_NORMAL;
  2254.     mmi_uc_set_processing_screen(
  2255.             STR_GLOBAL_ABORTING, 
  2256.             STR_UC_PLEASE_WAIT_ID, 
  2257.             IMG_GLOBAL_PROGRESS, 
  2258.             0);
  2259.     
  2260.     mmi_uc_entry_processing_generic();        
  2261.     mmi_frm_sms_abort_sending_sms(MMI_FRM_SMS_ABORT_WITH_FINISH_IND);
  2262. }
  2263.     
  2264. /*****************************************************************************
  2265.  * FUNCTION
  2266.  *  mmi_uc_abort_send_sms_by_end_key
  2267.  * DESCRIPTION
  2268.  *  Abort sending SMS by endkey
  2269.  * PARAMETERS
  2270.  *  void
  2271.  * RETURNS
  2272.  *  void
  2273.  *****************************************************************************/
  2274. void mmi_uc_abort_send_sms_by_end_key(void)
  2275. {
  2276.     /*----------------------------------------------------------------*/
  2277.     /* Local Variables                                                */
  2278.     /*----------------------------------------------------------------*/
  2279.     /*----------------------------------------------------------------*/
  2280.     /* Code Body                                                      */
  2281.     /*----------------------------------------------------------------*/
  2282.     if (isInCall() == FALSE)
  2283.     {
  2284.         g_uc_p->send_info.abort = MMI_UC_ABORT_BY_END_KEY;
  2285.         mmi_uc_set_processing_screen(
  2286.                 STR_GLOBAL_ABORTING, 
  2287.                 STR_UC_PLEASE_WAIT_ID, 
  2288.                 IMG_GLOBAL_PROGRESS, 
  2289.                 0);
  2290.         
  2291.         mmi_uc_entry_processing_generic();
  2292.         DeleteUptoScrID(IDLE_SCREEN_ID);
  2293.         mmi_frm_sms_abort_sending_sms(MMI_FRM_SMS_ABORT_WITHOUT_FINISH_IND);
  2294.        ClearInputEventHandler(MMI_DEVICE_ALL);
  2295.        ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  2296.        ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2297.        ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  2298.        ClearKeyHandler(KEY_END, KEY_REPEAT);        
  2299.     }
  2300.     else
  2301.     {    
  2302.         ExecCurrEndKeyDownHandler();
  2303.     }
  2304. }
  2305. /*****************************************************************************
  2306.  * FUNCTION
  2307.  *  mmi_uc_action_fsm
  2308.  * DESCRIPTION
  2309.  *  FSM for unified composer action
  2310.  * PARAMETERS
  2311.  *  void
  2312.  * RETURNS
  2313.  *  void
  2314.  *****************************************************************************/
  2315. void mmi_uc_action_fsm (mmi_uc_action_type_enum action, U32 result)
  2316. {
  2317.     /*----------------------------------------------------------------*/
  2318.     /* Local Variables                                                */
  2319.     /*----------------------------------------------------------------*/
  2320.     /*----------------------------------------------------------------*/
  2321.     /* Code Body                                                      */
  2322.     /*----------------------------------------------------------------*/    
  2323.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2324.                          "*[UnifiedComposerMain.c] mmi_uc_action_fsm action=%d state=%d cur_action=%d  res=%d*n",
  2325.                          g_uc_p->send_info.action, g_uc_p->main.state, action, result));
  2326.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2327.                          "*[UnifiedComposerMain.c] mmi_uc_action_fsm cur_msg_type=%d existed_msg_type=%d*n",
  2328.                          g_uc_p->msg_type.curr_msg_type, g_uc_p->send_info.existed_msg_type));    
  2329.     
  2330.     switch (g_uc_p->send_info.action)
  2331.     {
  2332.         case MMI_UC_ACTION_SEND:
  2333.         {
  2334.             switch (g_uc_p->main.state)
  2335.             {
  2336.                 case MMI_UC_STATE_WRITE_NEW_MSG:
  2337.                 case MMI_UC_STATE_FORWARD:
  2338.                 case MMI_UC_STATE_REPLY:
  2339.                 case MMI_UC_STATE_REPLY_ALL:
  2340.                 {
  2341.                     switch (action)
  2342.                     {
  2343.                         /* send , write new */
  2344.                         case MMI_UC_ACTION_SEND:
  2345.                         {
  2346.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2347.                             {
  2348.                                 switch (result)
  2349.                                 {
  2350.                                     case MMI_FRM_SMS_OK:
  2351.                                     {
  2352.                                         DisplayPopup(
  2353.                                             (PU8) GetString(STR_UC_SENT_ID),
  2354.                                             IMG_SEND_SUCCESS_PIC_MSG,
  2355.                                             1,
  2356.                                             MMI_UC_POPUP_TIME_OUT,
  2357.                                             (U8) SUCCESS_TONE);
  2358.                                                                                 
  2359.                                         if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  2360.                                         {
  2361.                                             mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_SENDING);
  2362.                                         }
  2363.                                         else
  2364.                                         {
  2365.                                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_SENDING);
  2366.                                         }                                    
  2367.                                         mmi_uc_reset_msg();
  2368.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2369.                                         mmi_uc_delete_sms_frm_screen();
  2370.                                         AlmEnableSPOF();                                        
  2371.                                     }
  2372.                                     break;
  2373.                                     case MMI_FRM_SMS_ABORT:
  2374.                                     {
  2375.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  2376.                                         {                                        
  2377.                                             DisplayPopup(
  2378.                                                 (PU8) GetString(STR_UC_ABORTED_ID),
  2379.                                                 IMG_GLOBAL_ACTIVATED,
  2380.                                                 1,
  2381.                                                 MMI_UC_POPUP_TIME_OUT,
  2382.                                                 (U8) SUCCESS_TONE);
  2383.                                             if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  2384.                                             {
  2385.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  2386.                                             }
  2387.                                             else
  2388.                                             {
  2389.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  2390.                                             }                                            
  2391.                                             mmi_uc_delete_sms_frm_screen();
  2392.                                             AlmEnableSPOF();
  2393.                                         }
  2394.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  2395.                                         {
  2396.                                             mmi_uc_addr_struct* addr = NULL;
  2397.                                             addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);
  2398.                                             mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  2399.                                             AlmEnableSPOF();
  2400.                                         }
  2401.                                         else
  2402.                                         {
  2403.                                             MMI_ASSERT(0);
  2404.                                         }
  2405.                                     }
  2406.                                     break;
  2407.                                     
  2408.                                     case MMI_FRM_SMS_NOTREADY:
  2409.                                     {
  2410.                                         DisplayPopup(
  2411.                                             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  2412.                                             IMG_SEND_FAIL_PIC_MSG,
  2413.                                             1,
  2414.                                             MMI_UC_POPUP_TIME_OUT,
  2415.                                             (U8) ERROR_TONE);
  2416.                                         
  2417.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  2418.                                         AlmEnableSPOF();
  2419.                                     }
  2420.                                     break;
  2421.                                     case MMI_FRM_SMS_NUMINVALID:
  2422.                                     {
  2423.                                         DisplayPopup(
  2424.                                             (PU8) GetString(STR_ID_PHB_NUM_INVALID),
  2425.                                             IMG_GLOBAL_UNFINISHED,
  2426.                                             1,
  2427.                                             MMI_UC_POPUP_TIME_OUT,
  2428.                                             (U8) ERROR_TONE);
  2429.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_SENDING);   
  2430.                                         mmi_uc_delete_sms_frm_screen();
  2431.                                         AlmEnableSPOF();            
  2432.                                     }
  2433.                                     break;
  2434.                                     
  2435.                                     case MMI_FRM_SMS_RETURN:
  2436.                                     case MMI_FRM_SMS_END:
  2437.                                         break;
  2438.                                     default:
  2439.                                     {
  2440.                                         mmi_uc_addr_struct* addr = NULL;
  2441.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  2442.                                         /* Do not display processing screen in such cases. */
  2443.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  2444.                                         {
  2445.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  2446.                                                                          STR_UC_PLEASE_WAIT_ID, 
  2447.                                                                          IMG_GLOBAL_PROGRESS, 
  2448.                                                                          0);
  2449.                                             mmi_uc_entry_processing_generic();
  2450.                                         }
  2451.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  2452.                                         
  2453.                                         addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  2454.                                         mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  2455.                                     }
  2456.                                     break;                                    
  2457.                                 }    
  2458.                             }
  2459.                             /* send , write new mms*/
  2460.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2461.                             {
  2462.                                 switch (result)
  2463.                                 {
  2464.                                     case MMA_RESULT_OK:
  2465.                                     {
  2466.                                         /* Avoid user to send abort after sending rsp is received. */
  2467.                                         if (GetExitScrnID() == SCR_ID_UC_SENDING)
  2468.                                         {
  2469.                                             ClearInputEventHandler(MMI_DEVICE_ALL);
  2470.                                             ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  2471.                                             ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2472.                                             ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  2473.                                             ClearKeyHandler(KEY_END, KEY_REPEAT);
  2474.                                         }
  2475.                                         else if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  2476.                                         {
  2477.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2478.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  2479.                                             
  2480.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  2481.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  2482.                                             return;
  2483.                                         }
  2484.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);                                        
  2485.                                     }
  2486.                                     break;
  2487.                                     case MMA_RESULT_FAIL_USER_CANCEL:
  2488.                                     {
  2489.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  2490.                                         {                                        
  2491.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  2492.                                         }
  2493.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  2494.                                         {
  2495.                                             mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  2496.                                         }
  2497.                                         else
  2498.                                         {
  2499.                                             MMI_ASSERT(0);
  2500.                                         }
  2501.                                     }
  2502.                                     break;
  2503.                                     default:
  2504.                                     {
  2505.                                         if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  2506.                                         {
  2507.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2508.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  2509.                                             
  2510.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  2511.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  2512.                                             return;
  2513.                                         }
  2514.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  2515.                                         /* Do not display processing screen in such cases. */
  2516.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  2517.                                         {                                        
  2518.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  2519.                                                                          STR_UC_PLEASE_WAIT_ID, 
  2520.                                                                          IMG_GLOBAL_PROGRESS, 
  2521.                                                                          0);
  2522.                                             mmi_uc_entry_processing_generic();
  2523.                                         }
  2524.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  2525.                                         mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  2526.                                     }
  2527.                                     break;  
  2528.                                 }
  2529.                             }
  2530.                             else
  2531.                             {
  2532.                                 MMI_ASSERT(0);
  2533.                             }
  2534.                         }
  2535.                         break;
  2536.                         /* send , write new */
  2537.                         case MMI_UC_ACTION_SAVE:
  2538.                         {
  2539.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2540.                             {                                
  2541.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  2542.                                 {
  2543.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  2544.                                     {
  2545.                                         mmi_uc_reset_msg();
  2546.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2547.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  2548.                                         {
  2549.                                             GoBackHistory();
  2550.                                         }
  2551.                                         else
  2552.                                         {
  2553.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2554.                                         }                                        
  2555.                                         AlmEnableSPOF();                                        
  2556.                                     }
  2557.                                     else
  2558.                                     {
  2559.                                         MMI_ASSERT(0);
  2560.                                     }
  2561.                                 }
  2562.                                 else
  2563.                                 {
  2564.                                     if (result == MMI_FRM_SMS_OK)
  2565.                                     {
  2566.                                         DisplayPopup(
  2567.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  2568.                                             IMG_SEND_FAIL_PIC_MSG,
  2569.                                             1,
  2570.                                             MMI_UC_POPUP_TIME_OUT,
  2571.                                             (U8) ERROR_TONE);
  2572.                                     }
  2573.                                     else
  2574.                                     {
  2575.                                         DisplayPopup(
  2576.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  2577.                                             IMG_SEND_FAIL_PIC_MSG,
  2578.                                             1,
  2579.                                             MMI_UC_POPUP_TIME_OUT,
  2580.                                             (U8) ERROR_TONE);
  2581.                                     }
  2582.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  2583.                                     {
  2584.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  2585.                                     }
  2586.                                     else
  2587.                                     {
  2588.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2589.                                     }                                    
  2590.                                     
  2591.                                     mmi_uc_delete_sms_frm_screen();
  2592.                                     mmi_uc_reset_msg();
  2593.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2594.                                     AlmEnableSPOF();
  2595.                                 }                                                                
  2596.                             }
  2597.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2598.                             {
  2599.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  2600.                                 {
  2601.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  2602.                                     {
  2603.                                         mmi_uc_reset_msg();
  2604.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  2605.                                         {
  2606.                                             GoBackHistory();
  2607.                                         }
  2608.                                         else
  2609.                                         {
  2610.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2611.                                         }
  2612.                                         AlmEnableSPOF();                                        
  2613.                                     }
  2614.                                     else
  2615.                                     {
  2616.                                         MMI_ASSERT(0);
  2617.                                     }
  2618.                                 }
  2619.                                 else
  2620.                                 {
  2621.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  2622.                                     
  2623.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  2624.                                     {
  2625.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  2626.                                     }
  2627.                                     else
  2628.                                     {
  2629.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2630.                                     }   
  2631.                                     mmi_uc_reset_msg();
  2632.                                     AlmEnableSPOF();            
  2633.                                 }
  2634.                             }
  2635.                             else
  2636.                             {
  2637.                                 MMI_ASSERT(0);
  2638.                             }
  2639.                         }
  2640.                         break;
  2641.                         
  2642.                         /* send , write new */
  2643.                         case MMI_UC_ACTION_DELETE:
  2644.                         {
  2645.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2646.                             {
  2647.                                 MMI_ASSERT(0);
  2648.                             }
  2649.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2650.                             {
  2651.                                 /* Deletion may fail in USB normal mode. */
  2652.                                 
  2653.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  2654.                                 {
  2655.                                     DisplayPopup(
  2656.                                         (PU8) GetString(STR_UC_ABORTED_ID),
  2657.                                         IMG_GLOBAL_ACTIVATED,
  2658.                                         1,
  2659.                                         MMI_UC_POPUP_TIME_OUT,
  2660.                                         (U8) SUCCESS_TONE);
  2661.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  2662.                                         g_uc_p->main.state == MMI_UC_STATE_SEND)
  2663.                                     {
  2664.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  2665.                                     }
  2666.                                     else
  2667.                                     {
  2668.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  2669.                                     }                                       
  2670.                                     AlmEnableSPOF();
  2671.                                 }
  2672.                                 else
  2673.                                 {
  2674.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  2675.                                     
  2676.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  2677.                                     {
  2678.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_SENDING);
  2679.                                     }
  2680.                                     else
  2681.                                     {
  2682.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_SENDING);
  2683.                                     }   
  2684.                                     mmi_uc_reset_msg();                                    
  2685.                                     AlmEnableSPOF();