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

MTK

开发平台:

C/C++

  1.                                 }
  2.                                 
  3.                             }
  4.                             else
  5.                             {
  6.                                 MMI_ASSERT(0);
  7.                             }                            
  8.                         }
  9.                         break;
  10.                         
  11.                         /* send , write new */
  12.                         default:
  13.                         {
  14.                             MMI_ASSERT(0);
  15.                         }
  16.                         break;
  17.                     }
  18.                 }
  19.                 break; /* send , write new  */
  20.                 /* send , edit */
  21.                 case MMI_UC_STATE_EDIT_EXISTED_MSG:
  22.                 case MMI_UC_STATE_SEND:
  23.                 {
  24.                     UmMsgBoxType msg_box = mmi_um_get_current_msg_box_type();
  25.                     MMI_ASSERT(msg_box);
  26.                     if (g_uc_p->send_info.action == MMI_UC_STATE_SEND)
  27.                     {
  28.                         MMI_ASSERT(msg_box == UM_MSG_BOX_TYPE_UNSENT || 
  29.                                    msg_box == UM_MSG_BOX_TYPE_DRAFT);
  30.                     }
  31.                     
  32.                     switch (action)
  33.                     {
  34.                         /* send , edit */
  35.                         case MMI_UC_ACTION_SEND:
  36.                         {
  37.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  38.                             {
  39.                                 switch (result)
  40.                                 {
  41.                                     case MMI_FRM_SMS_OK:
  42.                                     {
  43.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  44.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  45.                                         {
  46.                                             DisplayPopup(
  47.                                                 (PU8) GetString(STR_UC_SENT_ID),
  48.                                                 IMG_SEND_SUCCESS_PIC_MSG,
  49.                                                 1,
  50.                                                 MMI_UC_POPUP_TIME_OUT,
  51.                                                 (U8) SUCCESS_TONE);
  52.                                             
  53.                                             if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  54.                                             {
  55.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_SENDING);
  56.                                             }
  57.                                             else
  58.                                             {
  59.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_SENDING);
  60.                                             }   
  61.                                             mmi_uc_reset_msg();
  62.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  63.                                             mmi_uc_delete_sms_frm_screen();
  64.                                             AlmEnableSPOF();
  65.                                         }
  66.                                         else
  67.                                         {
  68.                                             /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  69.                                             /* Do not display processing screen in such cases. */
  70.                                             if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  71.                                             {
  72.                                                 mmi_uc_set_processing_screen(STR_GLOBAL_DELETE, 
  73.                                                                          STR_UC_PLEASE_WAIT_ID, 
  74.                                                                          IMG_GLOBAL_PROGRESS, 
  75.                                                                          0);
  76.                                                 mmi_uc_entry_processing_generic();
  77.                                             }
  78.                                             DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  79.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  80.                                             {
  81.                                                 mmi_frm_sms_delete_sms(
  82.                                                     mmi_uc_delete_sms_callback, 
  83.                                                     MOD_MMI, 
  84.                                                     MMI_FRM_SMS_DRAFTS, 
  85.                                                     g_uc_p->send_info.existed_msg_id );
  86.                                             }
  87.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  88.                                             {
  89.                                                 mmi_uc_delete_existed_mms();
  90.                                             }
  91.                                             else
  92.                                             {
  93.                                                 MMI_ASSERT(0);
  94.                                             }
  95.                                         }
  96.                                     }
  97.                                     break;
  98.                                     case MMI_FRM_SMS_ABORT:
  99.                                     {
  100.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  101.                                         {                                        
  102.                                             DisplayPopup(
  103.                                                 (PU8) GetString(STR_UC_ABORTED_ID),
  104.                                                 IMG_GLOBAL_ACTIVATED,
  105.                                                 1,
  106.                                                 MMI_UC_POPUP_TIME_OUT,
  107.                                                 (U8) SUCCESS_TONE);
  108.                                             
  109.                                             if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  110.                                                 g_uc_p->main.state == MMI_UC_STATE_SEND)
  111.                                             {
  112.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  113.                                             }
  114.                                             else
  115.                                             {
  116.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  117.                                             }
  118.                                             mmi_uc_delete_sms_frm_screen();
  119.                                             AlmEnableSPOF();
  120.                                         }
  121.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  122.                                         {
  123.                                             if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  124.                                                 msg_box == UM_MSG_BOX_TYPE_SENT)
  125.                                             {
  126.                                                 mmi_uc_addr_struct* addr = NULL;
  127.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  128.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  129.                                                 AlmEnableSPOF();
  130.                                             }
  131.                                             else
  132.                                             {
  133.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  134.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  135.                                                 {
  136.                                                     mmi_frm_sms_delete_sms(
  137.                                                         mmi_uc_delete_sms_callback, 
  138.                                                         MOD_MMI, 
  139.                                                         MMI_FRM_SMS_DRAFTS, 
  140.                                                         g_uc_p->send_info.existed_msg_id );
  141.                                                 }
  142.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  143.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  144.                                                 {
  145.                                                     mmi_uc_addr_struct* addr = NULL;
  146.                                                     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  147.                                                     mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                    
  148.                                                 }
  149.                                                 else
  150.                                                 {
  151.                                                     MMI_ASSERT(0);
  152.                                                 }
  153.                                             }
  154.                                         }
  155.                                         else
  156.                                         {
  157.                                             MMI_ASSERT(0);
  158.                                         }
  159.                                     }
  160.                                     break;
  161.                                     
  162.                                     case MMI_FRM_SMS_NOTREADY:
  163.                                     {
  164.                                         DisplayPopup(
  165.                                             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  166.                                             IMG_SEND_FAIL_PIC_MSG,
  167.                                             1,
  168.                                             MMI_UC_POPUP_TIME_OUT,
  169.                                             (U8) ERROR_TONE);
  170.                                         
  171.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  172.                                         AlmEnableSPOF();
  173.                                     }
  174.                                     break;
  175.                                     case MMI_FRM_SMS_NUMINVALID:
  176.                                     {
  177.                                         DisplayPopup(
  178.                                             (PU8) GetString(STR_ID_PHB_NUM_INVALID),
  179.                                             IMG_GLOBAL_UNFINISHED,
  180.                                             1,
  181.                                             MMI_UC_POPUP_TIME_OUT,
  182.                                             (U8) ERROR_TONE);
  183.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_SENDING);   
  184.                                         mmi_uc_delete_sms_frm_screen();
  185.                                         AlmEnableSPOF();            
  186.                                     }
  187.                                     break;
  188.                                     
  189.                                     case MMI_FRM_SMS_RETURN:
  190.                                     case MMI_FRM_SMS_END:
  191.                                         break;
  192.                                     default:
  193.                                     {
  194.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  195.                                         /* Do not display processing screen in such cases. */
  196.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  197.                                         {
  198.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  199.                                                                          STR_UC_PLEASE_WAIT_ID, 
  200.                                                                          IMG_GLOBAL_PROGRESS, 
  201.                                                                          0);
  202.                                             mmi_uc_entry_processing_generic();
  203.                                         }
  204.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  205.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  206.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  207.                                         {
  208.                                             mmi_uc_addr_struct* addr = NULL;
  209.                                             
  210.                                             addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  211.                                             mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                
  212.                                         }
  213.                                         else
  214.                                         {
  215.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT)
  216.                                             {
  217.                                                 mmi_um_set_highlight_msg(0);
  218.                                             }
  219.                                             /* save msg from SMS to SMS. Delete original one and then save new one. */
  220.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  221.                                             {
  222.                                                 mmi_frm_sms_delete_sms(
  223.                                                     mmi_uc_delete_sms_callback, 
  224.                                                     MOD_MMI, 
  225.                                                     MMI_FRM_SMS_DRAFTS, 
  226.                                                     g_uc_p->send_info.existed_msg_id );
  227.                                             }
  228.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  229.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  230.                                             {
  231.                                                 mmi_uc_addr_struct* addr = NULL;
  232.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  233.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                    
  234.                                             }
  235.                                             else
  236.                                             {
  237.                                                 MMI_ASSERT(0);
  238.                                             }
  239.                                         }                                        
  240.                                     }
  241.                                     break;                                    
  242.                                 }    
  243.                             }
  244.                             /* send , edit*/
  245.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  246.                             {
  247.                                 switch (result)
  248.                                 {
  249.                                     case MMA_RESULT_OK:
  250.                                     {
  251.                                         if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  252.                                         {
  253.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  254.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  255.                                             
  256.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  257.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  258.                                             return;
  259.                                         }
  260.                                         
  261.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  262.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  263.                                         {
  264.                                             /* Avoid user to send abort after sending rsp is received. */
  265.                                             if (GetExitScrnID() == SCR_ID_UC_SENDING)
  266.                                             {
  267.                                                 ClearInputEventHandler(MMI_DEVICE_ALL);
  268.                                                 ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  269.                                                 ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  270.                                                 ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  271.                                                 ClearKeyHandler(KEY_END, KEY_REPEAT);
  272.                                             }
  273.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  274.                                         }
  275.                                         else
  276.                                         {
  277.                                             /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  278.                                             /* Do not display processing screen in such cases. */
  279.                                             if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  280.                                             {
  281.                                                 mmi_uc_set_processing_screen(STR_GLOBAL_DELETE, 
  282.                                                                          STR_UC_PLEASE_WAIT_ID, 
  283.                                                                          IMG_GLOBAL_PROGRESS, 
  284.                                                                          0);
  285.                                                 mmi_uc_entry_processing_generic();
  286.                                             }
  287.                                             DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  288.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  289.                                             {
  290.                                                 mmi_frm_sms_delete_sms(
  291.                                                     mmi_uc_delete_sms_callback, 
  292.                                                     MOD_MMI, 
  293.                                                     MMI_FRM_SMS_DRAFTS, 
  294.                                                     g_uc_p->send_info.existed_msg_id );
  295.                                             }
  296.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  297.                                             {
  298.                                                 mmi_uc_delete_existed_mms();
  299.                                             }
  300.                                             else
  301.                                             {
  302.                                                 MMI_ASSERT(0);
  303.                                             }
  304.                                         }                                        
  305.                                     }
  306.                                     break;
  307.                                     case MMA_RESULT_FAIL_USER_CANCEL:
  308.                                     {
  309.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  310.                                         {                                        
  311.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  312.                                         }
  313.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  314.                                         {
  315.                                             if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  316.                                                 msg_box == UM_MSG_BOX_TYPE_SENT)
  317.                                             {
  318.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  319.                                             }
  320.                                             else
  321.                                             {
  322.                                                 /* save msg from SMS to MMS. Save new one and then delete original one */
  323.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  324.                                                 {                                                        
  325.                                                     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);                                                        
  326.                                                 }
  327.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  328.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  329.                                                 {
  330.                                                     mmi_uc_delete_existed_mms();
  331.                                                 }
  332.                                                 else
  333.                                                 {
  334.                                                     MMI_ASSERT(0);
  335.                                                 }
  336.                                             } 
  337.                                         }
  338.                                         else
  339.                                         {
  340.                                             MMI_ASSERT(0);
  341.                                         }
  342.                                     }
  343.                                     break;
  344.                                     default:
  345.                                     {
  346.                                         if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  347.                                         {
  348.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  349.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  350.                                             
  351.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  352.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  353.                                             return;
  354.                                         }
  355.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  356.                                         /* Do not display processing screen in such cases. */
  357.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  358.                                         {
  359.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  360.                                                                          STR_UC_PLEASE_WAIT_ID, 
  361.                                                                          IMG_GLOBAL_PROGRESS, 
  362.                                                                          0);
  363.                                             mmi_uc_entry_processing_generic();
  364.                                         }
  365.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  366.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  367.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  368.                                         {
  369.                                             mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  370.                                         }
  371.                                         else
  372.                                         {
  373.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT)
  374.                                             {
  375.                                                 mmi_um_set_highlight_msg(0);
  376.                                             }
  377.                                             /* save msg from SMS to MMS. Save new one and then delete original one */
  378.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  379.                                             {                                                    
  380.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);                                                        
  381.                                             }
  382.                                             /* save msg from MMS to MMS. Delete original one and then save new one. */
  383.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  384.                                             {
  385.                                                 mmi_uc_delete_existed_mms();
  386.                                             }
  387.                                             else
  388.                                             {
  389.                                                 MMI_ASSERT(0);
  390.                                             }
  391.                                         }
  392.                                     }
  393.                                     break;  
  394.                                 }
  395.                             }
  396.                             else
  397.                             {
  398.                                 MMI_ASSERT(0);
  399.                             }
  400.                         }
  401.                         break;
  402.                         /* send , edit */
  403.                         case MMI_UC_ACTION_SAVE:
  404.                         {
  405.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  406.                             {                                
  407.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  408.                                 {
  409.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  410.                                     {
  411.                                         if (result == MMI_FRM_SMS_OK)
  412.                                         {
  413.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  414.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  415.                                             {
  416.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  417.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  418.                                                 {
  419.                                                     /* Do nothing. */
  420.                                                 }
  421.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  422.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  423.                                                 {
  424.                                                     mmi_uc_delete_existed_mms();
  425.                                                     return;                                                                                               
  426.                                                 }
  427.                                                 else
  428.                                                 {
  429.                                                     MMI_ASSERT(0);
  430.                                                 }
  431.                                             }
  432.                                         }
  433.                                         mmi_uc_reset_msg();
  434.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  435.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  436.                                         {
  437.                                             GoBackHistory();
  438.                                         }
  439.                                         else
  440.                                         {
  441.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  442.                                         }   
  443.                                         AlmEnableSPOF();
  444.                                     }
  445.                                     else
  446.                                     {
  447.                                         MMI_ASSERT(0);
  448.                                     }
  449.                                 }
  450.                                 else
  451.                                 {
  452.                                     if (result == MMI_FRM_SMS_OK)
  453.                                     {
  454.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  455.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  456.                                         {
  457.                                             /* save msg from SMS to SMS. Delete original one and then save new one. */
  458.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  459.                                             {
  460.                                                 /* Do nothing. */
  461.                                             }
  462.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  463.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  464.                                             {
  465.                                                 mmi_uc_delete_existed_mms();
  466.                                                 return;                                                                                               
  467.                                             }
  468.                                             else
  469.                                             {
  470.                                                 MMI_ASSERT(0);
  471.                                             }
  472.                                         }
  473.                                         DisplayPopup(
  474.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  475.                                             IMG_SEND_FAIL_PIC_MSG,
  476.                                             1,
  477.                                             MMI_UC_POPUP_TIME_OUT,
  478.                                             (U8) ERROR_TONE);
  479.                                     }
  480.                                     else
  481.                                     {
  482.                                         DisplayPopup(
  483.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  484.                                             IMG_SEND_FAIL_PIC_MSG,
  485.                                             1,
  486.                                             MMI_UC_POPUP_TIME_OUT,
  487.                                             (U8) ERROR_TONE);
  488.                                     }
  489.                                     
  490.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  491.                                     {
  492.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  493.                                     }
  494.                                     else
  495.                                     {
  496.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  497.                                     }   
  498.                                     mmi_uc_delete_sms_frm_screen();
  499.                                     mmi_uc_reset_msg();
  500.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  501.                                     AlmEnableSPOF();
  502.                                 }                                                                
  503.                             }
  504.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  505.                             {
  506.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  507.                                 {
  508.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  509.                                     {
  510.                                         if (result == MMA_RESULT_OK)
  511.                                         {
  512.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  513.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  514.                                             {
  515.                                                 /* save msg from SMS to MMS. Save new one and then delete original one. */ 
  516.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  517.                                                 {
  518.                                                      mmi_frm_sms_delete_sms(
  519.                                                         mmi_uc_delete_sms_callback, 
  520.                                                         MOD_MMI, 
  521.                                                         MMI_FRM_SMS_DRAFTS, 
  522.                                                         g_uc_p->send_info.existed_msg_id );
  523.                                                     return;
  524.                                                 }
  525.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  526.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  527.                                                 {
  528.                                                     /* Do nothing. */                                                                                                                                               
  529.                                                 }
  530.                                                 else
  531.                                                 {
  532.                                                     MMI_ASSERT(0);
  533.                                                 }
  534.                                             }
  535.                                         }
  536.                                         
  537.                                         mmi_uc_reset_msg();
  538.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  539.                                         {
  540.                                             GoBackHistory();
  541.                                         }
  542.                                         else
  543.                                         {
  544.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  545.                                         }   
  546.                                         AlmEnableSPOF();                                        
  547.                                     }
  548.                                     else
  549.                                     {
  550.                                         MMI_ASSERT(0);
  551.                                     }
  552.                                 }
  553.                                 else
  554.                                 {
  555.                                     if (result == MMA_RESULT_OK)
  556.                                     {
  557.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  558.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  559.                                         {
  560.                                             /* save msg from SMS to MMS. Save new one and then delete original one. */ 
  561.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  562.                                             {
  563.                                                  mmi_frm_sms_delete_sms(
  564.                                                     mmi_uc_delete_sms_callback, 
  565.                                                     MOD_MMI, 
  566.                                                     MMI_FRM_SMS_DRAFTS, 
  567.                                                     g_uc_p->send_info.existed_msg_id );
  568.                                                 return;
  569.                                             }
  570.                                             /* save msg from MMS to MMS. Delete original one and then save new one. */
  571.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  572.                                             {
  573.                                                 /* Do nothing. */                                                                                                                                               
  574.                                             }
  575.                                             else
  576.                                             {
  577.                                                 MMI_ASSERT(0);
  578.                                             }
  579.                                         }                                        
  580.                                     }
  581.                                     
  582.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  583.                                     
  584.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  585.                                     {
  586.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  587.                                     }
  588.                                     else
  589.                                     {
  590.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  591.                                     }  
  592.                                     mmi_uc_reset_msg();
  593.                                     AlmEnableSPOF();            
  594.                                 }
  595.                             }
  596.                             else
  597.                             {
  598.                                 MMI_ASSERT(0);
  599.                             }
  600.                         }
  601.                         break;
  602.                         
  603.                         /* send , edit */
  604.                         case MMI_UC_ACTION_DELETE:
  605.                         {
  606.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  607.                             {   
  608.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_OK)
  609.                                 {
  610.                                     DisplayPopup(
  611.                                         (PU8) GetString(STR_UC_SENT_ID),
  612.                                         IMG_SEND_SUCCESS_PIC_MSG,
  613.                                         1,
  614.                                         MMI_UC_POPUP_TIME_OUT,
  615.                                         (U8) SUCCESS_TONE);
  616.                                     
  617.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  618.                                     {
  619.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  620.                                     }
  621.                                     else
  622.                                     {
  623.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  624.                                     }  
  625.                                     mmi_uc_reset_msg();
  626.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  627.                                     mmi_uc_delete_sms_frm_screen();
  628.                                     AlmEnableSPOF(); 
  629.                                 }
  630.                                 else if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  631.                                 {
  632.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  633.                                     {
  634.                                         if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  635.                                             (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  636.                                         {
  637.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  638.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  639.                                             {
  640.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  641.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  642.                                                 {                                                
  643.                                                     mmi_uc_addr_struct* addr = NULL;
  644.                                                     
  645.                                                     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  646.                                                     mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                
  647.                                                     return;    
  648.                                                 }
  649.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  650.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  651.                                                 {
  652.                                                     /* Do nothing. */                                                                                                                                           
  653.                                                 }
  654.                                                 else
  655.                                                 {
  656.                                                     MMI_ASSERT(0);
  657.                                                 }
  658.                                             }
  659.                                             else
  660.                                             {
  661.                                                 MMI_ASSERT(0);
  662.                                             }                                                                                        
  663.                                         }                                    
  664.                                         mmi_uc_reset_msg();
  665.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  666.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  667.                                         {
  668.                                             GoBackHistory();
  669.                                         }
  670.                                         else
  671.                                         {
  672.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  673.                                         }   
  674.                                         AlmEnableSPOF();
  675.                                     }
  676.                                     else
  677.                                     {
  678.                                         MMI_ASSERT(0);
  679.                                     }
  680.                                 }
  681.                                 else
  682.                                 {
  683.                                     if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  684.                                         (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  685.                                     {
  686.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  687.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  688.                                         {
  689.                                             /* save msg from SMS to SMS. Delete original one and then save new one. */
  690.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  691.                                             {                                                
  692.                                                 mmi_uc_addr_struct* addr = NULL;
  693.                                                 
  694.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  695.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                
  696.                                                 return;    
  697.                                             }
  698.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  699.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  700.                                             {
  701.                                                 /* Do nothing. */                                                                                                                                           
  702.                                             }
  703.                                             else
  704.                                             {
  705.                                                 MMI_ASSERT(0);
  706.                                             }
  707.                                         }
  708.                                         else
  709.                                         {
  710.                                             MMI_ASSERT(0);
  711.                                         }
  712.                                         DisplayPopup(
  713.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  714.                                             IMG_SEND_FAIL_PIC_MSG,
  715.                                             1,
  716.                                             MMI_UC_POPUP_TIME_OUT,
  717.                                             (U8) ERROR_TONE);
  718.                                     }
  719.                                     else
  720.                                     {                                        
  721.                                         DisplayPopup(
  722.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  723.                                             IMG_SEND_FAIL_PIC_MSG,
  724.                                             1,
  725.                                             MMI_UC_POPUP_TIME_OUT,
  726.                                             (U8) ERROR_TONE);
  727.                                     }                                    
  728.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  729.                                     {
  730.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  731.                                     }
  732.                                     else
  733.                                     {
  734.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  735.                                     }   
  736.                                     mmi_uc_delete_sms_frm_screen();
  737.                                     mmi_uc_reset_msg();
  738.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  739.                                     AlmEnableSPOF();
  740.                                 }
  741.                             }
  742.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  743.                             {                            
  744.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_OK)
  745.                                 {
  746.                                     /* Original msg is deleted first in unsent and draft box cases */
  747.                                     if (g_uc_p->send_info.new_msg_id)
  748.                                     {
  749.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  750.                                         return;
  751.                                     }
  752.                                     
  753.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  754.                                     
  755.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  756.                                     {
  757.                                         if (IsScreenPresent(SCR_ID_UC_PROCESSING))
  758.                                         {
  759.                                             mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  760.                                         }
  761.                                         else if (IsScreenPresent(SCR_ID_UC_SENDING))
  762.                                         {
  763.                                             mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_SENDING);
  764.                                         }
  765.                                         else 
  766.                                         {
  767.                                             MMI_ASSERT(0);
  768.                                         }
  769.                                     }
  770.                                     else
  771.                                     {
  772.                                         if (IsScreenPresent(SCR_ID_UC_PROCESSING))
  773.                                         {
  774.                                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  775.                                         }
  776.                                         else if (IsScreenPresent(SCR_ID_UC_SENDING))
  777.                                         {
  778.                                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_SENDING);
  779.                                         }
  780.                                         else 
  781.                                         {
  782.                                             MMI_ASSERT(0);
  783.                                         }
  784.                                     }  
  785.                                     mmi_uc_reset_msg();                                    
  786.                                     AlmEnableSPOF(); 
  787.                                 }
  788.                                 else if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  789.                                 {
  790.                                  if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  791.                                 {
  792.                                     /* Deletion may fail in USB normal mode. */
  793.                                     
  794.                                     DisplayPopup(
  795.                                             (PU8) GetString(STR_UC_ABORTED_ID),
  796.                                             IMG_GLOBAL_ACTIVATED,
  797.                                             1,
  798.                                             MMI_UC_POPUP_TIME_OUT,
  799.                                             (U8) SUCCESS_TONE);
  800.                                     
  801.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  802.                                             g_uc_p->main.state == MMI_UC_STATE_SEND)
  803.                                     {
  804.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  805.                                     }
  806.                                     else
  807.                                     {
  808.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  809.                                     }                                        
  810.                                     AlmEnableSPOF();
  811.                                 }
  812.                                 else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  813.                                 {
  814.                                         if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  815.                                             (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  816.                                         {
  817.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  818.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  819.                                             {
  820.                                                 /* save msg from SMS to MMS. Save new one and then delete original one. */
  821.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  822.                                                 {                                                
  823.                                                     /* Do nothing. */
  824.                                                 }
  825.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  826.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  827.                                                 {
  828.                                                     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  829.                                                     return;
  830.                                                 }
  831.                                                 else
  832.                                                 {
  833.                                                     MMI_ASSERT(0);
  834.                                                 }
  835.                                             }
  836.                                             else
  837.                                             {
  838.                                                 MMI_ASSERT(0);
  839.                                             }
  840.                                         }
  841.                                         mmi_uc_reset_msg();
  842.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  843.                                         {
  844.                                             GoBackHistory();
  845.                                         }
  846.                                         else
  847.                                         {
  848.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  849.                                         }   
  850.                                         AlmEnableSPOF();
  851.                                     }
  852.                                     else 
  853.                                     {
  854.                                         MMI_ASSERT(0);
  855.                                     }
  856.                                 }
  857.                                 else
  858.                                 {                                    
  859.                                     if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  860.                                         (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  861.                                     {
  862.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  863.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  864.                                         {
  865.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  866.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  867.                                             {                                                
  868.                                                 /* Do nothing. */
  869.                                             }
  870.                                             /* save msg from MMS to MMS. Delete original one and then save new one. */
  871.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  872.                                             {
  873.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  874.                                                 return;
  875.                                             }
  876.                                             else
  877.                                             {
  878.                                                 MMI_ASSERT(0);
  879.                                             }
  880.                                         }
  881.                                         else
  882.                                         {
  883.                                             MMI_ASSERT(0);
  884.                                         }
  885.                                     }
  886.                                     
  887.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  888.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  889.                                     {
  890.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  891.                                     }
  892.                                     else
  893.                                     {
  894.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  895.                                     }   
  896.                                     mmi_uc_reset_msg();
  897.                                     AlmEnableSPOF();
  898.                                 }
  899.                                 
  900.                             }
  901.                             else
  902.                             {
  903.                                 MMI_ASSERT(0);
  904.                             }                            
  905.                         }
  906.                         break;
  907.                         
  908.                         /* send , write new */
  909.                         default:
  910.                         {
  911.                             MMI_ASSERT(0);
  912.                         }
  913.                         break;
  914.                     }
  915.                 }
  916.                 break; /* send , edit existed  */
  917.                 default:
  918.                 {
  919.                     MMI_ASSERT(0);
  920.                 }
  921.                 break;
  922.             }
  923.         }
  924.         break;
  925.         case MMI_UC_ACTION_SEND_AND_SAVE:
  926.         {
  927.             UmMsgBoxType msg_box = mmi_um_get_current_msg_box_type();
  928.             
  929.             switch (g_uc_p->main.state)
  930.             {                
  931.                 /* send and save, write new */
  932.                 case MMI_UC_STATE_WRITE_NEW_MSG:
  933.                 case MMI_UC_STATE_FORWARD:                    
  934.                 case MMI_UC_STATE_REPLY:
  935.                 case MMI_UC_STATE_REPLY_ALL:
  936.                 {
  937.                     switch (action)
  938.                     {
  939.                         /* send and save, write new */
  940.                         case MMI_UC_ACTION_SEND:
  941.                         {
  942.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  943.                             {
  944.                                 switch (result)
  945.                                 {
  946.                                     case MMI_FRM_SMS_OK:
  947.                                     {
  948.                                         mmi_uc_addr_struct* addr = NULL;
  949.                                         if (msg_box == UM_MSG_BOX_TYPE_SENT)
  950.                                         {
  951.                                             mmi_um_set_highlight_msg(0);
  952.                                         }
  953.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  954.                                         /* Do not display processing screen in such cases. */
  955.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  956.                                         {
  957.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  958.                                                                          STR_UC_PLEASE_WAIT_ID, 
  959.                                                                          IMG_GLOBAL_PROGRESS, 
  960.                                                                          0);
  961.                                             mmi_uc_entry_processing_generic();
  962.                                         }
  963.                                         DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  964.                                         
  965.                                         addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, 0);                                        
  966.                                         mmi_uc_save_sms_after_send(SMSAL_STO_SENT, addr->addr);
  967.                                     }
  968.                                     break;
  969.                                     case MMI_FRM_SMS_ABORT:
  970.                                     {                                                                                
  971.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  972.                                         {                                        
  973.                                             DisplayPopup(
  974.                                                 (PU8) GetString(STR_UC_ABORTED_ID),
  975.                                                 IMG_GLOBAL_ACTIVATED,
  976.                                                 1,
  977.                                                 MMI_UC_POPUP_TIME_OUT,
  978.                                                 (U8) SUCCESS_TONE);
  979.                                             
  980.                                             if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  981.                                             {
  982.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  983.                                             }
  984.                                             else
  985.                                             {
  986.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  987.                                             }                                           
  988.                                             mmi_uc_delete_sms_frm_screen();
  989.                                             AlmEnableSPOF();
  990.                                         }
  991.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  992.                                         {
  993.                                             mmi_uc_addr_struct* addr = NULL;
  994.                                             addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  995.                                             mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  996.                                             AlmEnableSPOF();
  997.                                         }
  998.                                         else
  999.                                         {
  1000.                                             MMI_ASSERT(0);
  1001.                                         }
  1002.                                     }
  1003.                                     break;
  1004.                                     
  1005.                                     case MMI_FRM_SMS_NOTREADY:
  1006.                                     {
  1007.                                         DisplayPopup(
  1008.                                             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  1009.                                             IMG_SEND_FAIL_PIC_MSG,
  1010.                                             1,
  1011.                                             MMI_UC_POPUP_TIME_OUT,
  1012.                                             (U8) ERROR_TONE);
  1013.                                         AlmEnableSPOF();
  1014.                                     }
  1015.                                     break;
  1016.                                     case MMI_FRM_SMS_NUMINVALID:
  1017.                                     {
  1018.                                         DisplayPopup(
  1019.                                             (PU8) GetString(STR_ID_PHB_NUM_INVALID),
  1020.                                             IMG_GLOBAL_UNFINISHED,
  1021.                                             1,
  1022.                                             MMI_UC_POPUP_TIME_OUT,
  1023.                                             (U8) ERROR_TONE);
  1024.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);   
  1025.                                         mmi_uc_delete_sms_frm_screen();
  1026.                                         AlmEnableSPOF();            
  1027.                                     }
  1028.                                     break;
  1029.                                     
  1030.                                     case MMI_FRM_SMS_RETURN:
  1031.                                     case MMI_FRM_SMS_END:
  1032.                                         break;
  1033.                                     default:
  1034.                                     {
  1035.                                         mmi_uc_addr_struct* addr = NULL;
  1036.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1037.                                         /* Do not display processing screen in such cases. */
  1038.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1039.                                         {
  1040.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1041.                                                                          STR_UC_PLEASE_WAIT_ID, 
  1042.                                                                          IMG_GLOBAL_PROGRESS, 
  1043.                                                                          0);
  1044.                                             mmi_uc_entry_processing_generic();
  1045.                                         }
  1046.                                         DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1047.                                         
  1048.                                         addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  1049.                                         mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  1050.                                     }
  1051.                                     break;                                    
  1052.                                 }    
  1053.                             }
  1054.                             /* send and save, write new */
  1055.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1056.                             {
  1057.                                 switch (result)
  1058.                                 {
  1059.                                     case MMA_RESULT_OK:
  1060.                                     {
  1061.                                         if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  1062.                                         {
  1063.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  1064.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  1065.                                             
  1066.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  1067.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  1068.                                             return;
  1069.                                         }
  1070.                                         
  1071.                                         if (msg_box == UM_MSG_BOX_TYPE_SENT)
  1072.                                         {
  1073.                                             mmi_um_set_highlight_msg(0);
  1074.                                         }
  1075.                                         
  1076.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1077.                                         /* Do not display processing screen in such cases. */
  1078.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1079.                                         {
  1080.                                             mmi_uc_set_processing_screen(
  1081.                                                         STR_GLOBAL_SAVING, 
  1082.                                                         STR_UC_PLEASE_WAIT_ID, 
  1083.                                                         IMG_GLOBAL_PROGRESS, 
  1084.                                                         0);
  1085.                                             
  1086.                                             mmi_uc_entry_processing_generic();        
  1087.                                         }
  1088.                                         mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_SENT);
  1089.                                     }
  1090.                                     break;
  1091.                                     case MMA_RESULT_FAIL_USER_CANCEL:
  1092.                                     {
  1093.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  1094.                                         {                                        
  1095.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  1096.                                         }
  1097.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1098.                                         {
  1099.                                             mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  1100.                                         }
  1101.                                         else
  1102.                                         {
  1103.                                             MMI_ASSERT(0);
  1104.                                         }
  1105.                                     }
  1106.                                     break;
  1107.                                     default:
  1108.                                     {
  1109.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1110.                                         /* Do not display processing screen in such cases. */
  1111.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1112.                                         {
  1113.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1114.                                                                          STR_UC_PLEASE_WAIT_ID, 
  1115.                                                                          IMG_GLOBAL_PROGRESS, 
  1116.                                                                          0);
  1117.                                             mmi_uc_entry_processing_generic();
  1118.                                         }
  1119.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  1120.                                         mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  1121.                                     }
  1122.                                     break;  
  1123.                                 }
  1124.                             }
  1125.                             else
  1126.                             {
  1127.                                 MMI_ASSERT(0);
  1128.                             }
  1129.                         }
  1130.                         break;
  1131.                         /* send and save, write new */
  1132.                         case MMI_UC_ACTION_SAVE:
  1133.                         {
  1134.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1135.                             {
  1136.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  1137.                                 {
  1138.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1139.                                     {
  1140.                                         mmi_uc_reset_msg();
  1141.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  1142.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  1143.                                         {
  1144.                                             GoBackHistory();
  1145.                                         }
  1146.                                         else
  1147.                                         {
  1148.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1149.                                         }   
  1150.                                         AlmEnableSPOF();                                        
  1151.                                     }
  1152.                                     else
  1153.                                     {
  1154.                                         MMI_ASSERT(0);
  1155.                                     }
  1156.                                 }
  1157.                                 else
  1158.                                 {
  1159.                                     if (g_uc_p->send_info.send_result == MMI_FRM_SMS_OK)
  1160.                                     {
  1161.                                         if (result == MMI_FRM_SMS_OK)
  1162.                                         {
  1163.                                             DisplayPopup(
  1164.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_SUCCESS),
  1165.                                                 IMG_SEND_SUCCESS_PIC_MSG,
  1166.                                                 1,
  1167.                                                 MESSAGES_POPUP_TIME_OUT,
  1168.                                                 (U8) SUCCESS_TONE);
  1169.                                         }
  1170.                                         else
  1171.                                         {
  1172.                                             DisplayPopup(
  1173.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_FAIL),
  1174.                                                 IMG_SEND_FAIL_PIC_MSG,
  1175.                                                 1,
  1176.                                                 MMI_UC_POPUP_TIME_OUT,
  1177.                                                 (U8) ERROR_TONE);
  1178.                                         }
  1179.                                     }
  1180.                                     else
  1181.                                     {
  1182.                                         if (result == MMI_FRM_SMS_OK)
  1183.                                         {
  1184.                                             DisplayPopup(
  1185.                                                 (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  1186.                                                 IMG_SEND_FAIL_PIC_MSG,
  1187.                                                 1,
  1188.                                                 MMI_UC_POPUP_TIME_OUT,
  1189.                                                 (U8) ERROR_TONE);
  1190.                                         }
  1191.                                         else
  1192.                                         {
  1193.                                             DisplayPopup(
  1194.                                                 (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  1195.                                                 IMG_SEND_FAIL_PIC_MSG,
  1196.                                                 1,
  1197.                                                 MMI_UC_POPUP_TIME_OUT,
  1198.                                                 (U8) ERROR_TONE);
  1199.                                         }
  1200.                                     }
  1201.                                     
  1202.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  1203.                                     {
  1204.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  1205.                                     }
  1206.                                     else
  1207.                                     {
  1208.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  1209.                                     }  
  1210.                                     mmi_uc_delete_sms_frm_screen();
  1211.                                 }
  1212.                                 mmi_uc_reset_msg();
  1213.                                 mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  1214.                                 AlmEnableSPOF();                                
  1215.                             }
  1216.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1217.                             {
  1218.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  1219.                                 {
  1220.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1221.                                     {
  1222.                                         mmi_uc_reset_msg();
  1223.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  1224.                                         {
  1225.                                             GoBackHistory();
  1226.                                         }
  1227.                                         else
  1228.                                         {
  1229.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1230.                                         }   
  1231.                                         AlmEnableSPOF();                                        
  1232.                                     }
  1233.                                     else
  1234.                                     {
  1235.                                         MMI_ASSERT(0);
  1236.                                     }
  1237.                                 }
  1238.                                 else
  1239.                                 {
  1240.                                     if (g_uc_p->send_info.send_result == MMA_RESULT_OK)
  1241.                                     {
  1242.                                         if (result == MMA_RESULT_OK)
  1243.                                         {
  1244.                                             DisplayPopup(
  1245.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_SUCCESS),
  1246.                                                 IMG_SEND_SUCCESS_PIC_MSG,
  1247.                                                 1,
  1248.                                                 MESSAGES_POPUP_TIME_OUT,
  1249.                                                 (U8) SUCCESS_TONE);
  1250.                                         }
  1251.                                         else
  1252.                                         {
  1253.                                             DisplayPopup(
  1254.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_FAIL),
  1255.                                                 IMG_SEND_FAIL_PIC_MSG,
  1256.                                                 1,
  1257.                                                 MMI_UC_POPUP_TIME_OUT,
  1258.                                                 (U8) ERROR_TONE);
  1259.                                         }
  1260.                                     }
  1261.                                     else
  1262.                                     {
  1263.                                         mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  1264.                                     }                                    
  1265.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD)
  1266.                                     {
  1267.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  1268.                                     }
  1269.                                     else
  1270.                                     {
  1271.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  1272.                                     }  
  1273.                                 }
  1274.                                 mmi_uc_reset_msg();
  1275.                                 AlmEnableSPOF();                                
  1276.                             }
  1277.                             else
  1278.                             {
  1279.                                 MMI_ASSERT(0);
  1280.                             }
  1281.                         }
  1282.                         break;
  1283.                         case MMI_UC_ACTION_DELETE:
  1284.                         {
  1285.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1286.                             {
  1287.                                 MMI_ASSERT(0);
  1288.                             }
  1289.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1290.                             {
  1291.                                 /* Deletion may fail in USB normal mode. */
  1292.                                 
  1293.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  1294.                                 {
  1295.                                     DisplayPopup(
  1296.                                             (PU8) GetString(STR_UC_ABORTED_ID),
  1297.                                             IMG_GLOBAL_ACTIVATED,
  1298.                                             1,
  1299.                                             MMI_UC_POPUP_TIME_OUT,
  1300.                                             (U8) SUCCESS_TONE);
  1301.                                     
  1302.                                     if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  1303.                                         g_uc_p->main.state == MMI_UC_STATE_SEND)
  1304.                                     {
  1305.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  1306.                                     }
  1307.                                     else
  1308.                                     {
  1309.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  1310.                                     }                                        
  1311.                                     AlmEnableSPOF();
  1312.                                 }
  1313.                                 else
  1314.                                 {
  1315.                                     MMI_ASSERT(0);     
  1316.                                 }
  1317.                                 
  1318.                             }
  1319.                             else
  1320.                             {
  1321.                                 MMI_ASSERT(0);
  1322.                             }             
  1323.                         }
  1324.                         break;
  1325.                         
  1326.                         /* send and save, write new */
  1327.                         default:
  1328.                         {
  1329.                             MMI_ASSERT(0);
  1330.                         }
  1331.                         break;
  1332.                     }
  1333.                 }
  1334.                 break; /* send and save, write new */
  1335.                 
  1336.                 case MMI_UC_STATE_EDIT_EXISTED_MSG:
  1337.                 case MMI_UC_STATE_SEND:
  1338.                 {
  1339.                     MMI_ASSERT(msg_box);
  1340.                     
  1341.                     if (g_uc_p->send_info.action == MMI_UC_STATE_SEND)
  1342.                     {
  1343.                         MMI_ASSERT(msg_box == UM_MSG_BOX_TYPE_UNSENT || 
  1344.                                    msg_box == UM_MSG_BOX_TYPE_DRAFT);
  1345.                     }
  1346.                     
  1347.                     switch (action)
  1348.                     {
  1349.                         /* send and save, edit */
  1350.                         case MMI_UC_ACTION_SEND:
  1351.                         {
  1352.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1353.                             {
  1354.                                 switch (result)
  1355.                                 {
  1356.                                     case MMI_FRM_SMS_OK:
  1357.                                     {
  1358.                                         if (msg_box == UM_MSG_BOX_TYPE_SENT)
  1359.                                         {
  1360.                                             mmi_um_set_highlight_msg(0);
  1361.                                         }
  1362.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1363.                                         /* Do not display processing screen in such cases. */
  1364.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1365.                                         {                                        
  1366.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1367.                                                                          STR_UC_PLEASE_WAIT_ID, 
  1368.                                                                          IMG_GLOBAL_PROGRESS, 
  1369.                                                                          0);
  1370.                                             mmi_uc_entry_processing_generic();
  1371.                                         }
  1372.                                         DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1373.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1374.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  1375.                                         {
  1376.                                             mmi_uc_addr_struct* addr = NULL;
  1377.                                             
  1378.                                             addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, 0);                                        
  1379.                                             mmi_uc_save_sms_after_send(SMSAL_STO_SENT, addr->addr);
  1380.                                         }
  1381.                                         else
  1382.                                         {
  1383.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1384.                                             {
  1385.                                                 mmi_frm_sms_delete_sms(
  1386.                                                     mmi_uc_delete_sms_callback, 
  1387.                                                     MOD_MMI, 
  1388.                                                     MMI_FRM_SMS_DRAFTS, 
  1389.                                                     g_uc_p->send_info.existed_msg_id );
  1390.                                             }
  1391.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1392.                                             {
  1393.                                                 mmi_uc_delete_existed_mms();
  1394.                                             }
  1395.                                             else
  1396.                                             {
  1397.                                                 MMI_ASSERT(0);
  1398.                                             }
  1399.                                         }
  1400.                                     }
  1401.                                     break;
  1402.                                     case MMI_FRM_SMS_ABORT:
  1403.                                     {
  1404.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  1405.                                         {                                        
  1406.                                             DisplayPopup(
  1407.                                                 (PU8) GetString(STR_UC_ABORTED_ID),
  1408.                                                 IMG_GLOBAL_ACTIVATED,
  1409.                                                 1,
  1410.                                                 MMI_UC_POPUP_TIME_OUT,
  1411.                                                 (U8) SUCCESS_TONE);
  1412.                                             
  1413.                                             if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  1414.                                                 g_uc_p->main.state == MMI_UC_STATE_SEND )
  1415.                                             {
  1416.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  1417.                                             }
  1418.                                             else
  1419.                                             {
  1420.                                                 mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  1421.                                             }                                           
  1422.                                             mmi_uc_delete_sms_frm_screen();
  1423.                                             AlmEnableSPOF();
  1424.                                         }
  1425.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1426.                                         {
  1427.                                             if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1428.                                                 msg_box == UM_MSG_BOX_TYPE_SENT)
  1429.                                             {
  1430.                                                 mmi_uc_addr_struct* addr = NULL;
  1431.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  1432.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  1433.                                                 AlmEnableSPOF();
  1434.                                             }
  1435.                                             else
  1436.                                             {
  1437.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  1438.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1439.                                                 {
  1440.                                                     mmi_frm_sms_delete_sms(
  1441.                                                         mmi_uc_delete_sms_callback, 
  1442.                                                         MOD_MMI, 
  1443.                                                         MMI_FRM_SMS_DRAFTS, 
  1444.                                                         g_uc_p->send_info.existed_msg_id );
  1445.                                                 }
  1446.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  1447.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1448.                                                 {
  1449.                                                     mmi_uc_addr_struct* addr = NULL;
  1450.                                                     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  1451.                                                     mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                    
  1452.                                                 }
  1453.                                                 else
  1454.                                                 {
  1455.                                                     MMI_ASSERT(0);
  1456.                                                 }                                                
  1457.                                             }
  1458.                                         }
  1459.                                         else
  1460.                                         {
  1461.                                             MMI_ASSERT(0);
  1462.                                         }
  1463.                                     }
  1464.                                     break;
  1465.                                     
  1466.                                     case MMI_FRM_SMS_NOTREADY:
  1467.                                     {
  1468.                                         DisplayPopup(
  1469.                                             (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  1470.                                             IMG_SEND_FAIL_PIC_MSG,
  1471.                                             1,
  1472.                                             MMI_UC_POPUP_TIME_OUT,
  1473.                                             (U8) ERROR_TONE);
  1474.                                         
  1475.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  1476.                                         AlmEnableSPOF();
  1477.                                     }
  1478.                                     break;
  1479.                                     case MMI_FRM_SMS_NUMINVALID:
  1480.                                     {
  1481.                                         DisplayPopup(
  1482.                                             (PU8) GetString(STR_ID_PHB_NUM_INVALID),
  1483.                                             IMG_GLOBAL_UNFINISHED,
  1484.                                             1,
  1485.                                             MMI_UC_POPUP_TIME_OUT,
  1486.                                             (U8) ERROR_TONE);
  1487.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_SENDING);   
  1488.                                         mmi_uc_delete_sms_frm_screen();
  1489.                                         AlmEnableSPOF();            
  1490.                                     }
  1491.                                     break;
  1492.                                     
  1493.                                     case MMI_FRM_SMS_RETURN:
  1494.                                     case MMI_FRM_SMS_END:
  1495.                                         break;
  1496.                                     default:
  1497.                                     {
  1498.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1499.                                         /* Do not display processing screen in such cases. */
  1500.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1501.                                         {
  1502.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1503.                                                                          STR_UC_PLEASE_WAIT_ID, 
  1504.                                                                          IMG_GLOBAL_PROGRESS, 
  1505.                                                                          0);
  1506.                                             mmi_uc_entry_processing_generic();
  1507.                                         }
  1508.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  1509.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1510.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  1511.                                         {
  1512.                                             mmi_uc_addr_struct* addr = NULL;
  1513.                                             
  1514.                                             addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);                                        
  1515.                                             mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                
  1516.                                         }
  1517.                                         else
  1518.                                         {
  1519.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT)
  1520.                                             {
  1521.                                                 mmi_um_set_highlight_msg(0);
  1522.                                             }
  1523.                                             
  1524.                                             /* save msg from SMS to SMS. Delete original one and then save new one. */
  1525.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1526.                                             {
  1527.                                                 mmi_frm_sms_delete_sms(
  1528.                                                     mmi_uc_delete_sms_callback, 
  1529.                                                     MOD_MMI, 
  1530.                                                     MMI_FRM_SMS_DRAFTS, 
  1531.                                                     g_uc_p->send_info.existed_msg_id );
  1532.                                             }
  1533.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  1534.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1535.                                             {
  1536.                                                 mmi_uc_addr_struct* addr = NULL;
  1537.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  1538.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                    
  1539.                                             }
  1540.                                             else
  1541.                                             {
  1542.                                                 MMI_ASSERT(0);
  1543.                                             }
  1544.                                         }                                        
  1545.                                     }
  1546.                                     break;                                    
  1547.                                 }    
  1548.                             }
  1549.                             /* send and save , edit*/
  1550.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1551.                             {
  1552.                                 switch (result)
  1553.                                 {
  1554.                                     case MMA_RESULT_OK:
  1555.                                     {
  1556.                                         if (g_uc_p->send_info.abort != MMI_UC_ABORT_NONE)
  1557.                                         {
  1558.                                             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  1559.                                                                  "*[UnifiedComposerMain.c] mmi_uc_action_fsm race condition for send_mms_rsp and cancel_mms_req *n"));
  1560.                                             
  1561.                                             g_uc_p->send_info.send_result = MMA_RESULT_FAIL_USER_CANCEL;
  1562.                                             mmi_uc_action_fsm(MMI_UC_ACTION_SEND, MMA_RESULT_FAIL_USER_CANCEL);
  1563.                                             return;
  1564.                                         }
  1565.                                         
  1566.                                         if (msg_box == UM_MSG_BOX_TYPE_SENT)
  1567.                                         {
  1568.                                             mmi_um_set_highlight_msg(0);
  1569.                                         }
  1570.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1571.                                         /* Do not display processing screen in such cases. */
  1572.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1573.                                         {                                        
  1574.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1575.                                                                       STR_UC_PLEASE_WAIT_ID, 
  1576.                                                                       IMG_GLOBAL_PROGRESS, 
  1577.                                                                       0);
  1578.                                             mmi_uc_entry_processing_generic();
  1579.                                         }
  1580.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  1581.                                        
  1582.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1583.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  1584.                                         {
  1585.                                             mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_SENT);
  1586.                                         }
  1587.                                         else
  1588.                                         {
  1589.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1590.                                             {
  1591.                                                 mmi_frm_sms_delete_sms(
  1592.                                                     mmi_uc_delete_sms_callback, 
  1593.                                                     MOD_MMI, 
  1594.                                                     MMI_FRM_SMS_DRAFTS, 
  1595.                                                     g_uc_p->send_info.existed_msg_id );
  1596.                                             }
  1597.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1598.                                             {
  1599.                                                 mmi_uc_delete_existed_mms();
  1600.                                             }
  1601.                                             else
  1602.                                             {
  1603.                                                 MMI_ASSERT(0);
  1604.                                             }
  1605.                                         }                                        
  1606.                                     }
  1607.                                     break;
  1608.                                     case MMA_RESULT_FAIL_USER_CANCEL:
  1609.                                     {
  1610.                                         if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  1611.                                         {                                        
  1612.                                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_MMS_PREFER);
  1613.                                         }
  1614.                                         else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1615.                                         {
  1616.                                             if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1617.                                                 msg_box == UM_MSG_BOX_TYPE_SENT)
  1618.                                             {
  1619.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  1620.                                             }
  1621.                                             else
  1622.                                             {
  1623.                                                 /* save msg from SMS to MMS. Save new one and then delete original one */
  1624.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1625.                                                 {
  1626.                                                     /*mmi_frm_sms_delete_sms(
  1627.                                                         mmi_uc_delete_sms_callback, 
  1628.                                                         MOD_MMI, 
  1629.                                                         MMI_FRM_SMS_DRAFTS, 
  1630.                                                         g_uc_p->send_info.existed_msg_id );*/
  1631.                                                         
  1632.                                                     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);                                                        
  1633.                                                 }
  1634.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  1635.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1636.                                                 {
  1637.                                                     mmi_uc_delete_existed_mms();
  1638.                                                 }
  1639.                                                 else
  1640.                                                 {
  1641.                                                     MMI_ASSERT(0);
  1642.                                                 }
  1643.                                             } 
  1644.                                         }
  1645.                                         else
  1646.                                         {
  1647.                                             MMI_ASSERT(0);
  1648.                                         }
  1649.                                     }
  1650.                                     break;
  1651.                                     default:
  1652.                                     {
  1653.                                         /* UC Screens may be deleted by other Apps, ex. USB normal mode.*/
  1654.                                         /* Do not display processing screen in such cases. */
  1655.                                         if (IsScreenPresent(SCR_ID_UC_OPT_DONE))
  1656.                                         {
  1657.                                             mmi_uc_set_processing_screen(STR_GLOBAL_SAVING, 
  1658.                                                                          STR_UC_PLEASE_WAIT_ID, 
  1659.                                                                          IMG_GLOBAL_PROGRESS, 
  1660.                                                                          0);
  1661.                                             mmi_uc_entry_processing_generic();
  1662.                                         }
  1663.                                         DeleteScreenIfPresent(SCR_ID_UC_SENDING);
  1664.                                         if (msg_box == UM_MSG_BOX_TYPE_INBOX ||
  1665.                                             msg_box == UM_MSG_BOX_TYPE_SENT)
  1666.                                         {
  1667.                                             mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  1668.                                         }
  1669.                                         else
  1670.                                         {
  1671.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT)
  1672.                                             {
  1673.                                                 mmi_um_set_highlight_msg(0);
  1674.                                             }
  1675.                                             
  1676.                                             /* save msg from SMS to MMS. Save new one and then delete original one */
  1677.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1678.                                             {
  1679.                                                 /*mmi_frm_sms_delete_sms(
  1680.                                                     mmi_uc_delete_sms_callback, 
  1681.                                                     MOD_MMI, 
  1682.                                                     MMI_FRM_SMS_DRAFTS, 
  1683.                                                     g_uc_p->send_info.existed_msg_id );*/
  1684.                                                     
  1685.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);                                                        
  1686.                                             }
  1687.                                             /* save msg from MMS to MMS. Delete original one and then save new one. */
  1688.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1689.                                             {
  1690.                                                 mmi_uc_delete_existed_mms();
  1691.                                             }
  1692.                                             else
  1693.                                             {
  1694.                                                 MMI_ASSERT(0);
  1695.                                             }
  1696.                                         }
  1697.                                     }
  1698.                                     break;  
  1699.                                 }
  1700.                             }
  1701.                             else
  1702.                             {
  1703.                                 MMI_ASSERT(0);
  1704.                             }
  1705.                         }
  1706.                         break;
  1707.                         /* send and save, edit */
  1708.                         case MMI_UC_ACTION_SAVE:
  1709.                         {
  1710.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1711.                             {                                
  1712.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  1713.                                 {
  1714.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1715.                                     {
  1716.                                         if (result == MMI_FRM_SMS_OK)
  1717.                                         {
  1718.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  1719.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1720.                                             {
  1721.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  1722.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1723.                                                 {
  1724.                                                     /* Do nothing. */
  1725.                                                 }
  1726.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  1727.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1728.                                                 {
  1729.                                                     mmi_uc_delete_existed_mms();
  1730.                                                     return;                                                                                               
  1731.                                                 }
  1732.                                                 else
  1733.                                                 {
  1734.                                                     MMI_ASSERT(0);
  1735.                                                 }
  1736.                                             }
  1737.                                         }
  1738.                                         mmi_uc_reset_msg();
  1739.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  1740.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  1741.                                         {
  1742.                                             GoBackHistory();
  1743.                                         }
  1744.                                         else
  1745.                                         {
  1746.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1747.                                         }   
  1748.                                         AlmEnableSPOF();                                        
  1749.                                     }
  1750.                                     else
  1751.                                     {
  1752.                                         MMI_ASSERT(0);
  1753.                                     }
  1754.                                 }
  1755.                                 else
  1756.                                 {
  1757.                                     if (g_uc_p->send_info.send_result == MMI_FRM_SMS_OK)
  1758.                                     {                                        
  1759.                                         if (result == MMI_FRM_SMS_OK)
  1760.                                         {
  1761.                                             DisplayPopup(
  1762.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_SUCCESS),
  1763.                                                 IMG_SEND_SUCCESS_PIC_MSG,
  1764.                                                 1,
  1765.                                                 MESSAGES_POPUP_TIME_OUT,
  1766.                                                 (U8) SUCCESS_TONE);
  1767.                                         }
  1768.                                         else
  1769.                                         {
  1770.                                             DisplayPopup(
  1771.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_FAIL),
  1772.                                                 IMG_SEND_FAIL_PIC_MSG,
  1773.                                                 1,
  1774.                                                 MMI_UC_POPUP_TIME_OUT,
  1775.                                                 (U8) ERROR_TONE);
  1776.                                         }
  1777.                                     }
  1778.                                     else
  1779.                                     {
  1780.                                         if (result == MMI_FRM_SMS_OK)
  1781.                                         {
  1782.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  1783.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1784.                                             {
  1785.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  1786.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1787.                                                 {
  1788.                                                     /* Do nothing. */
  1789.                                                 }
  1790.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  1791.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1792.                                                 {
  1793.                                                     mmi_uc_delete_existed_mms();
  1794.                                                     return;                                                                                               
  1795.                                                 }
  1796.                                                 else
  1797.                                                 {
  1798.                                                     MMI_ASSERT(0);
  1799.                                                 }
  1800.                                             }
  1801.                                             
  1802.                                             DisplayPopup(
  1803.                                                 (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  1804.                                                 IMG_SEND_FAIL_PIC_MSG,
  1805.                                                 1,
  1806.                                                 MMI_UC_POPUP_TIME_OUT,
  1807.                                                 (U8) ERROR_TONE);
  1808.                                         }
  1809.                                         else
  1810.                                         {
  1811.                                             DisplayPopup(
  1812.                                                 (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  1813.                                                 IMG_SEND_FAIL_PIC_MSG,
  1814.                                                 1,
  1815.                                                 MMI_UC_POPUP_TIME_OUT,
  1816.                                                 (U8) ERROR_TONE);
  1817.                                         }
  1818.                                     }
  1819.                                     
  1820.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  1821.                                     {
  1822.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  1823.                                     }
  1824.                                     else
  1825.                                     {
  1826.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  1827.                                     }  
  1828.                                     mmi_uc_delete_sms_frm_screen();
  1829.                                     mmi_uc_reset_msg();
  1830.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  1831.                                     AlmEnableSPOF();
  1832.                                 }                                                                
  1833.                             }
  1834.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1835.                             {
  1836.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  1837.                                 {
  1838.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1839.                                     {
  1840.                                         if (result == MMA_RESULT_OK)
  1841.                                         {
  1842.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  1843.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1844.                                             {
  1845.                                                 /* save msg from SMS to MMS. Save new one and then delete original one. */ 
  1846.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1847.                                                 {
  1848.                                                      mmi_frm_sms_delete_sms(
  1849.                                                         mmi_uc_delete_sms_callback, 
  1850.                                                         MOD_MMI, 
  1851.                                                         MMI_FRM_SMS_DRAFTS, 
  1852.                                                         g_uc_p->send_info.existed_msg_id );
  1853.                                                     return;
  1854.                                                 }
  1855.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  1856.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1857.                                                 {
  1858.                                                     /* Do nothing. */                                                                                                                                               
  1859.                                                 }
  1860.                                                 else
  1861.                                                 {
  1862.                                                     MMI_ASSERT(0);
  1863.                                                 }
  1864.                                             }
  1865.                                         }
  1866.                                         
  1867.                                         mmi_uc_reset_msg();
  1868.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  1869.                                         {
  1870.                                             GoBackHistory();
  1871.                                         }
  1872.                                         else
  1873.                                         {
  1874.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  1875.                                         }   
  1876.                                         AlmEnableSPOF();                                        
  1877.                                     }
  1878.                                     else
  1879.                                     {
  1880.                                         MMI_ASSERT(0);
  1881.                                     }
  1882.                                 }
  1883.                                 else
  1884.                                 {
  1885.                                     if (g_uc_p->send_info.send_result == MMA_RESULT_OK)
  1886.                                     {
  1887.                                         if (result == MMA_RESULT_OK)
  1888.                                         {
  1889.                                             DisplayPopup(
  1890.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_SUCCESS),
  1891.                                                 IMG_SEND_SUCCESS_PIC_MSG,
  1892.                                                 1,
  1893.                                                 MESSAGES_POPUP_TIME_OUT,
  1894.                                                 (U8) SUCCESS_TONE);
  1895.                                         }
  1896.                                         else
  1897.                                         {
  1898.                                             DisplayPopup(
  1899.                                                 (PU8) GetString(STR_UC_SEND_SUCCESS_SAVE_FAIL),
  1900.                                                 IMG_SEND_FAIL_PIC_MSG,
  1901.                                                 1,
  1902.                                                 MMI_UC_POPUP_TIME_OUT,
  1903.                                                 (U8) ERROR_TONE);
  1904.                                         }
  1905.                                     }
  1906.                                     else
  1907.                                     {
  1908.                                         if (result == MMA_RESULT_OK)
  1909.                                         {
  1910.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  1911.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1912.                                             {
  1913.                                                 /* save msg from SMS to MMS. Save new one and then delete original one. */ 
  1914.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1915.                                                 {
  1916.                                                      mmi_frm_sms_delete_sms(
  1917.                                                         mmi_uc_delete_sms_callback, 
  1918.                                                         MOD_MMI, 
  1919.                                                         MMI_FRM_SMS_DRAFTS, 
  1920.                                                         g_uc_p->send_info.existed_msg_id );
  1921.                                                     return;
  1922.                                                 }
  1923.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  1924.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1925.                                                 {
  1926.                                                     /* Do nothing. */                                                                                                                                               
  1927.                                                 }
  1928.                                                 else
  1929.                                                 {
  1930.                                                     MMI_ASSERT(0);
  1931.                                                 }
  1932.                                             }                                                                                        
  1933.                                         }
  1934.                                         
  1935.                                         mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  1936.                                     }                                    
  1937.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  1938.                                     {
  1939.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  1940.                                     }
  1941.                                     else
  1942.                                     {
  1943.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  1944.                                     }  
  1945.                                     mmi_uc_reset_msg();
  1946.                                     AlmEnableSPOF();                   
  1947.                                 }
  1948.                             }
  1949.                             else
  1950.                             {
  1951.                                 MMI_ASSERT(0);
  1952.                             }
  1953.                         }
  1954.                         break;
  1955.                         case MMI_UC_ACTION_DELETE:
  1956.                         {
  1957.                             if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1958.                             {                                
  1959.                                 if (g_uc_p->send_info.send_result == MMI_FRM_SMS_OK)
  1960.                                 {
  1961.                                     mmi_uc_addr_struct* addr = NULL;
  1962.                                     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, 0);  
  1963.                                     mmi_uc_save_sms_after_send(SMSAL_STO_SENT, addr->addr);
  1964.                                 }
  1965.                                 else if (g_uc_p->send_info.send_result == MMI_FRM_SMS_ABORT)
  1966.                                 {                                    
  1967.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  1968.                                     {
  1969.                                         if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  1970.                                             (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  1971.                                         {
  1972.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  1973.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  1974.                                             {
  1975.                                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  1976.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  1977.                                                 {                                                                                                    
  1978.                                                     mmi_uc_addr_struct* addr = NULL;
  1979.                                                     
  1980.                                                     addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  1981.                                                     mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);
  1982.                                                     return;
  1983.                                                     
  1984.                                                 }
  1985.                                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  1986.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  1987.                                                 {
  1988.                                                     /* Do nothing. */                                                                                                                                           
  1989.                                                 }
  1990.                                                 else
  1991.                                                 {
  1992.                                                     MMI_ASSERT(0);
  1993.                                                 }
  1994.                                             }
  1995.                                             else
  1996.                                             {
  1997.                                                 MMI_ASSERT(0);
  1998.                                             }                                                                                        
  1999.                                         }                                    
  2000.                                         mmi_uc_reset_msg();
  2001.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2002.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  2003.                                         {
  2004.                                             GoBackHistory();
  2005.                                         }
  2006.                                         else
  2007.                                         {
  2008.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2009.                                         }   
  2010.                                         AlmEnableSPOF();
  2011.                                     }
  2012.                                     else
  2013.                                     {
  2014.                                         MMI_ASSERT(0);
  2015.                                     }
  2016.                                 }
  2017.                                 else
  2018.                                 {
  2019.                                     if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  2020.                                         (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  2021.                                     {
  2022.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  2023.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  2024.                                         {
  2025.                                             /* save msg from SMS to SMS. Delete original one and then save new one. */
  2026.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2027.                                             {                                                
  2028.                                                 mmi_uc_addr_struct* addr = NULL;
  2029.                                                 
  2030.                                                 addr = mmi_uc_get_addr(MMI_UC_ADDRESS_GROUP_TYPE_TO, g_uc_p->send_info.curr_send_number);  
  2031.                                                 mmi_uc_save_sms_after_send(SMSAL_STO_UNSENT, addr->addr);                                                
  2032.                                                 return;    
  2033.                                             }
  2034.                                             /* save msg from MMS to SMS. Save new one and then delete original one. */
  2035.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2036.                                             {
  2037.                                                 /* Do nothing. */                                                                                                                                           
  2038.                                             }
  2039.                                             else
  2040.                                             {
  2041.                                                 MMI_ASSERT(0);
  2042.                                             }
  2043.                                         }
  2044.                                         else
  2045.                                         {
  2046.                                             MMI_ASSERT(0);
  2047.                                         }
  2048.                                         DisplayPopup(
  2049.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_SUCCESS),
  2050.                                             IMG_SEND_FAIL_PIC_MSG,
  2051.                                             1,
  2052.                                             MMI_UC_POPUP_TIME_OUT,
  2053.                                             (U8) ERROR_TONE);
  2054.                                     }
  2055.                                     else
  2056.                                     {                                        
  2057.                                         DisplayPopup(
  2058.                                             (PU8) GetString(STR_UC_SEND_FAIL_SAVE_FAIL),
  2059.                                             IMG_SEND_FAIL_PIC_MSG,
  2060.                                             1,
  2061.                                             MMI_UC_POPUP_TIME_OUT,
  2062.                                             (U8) ERROR_TONE);
  2063.                                     }                                    
  2064.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  2065.                                     {
  2066.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  2067.                                     }
  2068.                                     else
  2069.                                     {
  2070.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2071.                                     }   
  2072.                                     mmi_uc_delete_sms_frm_screen();
  2073.                                     mmi_uc_reset_msg();
  2074.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2075.                                     AlmEnableSPOF();
  2076.                                 }
  2077.                             }
  2078.                             else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2079.                             {
  2080.                                 if (g_uc_p->send_info.send_result == MMA_RESULT_OK)
  2081.                                 {
  2082.                                     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_SENT); 
  2083.                                 }
  2084.                                 else if (g_uc_p->send_info.send_result == MMA_RESULT_FAIL_USER_CANCEL)
  2085.                                 {
  2086.                                     if (g_uc_p->send_info.abort == MMI_UC_ABORT_NORMAL)
  2087.                                     {
  2088.                                         MMI_ASSERT(result == MMA_RESULT_OK);
  2089.                                         
  2090.                                         DisplayPopup(
  2091.                                             (PU8) GetString(STR_UC_ABORTED_ID),
  2092.                                             IMG_GLOBAL_ACTIVATED,
  2093.                                             1,
  2094.                                             MMI_UC_POPUP_TIME_OUT,
  2095.                                             (U8) SUCCESS_TONE);
  2096.                                         
  2097.                                         if (g_uc_p->main.state == MMI_UC_STATE_FORWARD ||
  2098.                                             g_uc_p->main.state == MMI_UC_STATE_SEND)
  2099.                                         {
  2100.                                             mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE_OPT, SCR_ID_UC_PROCESSING);
  2101.                                         }
  2102.                                         else
  2103.                                         {
  2104.                                             mmi_uc_delete_between_screens(SCR_ID_UC_OPT, SCR_ID_UC_PROCESSING);
  2105.                                         }                                           
  2106.                                         AlmEnableSPOF();
  2107.                                     }
  2108.                                     else if (g_uc_p->send_info.abort == MMI_UC_ABORT_BY_END_KEY)
  2109.                                     {
  2110.                                         if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  2111.                                             (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  2112.                                         {
  2113.                                             if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  2114.                                                 msg_box == UM_MSG_BOX_TYPE_DRAFT)
  2115.                                             {
  2116.                                                 /* save msg from SMS to MMS. Save new one and then delete original one. */
  2117.                                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2118.                                                 {                                                
  2119.                                                     /* Do nothing. */
  2120.                                                 }
  2121.                                                 /* save msg from MMS to MMS. Delete original one and then save new one. */
  2122.                                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2123.                                                 {
  2124.                                                     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  2125.                                                     return;
  2126.                                                 }
  2127.                                                 else
  2128.                                                 {
  2129.                                                     MMI_ASSERT(0);
  2130.                                                 }
  2131.                                             }
  2132.                                             else
  2133.                                             {
  2134.                                                 MMI_ASSERT(0);
  2135.                                             }
  2136.                                         }
  2137.                                         mmi_uc_reset_msg();
  2138.                                         if (GetExitScrnID() == SCR_ID_UC_PROCESSING)
  2139.                                         {
  2140.                                             GoBackHistory();
  2141.                                         }
  2142.                                         else
  2143.                                         {
  2144.                                             DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2145.                                         }   
  2146.                                         AlmEnableSPOF();
  2147.                                     }
  2148.                                     else 
  2149.                                     {
  2150.                                         MMI_ASSERT(0);
  2151.                                     }
  2152.                                 }
  2153.                                 else /* send fail*/
  2154.                                 {                                    
  2155.                                     if ((g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER && result == MMI_FRM_SMS_OK) ||
  2156.                                         (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER && result == MMA_RESULT_OK))
  2157.                                     {
  2158.                                         if (msg_box == UM_MSG_BOX_TYPE_UNSENT ||
  2159.                                             msg_box == UM_MSG_BOX_TYPE_DRAFT)
  2160.                                         {
  2161.                                             /* save msg from SMS to MMS. Save new one and then delete original one. */
  2162.                                             if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2163.                                             {                                                
  2164.                                                 /* Do nothing. */    
  2165.                                             }
  2166.                                             /* save msg from MMS to MMS. Delete original one and then save new one. */
  2167.                                             else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2168.                                             {
  2169.                                                 mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_OUTBOX);
  2170.                                                 return;
  2171.                                             }
  2172.                                             else
  2173.                                             {
  2174.                                                 MMI_ASSERT(0);
  2175.                                             }
  2176.                                         }
  2177.                                         else
  2178.                                         {
  2179.                                             MMI_ASSERT(0);
  2180.                                         }
  2181.                                     }
  2182.                                     mmi_uc_display_mma_send_result_popup(g_uc_p->send_info.send_result);
  2183.                                     if (g_uc_p->main.state == MMI_UC_STATE_SEND)
  2184.                                     {
  2185.                                         mmi_uc_delete_between_screens(SCR_ID_UC_OPT_DONE, SCR_ID_UC_PROCESSING);
  2186.                                     }
  2187.                                     else
  2188.                                     {
  2189.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2190.                                     }   
  2191.                                     mmi_uc_reset_msg();
  2192.                                     AlmEnableSPOF();
  2193.                                 }                                
  2194.                             }
  2195.                             else
  2196.                             {
  2197.                                 MMI_ASSERT(0);
  2198.                             }                            
  2199.                         }
  2200.                         break;
  2201.                         
  2202.                         /* send , write new */
  2203.                         default:
  2204.                         {
  2205.                             MMI_ASSERT(0);
  2206.                         }
  2207.                         break;
  2208.                     }
  2209.                 }
  2210.                 break;                                
  2211.                 default:
  2212.                 {
  2213.                     MMI_ASSERT(0);
  2214.                 }
  2215.                 break;
  2216.             }        
  2217.         }
  2218.         break;
  2219.         case MMI_UC_ACTION_SAVE:
  2220.         {
  2221.             UmMsgBoxType msg_box = mmi_um_get_current_msg_box_type();
  2222.             /* save */
  2223.             switch (g_uc_p->main.state)
  2224.             {
  2225.                 /* save, write new */
  2226.                 case MMI_UC_STATE_WRITE_NEW_MSG:
  2227.                 case MMI_UC_STATE_REPLY:
  2228.                 case MMI_UC_STATE_REPLY_ALL:
  2229.                 {
  2230.                     /* save, write new */
  2231.                     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2232.                     {
  2233.                         /* save, write new, sms */
  2234.                         if (action == MMI_UC_ACTION_SAVE)
  2235.                         {
  2236.                             if (result == MMI_FRM_SMS_OK)
  2237.                             {
  2238.                                 DisplayPopup(
  2239.                                     (PU8) GetString(STR_GLOBAL_DONE),
  2240.                                     IMG_GLOBAL_ACTIVATED,
  2241.                                     1,
  2242.                                     MESSAGES_POPUP_TIME_OUT,
  2243.                                     (U8) SUCCESS_TONE);
  2244.                             }
  2245.                             else
  2246.                             {
  2247.                                 DisplayPopup(
  2248.                                     (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
  2249.                                     IMG_GLOBAL_UNFINISHED,
  2250.                                     1,
  2251.                                     MESSAGES_POPUP_TIME_OUT,
  2252.                                     (U8) WARNING_TONE);                        
  2253.                             }
  2254.                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2255.                             mmi_uc_reset_msg();
  2256.                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2257.                             mmi_uc_delete_sms_frm_screen();
  2258.                             AlmEnableSPOF();
  2259.                         }
  2260.                         else
  2261.                         {
  2262.                             MMI_ASSERT(0);
  2263.                         }
  2264.                     }
  2265.                     /* save, write new */
  2266.                     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2267.                     {
  2268.                         /* save, write new, mms */
  2269.                         if (action == MMI_UC_ACTION_SAVE)
  2270.                         {
  2271.                             if (result == MMA_RESULT_OK)
  2272.                             {
  2273.                                 DisplayPopup(
  2274.                                     (PU8) GetString(STR_GLOBAL_DONE),
  2275.                                     IMG_GLOBAL_ACTIVATED,
  2276.                                     1,
  2277.                                     MESSAGES_POPUP_TIME_OUT,
  2278.                                     (U8) SUCCESS_TONE);
  2279.                             }
  2280.                             else
  2281.                             {
  2282.                                 DisplayPopup(
  2283.                                     (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
  2284.                                     IMG_GLOBAL_UNFINISHED,
  2285.                                     1,
  2286.                                     MESSAGES_POPUP_TIME_OUT,
  2287.                                     (U8) WARNING_TONE);                        
  2288.                             }
  2289.                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2290.                             mmi_uc_reset_msg();
  2291.                             AlmEnableSPOF();
  2292.                         }
  2293.                         else
  2294.                         {
  2295.                             MMI_ASSERT(0);
  2296.                         }
  2297.                         
  2298.                     }
  2299.                     else
  2300.                     {
  2301.                         MMI_ASSERT(0);
  2302.                     }                    
  2303.                 }
  2304.                 break;
  2305.                 /* save, edit existed */
  2306.                 case MMI_UC_STATE_EDIT_EXISTED_MSG:
  2307.                 {                    
  2308.                     /* save, edit */
  2309.                     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2310.                     {
  2311.                         /* save, edit, sms */
  2312.                         if (action == MMI_UC_ACTION_SAVE)
  2313.                         {                        
  2314.                             if (result == MMI_FRM_SMS_OK)
  2315.                             {                                                                
  2316.                                 if (msg_box == UM_MSG_BOX_TYPE_DRAFT || 
  2317.                                     (msg_box == UM_MSG_BOX_TYPE_UNSENT && g_uc_p->msg.to_num > 0))
  2318.                                 {
  2319.                                     /* save msg from SMS to SMS. Delete original one and then save new one. */
  2320.                                     if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2321.                                     {                                
  2322.                                         DisplayPopup(
  2323.                                             (PU8) GetString(STR_GLOBAL_DONE),
  2324.                                             IMG_GLOBAL_ACTIVATED,
  2325.                                             1,
  2326.                                             MESSAGES_POPUP_TIME_OUT,
  2327.                                             (U8) SUCCESS_TONE);
  2328.                                     }
  2329.                                     /* save msg from MMS to SMS. Save new one and then delete original one. */
  2330.                                     else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2331.                                     {
  2332.                                         mmi_uc_delete_existed_mms();
  2333.                                         return;
  2334.                                     }
  2335.                                     else
  2336.                                     {
  2337.                                         MMI_ASSERT(0);
  2338.                                     }
  2339.                                 }
  2340.                                 else
  2341.                                 {
  2342.                                     DisplayPopup(
  2343.                                         (PU8) GetString(STR_GLOBAL_DONE),
  2344.                                         IMG_GLOBAL_ACTIVATED,
  2345.                                         1,
  2346.                                         MESSAGES_POPUP_TIME_OUT,
  2347.                                         (U8) SUCCESS_TONE);
  2348.                                 }
  2349.                             }
  2350.                             else
  2351.                             {
  2352.                                 DisplayPopup(
  2353.                                     (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
  2354.                                     IMG_GLOBAL_UNFINISHED,
  2355.                                     1,
  2356.                                     MESSAGES_POPUP_TIME_OUT,
  2357.                                     (U8) WARNING_TONE);                        
  2358.                             }
  2359.                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2360.                             mmi_uc_reset_msg();
  2361.                             mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2362.                             mmi_uc_delete_sms_frm_screen();
  2363.                             AlmEnableSPOF();
  2364.                         }
  2365.                         else if (action == MMI_UC_ACTION_DELETE)
  2366.                         {                        
  2367.                             if (msg_box == UM_MSG_BOX_TYPE_DRAFT || 
  2368.                                (msg_box == UM_MSG_BOX_TYPE_UNSENT && g_uc_p->msg.to_num > 0))
  2369.                             {
  2370.                                 /* save msg from SMS to SMS. Delete original one and then save new one. */
  2371.                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2372.                                 {
  2373.                                     if (result == MMI_FRM_SMS_OK)
  2374.                                     {
  2375.                                         mmi_uc_save_sms_req();
  2376.                                     }
  2377.                                     else
  2378.                                     {
  2379.                                         DisplayPopup(
  2380.                                             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  2381.                                             IMG_GLOBAL_UNFINISHED,
  2382.                                             1,
  2383.                                             MESSAGES_POPUP_TIME_OUT,
  2384.                                             (U8) WARNING_TONE);
  2385.                                         
  2386.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2387.                                         mmi_uc_reset_msg();
  2388.                                         mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2389.                                         mmi_uc_delete_sms_frm_screen();
  2390.                                         AlmEnableSPOF();
  2391.                                     }                            
  2392.                                 }
  2393.                                 /* save msg from MMS to SMS. Save new one and then delete original one. */
  2394.                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2395.                                 {
  2396.                                     /* Deletion may fail in USB normal mode. */
  2397.                                     
  2398.                                     DisplayPopup(
  2399.                                             (PU8) GetString(STR_GLOBAL_DONE),
  2400.                                             IMG_GLOBAL_ACTIVATED,
  2401.                                             1,
  2402.                                             MESSAGES_POPUP_TIME_OUT,
  2403.                                             (U8) SUCCESS_TONE);
  2404.                                     mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2405.                                     mmi_uc_reset_msg();
  2406.                                     mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2407.                                     mmi_uc_delete_sms_frm_screen();
  2408.                                     AlmEnableSPOF();
  2409.                                 }
  2410.                                 else
  2411.                                 {
  2412.                                     MMI_ASSERT(0);
  2413.                                 }
  2414.                             }
  2415.                             else
  2416.                             {
  2417.                                 MMI_ASSERT(0);
  2418.                             }
  2419.                         }
  2420.                         else
  2421.                         {
  2422.                             MMI_ASSERT(0);
  2423.                         }
  2424.                     }
  2425.                     /* save, edit */
  2426.                     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2427.                     {
  2428.                         /* save, edit, mms */
  2429.                         if (action == MMI_UC_ACTION_SAVE)
  2430.                         {
  2431.                             if (result == MMA_RESULT_OK)
  2432.                             {
  2433.                                 if (msg_box == UM_MSG_BOX_TYPE_DRAFT)
  2434.                                 {
  2435.                                     /* save msg from SMS to MMS. Save new one and then delete original one. */
  2436.                                     if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2437.                                     {
  2438.                                         mmi_frm_sms_delete_sms(
  2439.                                             mmi_uc_delete_sms_callback, 
  2440.                                             MOD_MMI, 
  2441.                                             MMI_FRM_SMS_DRAFTS, 
  2442.                                             g_uc_p->send_info.existed_msg_id );
  2443.                                         return;
  2444.                                     }
  2445.                                     /* save msg from MMS to MMS. Delete original one and then save new one. */
  2446.                                     else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2447.                                     {
  2448.                                         DisplayPopup(
  2449.                                             (PU8) GetString(STR_GLOBAL_DONE),
  2450.                                             IMG_GLOBAL_ACTIVATED,
  2451.                                             1,
  2452.                                             MESSAGES_POPUP_TIME_OUT,
  2453.                                             (U8) SUCCESS_TONE);                                        
  2454.                                     }
  2455.                                     else
  2456.                                     {
  2457.                                         MMI_ASSERT(0);
  2458.                                     }
  2459.                                 }
  2460.                                 else
  2461.                                 {
  2462.                                     DisplayPopup(
  2463.                                         (PU8) GetString(STR_GLOBAL_DONE),
  2464.                                         IMG_GLOBAL_ACTIVATED,
  2465.                                         1,
  2466.                                         MESSAGES_POPUP_TIME_OUT,
  2467.                                         (U8) SUCCESS_TONE);
  2468.                                 }
  2469.                             }
  2470.                             else
  2471.                             {
  2472.                                 DisplayPopup(
  2473.                                     (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
  2474.                                     IMG_GLOBAL_UNFINISHED,
  2475.                                     1,
  2476.                                     MESSAGES_POPUP_TIME_OUT,
  2477.                                     (U8) WARNING_TONE);                        
  2478.                             }
  2479.                             mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2480.                             mmi_uc_reset_msg();
  2481.                             AlmEnableSPOF();
  2482.                         }
  2483.                         else if (action == MMI_UC_ACTION_DELETE)
  2484.                         {
  2485.                             if (msg_box == UM_MSG_BOX_TYPE_DRAFT)
  2486.                             {
  2487.                                 /* save msg from SMS to MMS. save new one and then delete original one . */
  2488.                                 if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2489.                                 {
  2490.                                     MMI_ASSERT(result == MMI_FRM_SMS_OK);
  2491.                                     DisplayPopup(
  2492.                                             (PU8) GetString(STR_GLOBAL_DONE),
  2493.                                             IMG_GLOBAL_ACTIVATED,
  2494.                                             1,
  2495.                                             MESSAGES_POPUP_TIME_OUT,
  2496.                                             (U8) SUCCESS_TONE);
  2497.                                     
  2498.                                     mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2499.                                     mmi_uc_reset_msg();
  2500.                                     AlmEnableSPOF();
  2501.                                 }
  2502.                                 /* save msg from MMS to MMS. delete original one and then Save new one. */
  2503.                                 else if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2504.                                 {
  2505.                                     if (result == MMA_RESULT_OK)
  2506.                                     {
  2507.                                         mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_DRAFT);
  2508.                                     }
  2509.                                     else
  2510.                                     {
  2511.                                         DisplayPopup(
  2512.                                             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  2513.                                             IMG_GLOBAL_UNFINISHED,
  2514.                                             1,
  2515.                                             MESSAGES_POPUP_TIME_OUT,
  2516.                                             (U8) WARNING_TONE);
  2517.                                         mmi_uc_delete_between_screens(SCR_ID_UC_EDITOR, SCR_ID_UC_PROCESSING);
  2518.                                         mmi_uc_reset_msg();
  2519.                                         AlmEnableSPOF();
  2520.                                     }
  2521.                                 }
  2522.                                 else
  2523.                                 {
  2524.                                     MMI_ASSERT(0);
  2525.                                 }
  2526.                             }
  2527.                             else
  2528.                             {
  2529.                                 MMI_ASSERT(0);
  2530.                             }
  2531.                         }
  2532.                         else
  2533.                         {
  2534.                             MMI_ASSERT(0);
  2535.                         }                        
  2536.                     }
  2537.                     else
  2538.                     {
  2539.                         MMI_ASSERT(0);
  2540.                     }             
  2541.                 }
  2542.                 break;
  2543.                 
  2544.                 default:
  2545.                 {
  2546.                     MMI_ASSERT(0);
  2547.                 }
  2548.                 break;
  2549.             }        
  2550.         }
  2551.         break; /* save */
  2552.         case MMI_UC_ACTION_SAVE_IN_BACKGROUND:
  2553.         {
  2554.             /* save in background*/
  2555.             switch (g_uc_p->main.state)
  2556.             {
  2557.                 /* save in background, write new */
  2558.                 case MMI_UC_STATE_WRITE_NEW_MSG:
  2559.                 case MMI_UC_STATE_REPLY:
  2560.                 case MMI_UC_STATE_REPLY_ALL:
  2561.                 case MMI_UC_STATE_EDIT_EXISTED_MSG:
  2562.                 {
  2563.                     /* save in background, write new */
  2564.                     if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
  2565.                     {
  2566.                         /* save, write new, sms */
  2567.                         if (action == MMI_UC_ACTION_SAVE)
  2568.                         {
  2569.                             mmi_uc_reset_msg();
  2570.                             /* The ems buffer would be reset in SMS framework. */
  2571.                             //mmi_uc_clear_msg_bearer(MMI_UC_MSG_TYPE_SMS_PREFER);
  2572.                             AlmEnableSPOF();
  2573.                         }
  2574.                         else
  2575.                         {
  2576.                             MMI_ASSERT(0);
  2577.                         }
  2578.                     }
  2579.                     /* save in background, write new */
  2580.                     else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
  2581.                     {
  2582.                         /* save in background, write new, mms */
  2583.                         if (action == MMI_UC_ACTION_SAVE)
  2584.                         {
  2585.                             mmi_uc_reset_msg();
  2586.                             AlmEnableSPOF();
  2587.                         }
  2588.                         else
  2589.                         {
  2590.                             MMI_ASSERT(0);
  2591.                         }                        
  2592.                     }
  2593.                     else
  2594.                     {
  2595.                         MMI_ASSERT(0);
  2596.                     }                    
  2597.                 }
  2598.                 break;
  2599.                 
  2600.                 default:
  2601.                 {
  2602.                     MMI_ASSERT(0);
  2603.                 }
  2604.                 break;
  2605.             }        
  2606.         }
  2607.         break; /* save in background */
  2608.         case MMI_UC_ACTION_IDLE:
  2609.         {
  2610.             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2611.                          "*[UnifiedComposerMain.c] mmi_uc_action_fsm IDLE DO Nothing *n"));        
  2612.         }
  2613.         break;
  2614.         
  2615.         default:
  2616.         {
  2617.             MMI_ASSERT(0);
  2618.         }
  2619.         break;
  2620.     }
  2621. }
  2622. /*****************************************************************************
  2623.  * FUNCTION
  2624.  *  mmi_uc_create_mms
  2625.  * DESCRIPTION
  2626.  *  Create MMS xml file
  2627.  * PARAMETERS
  2628.  *  void
  2629.  * RETURNS
  2630.  *  void
  2631.  *****************************************************************************/
  2632. void mmi_uc_create_mms(void)
  2633. {
  2634.     /*----------------------------------------------------------------*/
  2635.     /* Local Variables                                                */
  2636.     /*----------------------------------------------------------------*/
  2637.     S32 result;
  2638.     /*----------------------------------------------------------------*/
  2639.     /* Code Body                                                      */
  2640.     /*----------------------------------------------------------------*/
  2641.     mmi_uc_set_processing_screen(STR_UC_CREATING_ID, STR_UC_PLEASE_WAIT_ID, IMG_GLOBAL_PROGRESS, 0);
  2642.     mmi_uc_entry_processing_generic();
  2643.     
  2644.     result = mmi_uc_create_mms_xml_description_file();
  2645.     if (result == FS_NO_ERROR)
  2646.     {
  2647.         mmi_uc_create_mms_req();
  2648.     }
  2649.     else
  2650.     {
  2651.         if (result == FS_DISK_FULL)
  2652.         {
  2653.             DisplayPopup(
  2654.                 (PU8)GetString(STR_UC_STORAGE_FULL_DELETE_FILE_ID),
  2655.                 IMG_GLOBAL_UNFINISHED,
  2656.                 1,
  2657.                 MMI_UC_POPUP_TIME_OUT,
  2658.                 (U8) ERROR_TONE);         
  2659.         }
  2660.         else
  2661.         {
  2662.             DisplayPopup(
  2663.                 (PU8)GetString(GetFileSystemErrorString(result)),
  2664.                 IMG_GLOBAL_UNFINISHED,
  2665.                 1,
  2666.                 MMI_UC_POPUP_TIME_OUT,
  2667.                 (U8) ERROR_TONE);                        
  2668.         }
  2669.         DeleteScreenIfPresent(SCR_ID_UC_PROCESSING);
  2670.         /* reset state */
  2671.         g_uc_p->send_info.action = MMI_UC_ACTION_IDLE;
  2672.     }    
  2673. }
  2674. /*****************************************************************************
  2675.  * FUNCTION
  2676.  *  mmi_uc_send_mms
  2677.  * DESCRIPTION
  2678.  *  Send MMS msg
  2679.  * PARAMETERS
  2680.  *  void
  2681.  * RETURNS
  2682.  *  void
  2683.  *****************************************************************************/
  2684. void mmi_uc_send_mms(void)
  2685. {
  2686.     /*----------------------------------------------------------------*/
  2687.     /* Local Variables                                                */
  2688.     /*----------------------------------------------------------------*/
  2689.     /*----------------------------------------------------------------*/
  2690.     /* Code Body                                                      */
  2691.     /*----------------------------------------------------------------*/
  2692.     g_uc_p->send_info.percent = 0;
  2693.     mmi_uc_entry_sending_mms();
  2694.     mmi_uc_send_mms_req(FALSE, 0);
  2695. }
  2696. /*****************************************************************************
  2697.  * FUNCTION
  2698.  *  mmi_uc_send_and_save_mms
  2699.  * DESCRIPTION
  2700.  *  Send MMS msg
  2701.  * PARAMETERS
  2702.  *  void
  2703.  * RETURNS
  2704.  *  void
  2705.  *****************************************************************************/
  2706. void mmi_uc_send_and_save_mms(void)
  2707. {
  2708.     /*----------------------------------------------------------------*/
  2709.     /* Local Variables                                                */
  2710.     /*----------------------------------------------------------------*/
  2711.     /*----------------------------------------------------------------*/
  2712.     /* Code Body                                                      */
  2713.     /*----------------------------------------------------------------*/
  2714.     g_uc_p->send_info.percent = 0;
  2715.     mmi_uc_entry_sending_mms();
  2716.     mmi_uc_send_mms_req(TRUE, 0);
  2717. }
  2718. /*****************************************************************************
  2719.  * FUNCTION
  2720.  *  mmi_uc_save_mms
  2721.  * DESCRIPTION
  2722.  *  Send SMS msg
  2723.  * PARAMETERS
  2724.  *  void
  2725.  * RETURNS
  2726.  *  void
  2727.  *****************************************************************************/
  2728. void mmi_uc_save_mms(void)
  2729. {
  2730.     /*----------------------------------------------------------------*/
  2731.     /* Local Variables                                                */
  2732.     /*----------------------------------------------------------------*/
  2733.     
  2734.     /*----------------------------------------------------------------*/
  2735.     /* Code Body                                                      */
  2736.     /*----------------------------------------------------------------*/
  2737.     mmi_uc_set_processing_screen(
  2738.                 STR_GLOBAL_SAVING, 
  2739.                 STR_UC_PLEASE_WAIT_ID, 
  2740.                 IMG_GLOBAL_PROGRESS, 
  2741.                 0);
  2742.     
  2743.     mmi_uc_entry_processing_generic();        
  2744.     mmi_uc_save_mms_req(g_uc_p->send_info.new_msg_id, MMA_FOLDER_DRAFT);
  2745. }
  2746. /*****************************************************************************
  2747.  * FUNCTION
  2748.  *  mmi_uc_entry_sending_mms
  2749.  * DESCRIPTION
  2750.  *  Entry function of sending MMS msg
  2751.  * PARAMETERS
  2752.  *  void
  2753.  * RETURNS
  2754.  *  void
  2755.  *****************************************************************************/
  2756. void mmi_uc_entry_sending_mms(void)
  2757. {
  2758.     /*----------------------------------------------------------------*/
  2759.     /* Local Variables                                                */
  2760.     /*----------------------------------------------------------------*/
  2761.     /*----------------------------------------------------------------*/
  2762.     /* Code Body                                                      */
  2763.     /*----------------------------------------------------------------*/
  2764.     EntryNewScreen(SCR_ID_UC_SENDING, NULL, mmi_uc_entry_sending_mms, NULL);
  2765.     ShowCategory402Screen(
  2766.         (U8 *) GetString(STR_UC_SENDING_MMS_ID), 
  2767.         0,
  2768.         0, 
  2769.         0, 
  2770.         STR_GLOBAL_ABORT, 
  2771.         IMG_GLOBAL_BACK, 
  2772.         (U8 *) GetString(STR_UC_PLEASE_WAIT_ID), 
  2773.         g_uc_p->send_info.percent,
  2774.         NULL);
  2775.     
  2776.     GetCurrEndKeyDownHandler();
  2777.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2778.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  2779.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2780.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  2781.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  2782.         
  2783.     SetKeyHandler(mmi_uc_abort_send_mms_by_end_key, KEY_END, KEY_EVENT_DOWN);
  2784.     SetRightSoftkeyFunction(mmi_uc_abort_send_mms, KEY_EVENT_UP);
  2785. }
  2786. /*****************************************************************************
  2787.  * FUNCTION
  2788.  *  mmi_uc_update_sending_mms_percent
  2789.  * DESCRIPTION
  2790.  *  Update percent of sending MMS msg
  2791.  * PARAMETERS
  2792.  *  void
  2793.  * RETURNS
  2794.  *  void
  2795.  *****************************************************************************/
  2796. void mmi_uc_update_sending_mms_percent(U16 percent)
  2797. {
  2798.     /*----------------------------------------------------------------*/
  2799.     /* Local Variables                                                */
  2800.     /*----------------------------------------------------------------*/
  2801.     /*----------------------------------------------------------------*/
  2802.     /* Code Body                                                      */
  2803.     /*----------------------------------------------------------------*/
  2804.     if (GetExitScrnID() == SCR_ID_UC_SENDING)
  2805.     {
  2806.         if(percent != g_uc_p->send_info.percent)
  2807.         {
  2808.             g_uc_p->send_info.percent = percent;
  2809.             UpdateCategory402Value((U16)percent, NULL);
  2810.         }
  2811.     }
  2812.     else
  2813.     {
  2814.         g_uc_p->send_info.percent = percent;
  2815.     }
  2816. }
  2817. /*****************************************************************************
  2818.  * FUNCTION
  2819.  *  mmi_uc_abort_send_mms
  2820.  * DESCRIPTION
  2821.  *  Abort sending MMS by RSK
  2822.  * PARAMETERS
  2823.  *  void
  2824.  * RETURNS
  2825.  *  void
  2826.  *****************************************************************************/
  2827. void mmi_uc_abort_send_mms(void)
  2828. {
  2829.     /*----------------------------------------------------------------*/
  2830.     /* Local Variables                                                */
  2831.     /*----------------------------------------------------------------*/
  2832.     /*----------------------------------------------------------------*/
  2833.     /* Code Body                                                      */
  2834.     /*----------------------------------------------------------------*/
  2835.     g_uc_p->send_info.abort = MMI_UC_ABORT_NORMAL;