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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2002
  8. *
  9. *****************************************************************************/
  10. /*****************************************************************************
  11.  *
  12.  * Filename:
  13.  * ---------
  14.  *  jmms_drafts_ui.c
  15.  *
  16.  * Project:
  17.  * --------
  18.  *  MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *  This file contain the ui of dratfs folder in mms
  23.  *
  24.  * Author:
  25.  * -------
  26.  * -------
  27.  *
  28.  *============================================================================
  29.  *             HISTORY
  30.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  31.  *------------------------------------------------------------------------------
  32.  * removed!
  33.  *
  34.  * removed!
  35.  * removed!
  36.  * removed!
  37.  *
  38.  * removed!
  39.  * removed!
  40.  * removed!
  41.  *
  42.  * removed!
  43.  * removed!
  44.  * removed!
  45.  *
  46.  * removed!
  47.  * removed!
  48.  * removed!
  49.  *
  50.  * removed!
  51.  * removed!
  52.  * removed!
  53.  *
  54.  * removed!
  55.  * removed!
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  *
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  *
  102.  * removed!
  103.  * removed!
  104.  * removed!
  105.  *
  106.  * removed!
  107.  * removed!
  108.  * removed!
  109.  *
  110.  * removed!
  111.  * removed!
  112.  * removed!
  113.  *
  114.  * removed!
  115.  * removed!
  116.  * removed!
  117.  *
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  *
  122.  * removed!
  123.  * removed!
  124.  * removed!
  125.  *
  126.  *------------------------------------------------------------------------------
  127.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  128.  *============================================================================
  129.  ****************************************************************************/
  130. #ifndef _MMI_JMMSDRAFTSSECMMI_C
  131. #define _MMI_JMMSDRAFTSSECMMI_C
  132. /***************************************************************************** 
  133. * Include
  134. *****************************************************************************/
  135. // #if 0 //Pranav Commeneted
  136. #include "MMI_features.h"
  137. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  138. #include "PixtelDataTypes.h"
  139. #include "Unicodexdcl.h"
  140. #include "HistoryGprot.h"
  141. #include "GlobalDefs.h"
  142. #include "SettingProfile.h"
  143. #include "DebugInitDef.h"
  144. #include "CommonScreens.h"
  145. #include "EventsGprot.h"
  146. #include "wgui_inputs.h"
  147. #include "wgui_categories.h"
  148. #include "wgui_categories_inputs.h"
  149. #include "JMMSStoreHandling.h"
  150. #include "MainMenuDef.h"
  151. #include "JMMSStoreHandling.h"
  152. #include "JMMSConfig.h"
  153. #include "JMMSMainMMS.h"
  154. #include "JMMSUseDetails.h"
  155. #include "JMMSDrafts.h"
  156. #include <ddl.h>
  157. #include <jcal.h>
  158. #include <jcalnet.h>
  159. #include "jdi_wspdatatype.h"
  160. #include "jdi_transport.h"
  161. // #include "transport.h"
  162. #include "JMMSWriteMMS.h"
  163. // #include <jdi_miscutils.h>
  164. #include <jdi_communicator.h>
  165. #include <MessagingDatatypes.h>
  166. #include <MessagingAPI.h>
  167. #include "JMMSExdcl.h"
  168. #include "JMMSPushHandling.h"
  169. #include "JMMSCompose.h"
  170. #include <PrvMessagingDataTypes.h>
  171. #include <MM1DataTypes.h>
  172. #include <ComposeUtils.h>
  173. #include "JMMSCoreAPI.h"
  174. #include "JMMSResEnum.h"
  175. #include "JMMSMainMMS.h"
  176. #include "JMMSProtocols.h"
  177. #include "JMMSView.h"
  178. #include "JMMSMessageSettingsUtils.h"
  179. #include "JMMSTemplates.h"
  180. #ifdef __MMI_UNIFIED_MESSAGE__
  181. #include "UnifiedMessageDef.h"
  182. #include "UnifiedMessageProt.h"
  183. #include "JMMSUMHandling.h"
  184. #endif /* __MMI_UNIFIED_MESSAGE__ */
  185. #include "wapadp.h"  // compiler warning removal
  186. /***************************************************************************** 
  187. * Define
  188. *****************************************************************************/
  189. /***************************************************************************** 
  190. * Typedef 
  191. *****************************************************************************/
  192. /***************************************************************************** 
  193. * Local Variable
  194. *****************************************************************************/
  195. /***************************************************************************** 
  196. * Local Function
  197. *****************************************************************************/
  198. /***************************************************************************** 
  199. * Global Variable
  200. *****************************************************************************/
  201. /***************************************************************************** 
  202. * Global Function
  203. *****************************************************************************/
  204. U16 DeleteScreenFromToNnodes(U16 ScrId, U16 num_nodes);
  205. U8 DeleteFromScrUptoScr(U16 beyondScrnid, U16 tillScrnid);
  206. #ifndef __MMI_UNIFIED_MESSAGE__
  207. /*****************************************************************************
  208.  * FUNCTION
  209.  *  mmi_jmms_highlight_drafts
  210.  * DESCRIPTION
  211.  *  This function is highlight handler of Drafts menu item
  212.  * PARAMETERS
  213.  *  void
  214.  * RETURNS
  215.  *  void
  216.  *****************************************************************************/
  217. void mmi_jmms_highlight_drafts(void)
  218. {
  219.     /*----------------------------------------------------------------*/
  220.     /* Local Variables                                                */
  221.     /*----------------------------------------------------------------*/
  222.     /*----------------------------------------------------------------*/
  223.     /* Code Body                                                      */
  224.     /*----------------------------------------------------------------*/
  225.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  226.     SetLeftSoftkeyFunction(mmi_jmms_entry_drafts, KEY_EVENT_UP);
  227.     SetKeyHandler(mmi_jmms_entry_drafts, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  228.     SetKeyHandler(mmi_jmms_entry_drafts, KEY_WAP, KEY_EVENT_DOWN);
  229. }
  230. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  231. /*****************************************************************************
  232.  * FUNCTION
  233.  *  mmi_jmms_drafts_init
  234.  * DESCRIPTION
  235.  *  This function init the hilight handlers of drafts menu items.
  236.  *  This is called at boot up time
  237.  * PARAMETERS
  238.  *  void
  239.  * RETURNS
  240.  *  void
  241.  *****************************************************************************/
  242. void mmi_jmms_drafts_init(void)
  243. {
  244.     /*----------------------------------------------------------------*/
  245.     /* Local Variables                                                */
  246.     /*----------------------------------------------------------------*/
  247.     /*----------------------------------------------------------------*/
  248.     /* Code Body                                                      */
  249.     /*----------------------------------------------------------------*/
  250.     /* Drafts options Highlight handlers */
  251.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_VIEW, mmi_jmms_highlight_drafts_options_view);
  252.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_SENT, mmi_jmms_highlight_drafts_options_sent);
  253.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_EDIT_MESSAGE, mmi_jmms_highlight_drafts_options_edit_message);
  254.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_DELETE, mmi_jmms_highlight_drafts_options_delete);
  255.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_DELETE_ALL, mmi_jmms_highlight_drafts_options_delete_all);
  256.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_PROPERTIES, mmi_jmms_highlight_drafts_options_properties);
  257.     /* Drafts use details highlight handlers */
  258.     SetHiliteHandler(
  259.         MENU_ID_JMMS_DRAFTS_USE_DETAILS_ADDRESSES_ADD_TO_CONTACT,
  260.         mmi_jmms_highlight_options_use_details_add_to_contact);
  261.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_USE_DETAILS_ADDRESSES_CALL, mmi_jmms_highlight_options_use_details_call);
  262. //KP Jerry add on 2007-4-12 start
  263. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  264.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_USE_DETAILS_ADDRESSES_DAILIP, mmi_jmms_highlight_options_use_details_dialIP);
  265.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_USE_DETAILS_ADDRESSES_SENDSMS, mmi_jmms_highlight_options_use_details_sendsms);
  266.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_USE_DETAILS_ADDRESSES_SENDMMS, mmi_jmms_highlight_options_use_details_sendmms);
  267. #endif
  268. //KP Jerry add on 2007-4-12 end
  269. #ifdef __MMI_UNIFIED_MESSAGE__
  270.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_draft_options_use_number);
  271.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_SAVE_OBJECTS, mmi_jmms_highlight_draft_options_save_object);
  272. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  273.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_USE_DETAILS, mmi_jmms_highlight_drafts_options_use_details);
  274.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_options_use_details_number);
  275.     SetHiliteHandler(MENU_ID_JMMS_DRAFTS_OPTIONS_USE_DETAILS_EMAIL, mmi_jmms_highlight_options_use_details_email);
  276. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  277. }
  278. #ifndef __MMI_UNIFIED_MESSAGE__
  279. /*****************************************************************************
  280.  * FUNCTION
  281.  *  mmi_jmms_entry_drafts
  282.  * DESCRIPTION
  283.  *  pre entry fn for dratfs screen
  284.  * PARAMETERS
  285.  *  void
  286.  * RETURNS
  287.  *  void
  288.  *****************************************************************************/
  289. void mmi_jmms_entry_drafts(void)
  290. {
  291.     /*----------------------------------------------------------------*/
  292.     /* Local Variables                                                */
  293.     /*----------------------------------------------------------------*/
  294.     U8 total_num_msgs = 0;
  295.     JC_RETCODE eRet = JC_OK;
  296.     U16 currScrenID = 0;
  297.     /*----------------------------------------------------------------*/
  298.     /* Code Body                                                      */
  299.     /*----------------------------------------------------------------*/
  300.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &total_num_msgs);
  301.     if (eRet != JC_OK)
  302.     {
  303.         ASSERT(0);
  304.     }
  305.     /* set the open msg status- for At delete */
  306.     g_jmms_context->msg_open_status[0] = E_JMMS_DRAFTS;
  307.     g_jmms_context->msg_open_status[1] = 0;
  308.     if (total_num_msgs == 0)
  309.     {
  310.         DisplayPopup((U8*) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, JMMS_POPUP_TIME, EMPTY_LIST_TONE);
  311.         return;
  312.     }
  313.     g_jmms_context->store_context->nMsgs_in_Current_folder = total_num_msgs;
  314. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  315.     g_jmms_context->store_context->current_folder_name = E_JMMS_DRAFTS;
  316.     mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  317.     g_jmms_context->store_context->jmms_start_index = 1;
  318.     mmi_jmms_entry_get_msgs_progress_screen();
  319.     eRet = mmi_jmms_get_folder_msg_list(&(g_jmms_context->store_context->messages_list), MMI_JMMS_DRAFTS, total_num_msgs);
  320.     if (eRet != JC_OK || g_jmms_context->store_context->messages_list == NULL)
  321.     {
  322.         currScrenID = GetActiveScreenId();
  323.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  324.         if (currScrenID == SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN)
  325.         {
  326.             DisplayPopup(
  327.                 (U8*) GetString(STR_ID_JMMS_ERROR_GET_MSG_LIST),
  328.                 IMG_GLOBAL_ERROR,
  329.                 1,
  330.                 JMMS_POPUP_TIME,
  331.                 (U8) ERROR_TONE);
  332.             DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  333.         }
  334.         else
  335.         {
  336.             /* to avoid the show of pop up over Phone call or some other screen */
  337.             HistoryReplace(
  338.                 SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN,
  339.                 SCR_ID_JMMS_GET_MSGS_ERROR_SCREEN,
  340.                 mmi_jmms_entry_msgs_get_error_screen);
  341.         }
  342.     }
  343.     return;
  344. }
  345. /*****************************************************************************
  346.  * FUNCTION
  347.  *  mmi_jmms_entry_drafts_screen
  348.  * DESCRIPTION
  349.  *  Entry fn for drafts screen
  350.  * PARAMETERS
  351.  *  void
  352.  * RETURNS
  353.  *  void
  354.  *****************************************************************************/
  355. void mmi_jmms_entry_drafts_screen(void)
  356. {
  357.     /*----------------------------------------------------------------*/
  358.     /* Local Variables                                                */
  359.     /*----------------------------------------------------------------*/
  360.     PU8 gui_buffer; /* Buffer holding history data */
  361.     U8 num_item;    /* Stores no of children in the submenu */
  362.     JC_RETCODE eRet = JC_OK;
  363.     /*----------------------------------------------------------------*/
  364.     /* Code Body                                                      */
  365.     /*----------------------------------------------------------------*/
  366.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_DRAFTS, &num_item);
  367.     if (eRet != JC_OK)
  368.     {
  369.         ASSERT(0);
  370.     }
  371.     //if number of msga in fodelr is not same to as in global var then
  372.     //it means some has been recieved as user was in inbox so need to update
  373.     ///the msgs list
  374.     if (g_jmms_context->store_context->update_nmsgs_in_current_folder)
  375.     {
  376.         mmi_jmms_entry_drafts();
  377.         return;
  378.     }
  379.     EntryNewScreen(SCR_ID_JMMS_DRAFTS, NULL, mmi_jmms_entry_drafts_screen, NULL);
  380.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_DRAFTS);
  381.     SetParentHandler(MENU_ID_JMMS_DRAFTS);
  382.     RegisterHighlightHandler(mmi_jmms_folder_list_highlight_hdlr);
  383.     /* reset the open msg status- for At delete */
  384.     g_jmms_context->msg_open_status[0] = 0;
  385.     g_jmms_context->msg_open_status[1] = 0;
  386.     ShowCategory184Screen(
  387.         STR_ID_JMMS_DRAFTS,
  388.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  389.         STR_GLOBAL_OPTIONS,
  390.         IMG_GLOBAL_OPTIONS,
  391.         STR_GLOBAL_BACK,
  392.         IMG_GLOBAL_BACK,
  393.         g_jmms_context->store_context->nMsgs_in_Current_folder,
  394.         mmi_jmms_get_item_data_drafts,
  395.         mmi_jmms_get_item_hint_drafts,
  396.         g_jmms_context->nCurr_scr_hilited_index,
  397.         gui_buffer);
  398.     SetLeftSoftkeyFunction(mmi_jmms_entry_drafts_options_scren, KEY_EVENT_UP);
  399.     SetKeyHandler(mmi_jmms_entry_drafts_options_scren, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  400.     SetKeyHandler(mmi_jmms_entry_drafts_options_scren, KEY_WAP, KEY_EVENT_DOWN);
  401.     SetRightSoftkeyFunction(mmi_jmms_back_from_msgs_list_screen, KEY_EVENT_UP);
  402.     SetKeyHandler(mmi_jmms_back_from_msgs_list_screen, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  403. }
  404. /*****************************************************************************
  405.  * FUNCTION
  406.  *  mmi_jmms_get_item_data_drafts
  407.  * DESCRIPTION
  408.  *  fn retrun the item data
  409.  * PARAMETERS
  410.  *  item_index          [IN]        (index of item to be drawn)
  411.  *  str_buff            [IN]        (string of item)
  412.  *  img_buff_p          [?]         [?]         (image corrsponding to item
  413.  *  str_img_mask        [IN]        
  414.  * RETURNS
  415.  *  void
  416.  *****************************************************************************/
  417. pBOOL mmi_jmms_get_item_data_drafts(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  418. {
  419.     /*----------------------------------------------------------------*/
  420.     /* Local Variables                                                */
  421.     /*----------------------------------------------------------------*/
  422.     S32 count = 0;
  423.     jmms_folder_msgs_list *msgs_list_node = NULL;
  424.     /*----------------------------------------------------------------*/
  425.     /* Code Body                                                      */
  426.     /*----------------------------------------------------------------*/
  427.     if ((item_index < 0) || (item_index > MAX_POSSIBLE_MESSAGES))
  428.     {
  429.         return FALSE;
  430.     }
  431.     msgs_list_node = g_jmms_context->store_context->messages_list;
  432.     while (count != item_index && msgs_list_node != NULL)
  433.     {
  434.         msgs_list_node = msgs_list_node->next;
  435.         count++;
  436.     }
  437.     if (msgs_list_node == NULL)
  438.     {
  439.         return FALSE;
  440.     }
  441.     pfnUnicodeStrcpy((S8*) str_buff, msgs_list_node->subject_as_caption);
  442.     /* /TODO:: may need to change the icon */
  443.     *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_SENT_MMS));
  444.     return TRUE;
  445. }
  446. /*****************************************************************************
  447.  * FUNCTION
  448.  *  mmi_jmms_get_item_hint_drafts
  449.  * DESCRIPTION
  450.  *  Retrun the hint fot the item to be drawn
  451.  * PARAMETERS
  452.  *  item_index      [IN]        (index of item to be drawn)
  453.  *  hint_array      [?]         [?]         (hint buufer for the item_index)
  454.  * RETURNS
  455.  *  void
  456.  *****************************************************************************/
  457. S32 mmi_jmms_get_item_hint_drafts(S32 item_index, UI_string_type *hint_array)
  458. {
  459.     /*----------------------------------------------------------------*/
  460.     /* Local Variables                                                */
  461.     /*----------------------------------------------------------------*/
  462.     S32 count = 0;
  463.     jmms_folder_msgs_list *msgs_list_node = NULL;
  464.     /*----------------------------------------------------------------*/
  465.     /* Code Body                                                      */
  466.     /*----------------------------------------------------------------*/
  467.     if ((item_index < 0) || (item_index > MAX_POSSIBLE_MESSAGES))
  468.     {
  469.         return FALSE;
  470.     }
  471.     msgs_list_node = g_jmms_context->store_context->messages_list;
  472.     while (count != item_index && msgs_list_node != NULL)
  473.     {
  474.         msgs_list_node = msgs_list_node->next;
  475.         count++;
  476.     }
  477.     if (msgs_list_node == NULL || msgs_list_node->address_as_hint == NULL)
  478.     {
  479.         return 0;
  480.     }
  481.     if (pfnUnicodeStrlen((S8*) (msgs_list_node->address_as_hint)))
  482.     {
  483.         pfnUnicodeStrcpy((S8*) hint_array[0], (S8*) (msgs_list_node->address_as_hint));
  484.     }
  485.     else
  486.     {
  487.         return 0;   /* No Hint Data */
  488.     }
  489.     return TRUE;
  490. }
  491. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  492. /*****************************************************************************
  493.  * FUNCTION
  494.  *  mmi_jmms_entry_drafts_options_scren
  495.  * DESCRIPTION
  496.  *  Entry fn for drafts options screen
  497.  * PARAMETERS
  498.  *  void
  499.  * RETURNS
  500.  *  void
  501.  *****************************************************************************/
  502. void mmi_jmms_entry_drafts_options_scren(void)
  503. {
  504.     /*----------------------------------------------------------------*/
  505.     /* Local Variables                                                */
  506.     /*----------------------------------------------------------------*/
  507.     PU8 gui_buffer;                     /* Buffer holding history data */
  508.     U16 str_item_list[MAX_SUB_MENUS];   /* Stores the strings id of submenus returned */
  509.     U16 num_item;                       /* Stores no of children in the submenu */
  510.     U16 menuid;
  511.     MMI_BOOL bContainsAdd = MMI_TRUE;
  512. #ifdef __MMI_UNIFIED_MESSAGE__
  513.     U8 curr_page =0;
  514.     MEDIA_INFO *image_info;
  515.     U8 media_count = 0;
  516. #else 
  517.     S32 count = 0;
  518. #endif
  519.     jmms_folder_msgs_list *msgs_list_node = NULL;
  520.     /*----------------------------------------------------------------*/
  521.     /* Code Body                                                      */
  522.     /*----------------------------------------------------------------*/
  523.     /* /check whether selected msg has some adress */
  524.     msgs_list_node = g_jmms_context->store_context->messages_list;
  525. #ifdef __MMI_UNIFIED_MESSAGE__
  526.     while ( msgs_list_node != NULL && msgs_list_node->msg_index != g_jmms_context->nCurr_scr_hilited_index)
  527.     {
  528.         msgs_list_node = msgs_list_node->next;
  529.     }
  530. #else
  531.     while (count != g_jmms_context->nCurr_scr_hilited_index && msgs_list_node != NULL)
  532.     {
  533.         msgs_list_node = msgs_list_node->next;
  534.         count++;
  535.     }
  536. #endif
  537.     /* /if hint is NULL then it means no address is present */
  538. #ifdef __MMI_UNIFIED_MESSAGE__
  539.     if (msgs_list_node->um_msg_info->address == NULL)
  540. #else 
  541.     if (msgs_list_node->address_as_hint == NULL)
  542. #endif 
  543.     {
  544.         bContainsAdd = MMI_FALSE;
  545.     }
  546. #ifndef __MMI_UNIFIED_MESSAGE__
  547.     if (bContainsAdd == MMI_TRUE)
  548.     {
  549.         menuid = MENU_ID_JMMS_DRAFTS_OPTIONS1;
  550.     }
  551.     else if (bContainsAdd == MMI_FALSE)
  552.     {
  553.         menuid = MENU_ID_JMMS_DRAFTS_OPTIONS2;
  554.     }
  555.     else
  556.     {
  557.         return;
  558.     }
  559. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  560.     menuid = MENU_ID_JMMS_DRAFTS_OPTIONS1;
  561. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  562.     EntryNewScreen(SCR_ID_JMMS_DRAFTS_OPTIONS, NULL, mmi_jmms_entry_drafts_options_scren, NULL);
  563.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_DRAFTS_OPTIONS);
  564. #ifdef __MMI_UNIFIED_MESSAGE__
  565.     DeleteScreenIfPresent(SCR_ID_JMMS_DRAFTS_OPTIONS);
  566. #endif 
  567.     num_item = GetNumOfChild(menuid);
  568. #ifdef __MMI_UNIFIED_MESSAGE__
  569.     mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 0, &media_count, E_TRUE);
  570.     mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  571.     image_info = mmi_jmms_jdi_get_image_data(curr_page);
  572.     if (g_jmms_context->view_context != NULL)
  573.     {
  574.         if (/*g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_IMAGE ||
  575.             g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_AUDIO ||
  576.             g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_VIDEO ||
  577.             */
  578.             media_count || g_jmms_context->view_context->view_audio_id || g_jmms_context->view_context->view_video_id || image_info != NULL)
  579.         {
  580.             mmi_frm_unhide_menu_item(MENU_ID_JMMS_DRAFTS_OPTIONS_SAVE_OBJECTS);
  581.         }
  582.         else
  583.         {
  584.             mmi_frm_hide_menu_item(MENU_ID_JMMS_DRAFTS_OPTIONS_SAVE_OBJECTS);
  585.             num_item--;
  586.         }
  587.     }
  588.     else
  589.     {
  590.         mmi_frm_hide_menu_item(MENU_ID_JMMS_DRAFTS_OPTIONS_SAVE_OBJECTS);
  591.         num_item--;
  592.     }
  593. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  594.     GetSequenceStringIds_Ext(menuid, str_item_list);
  595.     SetParentHandler(menuid);
  596.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  597. #ifndef __MMI_UNIFIED_MESSAGE__
  598.     /* set the open msg status- for At delete */
  599.     g_jmms_context->msg_open_status[0] = E_JMMS_DRAFTS;
  600.     //PMT HIMANSHU START 20060425
  601.     //      g_jmms_context->msg_open_status[1]=(U16)(g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  602.     g_jmms_context->msg_open_status[1] =
  603.         (U32) mmi_jmms_get_message_id(
  604.                 MMI_JMMS_DRAFTS,
  605.                 (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index));
  606.     /* PMT HIMANSHU END 20060425 */
  607. #endif
  608.     ShowCategory52Screen(
  609.         STR_GLOBAL_OPTIONS,
  610.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  611.         STR_GLOBAL_OK,
  612.         IMG_GLOBAL_OK,
  613.         STR_GLOBAL_BACK,
  614.         IMG_GLOBAL_BACK,
  615.         num_item,
  616.         str_item_list,
  617.         (U16*) gIndexIconsImageList,
  618.         NULL,
  619.         0,
  620.         0,
  621.         gui_buffer);
  622.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  623.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  624. }
  625. /*****************************************************************************
  626.  * FUNCTION
  627.  *  mmi_jmms_highlight_drafts_options_view
  628.  * DESCRIPTION
  629.  *  highlight hdlr of view menu item in Drafts options
  630.  * PARAMETERS
  631.  *  void
  632.  * RETURNS
  633.  *  void
  634.  *****************************************************************************/
  635. void mmi_jmms_highlight_drafts_options_view(void)
  636. {
  637.     /*----------------------------------------------------------------*/
  638.     /* Local Variables                                                */
  639.     /*----------------------------------------------------------------*/
  640.     /*----------------------------------------------------------------*/
  641.     /* Code Body                                                      */
  642.     /*----------------------------------------------------------------*/
  643.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  644. #ifdef __MMI_UNIFIED_MESSAGE__
  645. SetLeftSoftkeyFunction(mmi_jmms_pre_entry_view, KEY_EVENT_UP);
  646. SetKeyHandler(mmi_jmms_pre_entry_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  647.     SetKeyHandler(mmi_jmms_pre_entry_view, KEY_WAP, KEY_EVENT_DOWN);
  648. #else
  649. SetLeftSoftkeyFunction(mmi_jmms_drafts_view, KEY_EVENT_UP);
  650. /* MAUI_00018463 Start */
  651.   //  SetKeyHandler(mmi_jmms_drafts_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  652. /* MAUI_00018463 End */
  653.     SetKeyHandler(mmi_jmms_drafts_view, KEY_WAP, KEY_EVENT_DOWN); 
  654. #endif
  655. }
  656. /*****************************************************************************
  657.  * FUNCTION
  658.  *  mmi_jmms_highlight_drafts_options_sent
  659.  * DESCRIPTION
  660.  *  highlight hdlr of drafts menu item in Drafts options
  661.  * PARAMETERS
  662.  *  void
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. void mmi_jmms_highlight_drafts_options_sent(void)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     /*----------------------------------------------------------------*/
  672.     /* Code Body                                                      */
  673.     /*----------------------------------------------------------------*/
  674.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  675.     SetLeftSoftkeyFunction(mmi_jmms_drafts_sent, KEY_EVENT_UP);
  676.     SetKeyHandler(mmi_jmms_drafts_sent, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  677.     SetKeyHandler(mmi_jmms_drafts_sent, KEY_WAP, KEY_EVENT_DOWN);
  678. }
  679. /*****************************************************************************
  680.  * FUNCTION
  681.  *  mmi_jmms_highlight_drafts_options_edit_message
  682.  * DESCRIPTION
  683.  *  highlight hdlr of edit message menu item in Drafts options
  684.  * PARAMETERS
  685.  *  void
  686.  * RETURNS
  687.  *  void
  688.  *****************************************************************************/
  689. void mmi_jmms_highlight_drafts_options_edit_message(void)
  690. {
  691.     /*----------------------------------------------------------------*/
  692.     /* Local Variables                                                */
  693.     /*----------------------------------------------------------------*/
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  698. #ifdef __MMI_UNIFIED_MESSAGE__
  699.     SetLeftSoftkeyFunction(mmi_jmms_pre_drafts_edit_message, KEY_EVENT_UP);
  700.     SetKeyHandler(mmi_jmms_pre_drafts_edit_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  701.     SetKeyHandler(mmi_jmms_pre_drafts_edit_message, KEY_WAP, KEY_EVENT_DOWN);
  702. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  703.     SetLeftSoftkeyFunction(mmi_jmms_drafts_edit_message, KEY_EVENT_UP);
  704.     SetKeyHandler(mmi_jmms_drafts_edit_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  705.     SetKeyHandler(mmi_jmms_drafts_edit_message, KEY_WAP, KEY_EVENT_DOWN);
  706. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  707. }
  708. /*****************************************************************************
  709.  * FUNCTION
  710.  *  mmi_jmms_highlight_drafts_options_delete
  711.  * DESCRIPTION
  712.  *  highlight hdlr of delete menu item in Drafts options
  713.  * PARAMETERS
  714.  *  void
  715.  * RETURNS
  716.  *  void
  717.  *****************************************************************************/
  718. void mmi_jmms_highlight_drafts_options_delete(void)
  719. {
  720.     /*----------------------------------------------------------------*/
  721.     /* Local Variables                                                */
  722.     /*----------------------------------------------------------------*/
  723.     /*----------------------------------------------------------------*/
  724.     /* Code Body                                                      */
  725.     /*----------------------------------------------------------------*/
  726.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  727.     SetLeftSoftkeyFunction(mmi_jmms_drafts_pre_delete, KEY_EVENT_UP);
  728.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  729.     SetKeyHandler(mmi_jmms_drafts_pre_delete, KEY_WAP, KEY_EVENT_DOWN);
  730. }
  731. /*****************************************************************************
  732.  * FUNCTION
  733.  *  mmi_jmms_highlight_drafts_options_delete_all
  734.  * DESCRIPTION
  735.  *  highlight hdlr of delete all menu item in Drafts options
  736.  * PARAMETERS
  737.  *  void
  738.  * RETURNS
  739.  *  void
  740.  *****************************************************************************/
  741. void mmi_jmms_highlight_drafts_options_delete_all(void)
  742. {
  743.     /*----------------------------------------------------------------*/
  744.     /* Local Variables                                                */
  745.     /*----------------------------------------------------------------*/
  746.     /*----------------------------------------------------------------*/
  747.     /* Code Body                                                      */
  748.     /*----------------------------------------------------------------*/
  749.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  750.     SetLeftSoftkeyFunction(mmi_jmms_drafts_delete_all, KEY_EVENT_UP);
  751.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  752.     SetKeyHandler(mmi_jmms_drafts_delete_all, KEY_WAP, KEY_EVENT_DOWN);
  753. }
  754. /*****************************************************************************
  755.  * FUNCTION
  756.  *  mmi_jmms_highlight_drafts_options_use_details
  757.  * DESCRIPTION
  758.  *  highlight hdlr of use details menu item in Drafts options
  759.  * PARAMETERS
  760.  *  void
  761.  * RETURNS
  762.  *  void
  763.  *****************************************************************************/
  764. #ifndef __MMI_UNIFIED_MESSAGE__
  765. void mmi_jmms_highlight_drafts_options_use_details(void)
  766. #else 
  767. void mmi_jmms_highlight_draft_options_use_number(void)
  768. #endif 
  769. {
  770.     /*----------------------------------------------------------------*/
  771.     /* Local Variables                                                */
  772.     /*----------------------------------------------------------------*/
  773.     /*----------------------------------------------------------------*/
  774.     /* Code Body                                                      */
  775.     /*----------------------------------------------------------------*/
  776.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  777.     SetLeftSoftkeyFunction(mmi_jmms_drafts_use_details, KEY_EVENT_UP);
  778.     SetKeyHandler(mmi_jmms_drafts_use_details, KEY_SEND, KEY_EVENT_UP);
  779.     SetKeyHandler(mmi_jmms_drafts_use_details, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  780.     SetKeyHandler(mmi_jmms_drafts_use_details, KEY_WAP, KEY_EVENT_DOWN);
  781. }
  782. /*****************************************************************************
  783.  * FUNCTION
  784.  *  mmi_jmms_highlight_drafts_options_properties
  785.  * DESCRIPTION
  786.  *  highlight hdlr of properties menu item in Drafts options
  787.  * PARAMETERS
  788.  *  void
  789.  * RETURNS
  790.  *  void
  791.  *****************************************************************************/
  792. void mmi_jmms_highlight_drafts_options_properties(void)
  793. {
  794.     /*----------------------------------------------------------------*/
  795.     /* Local Variables                                                */
  796.     /*----------------------------------------------------------------*/
  797.     /*----------------------------------------------------------------*/
  798.     /* Code Body                                                      */
  799.     /*----------------------------------------------------------------*/
  800.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  801.     SetLeftSoftkeyFunction(mmi_jmms_drafts_properties, KEY_EVENT_UP);
  802.     SetKeyHandler(mmi_jmms_drafts_properties, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  803.     SetKeyHandler(mmi_jmms_drafts_properties, KEY_WAP, KEY_EVENT_DOWN);
  804. }
  805. /*****************************************************************************
  806.  * FUNCTION
  807.  *  mmi_jmms_drafts_view
  808.  * DESCRIPTION
  809.  *  
  810.  * PARAMETERS
  811.  *  void
  812.  * RETURNS
  813.  *  void
  814.  *****************************************************************************/
  815. void mmi_jmms_drafts_view(void)
  816. {
  817.     /*----------------------------------------------------------------*/
  818.     /* Local Variables                                                */
  819.     /*----------------------------------------------------------------*/
  820.     JC_RETCODE eRet = JC_OK;
  821.     CONTENT_DATA Content = {0, };
  822.     U8 msg_index = 0;
  823.     /*----------------------------------------------------------------*/
  824.     /* Code Body                                                      */
  825.     /*----------------------------------------------------------------*/
  826.     msg_index = g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index;
  827.     Content.bIsStream = E_TRUE;
  828.     eRet = mmi_jmms_get_message("Drafts", &Content, (msg_index));
  829.     if (eRet != JC_OK)
  830.     {
  831.         goto END;
  832.     }
  833. #ifdef __MMI_UNIFIED_MESSAGE__
  834. mmi_jmms_deinit_view();  
  835. #endif 
  836.     eRet = mmi_jmms_pre_entry_mms_view(&Content);
  837.     if (eRet == JC_ERR_MMS_PARSE_PENDING)
  838.     {
  839.         return;
  840.     }
  841.   END:
  842.     if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  843.     {
  844.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  845.         g_jmms_context->msg_handle = NULL;
  846.     }
  847.     if (eRet != JC_OK)
  848.     {
  849.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  850.     }
  851. }
  852. /*****************************************************************************
  853.  * FUNCTION
  854.  *  mmi_jmms_drafts_sent
  855.  * DESCRIPTION
  856.  *  
  857.  * PARAMETERS
  858.  *  void
  859.  * RETURNS
  860.  *  void
  861.  *****************************************************************************/
  862. void mmi_jmms_drafts_sent(void)
  863. {
  864.     /*----------------------------------------------------------------*/
  865.     /* Local Variables                                                */
  866.     /*----------------------------------------------------------------*/
  867.     /* CONTENT_DATA Content = {0, }; */
  868.     JC_RETCODE eRet = JC_OK;
  869. #ifdef __MMI_UNIFIED_MESSAGE__
  870. jmms_folder_msgs_list *msgs_list_node = NULL;
  871. #else
  872. JC_INT32 index = 0;
  873. #endif
  874.     /*----------------------------------------------------------------*/
  875.     /* Code Body                                                      */
  876.     /*----------------------------------------------------------------*/
  877. #ifndef __MMI_UNIFIED_MESSAGE__
  878.     mmi_jmms_deinit_mms_context(g_jmms_context);
  879.     if (g_jmms_context->pParseContent == NULL)
  880.     {
  881.         g_jmms_context->pParseContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
  882.     }
  883.     g_jmms_context->pParseContent->bIsStream = E_TRUE;
  884. #endif 
  885. #ifdef __MMI_UNIFIED_MESSAGE__
  886.     msgs_list_node = g_jmms_context->store_context->messages_list;
  887.     while ( msgs_list_node != NULL && msgs_list_node->msg_index != g_jmms_context->nCurr_scr_hilited_index)
  888.     {
  889.         msgs_list_node = msgs_list_node->next;
  890.     }
  891.     /* Dilip Start August 24, 2006*/
  892.     /*This part of the function is modified to remove unwanted slide if no address is present in drafts*/
  893.       g_jmms_context->num_attachments= msgs_list_node->attachment_status;
  894.       if(g_jmms_context->num_attachments==E_JMMS_ATTACHMENT_NOT_PRESENT)
  895. g_jmms_context->num_attachments=0;           
  896.            
  897.       #ifdef __MMI_UNIFIED_MESSAGE__
  898.       if(IsScreenPresent(SCR_ID_UM_DRAFT))
  899.       {
  900.         DeleteUptoScrID(SCR_ID_UM_DRAFT);
  901.       }
  902.       #endif
  903.     /* Dilip End August 24, 2006*/
  904.     /* /if hint is NULL then it means no address is present */
  905.     if (msgs_list_node->um_msg_info->address_length == 0)
  906.     {
  907.         DisplayPopupCallBack(
  908.             (U8*) GetString(STR_ID_JMMS_LACK_RECIPENTS),
  909.             IMG_GLOBAL_ERROR,
  910.             1,
  911.             JMMS_POPUP_TIME,
  912.             (U8) ERROR_TONE,
  913.             mmi_jmms_pre_drafts_edit_message_add_recipients);/*To bring screen to edit page. Dilip Start August 24, 2006*/
  914.         return;
  915.     }
  916. #endif
  917. #ifndef __MMI_UNIFIED_MESSAGE__
  918.    index =
  919.         (JC_INT32) (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  920.     eRet = mmi_jmms_get_message("Drafts", g_jmms_context->pParseContent, index);
  921.     if (eRet != JC_OK)
  922.     {
  923.         mmi_jmms_error_handler(eRet);
  924.         goto END;
  925.     }
  926. #endif 
  927.     g_jmms_context->last_scr_id = GetActiveScreenId(); 
  928. #ifndef __MMI_UNIFIED_MESSAGE__
  929. mmi_jmms_parsing_progressing_screen();
  930.     eRet = mmi_jmms_jdi_parse_msg_buffer(&(g_jmms_context->msg_handle), g_jmms_context->pParseContent, E_TYPE_MMS, E_TRUE);
  931.     /*  */
  932.     if (eRet == JC_ERR_MMS_PARSE_PENDING)
  933.     {
  934.         mmi_jmms_parse_continue_start_timer(g_jmms_context->msg_handle, mmi_jmms_drafts_sent_callback, mmi_jmms_only_abort_parsing_progress);
  935.         return;
  936.     }
  937. #endif
  938. #ifdef __MMI_UNIFIED_MESSAGE__ // sachin Parsing
  939. // mmi_jmms_jdi_deinitview(g_jmms_context->msg_handle);
  940. #endif  
  941. mmi_jmms_drafts_sent_callback(eRet);
  942.     return;
  943. #ifndef __MMI_UNIFIED_MESSAGE__
  944. END:
  945.     if (g_jmms_context->pParseContent != NULL)
  946.     {
  947.         if (g_jmms_context->pParseContent->pFileName != NULL)
  948.         {
  949.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  950.             g_jmms_context->pParseContent->pFileName = NULL;
  951.         }
  952.         jdd_MemFree(g_jmms_context->pParseContent);
  953.         g_jmms_context->pParseContent = NULL;
  954.     }
  955.     if (eRet != JC_OK)
  956.     {
  957.         if (g_jmms_context->msg_handle != NULL)
  958.         {
  959.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  960.             g_jmms_context->msg_handle = NULL;
  961.         }
  962.     }
  963. #endif
  964.     return;    
  965. }
  966. /*****************************************************************************
  967.  * FUNCTION
  968.  *  mmi_jmms_drafts_sent_callback
  969.  * DESCRIPTION
  970.  *  
  971.  * PARAMETERS
  972.  *  eRet        [IN]        
  973.  * RETURNS
  974.  *  void
  975.  *****************************************************************************/
  976. void mmi_jmms_drafts_sent_callback(JC_RETCODE eRet)
  977. {
  978.     /*----------------------------------------------------------------*/
  979.     /* Local Variables                                                */
  980.     /*----------------------------------------------------------------*/
  981.     U8 page_count = 0;
  982.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  983.     MESSAGE_SEND *send_p;
  984.     /*----------------------------------------------------------------*/
  985.     /* Code Body                                                      */
  986.     /*----------------------------------------------------------------*/
  987.     if (JC_OK != eRet)
  988.     {
  989.         if (GetActiveScreenId() == SCR_ID_JMMS_PARSING_PROGRESS)
  990.         {
  991.             mmi_jmms_error_handler(eRet);
  992.         }
  993.         goto END;
  994.     }
  995.     ///Todo:  check tehse APIs should not be rquired because
  996.     ///MMS in Drafts folder will be from write MMS and this information
  997.     ///should already be there in MMS
  998.     eRet = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
  999.     if (eRet != JC_OK)
  1000.     {
  1001.         mmi_jmms_error_handler(eRet);
  1002.         goto END;
  1003.     }
  1004.     eRet = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
  1005.     if (eRet != JC_OK)
  1006.     {
  1007.         mmi_jmms_error_handler(eRet);
  1008.         goto END;
  1009.     }
  1010.     eRet = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
  1011.     if (eRet != JC_OK)
  1012.     {
  1013.         mmi_jmms_error_handler(eRet);
  1014.         goto END;
  1015.     }
  1016.     eRet = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
  1017.     if (eRet != JC_OK)
  1018.     {
  1019.         mmi_jmms_error_handler(eRet);
  1020.         goto END;
  1021.     }
  1022.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
  1023.     if (eRet != JC_OK || pMsgHeaders == NULL)
  1024.     {
  1025.         eRet = JC_ERR_STORE_FILE_CORRUPTED;
  1026.         mmi_jmms_error_handler(eRet);
  1027.         goto END;
  1028.     }
  1029.     send_p = (MESSAGE_SEND*) (pMsgHeaders->pHeaders);
  1030.     g_jmms_context->version = (S8*) (send_p->pVersion);
  1031. #ifdef __MMI_UNIFIED_MESSAGE__
  1032.     g_jmms_context->save_mms = MMI_FALSE;
  1033. #else 
  1034.     g_jmms_context->save_mms = MMI_TRUE;
  1035. #endif 
  1036.  //   mmi_jmms_entry_communication_progress_screen();
  1037.  /******************************************************************************
  1038.     This part of the function is modified to add the blank slide into the MMS.
  1039.    Modified By          : Raj Kumar Gupta
  1040.    Date of Modification : July 25, 2006
  1041.  *****************************************************************************/
  1042.     mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
  1043.     if (page_count == 0 && mmi_jmms_compose_settings_auto_sign_status() == E_OFF)
  1044.     {
  1045.         MMI_BOOL context_to_free = MMI_FALSE;
  1046.         JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
  1047.         if(g_jmms_context->compose_context == NULL)
  1048.         {
  1049.             g_jmms_context->compose_context =
  1050.             (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
  1051.             if (g_jmms_context->compose_context == NULL)
  1052.             {
  1053.                 DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
  1054.                 return;
  1055.             }
  1056.             memset( g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
  1057.                     0,
  1058.                     (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
  1059.         }
  1060.         DisplayPopupCallBack(
  1061.                 (U8*) GetString(STR_ID_JMMS_ADD_BLANK_SLIDE),
  1062.                 IMG_GLOBAL_WARNING,
  1063.                 1,
  1064.                 JMMS_POPUP_TIME,
  1065.                 (U8) WARNING_TONE,
  1066.                 mmi_jmms_add_blank_slide_popup_callback);
  1067.         g_jmms_context->compose_context->curr_page_index = 0;
  1068.         g_jmms_context->compose_context->mms_bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
  1069.         err_code = mmi_jmms_set_bg_color(g_jmms_context->compose_context->mms_bg_color);
  1070.         if (JMMS_COMP_OK == err_code)
  1071.         {
  1072. #ifdef MMI_ON_HARDWARE_P
  1073. stFontAttribute text_font;
  1074. text_font.italic = 0;
  1075. text_font.bold = 0;
  1076. text_font.size = MEDIUM_FONT;
  1077. #endif
  1078.             mmi_jmms_compose_insert_slide();
  1079. #ifdef MMI_ON_HARDWARE_P
  1080. if(is_test_sim() == MMI_FALSE)
  1081.             {
  1082. pfnUnicodeStrcpy(
  1083. (S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
  1084. (S8*) GetString(STR_ID_JMMS_BLANK_SLIDE_STRING));
  1085. g_jmms_context->disable_warning_popup = 1;
  1086. mmi_jmms_compose_add_text((U8) (page_count + 1), &(text_font), g_jmms_color_RGB_list[COLOR_BLACK],1);
  1087. g_jmms_context->disable_warning_popup = 0;
  1088. }
  1089. #endif
  1090.         }
  1091.         if (context_to_free == MMI_TRUE)
  1092.         {
  1093.             context_to_free = MMI_FALSE;
  1094.             if (g_jmms_context->compose_context != NULL)
  1095.             {
  1096.                 jdd_MemFree(g_jmms_context->compose_context);
  1097.                 g_jmms_context->compose_context = NULL;
  1098.             }
  1099.         }
  1100.         return;
  1101.     }
  1102.     else
  1103.     {
  1104.         g_jmms_context->progress_screen_title = STR_ID_PROGRESS_SENDING;
  1105.         memset(g_jmms_context->g_jmms_progress_str, 0x00, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);
  1106.         mmi_jmms_entry_communication_progress_screen();
  1107.     /* PMT VIKAS START 20060325 */
  1108. //    #ifdef __MMI_MMS_SIGNATURE__
  1109.         mmi_jmms_insert_auto_signature();
  1110. //    #endif 
  1111.     }
  1112. /*****************************************************************************
  1113.    End of modification to insert the blank slide into blank MMS.
  1114.  *****************************************************************************/
  1115.  /******************************************************************************
  1116.    This part of the function is modified to make the MMS send process asynch.
  1117.    Modified By          : Raj Kumar Gupta
  1118.    Date of Modification : 09 June 2006
  1119.  *****************************************************************************/
  1120.     /* Register the function that to be execute after the completion of the 
  1121.        encapsulation */
  1122.     mmi_jmms_add_send_callback_node(mmi_jmms_send_drafts_sent_callback);
  1123.     mmi_jmms_send_mms(g_jmms_context->msg_handle, E_TYPE_NEW_MMS, E_TRUE, 1, E_TRUE);
  1124.     DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
  1125.     return;
  1126.   END:
  1127. #ifndef __MMI_UNIFIED_MESSAGE__
  1128.     if (g_jmms_context->pParseContent != NULL)
  1129.     {
  1130.         if (g_jmms_context->pParseContent->pFileName != NULL)
  1131.         {
  1132.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  1133.             g_jmms_context->pParseContent->pFileName = NULL;
  1134.         }
  1135.         jdd_MemFree(g_jmms_context->pParseContent);
  1136.         g_jmms_context->pParseContent = NULL;
  1137.     }
  1138.     if (eRet != JC_OK)
  1139.     {
  1140.         if (g_jmms_context->msg_handle != NULL)
  1141.         {
  1142.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1143.             g_jmms_context->msg_handle = NULL;
  1144.         }
  1145.     }
  1146. #endif 
  1147.     DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
  1148.     return;
  1149. }
  1150. /*****************************************************************************
  1151.  * FUNCTION
  1152.  *  mmi_jmms_add_blank_slide_popup_callback
  1153.  * DESCRIPTION
  1154.  *  
  1155.  * PARAMETERS
  1156.  *  void
  1157.  * RETURNS
  1158.  *  void
  1159.  *****************************************************************************/
  1160. void mmi_jmms_add_blank_slide_popup_callback(void)
  1161. {
  1162.     g_jmms_context->progress_screen_title = STR_ID_PROGRESS_SENDING;
  1163.     memset(g_jmms_context->g_jmms_progress_str, 0x00, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);
  1164.     mmi_jmms_entry_communication_progress_screen();
  1165.     /* PMT VIKAS START 20060325 */
  1166. //#ifdef __MMI_MMS_SIGNATURE__
  1167.     mmi_jmms_insert_auto_signature();
  1168. //#endif 
  1169.     mmi_jmms_add_send_callback_node(mmi_jmms_send_drafts_sent_callback);
  1170.     mmi_jmms_send_mms(g_jmms_context->msg_handle, E_TYPE_NEW_MMS, E_TRUE, 1, E_TRUE);
  1171.     DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
  1172. }
  1173. /*****************************************************************************
  1174.  * FUNCTION
  1175.  *  mmi_jmms_send_drafts_sent_callback
  1176.  * DESCRIPTION
  1177.  *  
  1178.  * PARAMETERS
  1179.  *  eRet        [IN]        
  1180.  * RETURNS
  1181.  *  void
  1182.  *****************************************************************************/
  1183. void mmi_jmms_send_drafts_sent_callback(JC_RETCODE eRet)
  1184. {
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Local Variables                                                */
  1187.     /*----------------------------------------------------------------*/
  1188.     /*----------------------------------------------------------------*/
  1189.     /* Code Body                                                      */
  1190.     /*----------------------------------------------------------------*/
  1191.     if (JC_OK != eRet)
  1192.     {
  1193.         /* PMT VIKAS START 20060405 */
  1194. //    #ifdef __MMI_MMS_SIGNATURE__
  1195.         mmi_jmms_del_inserted_auto_signature_slide();
  1196. //    #endif 
  1197.         //PMT VIKAS END 20060405        
  1198.         ////DisplayPopup((U8*)GetString(STR_ID_JMMS_ERROR_MMS_SENT) ,IMG_GLOBAL_ERROR, 1,1000,(U8)ERROR_TONE);
  1199.         if (eRet == E_JMMS_STORAGE_FULL)
  1200.         {
  1201.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT_STORE_FUL);
  1202.         }
  1203.         /* Added by - Raj Kumar Gupta on 31 August, 2006 */
  1204.         else if(eRet == E_COMMUNICATION_ABORTED)
  1205.         {
  1206.             DisplayPopup(
  1207.                     (U8*) GetString(STR_ID_JMMS_COMM_ABORTED),
  1208.                     IMG_GLOBAL_INFO,
  1209.                     1,
  1210.                     JMMS_POPUP_TIME,
  1211.                     (U8) SUCCESS_TONE);
  1212.         }
  1213.         else
  1214.         {
  1215.             mmi_jmms_handle_pop_up_for_interupt(STR_ID_JMMS_ERROR_MMS_SENT);
  1216.         }
  1217. #ifdef __MMI_UNIFIED_MESSAGE__/* Fixed by Vikram to avoid going to Options screen in case of any error*/
  1218.         
  1219.          if (IsScreenPresent(SCR_ID_UM_DRAFT))
  1220.            {
  1221.               DeleteUptoScrID(SCR_ID_UM_DRAFT);
  1222.            }
  1223.         
  1224. #else
  1225.        DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, g_jmms_context->last_scr_id);
  1226. #endif
  1227.         mmi_jmms_deinit_mms_context(g_jmms_context);
  1228.     }
  1229.   
  1230. #ifndef __MMI_UNIFIED_MESSAGE__
  1231.     if (g_jmms_context->pParseContent != NULL)
  1232.     {
  1233.         if (g_jmms_context->pParseContent->pFileName != NULL)
  1234.         {
  1235.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  1236.         }
  1237.         jdd_MemFree(g_jmms_context->pParseContent);
  1238.         g_jmms_context->pParseContent = NULL;
  1239.     }
  1240.     if (eRet != JC_OK)
  1241.     {
  1242.         if (g_jmms_context->msg_handle != NULL)
  1243.         {
  1244.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1245.             g_jmms_context->msg_handle = NULL;
  1246.         }
  1247.     }
  1248. #endif 
  1249.     return;
  1250. }
  1251. #ifdef __MMI_UNIFIED_MESSAGE__
  1252. /*****************************************************************************
  1253.  * FUNCTION
  1254.  *  mmi_jmms_pre_drafts_edit_message_add_recipients
  1255.  * DESCRIPTION
  1256.  *  
  1257.  * PARAMETERS
  1258.  *  void
  1259.  * RETURNS
  1260.  *  void
  1261.  *****************************************************************************/
  1262. void mmi_jmms_pre_drafts_edit_message_add_recipients(void)
  1263. {
  1264.     /*----------------------------------------------------------------*/
  1265.     /* Local Variables                                                */
  1266.     /*----------------------------------------------------------------*/
  1267.     /*----------------------------------------------------------------*/
  1268.     /* Code Body                                                      */
  1269.     /*----------------------------------------------------------------*/
  1270. #ifdef __MMI_UNIFIED_MESSAGE__
  1271. U8 curr_page = 0;
  1272.     if(g_jmms_context->msg_handle)
  1273. mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  1274. g_jmms_context->edit_error_code=JC_OK;
  1275. #endif
  1276.     g_jmms_context->g_use_local_send_setings = 1;  // sanjeev  5/1/07  
  1277.     mmi_jmms_edit_message(MMI_JMMS_DRAFTS);
  1278. #ifdef __MMI_UNIFIED_MESSAGE__
  1279. if(g_jmms_context->edit_error_code!=JC_OK && curr_page>1 && g_jmms_context->msg_handle)
  1280. {
  1281. gui_lock_double_buffer();
  1282. mmi_jmms_jdi_view_event(g_jmms_context->msg_handle, E_VIEW_SET_ACTIVE_SLIDE, &curr_page);
  1283. gui_unlock_double_buffer();
  1284. }
  1285. #endif
  1286. }
  1287. /*****************************************************************************
  1288.  * FUNCTION
  1289.  *  mmi_jmms_pre_drafts_edit_message
  1290.  * DESCRIPTION
  1291.  *  
  1292.  * PARAMETERS
  1293.  *  void
  1294.  * RETURNS
  1295.  *  void
  1296.  *****************************************************************************/
  1297. void mmi_jmms_pre_drafts_edit_message(void)
  1298. {
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Local Variables                                                */
  1301.     /*----------------------------------------------------------------*/
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Code Body                                                      */
  1304.     /*----------------------------------------------------------------*/
  1305. #ifdef __MMI_UNIFIED_MESSAGE__
  1306. U8 curr_page = 0;
  1307.     if(g_jmms_context->msg_handle)
  1308. mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  1309. g_jmms_context->edit_error_code=JC_OK;
  1310. #endif
  1311.     g_jmms_context->g_use_local_send_setings = 1;  // sanjeev  5/1/07  
  1312.     mmi_jmms_edit_message(MMI_JMMS_DRAFTS);
  1313. #ifdef __MMI_UNIFIED_MESSAGE__
  1314. if(g_jmms_context->edit_error_code!=JC_OK && curr_page>1 && g_jmms_context->msg_handle)
  1315. {
  1316. gui_lock_double_buffer();
  1317. mmi_jmms_jdi_view_event(g_jmms_context->msg_handle, E_VIEW_SET_ACTIVE_SLIDE, &curr_page);
  1318. gui_unlock_double_buffer();
  1319. }
  1320. #endif
  1321. }
  1322. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1323. /*****************************************************************************
  1324.  * FUNCTION
  1325.  *  mmi_jmms_drafts_edit_message
  1326.  * DESCRIPTION
  1327.  *  
  1328.  * PARAMETERS
  1329.  *  void
  1330.  * RETURNS
  1331.  *  void
  1332.  *****************************************************************************/
  1333. #ifndef __MMI_UNIFIED_MESSAGE__
  1334. void mmi_jmms_drafts_edit_message(void)
  1335. #else 
  1336. void mmi_jmms_edit_message(S8 *folder_name)
  1337. #endif 
  1338. {
  1339.     /*----------------------------------------------------------------*/
  1340.     /* Local Variables                                                */
  1341.     /*----------------------------------------------------------------*/
  1342.     /* CONTENT_DATA Content = {0, }; */
  1343.     JC_RETCODE eRet = JC_OK;
  1344.     #ifndef __MMI_UNIFIED_MESSAGE__
  1345. JC_INT32 index = 0;
  1346.     #endif
  1347.    
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Code Body                                                      */
  1350.     /*----------------------------------------------------------------*/
  1351. #ifndef __MMI_UNIFIED_MESSAGE__
  1352.     mmi_jmms_deinit_mms_context(g_jmms_context);
  1353.     if (g_jmms_context->pParseContent == NULL)
  1354.     {
  1355.         g_jmms_context->pParseContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
  1356.     }
  1357.     g_jmms_context->pParseContent->bIsStream = E_TRUE;
  1358.     index =
  1359.         (JC_INT32) (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  1360. eRet = mmi_jmms_get_message("Drafts", g_jmms_context->pParseContent, index);
  1361. if (eRet != JC_OK)
  1362.     {
  1363.         mmi_jmms_error_handler(eRet);
  1364.         goto END;
  1365.     }
  1366.     mmi_jmms_parsing_progressing_screen();
  1367.     eRet =
  1368.         mmi_jmms_jdi_parse_msg_buffer(&(g_jmms_context->msg_handle), g_jmms_context->pParseContent, E_TYPE_MMS, E_TRUE);
  1369.     if (eRet == JC_ERR_MMS_PARSE_PENDING)
  1370.     {
  1371.         mmi_jmms_parse_continue_start_timer(g_jmms_context->msg_handle, mmi_jmms_drafts_edit_message_async_callback,mmi_jmms_only_abort_parsing_progress);
  1372.         return;
  1373.     }
  1374. #endif 
  1375. #ifdef __MMI_UNIFIED_MESSAGE__
  1376. mmi_jmms_jdi_preedit(&g_jmms_context->msg_handle); // Edit
  1377. #endif
  1378. mmi_jmms_drafts_edit_message_async_callback(eRet);
  1379.     return;
  1380. #ifndef __MMI_UNIFIED_MESSAGE__
  1381. END:
  1382.     if (g_jmms_context->pParseContent != NULL)
  1383.     {
  1384.         if (g_jmms_context->pParseContent->pFileName != NULL)
  1385.         {
  1386.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  1387.         }
  1388.         jdd_MemFree(g_jmms_context->pParseContent);
  1389.         g_jmms_context->pParseContent = NULL;
  1390.     }
  1391.     if (eRet != JC_OK)
  1392.     {
  1393.         if (g_jmms_context->msg_handle != NULL)
  1394.         {
  1395.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1396.             g_jmms_context->msg_handle = NULL;
  1397.         }
  1398.     }
  1399. #endif 
  1400.     g_jmms_context->is_add_media_warning = 0;
  1401. }
  1402. /*****************************************************************************
  1403.  * FUNCTION
  1404.  *  mmi_jmms_drafts_edit_message_async_callback
  1405.  * DESCRIPTION
  1406.  *  
  1407.  * PARAMETERS
  1408.  *  eRet        [IN]        
  1409.  * RETURNS
  1410.  *  void
  1411.  *****************************************************************************/
  1412. void mmi_jmms_drafts_edit_message_async_callback(JC_RETCODE eRet)
  1413. {
  1414.     /*----------------------------------------------------------------*/
  1415.     /* Local Variables                                                */
  1416.     /*----------------------------------------------------------------*/
  1417.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1418.     MESSAGE_SEND *send_p = NULL;
  1419. #ifdef __MMI_UNIFIED_MESSAGE__ 
  1420.     ECreationMode create_mode;
  1421.     MESSAGE_RETRIEVAL *reterive_p = NULL;
  1422. #endif
  1423.     S32 len = 0;
  1424.     S8 *temp_str = NULL;
  1425.     S8 *str = NULL;
  1426.     S32 start_index = 0;
  1427.     MMI_BOOL is_email = MMI_FALSE;
  1428.     S32 len_to_copy = 0;
  1429.     U8 ret = 0;
  1430.     JC_RETCODE eRet_restricted = JC_OK;
  1431.     /*----------------------------------------------------------------*/
  1432.     /* Code Body                                                      */
  1433.     /*----------------------------------------------------------------*/
  1434.     if (JC_OK != eRet)
  1435.     {
  1436.         if (GetActiveScreenId() == SCR_ID_JMMS_PARSING_PROGRESS)
  1437.         {
  1438.             mmi_jmms_error_handler(eRet);
  1439.         }
  1440.         goto END;
  1441.     }
  1442. #if !defined(__MMI_UNIFIED_MESSAGE__) && defined(__DRM_SUPPORT__) 
  1443.     if (mmi_jmms_is_drm_fwd_lock_media_in_mms(g_jmms_context->msg_handle, E_TRUE) == E_TRUE)
  1444.     {
  1445.        goto END;
  1446.     }
  1447. #endif
  1448.     eRet =
  1449.         mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_ERROR_IND, (void *)mmi_jmms_error_ind_cb);
  1450.     if (eRet != JC_OK)
  1451.     {
  1452.         mmi_jmms_error_handler(eRet);
  1453.         goto END;
  1454.     }
  1455.     eRet = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
  1456.     if (eRet != JC_OK)
  1457.     {
  1458.         mmi_jmms_error_handler(eRet);
  1459.         goto END;
  1460.     }
  1461.     eRet = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
  1462.     if (mmi_jmms_is_corrupted_video_media_in_mms(g_jmms_context->msg_handle) == E_TRUE)
  1463.     {
  1464.         eRet =-1;
  1465.         goto END;
  1466.     }
  1467. #ifdef __MMI_UNIFIED_MESSAGE__
  1468.     create_mode = mmi_jmms_compose_settings_creation_mode();
  1469.     if(IsMMSRestrictedMode(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS) != JC_OK)
  1470.     {
  1471.         if(create_mode == E_CREATION_MODE_RESTRICTED)
  1472.         {
  1473.             eRet_restricted = JC_ERR_MSG_MMS_CONTENT_RESTRICTED;
  1474.         }
  1475.         else if(create_mode == E_CREATION_MODE_WARNING)
  1476.         {
  1477.             g_jmms_context->is_add_media_warning = 1;
  1478.         }
  1479.     }
  1480. #endif
  1481.     if (eRet != JC_OK)
  1482.     {
  1483.         /********************************************************************
  1484.            These lines are added to ask a query if the message contains the 
  1485.            invalid media in restricted mode.
  1486.             Written By  : RAJ KUMAR GUPTA
  1487.             Date        : Augest 08, 2006
  1488.          *******************************************************************/
  1489.         if (JC_ERR_MSG_MMS_CONTENT_RESTRICTED == eRet)
  1490.         {
  1491.             eRet_restricted = JC_ERR_MSG_MMS_CONTENT_RESTRICTED;
  1492.         }
  1493.         else
  1494.         {
  1495.             mmi_jmms_error_handler(eRet);
  1496.             goto END;
  1497.         }
  1498.         /*******************************************************************/
  1499.     }
  1500.     eRet = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
  1501.     if (eRet != JC_OK)
  1502.     {
  1503.         mmi_jmms_error_handler(eRet);
  1504.         goto END;
  1505.     }
  1506.     eRet = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
  1507.     if (eRet != JC_OK)
  1508.     {
  1509.         mmi_jmms_error_handler(eRet);
  1510.         goto END;
  1511.     }
  1512.     eRet = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
  1513.     if (eRet != JC_OK)
  1514.     {
  1515.         mmi_jmms_error_handler(eRet);
  1516.         goto END;
  1517.     }
  1518.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
  1519.     if (eRet != JC_OK || pMsgHeaders == NULL)
  1520.     {
  1521.         eRet = JC_ERR_STORE_FILE_CORRUPTED;
  1522.         mmi_jmms_error_handler(eRet);
  1523.         goto END;
  1524.     }
  1525. #ifdef __MMI_UNIFIED_MESSAGE__
  1526.     if (pMsgHeaders->eMsgType == E_MSG_TYPE_SEND)
  1527.     {
  1528.         send_p = (MESSAGE_SEND*) (pMsgHeaders->pHeaders);
  1529.     }
  1530.     else if (pMsgHeaders->eMsgType == E_MSG_TYPE_RECEIVE)
  1531.     {
  1532.         reterive_p = (MESSAGE_RETRIEVAL*) (pMsgHeaders->pHeaders);
  1533.     }
  1534. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1535.     if (pMsgHeaders->eMsgType != E_MSG_TYPE_SEND)
  1536.     {
  1537.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1538.         goto END;
  1539.     }
  1540.     send_p = (MESSAGE_SEND *) (pMsgHeaders->pHeaders);
  1541. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1542.     mmi_jmms_free_addresses_list();
  1543.     /* /Make the To Addresses list */
  1544.     if(send_p != NULL)
  1545.     {
  1546.         if (send_p->pTo != NULL)
  1547.         {
  1548.             str = (S8*) (send_p->pTo);
  1549.             len = 0;
  1550.             start_index = 0;
  1551.             g_jmms_context->address_list_flag = E_TO_ADDRESSES;
  1552.             while (pfnUnicodeStrcmp(str, "") != 0)
  1553.             {
  1554.                 while (((*str) != ';') && ((*str) != ''))
  1555.                 {
  1556.                     if ((*str) == '@')
  1557.                     {
  1558.                         is_email = MMI_TRUE;
  1559.                     }
  1560.                     len++;
  1561.                     str = str + ENCODING_LENGTH;
  1562.                 }
  1563.                 if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1564.                 {
  1565.                     len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1566.                 }
  1567.                 else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1568.                 {
  1569.                     len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1570.                 }
  1571.                 else
  1572.                 {
  1573.                     len_to_copy = len;
  1574.                 }
  1575.                 temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1576.                 if (temp_str == NULL)
  1577.                 {
  1578.                     DisplayPopup(
  1579.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1580.                         IMG_GLOBAL_ERROR,
  1581.                         1,
  1582.                         JMMS_POPUP_TIME,
  1583.                         (U8) ERROR_TONE);
  1584.                     goto END;
  1585.                 }
  1586.                 pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pTo + start_index), len_to_copy);
  1587.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1588.                 if (ret != 0)
  1589.                 {
  1590.                     DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1591.                     goto END;
  1592.                 }
  1593.     
  1594.                 if (temp_str != NULL)
  1595.                 {
  1596.                     jdd_MemFree(temp_str);
  1597.                     temp_str = NULL;
  1598.                 }
  1599.     
  1600.                 start_index = start_index + len + 1;
  1601.                 len = 0;
  1602.                 if ((*str) != '')
  1603.                 {
  1604.                     str = str + ENCODING_LENGTH;
  1605.                 }
  1606.             }
  1607.     
  1608.             if (temp_str != NULL)
  1609.             {
  1610.                 jdd_MemFree(temp_str);
  1611.                 temp_str = NULL;
  1612.             }
  1613.         }
  1614.         /* /Make the Cc Addresses list */
  1615.         if (send_p->pCc != NULL)
  1616.         {
  1617.             str = (S8*) (send_p->pCc);
  1618.             len = 0;
  1619.             start_index = 0;
  1620.             g_jmms_context->address_list_flag = E_CC_ADDRESSES;
  1621.             is_email = MMI_FALSE;
  1622.     
  1623.             while (pfnUnicodeStrcmp(str, "") != 0)
  1624.             {
  1625.     
  1626.                 while (((*str) != ';') && ((*str) != ''))
  1627.                 {
  1628.                     len++;
  1629.                     if ((*str) == '@')
  1630.                     {
  1631.                         is_email = MMI_TRUE;
  1632.                     }
  1633.     
  1634.                     str = str + ENCODING_LENGTH;
  1635.                 }
  1636.                 if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1637.                 {
  1638.                     len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1639.                 }
  1640.                 else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1641.                 {
  1642.                     len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1643.                 }
  1644.                 else
  1645.                 {
  1646.                     len_to_copy = len;
  1647.                 }
  1648.                 temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1649.                 if (temp_str == NULL)
  1650.                 {
  1651.                     DisplayPopup(
  1652.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1653.                         IMG_GLOBAL_ERROR,
  1654.                         1,
  1655.                         JMMS_POPUP_TIME,
  1656.                         (U8) ERROR_TONE);
  1657.                     goto END;
  1658.                 }
  1659.                 pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pCc + start_index), len_to_copy);
  1660.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1661.                 if (ret != 0)
  1662.                 {
  1663.                     DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1664.                     goto END;
  1665.                 }
  1666.                 if (temp_str != NULL)
  1667.                 {
  1668.                     jdd_MemFree(temp_str);
  1669.                     temp_str = NULL;
  1670.                 }
  1671.                 start_index = start_index + len + 1;
  1672.                 len = 0;
  1673.                 if ((*str) != '')
  1674.                 {
  1675.                     str = str + ENCODING_LENGTH;
  1676.                 }
  1677.             }
  1678.             if (temp_str != NULL)
  1679.             {
  1680.                 jdd_MemFree(temp_str);
  1681.                 temp_str = NULL;
  1682.             }
  1683.         }
  1684.         /* /Make the BCc Addresses list */
  1685.         if (send_p->pBcc != NULL)
  1686.         {
  1687.             str = (S8*) (send_p->pBcc);
  1688.             len = 0;
  1689.             start_index = 0;
  1690.             g_jmms_context->address_list_flag = E_BCC_ADDRESSES;
  1691.             is_email = MMI_FALSE;
  1692.             while (pfnUnicodeStrcmp(str, "") != 0)
  1693.             {
  1694.                 while (((*str) != ';') && ((*str) != ''))
  1695.                 {
  1696.                     len++;
  1697.                     if ((*str) == '@')
  1698.                     {
  1699.                         is_email = MMI_TRUE;
  1700.                     }
  1701.                     str = str + ENCODING_LENGTH;
  1702.                 }
  1703.     
  1704.                 if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1705.                 {
  1706.                     len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1707.                 }
  1708.                 else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1709.                 {
  1710.                     len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1711.                 }
  1712.                 else
  1713.                 {
  1714.                     len_to_copy = len;
  1715.                 }
  1716.                 temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1717.                 if (temp_str == NULL)
  1718.                 {
  1719.                     DisplayPopup(
  1720.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1721.                         IMG_GLOBAL_ERROR,
  1722.                         1,
  1723.                         JMMS_POPUP_TIME,
  1724.                         (U8) ERROR_TONE);
  1725.                     goto END;
  1726.                 }
  1727.                 pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pBcc + start_index), len_to_copy);
  1728.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1729.                 if (ret != 0)
  1730.                 {
  1731.                     goto END;
  1732.                 }
  1733.                 if (temp_str != NULL)
  1734.                 {
  1735.                     jdd_MemFree(temp_str);
  1736.                     temp_str = NULL;
  1737.                 }
  1738.                 start_index = start_index + len + 1;
  1739.                 len = 0;
  1740.                 if ((*str) != '')
  1741.                 {
  1742.                     str = str + ENCODING_LENGTH;
  1743.                 }
  1744.             }
  1745.         }
  1746.         /* /Make the subject buffer */
  1747.         memset(g_jmms_context->subject_input_buffer, 0x00, (MAX_SUBJECT_LENGTH + 1) *ENCODING_LENGTH);
  1748.         if (send_p->pSubject != NULL)
  1749.         {
  1750.             len = (pfnUnicodeStrlen((S8*) (send_p->pSubject))) * ENCODING_LENGTH;
  1751.             if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  1752.             {
  1753.                 memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, (MAX_SUBJECT_LENGTH * ENCODING_LENGTH));
  1754.             }
  1755.             else
  1756.             {
  1757.                 memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, len);
  1758.             }
  1759.         }
  1760.     }
  1761. #ifdef __MMI_UNIFIED_MESSAGE__ 
  1762.     /* /Make the To Addresses list */
  1763.     if(reterive_p != NULL)
  1764.     {
  1765.         if (reterive_p->pTo != NULL)
  1766.         {
  1767.             str = (S8*) (reterive_p->pTo);
  1768.             len = 0;
  1769.             start_index = 0;
  1770.             g_jmms_context->address_list_flag = E_TO_ADDRESSES;
  1771.             while (pfnUnicodeStrcmp(str, "") != 0)
  1772.             {
  1773.                 while (((*str) != ';') && ((*str) != ''))
  1774.                 {
  1775.                     if ((*str) == '@')
  1776.                     {
  1777.                         is_email = MMI_TRUE;
  1778.                     }
  1779.                     len++;
  1780.                     str = str + ENCODING_LENGTH;
  1781.                 }
  1782.                 if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1783.                 {
  1784.                     len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1785.                 }
  1786.                 else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1787.                 {
  1788.                     len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1789.                 }
  1790.                 else
  1791.                 {
  1792.                     len_to_copy = len;
  1793.                 }
  1794.                 temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1795.                 if (temp_str == NULL)
  1796.                 {
  1797.                     DisplayPopup(
  1798.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1799.                         IMG_GLOBAL_ERROR,
  1800.                         1,
  1801.                         JMMS_POPUP_TIME,
  1802.                         (U8) ERROR_TONE);
  1803.                     goto END;
  1804.                 }
  1805.                 pfnUnicodeStrncpy((S8*) temp_str, (S8*) (reterive_p->pTo + start_index), len_to_copy);
  1806.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1807.                 if (ret != 0)
  1808.                 {
  1809.                     DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1810.                     goto END;
  1811.                 }
  1812.     
  1813.                 if (temp_str != NULL)
  1814.                 {
  1815.                     jdd_MemFree(temp_str);
  1816.                     temp_str = NULL;
  1817.                 }
  1818.     
  1819.                 start_index = start_index + len + 1;
  1820.                 len = 0;
  1821.                 if ((*str) != '')
  1822.                 {
  1823.                     str = str + ENCODING_LENGTH;
  1824.                 }
  1825.             }
  1826.     
  1827.             if (temp_str != NULL)
  1828.             {
  1829.                 jdd_MemFree(temp_str);
  1830.                 temp_str = NULL;
  1831.             }
  1832.         }
  1833.         /* /Make the Cc Addresses list */
  1834.         if (reterive_p->pCc != NULL)
  1835.         {
  1836.             str = (S8*) (reterive_p->pCc);
  1837.             len = 0;
  1838.             start_index = 0;
  1839.             g_jmms_context->address_list_flag = E_CC_ADDRESSES;
  1840.             is_email = MMI_FALSE;
  1841.     
  1842.             while (pfnUnicodeStrcmp(str, "") != 0)
  1843.             {
  1844.     
  1845.                 while (((*str) != ';') && ((*str) != ''))
  1846.                 {
  1847.                     len++;
  1848.                     if ((*str) == '@')
  1849.                     {
  1850.                         is_email = MMI_TRUE;
  1851.                     }
  1852.     
  1853.                     str = str + ENCODING_LENGTH;
  1854.                 }
  1855.                 if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1856.                 {
  1857.                     len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1858.                 }
  1859.                 else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1860.                 {
  1861.                     len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1862.                 }
  1863.                 else
  1864.                 {
  1865.                     len_to_copy = len;
  1866.                 }
  1867.                 temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1868.                 if (temp_str == NULL)
  1869.                 {
  1870.                     DisplayPopup(
  1871.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1872.                         IMG_GLOBAL_ERROR,
  1873.                         1,
  1874.                         JMMS_POPUP_TIME,
  1875.                         (U8) ERROR_TONE);
  1876.                     goto END;
  1877.                 }
  1878.                 pfnUnicodeStrncpy((S8*) temp_str, (S8*) (reterive_p->pCc + start_index), len_to_copy);
  1879.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1880.                 if (ret != 0)
  1881.                 {
  1882.                     DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1883.                     goto END;
  1884.                 }
  1885.                 if (temp_str != NULL)
  1886.                 {
  1887.                     jdd_MemFree(temp_str);
  1888.                     temp_str = NULL;
  1889.                 }
  1890.                 start_index = start_index + len + 1;
  1891.                 len = 0;
  1892.                 if ((*str) != '')
  1893.                 {
  1894.                     str = str + ENCODING_LENGTH;
  1895.                 }
  1896.             }
  1897.             if (temp_str != NULL)
  1898.             {
  1899.                 jdd_MemFree(temp_str);
  1900.                 temp_str = NULL;
  1901.             }
  1902.         }
  1903.         /* /Make the subject buffer */
  1904.         memset(g_jmms_context->subject_input_buffer, 0x00, (MAX_SUBJECT_LENGTH + 1) *ENCODING_LENGTH);
  1905.         if (reterive_p->pSubject != NULL)
  1906.         {
  1907.             len = (pfnUnicodeStrlen((S8*) (reterive_p->pSubject))) * ENCODING_LENGTH;
  1908.             if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  1909.             {
  1910.                 memcpy(g_jmms_context->subject_input_buffer, reterive_p->pSubject, (MAX_SUBJECT_LENGTH * ENCODING_LENGTH));
  1911.             }
  1912.             else
  1913.             {
  1914.                 memcpy(g_jmms_context->subject_input_buffer, reterive_p->pSubject, len);
  1915.             }
  1916.         }
  1917.     }
  1918. #endif
  1919.     g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1920. /* MAUI_00227929 Start */
  1921. mmi_jmms_fill_mms_sending_settings();
  1922. /* MAUI_00227929 End */
  1923.    // g_jmms_context->g_use_local_send_setings = 0;  // sanjeev comment for priority issue.
  1924.     if (g_jmms_context->is_add_media_warning == 0)
  1925.     {
  1926.         if (eRet_restricted == JC_ERR_MSG_MMS_CONTENT_RESTRICTED)
  1927.         {
  1928.             U32 mms_size = 0;
  1929.             mmi_jmms_jdi_get_size(g_jmms_context->msg_handle, 0, &mms_size);
  1930.             if(mms_size > MMS_SUPPORTED_CONTENT_CLASS_MAX_SIZE_RESTRICTED_MODE)
  1931.             {
  1932.                 mmi_jmms_entry_write_message_screen();
  1933.                 DisplayPopup((PU8) GetString(STR_ID_JMMS_MODE_MAX_MSG_SIZE_REACHED_NEED_DELETE),
  1934.                              IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);  
  1935.             }
  1936.             else
  1937.             {
  1938.                 mmi_jmms_edit_content_restricted_mode_query();
  1939.             }
  1940.         }
  1941.         else
  1942.         {
  1943.             mmi_jmms_entry_write_message_screen();
  1944.         }
  1945.     }
  1946.     else
  1947.     {
  1948. mmi_jmms_entry_write_message_screen();
  1949.         DisplayPopup((PU8) GetString(STR_ID_JMMS_MMS_ERR_WARNING_CONTENT_CLASS),
  1950.                              IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
  1951.     }
  1952.   END:
  1953.     if (temp_str != NULL)
  1954.     {
  1955.         jdd_MemFree(temp_str);
  1956.         temp_str = NULL;
  1957.     }
  1958. #ifndef __MMI_UNIFIED_MESSAGE__
  1959.     if (g_jmms_context->pParseContent != NULL)
  1960.     {
  1961.         if (g_jmms_context->pParseContent->pFileName != NULL)
  1962.         {
  1963.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  1964.             g_jmms_context->pParseContent->pFileName = NULL;
  1965.         }
  1966.         jdd_MemFree(g_jmms_context->pParseContent);
  1967.         g_jmms_context->pParseContent = NULL;
  1968.     }
  1969.     if (eRet != JC_OK)
  1970.     {
  1971.         if (g_jmms_context->msg_handle != NULL)
  1972.         {
  1973.             mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1974.             g_jmms_context->msg_handle = NULL;
  1975.         }
  1976.     }
  1977. #endif
  1978.     g_jmms_context->is_add_media_warning = 0;
  1979.     DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
  1980.     return;
  1981. }
  1982. /*****************************************************************************
  1983.  * FUNCTION
  1984.  *  mmi_jmms_drafts_pre_delete
  1985.  * DESCRIPTION
  1986.  *  
  1987.  * PARAMETERS
  1988.  *  void
  1989.  * RETURNS
  1990.  *  void
  1991.  *****************************************************************************/
  1992. void mmi_jmms_drafts_pre_delete(void)
  1993. {
  1994.     /*----------------------------------------------------------------*/
  1995.     /* Local Variables                                                */
  1996.     /*----------------------------------------------------------------*/
  1997.     /*----------------------------------------------------------------*/
  1998.     /* Code Body                                                      */
  1999.     /*----------------------------------------------------------------*/
  2000.     DisplayConfirm(
  2001.         STR_GLOBAL_YES,
  2002.         IMG_GLOBAL_YES,
  2003.         STR_GLOBAL_NO,
  2004.         IMG_GLOBAL_NO,
  2005.         get_string(STR_GLOBAL_DELETE),
  2006.         IMG_GLOBAL_QUESTION,
  2007.         WARNING_TONE);
  2008.     SetLeftSoftkeyFunction(mmi_jmms_drafts_delete, KEY_EVENT_UP);
  2009.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2010. }
  2011. /*****************************************************************************
  2012.  * FUNCTION
  2013.  *  mmi_jmms_post_drafts_delete_message
  2014.  * DESCRIPTION
  2015.  *  
  2016.  * PARAMETERS
  2017.  *  void
  2018.  * RETURNS
  2019.  *  void
  2020.  *****************************************************************************/
  2021. void mmi_jmms_post_drafts_delete_message(void)
  2022. {
  2023.     U8 number = 0;
  2024.     /*----------------------------------------------------------------*/
  2025.     /* Code Body                                                      */
  2026.     /*----------------------------------------------------------------*/
  2027.     /* mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number); */
  2028.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  2029.     #ifdef __MMI_UNIFIED_MESSAGE__
  2030.          DeleteUptoScrID(SCR_ID_UM_MAIN);
  2031.         mmi_um_jmms_pre_entry_draft();
  2032.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2033.         HistoryReplace(SCR_ID_JMMS_DRAFTS, SCR_ID_JMMS_DRAFTS, mmi_jmms_entry_drafts);
  2034.         if (number <= 1)    /* /now folder will empty */
  2035.         {
  2036.             GoBackToHistory(SCR_ID_JMMS_MAIN_MENU);
  2037.         }
  2038.         else
  2039.         {
  2040.             GoBackToHistory(SCR_ID_JMMS_DRAFTS);
  2041.         }
  2042.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2043. }
  2044. /*****************************************************************************
  2045.  * FUNCTION
  2046.  *  mmi_jmms_drafts_delete
  2047.  * DESCRIPTION
  2048.  *  
  2049.  * PARAMETERS
  2050.  *  void
  2051.  * RETURNS
  2052.  *  void
  2053.  *****************************************************************************/
  2054. void mmi_jmms_drafts_delete(void)
  2055. {
  2056.     /*----------------------------------------------------------------*/
  2057.     /* Local Variables                                                */
  2058.     /*----------------------------------------------------------------*/
  2059.     U8 number = 0;
  2060.     JC_RETCODE eRet = JC_OK;
  2061.     /*----------------------------------------------------------------*/
  2062.     /* Code Body                                                      */
  2063.     /*----------------------------------------------------------------*/
  2064.     /* mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &number); */
  2065.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  2066.     mmi_jmms_delete_progresing_screen(STR_ID_JMMS_DRAFTS, IMG_GLOBAL_DELETED);
  2067.     eRet = mmi_jmms_delete_message(MMI_JMMS_DRAFTS, (number - g_jmms_context->nCurr_scr_hilited_index));
  2068.     if (eRet == JC_OK)
  2069.     {
  2070.         /*Dilip 25 aug 2006*/
  2071.         DisplayPopupCallBack((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, 
  2072.             SUCCESS_TONE,
  2073.             mmi_jmms_post_drafts_delete_message);/*Vikram: To call entry function only after popup is over as this wil send a new request for messages in UM*/
  2074.     }
  2075.     else
  2076.     {
  2077.         DisplayPopup(
  2078.             (U8*) GetString(STR_ID_JMMS_ERROR_MMS_DELETE),
  2079.             IMG_GLOBAL_ERROR,
  2080.             1,
  2081.             JMMS_POPUP_TIME,
  2082.             (U8) ERROR_TONE);
  2083.     #ifdef __MMI_UNIFIED_MESSAGE__
  2084.         DeleteUptoScrID(SCR_ID_UM_DRAFT);
  2085.     #else 
  2086.         DeleteUptoScrID(SCR_ID_JMMS_DRAFTS);
  2087.     #endif 
  2088.     }
  2089. }
  2090. /*****************************************************************************
  2091.  * FUNCTION
  2092.  *  mmi_jmms_drafts_delete_on_sent
  2093.  * DESCRIPTION
  2094.  *  
  2095.  * PARAMETERS
  2096.  *  void
  2097.  * RETURNS
  2098.  *  void
  2099.  *****************************************************************************/
  2100. void mmi_jmms_drafts_delete_on_sent(void)
  2101. {
  2102.     /*----------------------------------------------------------------*/
  2103.     /* Local Variables                                                */
  2104.     /*----------------------------------------------------------------*/
  2105.     U8 number = 0;
  2106.     JC_RETCODE eRet = JC_OK;
  2107.     /*----------------------------------------------------------------*/
  2108.     /* Code Body                                                      */
  2109.     /*----------------------------------------------------------------*/
  2110.     /*********************************************************************************
  2111.       These lines has been added to delete the MMS stored into the Draft folder after
  2112.       It has been sent successfully. Since file handle is open so it is not able to 
  2113.       delete the MMS from the 'DRAFT' folder. So before performing the MMS delete, 
  2114.       close all the file handles by deinitializing the message handle.
  2115.       Written By  : Raj Kumar Gupta
  2116.       Date        : Augest 22, 2006
  2117.      *********************************************************************************/
  2118.     if (g_jmms_context->msg_handle != NULL)
  2119.     {
  2120.         mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2121.         g_jmms_context->msg_handle = NULL;
  2122.     }
  2123.     /*********************************************************************************/
  2124.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  2125.     eRet = mmi_jmms_delete_message(MMI_JMMS_DRAFTS, (number - g_jmms_context->nCurr_scr_hilited_index));
  2126.     if (eRet == JC_OK)
  2127.     {
  2128.     #ifdef __MMI_UNIFIED_MESSAGE__
  2129.         HistoryReplace(SCR_ID_UM_DRAFT, SCR_ID_UM_DRAFT, mmi_um_jmms_pre_entry_draft);
  2130.         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_DRAFT);
  2131.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2132.         HistoryReplace(SCR_ID_JMMS_DRAFTS, SCR_ID_JMMS_DRAFTS, mmi_jmms_entry_drafts);
  2133.         if (number <= 1)    /* /now folder will empty */
  2134.         {
  2135.             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_MAIN_MENU);
  2136.         }
  2137.         else
  2138.         {
  2139.             DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_DRAFTS);
  2140.         }
  2141.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2142.     }
  2143.     else
  2144.     {
  2145.     #ifdef __MMI_UNIFIED_MESSAGE__
  2146.         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_UM_DRAFT);
  2147.     #else 
  2148.         DeleteFromScrUptoScr(SCR_ID_JMMS_PROGRESS, SCR_ID_JMMS_DRAFTS);
  2149.     #endif 
  2150.     }
  2151. }
  2152. /*****************************************************************************
  2153.  * FUNCTION
  2154.  *  mmi_jmms_drafts_delete_all
  2155.  * DESCRIPTION
  2156.  *  
  2157.  * PARAMETERS
  2158.  *  void
  2159.  * RETURNS
  2160.  *  void
  2161.  *****************************************************************************/
  2162. void mmi_jmms_drafts_delete_all(void)
  2163. {
  2164.     /*----------------------------------------------------------------*/
  2165.     /* Local Variables                                                */
  2166.     /*----------------------------------------------------------------*/
  2167.     /*----------------------------------------------------------------*/
  2168.     /* Code Body                                                      */
  2169.     /*----------------------------------------------------------------*/
  2170.     
  2171. #ifdef __MMI_UNIFIED_MESSAGE__
  2172.     /*Dilip 29 Aug 2006 */
  2173.     DisplayConfirm(
  2174.         STR_GLOBAL_YES,
  2175.         IMG_GLOBAL_YES,
  2176.         STR_GLOBAL_NO,
  2177.         IMG_GLOBAL_NO,
  2178.         get_string(STR_ID_JMMS_DELETE_ALL_UM_DRAFTS),
  2179.         IMG_GLOBAL_QUESTION,
  2180.         WARNING_TONE);
  2181.     /*Dilip 29 Aug 2006 */
  2182.     SetLeftSoftkeyFunction(mmi_um_jmms_delete_all, KEY_EVENT_UP);
  2183. #else 
  2184.     /*Dilip 29 Aug 2006 */
  2185.     DisplayConfirm(
  2186.         STR_GLOBAL_YES,
  2187.         IMG_GLOBAL_YES,
  2188.         STR_GLOBAL_NO,
  2189.         IMG_GLOBAL_NO,
  2190. /* MAUI_00018477 Start */
  2191.         get_string(STR_ID_JMMS_DELETE_ALL_UM_DRAFTS),
  2192. /* MAUI_00018477 End */
  2193.         IMG_GLOBAL_QUESTION,
  2194.         WARNING_TONE);
  2195.     /*Dilip 29 Aug 2006 */
  2196.     SetLeftSoftkeyFunction(mmi_jmms_delete_all_message_drafts, KEY_EVENT_UP);
  2197. #endif 
  2198.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2199. }
  2200. /*****************************************************************************
  2201.  * FUNCTION
  2202.  *  mmi_jmms_delete_all_message_drafts
  2203.  * DESCRIPTION
  2204.  *  
  2205.  * PARAMETERS
  2206.  *  void
  2207.  * RETURNS
  2208.  *  void
  2209.  *****************************************************************************/
  2210. void mmi_jmms_delete_all_message_drafts(void)
  2211. {
  2212.     /*----------------------------------------------------------------*/
  2213.     /* Local Variables                                                */
  2214.     /*----------------------------------------------------------------*/
  2215.     JC_RETCODE eRet = JC_OK;
  2216.     /*----------------------------------------------------------------*/
  2217.     /* Code Body                                                      */
  2218.     /*----------------------------------------------------------------*/
  2219.     mmi_jmms_delete_progresing_screen(STR_ID_JMMS_DRAFTS, IMG_GLOBAL_PROGRESS);
  2220.     eRet = mmi_jmms_delete_all_message(MMI_JMMS_DRAFTS);
  2221.     if (JC_OK != eRet)
  2222.     {
  2223.         DisplayPopup(
  2224.             (U8*) GetString(STR_ID_JMMS_ERROR_MMS_DELETE),
  2225.             IMG_GLOBAL_ERROR,
  2226.             1,
  2227.             JMMS_POPUP_TIME,
  2228.             (U8) ERROR_TONE);
  2229.         DeleteUptoScrID(SCR_ID_JMMS_DRAFTS);
  2230.     }
  2231.     else
  2232.     {
  2233.         DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  2234.         DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  2235.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  2236.     }
  2237. }
  2238. /*****************************************************************************
  2239.  * FUNCTION
  2240.  *  mmi_jmms_drafts_use_details
  2241.  * DESCRIPTION
  2242.  *  pre entry fn for use details screen
  2243.  * PARAMETERS
  2244.  *  void
  2245.  * RETURNS
  2246.  *  void
  2247.  *****************************************************************************/
  2248. void mmi_jmms_drafts_use_details(void)
  2249. {
  2250.     /*----------------------------------------------------------------*/
  2251.     /* Local Variables                                                */
  2252.     /*----------------------------------------------------------------*/
  2253.     /*----------------------------------------------------------------*/
  2254.     /* Code Body                                                      */
  2255.     /*----------------------------------------------------------------*/
  2256.     mmi_jmms_pre_entry_use_details_screen(MMI_JMMS_DRAFTS);
  2257. }
  2258. /*****************************************************************************
  2259.  * FUNCTION
  2260.  *  mmi_jmms_drafts_properties
  2261.  * DESCRIPTION
  2262.  *  
  2263.  * PARAMETERS
  2264.  *  void
  2265.  * RETURNS
  2266.  *  void
  2267.  *****************************************************************************/
  2268. void mmi_jmms_drafts_properties(void)
  2269. {
  2270.     /*----------------------------------------------------------------*/
  2271.     /* Local Variables                                                */
  2272.     /*----------------------------------------------------------------*/
  2273.     /*----------------------------------------------------------------*/
  2274.     /* Code Body                                                      */
  2275.     /*----------------------------------------------------------------*/
  2276.     mmi_jmms_show_mms_properties(E_MSG_NEW_MMS_SEND, MMI_JMMS_DRAFTS);
  2277. }
  2278. #ifdef __MMI_UNIFIED_MESSAGE__
  2279. /*****************************************************************************
  2280.  * FUNCTION
  2281.  *  mmi_jmms_highlight_draft_options_save_object
  2282.  * DESCRIPTION
  2283.  *  
  2284.  * PARAMETERS
  2285.  *  void
  2286.  * RETURNS
  2287.  *  void
  2288.  *****************************************************************************/
  2289. void mmi_jmms_highlight_draft_options_save_object(void)
  2290. {
  2291.     /*----------------------------------------------------------------*/
  2292.     /* Local Variables                                                */
  2293.     /*----------------------------------------------------------------*/
  2294.     /*----------------------------------------------------------------*/
  2295.     /* Code Body                                                      */
  2296.     /*----------------------------------------------------------------*/
  2297.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2298.     SetLeftSoftkeyFunction(mmi_jmms_entry_save_object, KEY_EVENT_UP);
  2299.     SetKeyHandler(mmi_jmms_entry_save_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2300.     SetKeyHandler(mmi_jmms_entry_save_object, KEY_WAP, KEY_EVENT_DOWN);
  2301. }
  2302. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2303. #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */ 
  2304. #endif /* _MMI_JMMSDRAFTSSECMMI_C */