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

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_inbox_ui.C
  15.  *
  16.  * Project:
  17.  * --------
  18.  *  MAUI
  19.  *
  20.  * Description:
  21.  * ------------
  22.  *  This file contains the ui of inbox 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.  * removed!
  127.  * removed!
  128.  * removed!
  129.  *
  130.  * removed!
  131.  * removed!
  132.  * removed!
  133.  *
  134.  * removed!
  135.  * removed!
  136.  * removed!
  137.  *
  138.  * removed!
  139.  * removed!
  140.  * removed!
  141.  *
  142.  *------------------------------------------------------------------------------
  143.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  144.  *============================================================================
  145.  ****************************************************************************/
  146. #ifndef _MMI_JMMSINBOXSECMMI_C
  147. #define _MMI_JMMSINBOXSECMMI_C
  148. /***************************************************************************** 
  149. * Include
  150. *****************************************************************************/
  151. #include "MMI_features.h"
  152. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  153. #include "PixtelDataTypes.h"
  154. #include "Unicodexdcl.h"
  155. #include "HistoryGprot.h"
  156. #include "GlobalDefs.h"
  157. #include "SettingProfile.h"
  158. #include "DebugInitDef.h"
  159. #include "CommonScreens.h"
  160. #include "EventsGprot.h"
  161. #include "wgui_inputs.h"
  162. #include "wgui_categories.h"
  163. #include "wgui_categories_inputs.h"
  164. #include "JMMSStoreHandling.h"
  165. #include "MainMenuDef.h"
  166. #include "JMMSConfig.h"
  167. #include "JMMSMainMMS.h"
  168. #include "JMMSUseDetails.h"
  169. #include "JMMSInbox.h"
  170. #include "JMMSWriteMMS.h"
  171. #include "JMMSCoreAPI.h"
  172. #include "JMMSDRMHandler.h"
  173. #include <ddl.h>
  174. #include <jcal.h>
  175. #include <jcalnet.h>
  176. #include "jdi_wspdatatype.h"
  177. #include "jdi_transport.h"
  178. #include <jdi_communicator.h>
  179. #include <MessagingDatatypes.h>
  180. #include <MessagingAPI.h>
  181. #include "JMMSExdcl.h"
  182. #include "JMMSPushHandling.h"
  183. #include "NVRAMEnum.h"
  184. #include "NVRAMType.h"
  185. #include "NVRAMProt.h"
  186. #include "JMMSCompose.h"
  187. #include <PrvMessagingDataTypes.h>
  188. #include <MM1DataTypes.h>
  189. #include <ComposeUtils.h>
  190. #include "JMMSResEnum.h"
  191. #include "JMMSCoreAPI.h"
  192. #include "JMMSMainMMS.h"
  193. #include "JMMSProtocols.h"
  194. #include "JMMSView.h"
  195. #include "JMMSMessageSettingsUtils.h"
  196. #include "JMMSPushHandling.h"
  197. #include "MessagesResourceData.h"
  198. #include "JMMSTemplates.h"
  199. #ifdef __MMI_UNIFIED_MESSAGE__
  200. #include "JMMSUMHandling.h"
  201. #endif 
  202. #include "wapadp.h"  // compiler warning removal
  203. /***************************************************************************** 
  204. * Define
  205. *****************************************************************************/
  206. /***************************************************************************** 
  207. * Typedef 
  208. *****************************************************************************/
  209. /***************************************************************************** 
  210. * Local Variable
  211. *****************************************************************************/
  212. /***************************************************************************** 
  213. * Local Function
  214. *****************************************************************************/
  215. /***************************************************************************** 
  216. * Global Variable
  217. *****************************************************************************/
  218. /***************************************************************************** 
  219. * Global Function
  220. *****************************************************************************/
  221. /* PMT VIKAS START 20060405 */
  222. //#ifdef __MMI_MMS_SIGNATURE__
  223. /*****************************************************************************
  224.  * FUNCTION
  225.  *  mmi_jmms_is_fw_from_inbox
  226.  * DESCRIPTION
  227.  *  
  228.  * PARAMETERS
  229.  *  void
  230.  * RETURNS
  231.  *  
  232.  *****************************************************************************/
  233. MMI_BOOL mmi_jmms_is_fw_from_inbox(void)
  234. {
  235.     /*----------------------------------------------------------------*/
  236.     /* Local Variables                                                */
  237.     /*----------------------------------------------------------------*/
  238.     /*----------------------------------------------------------------*/
  239.     /* Code Body                                                      */
  240.     /*----------------------------------------------------------------*/
  241.     return g_jmms_context->fw_from_inbox;
  242. }
  243. /*****************************************************************************
  244.  * FUNCTION
  245.  *  mmi_jmms_set_fw_flag_of_inbox
  246.  * DESCRIPTION
  247.  *  
  248.  * PARAMETERS
  249.  *  void
  250.  * RETURNS
  251.  *  void
  252.  *****************************************************************************/
  253. void mmi_jmms_set_fw_flag_of_inbox(void)
  254. {
  255.     /*----------------------------------------------------------------*/
  256.     /* Local Variables                                                */
  257.     /*----------------------------------------------------------------*/
  258.     /*----------------------------------------------------------------*/
  259.     /* Code Body                                                      */
  260.     /*----------------------------------------------------------------*/
  261.     g_jmms_context->fw_from_inbox = MMI_TRUE;
  262. }
  263. /*****************************************************************************
  264.  * FUNCTION
  265.  *  mmi_jmms_reset_fw_flag_of_inbox
  266.  * DESCRIPTION
  267.  *  
  268.  * PARAMETERS
  269.  *  void
  270.  * RETURNS
  271.  *  void
  272.  *****************************************************************************/
  273. void mmi_jmms_reset_fw_flag_of_inbox(void)
  274. {
  275.     /*----------------------------------------------------------------*/
  276.     /* Local Variables                                                */
  277.     /*----------------------------------------------------------------*/
  278.     /*----------------------------------------------------------------*/
  279.     /* Code Body                                                      */
  280.     /*----------------------------------------------------------------*/
  281.     g_jmms_context->fw_from_inbox = MMI_FALSE;
  282. }
  283. //#endif /* __MMI_MMS_SIGNATURE__ */ 
  284. /* PMT VIKAS END 20060405 */
  285. #ifndef __MMI_UNIFIED_MESSAGE__
  286. /*****************************************************************************
  287.  * FUNCTION
  288.  *  mmi_jmms_highlight_inbox
  289.  * DESCRIPTION
  290.  *  This function is highlight handler of Inbox menu item in main mms screen
  291.  * PARAMETERS
  292.  *  void
  293.  * RETURNS
  294.  *  void
  295.  *****************************************************************************/
  296. void mmi_jmms_highlight_inbox(void)
  297. {
  298.     /*----------------------------------------------------------------*/
  299.     /* Local Variables                                                */
  300.     /*----------------------------------------------------------------*/
  301.     /*----------------------------------------------------------------*/
  302.     /* Code Body                                                      */
  303.     /*----------------------------------------------------------------*/
  304.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  305.     SetLeftSoftkeyFunction(mmi_jmms_entry_inbox, KEY_EVENT_UP);
  306.     SetKeyHandler(mmi_jmms_entry_inbox, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  307.     SetKeyHandler(mmi_jmms_entry_inbox, KEY_WAP, KEY_EVENT_DOWN);
  308. }
  309. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  310. /*****************************************************************************
  311.  * FUNCTION
  312.  *  mmi_jmms_inbox_init
  313.  * DESCRIPTION
  314.  *  This function init the hilight handlers of inbox menu items.
  315.  *  This is called at boot up time
  316.  * PARAMETERS
  317.  *  void
  318.  * RETURNS
  319.  *  void
  320.  *****************************************************************************/
  321. void mmi_jmms_inbox_init(void)
  322. {
  323.     /*----------------------------------------------------------------*/
  324.     /* Local Variables                                                */
  325.     /*----------------------------------------------------------------*/
  326.     S16 error;
  327.     /* U8 i = 0; */
  328.     /*----------------------------------------------------------------*/
  329.     /* Code Body                                                      */
  330.     /*----------------------------------------------------------------*/
  331.     /* Inbox options Highlight handlers */
  332.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_VIEW, mmi_jmms_highlight_inbox_options_view);
  333.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_REPLY, mmi_jmms_highlight_inbox_options_reply);
  334.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_REPLY_ALL, mmi_jmms_highlight_inbox_options_reply_all);
  335.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_FORWARD, mmi_jmms_highlight_inbox_options_forward);
  336.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_DOWNLOAD, mmi_jmms_highlight_inbox_options_download);
  337.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_DELETE, mmi_jmms_highlight_inbox_options_delete);
  338.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_DELETE_ALL, mmi_jmms_highlight_inbox_options_delete_all);
  339.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_PROPERTIES, mmi_jmms_highlight_inbox_options_properties);
  340.     /* Inbox use details highlight handlers */
  341.     SetHiliteHandler(
  342.         MENU_ID_JMMS_INBOX_USE_DETAILS_ADDRESSES_ADD_TO_CONTACT,
  343.         mmi_jmms_highlight_options_use_details_add_to_contact);
  344.     SetHiliteHandler(MENU_ID_JMMS_INBOX_USE_DETAILS_ADDRESSES_CALL, mmi_jmms_highlight_options_use_details_call);
  345. //KP Jerry add on 2007-4-12 start
  346. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  347.     SetHiliteHandler(MENU_ID_JMMS_INBOX_USE_DETAILS_ADDRESSES_DAILIP, mmi_jmms_highlight_options_use_details_dialIP);
  348.     SetHiliteHandler(MENU_ID_JMMS_INBOX_USE_DETAILS_ADDRESSES_SENDSMS, mmi_jmms_highlight_options_use_details_sendsms);
  349.     SetHiliteHandler(MENU_ID_JMMS_INBOX_USE_DETAILS_ADDRESSES_SENDMMS, mmi_jmms_highlight_options_use_details_sendmms);
  350. #endif
  351. //KP Jerry add on 2007-4-12 end
  352.   
  353.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_SAVE_OBJECTS, mmi_jmms_highlight_inbox_options_save_object);
  354. #ifdef __MMI_UNIFIED_MESSAGE__
  355.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_EDIT_MESSAGE, mmi_jmms_highlight_inbox_options_edit_message);
  356.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_inbox_options_use_number);
  357. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  358.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS, mmi_jmms_highlight_inbox_options_use_details);
  359.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_EMAIL, mmi_jmms_highlight_options_use_details_email);
  360.     SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_options_use_details_number);
  361. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  362.     g_jmms_context->store_context->inbox_msgs_read_status =
  363.         (U8*) jdd_MemAlloc(sizeof(U8), MAX_READ_UNREAD_STATUS_BYTES);
  364.     if (g_jmms_context->store_context->inbox_msgs_read_status == NULL)
  365.     {
  366.         return;
  367.     }
  368.     ReadRecord(
  369.         NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  370.         1,
  371.         (g_jmms_context->store_context->inbox_msgs_read_status),
  372.         (U16) MAX_READ_UNREAD_STATUS_BYTES,
  373.         &error);
  374.     /*
  375.      * if (g_jmms_context->store_context->inbox_msgs_read_status[0] == 0xFF)
  376.      * {
  377.      * for (i = 0; i < MAX_READ_UNREAD_STATUS_BYTES; i++)
  378.      * {
  379.      * g_jmms_context->store_context->inbox_msgs_read_status[i] = 0x00;
  380.      * }
  381.      * 
  382.      * WriteRecord(
  383.      * NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  384.      * 1,
  385.      * (g_jmms_context->store_context->inbox_msgs_read_status),
  386.      * (U16) MAX_READ_UNREAD_STATUS_BYTES,
  387.      * &error);
  388.      * ReadRecord(
  389.      * NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  390.      * 1,
  391.      * (g_jmms_context->store_context->inbox_msgs_read_status),
  392.      * (U16) MAX_READ_UNREAD_STATUS_BYTES,
  393.      * &error);
  394.      * }
  395.      */
  396. }
  397. /*****************************************************************************
  398.  * FUNCTION
  399.  *  mmi_jmms_free_read_unread_status_bytes
  400.  * DESCRIPTION
  401.  *  
  402.  * PARAMETERS
  403.  *  void
  404.  * RETURNS
  405.  *  void
  406.  *****************************************************************************/
  407. void mmi_jmms_free_read_unread_status_bytes(void)
  408. {
  409.     /*----------------------------------------------------------------*/
  410.     /* Local Variables                                                */
  411.     /*----------------------------------------------------------------*/
  412.     /*----------------------------------------------------------------*/
  413.     /* Code Body                                                      */
  414.     /*----------------------------------------------------------------*/
  415.     if (g_jmms_context->store_context->inbox_msgs_read_status != NULL)
  416.     {
  417.         jdd_MemFree(g_jmms_context->store_context->inbox_msgs_read_status);
  418.     }
  419. }
  420. #ifndef __MMI_UNIFIED_MESSAGE__
  421. /*****************************************************************************
  422.  * FUNCTION
  423.  *  mmi_jmms_entry_inbox
  424.  * DESCRIPTION
  425.  *  This is pre entry fn for Inbox screen
  426.  * PARAMETERS
  427.  *  void
  428.  * RETURNS
  429.  *  void
  430.  *****************************************************************************/
  431. void mmi_jmms_entry_inbox(void)
  432. {
  433.     /*----------------------------------------------------------------*/
  434.     /* Local Variables                                                */
  435.     /*----------------------------------------------------------------*/
  436.     U8 total_num_msgs = 0;
  437.     JC_RETCODE eRet = JC_OK;
  438.     U16 currScrenID = 0;
  439.     /*----------------------------------------------------------------*/
  440.     /* Code Body                                                      */
  441.     /*----------------------------------------------------------------*/
  442.     eRet = mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &total_num_msgs);
  443.     if (eRet != JC_OK)
  444.     {
  445.         ASSERT(0);
  446.     }
  447.     /* set the open msg status- for At delete */
  448.     g_jmms_context->msg_open_status[0] = E_JMMS_INBOX;
  449.     g_jmms_context->msg_open_status[1] = 0;
  450.     if (total_num_msgs == 0)
  451.     {
  452.         DisplayPopup((U8*) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, JMMS_POPUP_TIME, EMPTY_LIST_TONE);
  453.         return;
  454.     }
  455.     g_jmms_context->store_context->nMsgs_in_Current_folder = total_num_msgs;
  456. g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
  457.     g_jmms_context->store_context->current_folder_name = E_JMMS_INBOX;
  458.     mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  459.     g_jmms_context->store_context->jmms_start_index = 1;
  460.     mmi_jmms_entry_get_msgs_progress_screen();
  461.     eRet = mmi_jmms_get_folder_msg_list(&(g_jmms_context->store_context->messages_list), MMI_JMMS_INBOX, total_num_msgs);
  462.     if (eRet != JC_OK || g_jmms_context->store_context->messages_list == NULL)
  463.     {
  464.         currScrenID = GetActiveScreenId();
  465.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  466.         if (currScrenID == SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN)
  467.         {
  468.             DisplayPopup(
  469.                 (U8*) GetString(STR_ID_JMMS_ERROR_GET_MSG_LIST),
  470.                 IMG_GLOBAL_ERROR,
  471.                 1,
  472.                 JMMS_POPUP_TIME,
  473.                 (U8) ERROR_TONE);
  474.             DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  475.         }
  476.         else
  477.         {
  478.             /* to avoid the show of pop up over Phone call or some other screen */
  479.             HistoryReplace(
  480.                 SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN,
  481.                 SCR_ID_JMMS_GET_MSGS_ERROR_SCREEN,
  482.                 mmi_jmms_entry_msgs_get_error_screen);
  483.         }
  484.     }
  485.     return;
  486. }
  487. /*****************************************************************************
  488.  * FUNCTION
  489.  *  mmi_jmms_entry_inbox_screen
  490.  * DESCRIPTION
  491.  *  Entry fn for inbox screen
  492.  * PARAMETERS
  493.  *  void
  494.  * RETURNS
  495.  *  void
  496.  *****************************************************************************/
  497. void mmi_jmms_entry_inbox_screen(void)
  498. {
  499.     /*----------------------------------------------------------------*/
  500.     /* Local Variables                                                */
  501.     /*----------------------------------------------------------------*/
  502.     PU8 gui_buffer; /* Buffer holding history data */
  503.     U8 num_item = 0;
  504.     JC_RETCODE eRet = JC_OK;
  505.     /*----------------------------------------------------------------*/
  506.     /* Code Body                                                      */
  507.     /*----------------------------------------------------------------*/
  508.     mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &num_item);
  509.     if (eRet != JC_OK)
  510.     {
  511.         ASSERT(0);
  512.     }
  513.     //if number of msga in fodelr is not same to as in global var then
  514.     //it means some has been recieved as user was in inbox so need to update
  515.     ///the msgs list
  516.     if (g_jmms_context->store_context->update_nmsgs_in_current_folder)
  517.     {
  518.         mmi_jmms_entry_inbox();
  519.         return;
  520.     }
  521.     ///Free any pending node to show on ideal screen
  522.     //because after entering into inbox we can't show these nodes on ideal screen
  523.     ///because user may can change the mms e.g. may downlaod a mms notificaction
  524.     //so that notification will not be notification. 
  525.     mmi_jmms_delete_mms_pop_ups_list_on_inbox_entry();
  526.     EntryNewScreen(SCR_ID_JMMS_INBOX, NULL, mmi_jmms_entry_inbox_screen, NULL);
  527.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_INBOX);
  528.     SetParentHandler(MENU_ID_JMMS_INBOX);
  529.     RegisterHighlightHandler(mmi_jmms_folder_list_highlight_hdlr);
  530.     /* reset the open msg status- for At delete */
  531.     g_jmms_context->msg_open_status[0] = 0;
  532.     g_jmms_context->msg_open_status[1] = 0;
  533.     ShowCategory184Screen(
  534.         STR_ID_JMMS_INBOX,
  535.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  536.         STR_GLOBAL_OPTIONS,
  537.         IMG_GLOBAL_OPTIONS,
  538.         STR_GLOBAL_BACK,
  539.         IMG_GLOBAL_BACK,
  540.         g_jmms_context->store_context->nMsgs_in_Current_folder,
  541.         mmi_jmms_get_item_data_inbox,
  542.         mmi_jmms_get_item_hint_inbox,
  543.         g_jmms_context->nCurr_scr_hilited_index,
  544.         gui_buffer);
  545.     SetLeftSoftkeyFunction(mmi_jmms_pre_entry_inbox_options_scren, KEY_EVENT_UP);
  546.     SetKeyHandler(mmi_jmms_pre_entry_inbox_options_scren, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  547.     SetKeyHandler(mmi_jmms_pre_entry_inbox_options_scren, KEY_WAP, KEY_EVENT_DOWN);
  548.     SetRightSoftkeyFunction(mmi_jmms_back_from_msgs_list_screen, KEY_EVENT_UP);
  549.     SetKeyHandler(mmi_jmms_back_from_msgs_list_screen, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  550. }
  551. /*****************************************************************************
  552.  * FUNCTION
  553.  *  mmi_jmms_get_item_data_inbox
  554.  * DESCRIPTION
  555.  *  fn retrun the item data
  556.  * PARAMETERS
  557.  *  item_index          [IN]        (index of item to be drawn)
  558.  *  str_buff            [IN]        (string of item)
  559.  *  img_buff_p          [?]         [?]         (image corrsponding to item
  560.  *  str_img_mask        [IN]        
  561.  * RETURNS
  562.  *  void
  563.  *****************************************************************************/
  564. pBOOL mmi_jmms_get_item_data_inbox(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  565. {
  566.     /*----------------------------------------------------------------*/
  567.     /* Local Variables                                                */
  568.     /*----------------------------------------------------------------*/
  569.     S32 count = 0;
  570.     jmms_folder_msgs_list *msgs_list_node = NULL;
  571.     U8 msg_index = 0;
  572.     MMI_BOOL is_msg_read = MMI_TRUE;
  573.     /*----------------------------------------------------------------*/
  574.     /* Code Body                                                      */
  575.     /*----------------------------------------------------------------*/
  576.     if ((item_index < 0) || (item_index > MAX_POSSIBLE_MESSAGES))
  577.     {
  578.         return FALSE;
  579.     }
  580.     msgs_list_node = g_jmms_context->store_context->messages_list;
  581.     while (count != item_index && msgs_list_node != NULL)
  582.     {
  583.         msgs_list_node = msgs_list_node->next;
  584.         count++;
  585.     }
  586.     if (msgs_list_node == NULL)
  587.     {
  588.         return FALSE;
  589.     }
  590.     pfnUnicodeStrcpy((S8*) str_buff, msgs_list_node->subject_as_caption);
  591.     msg_index = g_jmms_context->store_context->nMsgs_in_Current_folder - item_index;
  592.     msg_index = msg_index - 1;
  593.     switch (msgs_list_node->msg_type)
  594.     {
  595.         case E_MSG_NOTIFICATION:
  596.             *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_MMS_NOTIFICATION));
  597.             break;
  598.         case E_MSG_RECEIVE:
  599.             is_msg_read = mmi_jmms_is_msg_read(msg_index);
  600.             if (is_msg_read == MMI_TRUE)
  601.             {
  602.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_NEW_MMS_READ));
  603.             }
  604.             else
  605.             {
  606.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_NEW_MMS_UNREAD));
  607.             }
  608.             break;
  609.         case E_MSG_DELIVERY_REPORT:
  610.             is_msg_read = mmi_jmms_is_msg_read(msg_index);
  611.             if (is_msg_read == MMI_TRUE)
  612.             {
  613.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_DELIVERY_READ));
  614.             }
  615.             else
  616.             {
  617.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_DELIVERY_UNREAD));
  618.             }
  619.             break;
  620.         case E_MSG_JAVA_MESSAGE:
  621.             *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_JAVA_MMS));
  622.             break;
  623.         case E_MSG_READ_REPORT:
  624.             is_msg_read = mmi_jmms_is_msg_read(msg_index);
  625.             if (is_msg_read == MMI_TRUE)
  626.             {
  627.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_READ_REPORT_READ));
  628.             }
  629.             else
  630.             {
  631.                 *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_READ_REPORT_UNREAD));
  632.             }
  633.             break;
  634.     }
  635.     return TRUE;
  636. }
  637. /*****************************************************************************
  638.  * FUNCTION
  639.  *  mmi_jmms_get_item_hint_inbox
  640.  * DESCRIPTION
  641.  *  Retrun the hint fot the item to be drawn
  642.  * PARAMETERS
  643.  *  item_index      [IN]        (index of item to be drawn)
  644.  *  hint_array      [?]         [?]         (hint buufer for the item_index)
  645.  * RETURNS
  646.  *  void
  647.  *****************************************************************************/
  648. S32 mmi_jmms_get_item_hint_inbox(S32 item_index, UI_string_type *hint_array)
  649. {
  650.     /*----------------------------------------------------------------*/
  651.     /* Local Variables                                                */
  652.     /*----------------------------------------------------------------*/
  653.     S32 count = 0;
  654.     jmms_folder_msgs_list *msgs_list_node = NULL;
  655.     /*----------------------------------------------------------------*/
  656.     /* Code Body                                                      */
  657.     /*----------------------------------------------------------------*/
  658.     if ((item_index < 0) || (item_index > MAX_POSSIBLE_MESSAGES))
  659.     {
  660.         return FALSE;
  661.     }
  662.     msgs_list_node = g_jmms_context->store_context->messages_list;
  663.     while (count != item_index && msgs_list_node != NULL)
  664.     {
  665.         msgs_list_node = msgs_list_node->next;
  666.         count++;
  667.     }
  668.     if (msgs_list_node == NULL || msgs_list_node->address_as_hint == NULL)
  669.     {
  670.         return 0;
  671.     }
  672.     if (pfnUnicodeStrlen((S8*) (msgs_list_node->address_as_hint)))
  673.     {
  674.         pfnUnicodeStrcpy((S8*) hint_array[0], (S8*) (msgs_list_node->address_as_hint));
  675.     }
  676.     else
  677.     {
  678.         return 0;   /* No Hint Data */
  679.     }
  680.     return TRUE;
  681. }
  682. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  683. /*****************************************************************************
  684.  * FUNCTION
  685.  *  mmi_jmms_pre_entry_inbox_options_scren
  686.  * DESCRIPTION
  687.  *  
  688.  * PARAMETERS
  689.  *  void
  690.  * RETURNS
  691.  *  void
  692.  *****************************************************************************/
  693. void mmi_jmms_pre_entry_inbox_options_scren(void)
  694. {
  695.     /*----------------------------------------------------------------*/
  696.     /* Local Variables                                                */
  697.     /*----------------------------------------------------------------*/
  698.     MMI_BOOL status = MMI_FALSE;
  699.     U16 msg_type = 0;
  700.     /*----------------------------------------------------------------*/
  701.     /* Code Body                                                      */
  702.     /*----------------------------------------------------------------*/
  703.     msg_type = mmi_jmms_get_msg_type(g_jmms_context->nCurr_scr_hilited_index);
  704.     if (msg_type == E_MSG_NOTIFICATION)
  705.     {
  706.         status = mmi_jmms_is_notifiction_in_use((U16)
  707.                                                 (g_jmms_context->store_context->nMsgs_in_Current_folder -
  708.                                                  g_jmms_context->nCurr_scr_hilited_index));
  709.         if (status == MMI_TRUE)
  710.         {
  711.             DisplayPopup(
  712.                 (U8*) GetString(STR_ID_JMMS_NOTF_IN_USE),
  713.                 IMG_GLOBAL_WARNING,
  714.                 1,
  715.                 JMMS_POPUP_TIME,
  716.                 (U8) WARNING_TONE);
  717.             return;
  718.         }
  719.     }
  720.     mmi_jmms_entry_inbox_options_scren();
  721. }
  722. /*****************************************************************************
  723.  * FUNCTION
  724.  *  mmi_jmms_entry_inbox_options_scren
  725.  * DESCRIPTION
  726.  *  Entry fn for inbox options screeen
  727.  * PARAMETERS
  728.  *  void
  729.  * RETURNS
  730.  *  void
  731.  *****************************************************************************/
  732. void mmi_jmms_entry_inbox_options_scren(void)
  733. {
  734.     /*----------------------------------------------------------------*/
  735.     /* Local Variables                                                */
  736.     /*----------------------------------------------------------------*/
  737.     PU8 gui_buffer;                     /* Buffer holding history data */
  738.     U16 str_item_list[MAX_SUB_MENUS];   /* Stores the strings id of submenus returned */
  739.     U16 num_item;                       /* Stores no of children in the submenu */
  740.     U16 msg_type = 0;
  741.     U16 parentid;
  742. #ifdef __MMI_UNIFIED_MESSAGE__
  743.     U8 curr_page =0;
  744.     MEDIA_INFO *image_info;
  745.     U8 media_count = 0;
  746. #endif 
  747.     /*----------------------------------------------------------------*/
  748.     /* Code Body                                                      */
  749.     /*----------------------------------------------------------------*/
  750.     msg_type = mmi_jmms_get_msg_type(g_jmms_context->nCurr_scr_hilited_index);
  751.     /* PMT VIKAS START 20060405 */
  752. //#ifdef __MMI_MMS_SIGNATURE__
  753.     mmi_jmms_reset_fw_flag_of_inbox();
  754. //#endif 
  755.     /* PMT VIKAS END 20060405 */
  756.     mmi_jmms_reset_fw_flag_of_message();
  757.     switch (msg_type)
  758.     {
  759.         case E_MSG_NOTIFICATION:
  760.             parentid = MENU_ID_JMMS_INBOX_OPTIONS_NOTIFICATION;
  761.             break;
  762.         case E_MSG_RECEIVE:
  763.             parentid = MENU_ID_JMMS_INBOX_OPTIONS_NEW_MMS;
  764.             break;
  765.         case E_MSG_DELIVERY_REPORT:
  766.             parentid = MENU_ID_JMMS_INBOX_OPTIONS_DELIVERY_REPORT;
  767.             break;
  768.         case E_MSG_READ_REPORT: /* /Read report have same options as Delivery Report */
  769.             parentid = MENU_ID_JMMS_INBOX_OPTIONS_DELIVERY_REPORT;
  770.             break;
  771.         case E_MSG_JAVA_MESSAGE:
  772.             parentid = MENU_ID_JMMS_INBOX_OPTIONS_JAVA_MMS;
  773.             break;
  774.         default:
  775.             return;
  776.     }
  777.     
  778.     EntryNewScreen(SCR_ID_JMMS_INBOX_OPTIONS, NULL, mmi_jmms_entry_inbox_options_scren, NULL);
  779. #ifdef __MMI_UNIFIED_MESSAGE__
  780.     DeleteScreenIfPresent(SCR_ID_JMMS_NOTIFICATION_PROPERTIES);
  781.     DeleteScreenIfPresent(SCR_ID_JMMS_RETRIEVED_MMS_PROPERTIES);
  782.     DeleteScreenIfPresent(SCR_ID_JMMS_NEW_MMS);
  783.     DeleteScreenIfPresent(SCR_ID_JMMS_READ_REPORT_QUERY);
  784. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  785.     gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_INBOX_OPTIONS);
  786. #ifdef __MMI_UNIFIED_MESSAGE__
  787.     DeleteScreenIfPresent(SCR_ID_JMMS_INBOX_OPTIONS);
  788. #endif 
  789.     num_item = GetNumOfChild(parentid);
  790. #ifdef __MMI_UNIFIED_MESSAGE__
  791.     mmi_jmms_jdi_get_media_count(g_jmms_context->msg_handle, 0, &media_count, E_TRUE);
  792.     mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  793.     image_info = mmi_jmms_jdi_get_image_data(curr_page);
  794.     if (g_jmms_context->view_context != NULL)
  795.     {
  796.         if (/*g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_IMAGE ||
  797.             g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_AUDIO ||
  798.             g_jmms_context->view_context->focus_object_type == E_MSG_FOCUS_VIDEO ||
  799.             */
  800.             media_count || g_jmms_context->view_context->view_audio_id || g_jmms_context->view_context->view_video_id || image_info != NULL)
  801.         {
  802.             mmi_frm_unhide_menu_item(MENU_ID_JMMS_INBOX_OPTIONS_SAVE_OBJECTS);
  803.         }
  804.         else
  805.         {
  806.             if (msg_type == E_MSG_RECEIVE)
  807.             {
  808.                 mmi_frm_hide_menu_item(MENU_ID_JMMS_INBOX_OPTIONS_SAVE_OBJECTS);
  809.                 num_item--;
  810.             }
  811.         }
  812.     }
  813.     else
  814.     {
  815.         if (msg_type == E_MSG_RECEIVE)
  816.         {
  817.             mmi_frm_hide_menu_item(MENU_ID_JMMS_INBOX_OPTIONS_SAVE_OBJECTS);
  818.             num_item--;
  819.         }
  820.     }
  821. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  822.     GetSequenceStringIds_Ext(parentid, str_item_list);
  823.     SetParentHandler(parentid);
  824.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  825. #ifndef __MMI_UNIFIED_MESSAGE__
  826.     /* set the open msg status- for At delete */
  827.     g_jmms_context->msg_open_status[0] = E_JMMS_INBOX;
  828.     //PMT HIMANSHU START 20060425
  829.     //      g_jmms_context->msg_open_status[1]=(U16)(g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);
  830.     g_jmms_context->msg_open_status[1] =
  831.         (U32) mmi_jmms_get_message_id(
  832.                 MMI_JMMS_INBOX,
  833.                 (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index));
  834.     /* PMT HIMANSHU END 20060425 */
  835. #endif
  836.     ShowCategory52Screen(
  837.         STR_GLOBAL_OPTIONS,
  838.         GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
  839.         STR_GLOBAL_OK,
  840.         IMG_GLOBAL_OK,
  841.         STR_GLOBAL_BACK,
  842.         IMG_GLOBAL_BACK,
  843.         num_item,
  844.         str_item_list,
  845.         (U16*) gIndexIconsImageList,
  846.         NULL,
  847.         0,
  848.         0,
  849.         gui_buffer);
  850.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  851.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  852. }
  853. /*****************************************************************************
  854.  * FUNCTION
  855.  *  mmi_jmms_is_notifiction_in_use
  856.  * DESCRIPTION
  857.  *  
  858.  * PARAMETERS
  859.  *  msg_index       [IN]        
  860.  * RETURNS
  861.  *  
  862.  *****************************************************************************/
  863. MMI_BOOL mmi_jmms_is_notifiction_in_use(U16 msg_index)
  864. {
  865.     /*----------------------------------------------------------------*/
  866.     /* Local Variables                                                */
  867.     /*----------------------------------------------------------------*/
  868.     jmms_communication_state_node *temp_node = NULL;
  869.     /*----------------------------------------------------------------*/
  870.     /* Code Body                                                      */
  871.     /*----------------------------------------------------------------*/
  872.     temp_node = g_jmms_context->comm_state;
  873.     while (temp_node != NULL)
  874.     {
  875.         if (temp_node->msg_index == msg_index)
  876.         {
  877.             return MMI_TRUE;
  878.         }
  879.         temp_node = temp_node->next;
  880.     }
  881.     return MMI_FALSE;
  882. }
  883. /*****************************************************************************
  884.  * FUNCTION
  885.  *  mmi_jmms_highlight_inbox_options_view
  886.  * DESCRIPTION
  887.  *  highlight hdlr of view menu item in Inbox options
  888.  * PARAMETERS
  889.  *  void
  890.  * RETURNS
  891.  *  void
  892.  *****************************************************************************/
  893. void mmi_jmms_highlight_inbox_options_view(void)
  894. {
  895.     /*----------------------------------------------------------------*/
  896.     /* Local Variables                                                */
  897.     /*----------------------------------------------------------------*/
  898.     /*----------------------------------------------------------------*/
  899.     /* Code Body                                                      */
  900.     /*----------------------------------------------------------------*/
  901.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  902. #ifdef __MMI_UNIFIED_MESSAGE__
  903. SetLeftSoftkeyFunction(mmi_jmms_pre_entry_view, KEY_EVENT_UP);
  904. SetKeyHandler(mmi_jmms_pre_entry_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  905.     SetKeyHandler(mmi_jmms_pre_entry_view, KEY_WAP, KEY_EVENT_DOWN);
  906. #else
  907. SetLeftSoftkeyFunction(mmi_jmms_inbox_view, KEY_EVENT_UP);
  908. /* MAUI_00018463 Start */
  909.    // SetKeyHandler(mmi_jmms_inbox_view, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  910. /* MAUI_00018463 End */
  911.     SetKeyHandler(mmi_jmms_inbox_view, KEY_WAP, KEY_EVENT_DOWN); 
  912. #endif
  913.   
  914. }
  915. /*****************************************************************************
  916.  * FUNCTION
  917.  *  mmi_jmms_highlight_inbox_options_reply
  918.  * DESCRIPTION
  919.  *  highlight hdlr of view menu item in Inbox options
  920.  * PARAMETERS
  921.  *  void
  922.  * RETURNS
  923.  *  void
  924.  *****************************************************************************/
  925. void mmi_jmms_highlight_inbox_options_reply(void)
  926. {
  927.     /*----------------------------------------------------------------*/
  928.     /* Local Variables                                                */
  929.     /*----------------------------------------------------------------*/
  930.     /*----------------------------------------------------------------*/
  931.     /* Code Body                                                      */
  932.     /*----------------------------------------------------------------*/
  933.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  934.     SetLeftSoftkeyFunction(mmi_jmms_inbox_reply, KEY_EVENT_UP);
  935.     SetKeyHandler(mmi_jmms_inbox_reply, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  936.     SetKeyHandler(mmi_jmms_inbox_reply, KEY_WAP, KEY_EVENT_DOWN);
  937. }
  938. /*****************************************************************************
  939.  * FUNCTION
  940.  *  mmi_jmms_highlight_inbox_options_reply_all
  941.  * DESCRIPTION
  942.  *  highlight hdlr of view menu item in Inbox options
  943.  * PARAMETERS
  944.  *  void
  945.  * RETURNS
  946.  *  void
  947.  *****************************************************************************/
  948. void mmi_jmms_highlight_inbox_options_reply_all(void)
  949. {
  950.     /*----------------------------------------------------------------*/
  951.     /* Local Variables                                                */
  952.     /*----------------------------------------------------------------*/
  953.     /*----------------------------------------------------------------*/
  954.     /* Code Body                                                      */
  955.     /*----------------------------------------------------------------*/
  956.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  957.     SetLeftSoftkeyFunction(mmi_jmms_inbox_reply_all, KEY_EVENT_UP);
  958.     SetKeyHandler(mmi_jmms_inbox_reply_all, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  959.     SetKeyHandler(mmi_jmms_inbox_reply_all, KEY_WAP, KEY_EVENT_DOWN);
  960. }
  961. /*****************************************************************************
  962.  * FUNCTION
  963.  *  mmi_jmms_highlight_inbox_options_forward
  964.  * DESCRIPTION
  965.  *  highlight hdlr of view menu item in Inbox options
  966.  * PARAMETERS
  967.  *  void
  968.  * RETURNS
  969.  *  void
  970.  *****************************************************************************/
  971. void mmi_jmms_highlight_inbox_options_forward(void)
  972. {
  973.     /*----------------------------------------------------------------*/
  974.     /* Local Variables                                                */
  975.     /*----------------------------------------------------------------*/
  976.     /*----------------------------------------------------------------*/
  977.     /* Code Body                                                      */
  978.     /*----------------------------------------------------------------*/
  979.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  980.     SetLeftSoftkeyFunction(mmi_jmms_inbox_forward, KEY_EVENT_UP);
  981.     SetKeyHandler(mmi_jmms_inbox_forward, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  982.     SetKeyHandler(mmi_jmms_inbox_forward, KEY_WAP, KEY_EVENT_DOWN);
  983. }
  984. /*****************************************************************************
  985.  * FUNCTION
  986.  *  mmi_jmms_highlight_inbox_options_download
  987.  * DESCRIPTION
  988.  *  highlight hdlr of view menu item in Inbox options
  989.  * PARAMETERS
  990.  *  void
  991.  * RETURNS
  992.  *  void
  993.  *****************************************************************************/
  994. void mmi_jmms_highlight_inbox_options_download(void)
  995. {
  996.     /*----------------------------------------------------------------*/
  997.     /* Local Variables                                                */
  998.     /*----------------------------------------------------------------*/
  999.     /*----------------------------------------------------------------*/
  1000.     /* Code Body                                                      */
  1001.     /*----------------------------------------------------------------*/
  1002.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1003.     SetLeftSoftkeyFunction(mmi_jmms_inbox_download, KEY_EVENT_UP);
  1004.     SetKeyHandler(mmi_jmms_inbox_download, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1005.     SetKeyHandler(mmi_jmms_inbox_download, KEY_WAP, KEY_EVENT_DOWN);
  1006. }
  1007. /*****************************************************************************
  1008.  * FUNCTION
  1009.  *  mmi_jmms_highlight_inbox_options_delete
  1010.  * DESCRIPTION
  1011.  *  highlight hdlr of view menu item in Inbox options
  1012.  * PARAMETERS
  1013.  *  void
  1014.  * RETURNS
  1015.  *  void
  1016.  *****************************************************************************/
  1017. void mmi_jmms_highlight_inbox_options_delete(void)
  1018. {
  1019.     /*----------------------------------------------------------------*/
  1020.     /* Local Variables                                                */
  1021.     /*----------------------------------------------------------------*/
  1022.     /*----------------------------------------------------------------*/
  1023.     /* Code Body                                                      */
  1024.     /*----------------------------------------------------------------*/
  1025.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1026.     SetLeftSoftkeyFunction(mmi_jmms_inbox_pre_delete, KEY_EVENT_UP);
  1027.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1028.     SetKeyHandler(mmi_jmms_inbox_pre_delete, KEY_WAP, KEY_EVENT_DOWN);
  1029. }
  1030. /*****************************************************************************
  1031.  * FUNCTION
  1032.  *  mmi_jmms_highlight_inbox_options_delete_all
  1033.  * DESCRIPTION
  1034.  *  highlight hdlr of delete all menu item in Inbox options
  1035.  * PARAMETERS
  1036.  *  void
  1037.  * RETURNS
  1038.  *  void
  1039.  *****************************************************************************/
  1040. void mmi_jmms_highlight_inbox_options_delete_all(void)
  1041. {
  1042.     /*----------------------------------------------------------------*/
  1043.     /* Local Variables                                                */
  1044.     /*----------------------------------------------------------------*/
  1045.     /*----------------------------------------------------------------*/
  1046.     /* Code Body                                                      */
  1047.     /*----------------------------------------------------------------*/
  1048.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1049.     SetLeftSoftkeyFunction(mmi_jmms_inbox_delete_all, KEY_EVENT_UP);
  1050.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1051.     SetKeyHandler(mmi_jmms_inbox_delete_all, KEY_WAP, KEY_EVENT_DOWN);
  1052. }
  1053. /*****************************************************************************
  1054.  * FUNCTION
  1055.  *  mmi_jmms_highlight_inbox_options_use_details
  1056.  * DESCRIPTION
  1057.  *  highlight hdlr of use details menu item in Inbox options
  1058.  * PARAMETERS
  1059.  *  void
  1060.  * RETURNS
  1061.  *  void
  1062.  *****************************************************************************/
  1063. #ifdef __MMI_UNIFIED_MESSAGE__
  1064. void mmi_jmms_highlight_inbox_options_use_number(void)
  1065. #else 
  1066. void mmi_jmms_highlight_inbox_options_use_details(void)
  1067. #endif 
  1068. {
  1069.     /*----------------------------------------------------------------*/
  1070.     /* Local Variables                                                */
  1071.     /*----------------------------------------------------------------*/
  1072.     /*----------------------------------------------------------------*/
  1073.     /* Code Body                                                      */
  1074.     /*----------------------------------------------------------------*/
  1075.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1076.     SetLeftSoftkeyFunction(mmi_jmms_inbox_use_details, KEY_EVENT_UP);
  1077.     SetKeyHandler(mmi_jmms_inbox_use_details, KEY_SEND, KEY_EVENT_UP);
  1078.     SetKeyHandler(mmi_jmms_inbox_use_details, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1079.     SetKeyHandler(mmi_jmms_inbox_use_details, KEY_WAP, KEY_EVENT_DOWN);
  1080. }
  1081. /*****************************************************************************
  1082.  * FUNCTION
  1083.  *  mmi_jmms_highlight_inbox_options_properties
  1084.  * DESCRIPTION
  1085.  *  highlight hdlr of properties menu item in Inbox options
  1086.  * PARAMETERS
  1087.  *  void
  1088.  * RETURNS
  1089.  *  void
  1090.  *****************************************************************************/
  1091. void mmi_jmms_highlight_inbox_options_properties(void)
  1092. {
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Local Variables                                                */
  1095.     /*----------------------------------------------------------------*/
  1096.     /*----------------------------------------------------------------*/
  1097.     /* Code Body                                                      */
  1098.     /*----------------------------------------------------------------*/
  1099.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1100.     SetLeftSoftkeyFunction(mmi_jmms_inbox_properties, KEY_EVENT_UP);
  1101.     SetKeyHandler(mmi_jmms_inbox_properties, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1102.     SetKeyHandler(mmi_jmms_inbox_properties, KEY_WAP, KEY_EVENT_DOWN);
  1103. }
  1104. /*****************************************************************************
  1105.  * FUNCTION
  1106.  *  mmi_jmms_inbox_view
  1107.  * DESCRIPTION
  1108.  *  
  1109.  * PARAMETERS
  1110.  *  void
  1111.  * RETURNS
  1112.  *  void
  1113.  *****************************************************************************/
  1114. void mmi_jmms_inbox_view(void)
  1115. {
  1116.     /*----------------------------------------------------------------*/
  1117.     /* Local Variables                                                */
  1118.     /*----------------------------------------------------------------*/
  1119.     U8 msg_index = 0;
  1120. #ifndef __MMI_UNIFIED_MESSAGE__
  1121.     U8 index = 0;
  1122. #endif
  1123.     jmms_folder_msgs_list *node = NULL;
  1124.     MMI_BOOL is_msg_read = MMI_TRUE;
  1125.     JC_RETCODE eRet = JC_OK;
  1126.     CONTENT_DATA Content = {0, };
  1127.     /*----------------------------------------------------------------*/
  1128.     /* Code Body                                                      */
  1129.     /*----------------------------------------------------------------*/
  1130.     node = g_jmms_context->store_context->messages_list;
  1131. #ifdef __MMI_UNIFIED_MESSAGE__
  1132.     while (node != NULL)
  1133.     {
  1134.         if (node->msg_index == g_jmms_context->nCurr_scr_hilited_index)
  1135.         {
  1136.             break;
  1137.         }
  1138.         node = node->next;
  1139.     }
  1140.     if (node == NULL)
  1141.     {
  1142.         return;
  1143.     }
  1144. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1145.     while (index < g_jmms_context->nCurr_scr_hilited_index)
  1146.     {
  1147.         node = node->next;
  1148.         index++;
  1149.     }
  1150. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1151.     /* /set the msg status as read if first time read */
  1152.     msg_index = g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index;
  1153.     msg_index = msg_index - 1;
  1154.     is_msg_read = mmi_jmms_is_msg_read(msg_index);
  1155. #ifdef __MMI_UNIFIED_MESSAGE__
  1156.     if ((is_msg_read == MMI_FALSE) && node->msg_type != E_MSG_NOTIFICATION && node->msg_type != E_MSG_JAVA_MESSAGE)
  1157. #else 
  1158.     if (is_msg_read == MMI_FALSE)
  1159. #endif 
  1160.     {
  1161.         mmi_jmms_set_msg_as_read(msg_index);
  1162.     }
  1163.     //TODO:: need to test read report PDU and Delivery Report PDU
  1164.     ///currently not able to save these PDUs. Will able to test
  1165.     ///in T3
  1166. #ifdef __MMI_UNIFIED_MESSAGE__
  1167.     if (node->msg_type == E_MSG_DELIVERY_REPORT || node->msg_type == E_MSG_READ_REPORT ||
  1168.         node->msg_type == E_MSG_NOTIFICATION || node->msg_type == E_MSG_JAVA_MESSAGE)
  1169. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1170.     if (node->msg_type == E_MSG_DELIVERY_REPORT || node->msg_type == E_MSG_READ_REPORT)
  1171. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1172.     {
  1173. #ifdef __MMI_UNIFIED_MESSAGE__
  1174.         if (node->msg_type == E_MSG_NOTIFICATION)
  1175.         {
  1176.             MMI_BOOL status = mmi_jmms_is_notifiction_in_use((U16)
  1177.                                                 (g_jmms_context->store_context->nMsgs_in_Current_folder -
  1178.                                                  g_jmms_context->nCurr_scr_hilited_index));
  1179.             if (status == MMI_TRUE)
  1180.             {
  1181.                 DisplayPopup(
  1182.                     (U8*) GetString(STR_ID_JMMS_NOTF_IN_USE),
  1183.                     IMG_GLOBAL_WARNING,
  1184.                     1,
  1185.                     JMMS_POPUP_TIME,
  1186.                     (U8) WARNING_TONE);
  1187.                 return;
  1188.             }
  1189.         }
  1190. #endif
  1191.         mmi_jmms_show_mms_properties(node->msg_type, MMI_JMMS_INBOX);
  1192.         return;
  1193.     }
  1194.     else
  1195.     {
  1196.         Content.bIsStream = E_TRUE;
  1197.         eRet = mmi_jmms_get_message(
  1198.                 "Inbox",
  1199.                 &Content,
  1200.                 (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index));
  1201.         if (eRet != JC_OK)
  1202.         {
  1203.             goto END;
  1204.         }
  1205.         if (is_msg_read == MMI_FALSE)
  1206.         {
  1207.             ///it means first time viewing the mms.
  1208.             ///so need to check for read report require to send
  1209.             mmi_jmms_deinit_mms_context(g_jmms_context);
  1210.             eRet = mmi_jmms_jdi_parse_msg_buffer(&(g_jmms_context->msg_handle), &Content, E_TYPE_MMS, E_FALSE);
  1211.             /* Async changes start */
  1212.             while (eRet == JC_ERR_MMS_PARSE_PENDING)
  1213.             {
  1214.                 eRet = mmi_jmms_jdi_msg_parse_continue(g_jmms_context->msg_handle);
  1215.             };
  1216.             /* Async changes end */
  1217.             if (JC_OK != eRet)
  1218.             {
  1219.                 goto END;
  1220.             }
  1221.             eRet = mmi_jmms_jdi_get_msg_headers(
  1222.                     g_jmms_context->msg_handle,
  1223.                     (MESSAGE_HEADERS **) (&(g_jmms_context->MsgHeaders_p)));
  1224.             if (JC_OK != eRet)
  1225.             {
  1226.                 goto END;
  1227.             }
  1228.             g_jmms_context->MsgHeader_type_p =
  1229.                 (MESSAGE_RETRIEVAL*) ((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->pHeaders;
  1230.             g_jmms_context->last_scr_id = SCR_ID_JMMS_INBOX_OPTIONS;
  1231.             g_jmms_context->mms_index =
  1232.                 g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index;
  1233.             g_jmms_context->is_unread_msg_deleted = 0;
  1234.         #ifdef __MMI_UNIFIED_MESSAGE__
  1235.             g_jmms_context->show_property_screen = MMI_FALSE;
  1236.         #endif 
  1237.             mmi_jmms_handle_read_report(g_jmms_context->MsgHeader_type_p);
  1238.         }
  1239.         else
  1240.         {
  1241.             /* /TODO:: to be added by deeapali */
  1242.             g_jmms_context->last_scr_id = SCR_ID_JMMS_INBOX_OPTIONS;
  1243. #ifdef __MMI_UNIFIED_MESSAGE__
  1244. mmi_jmms_deinit_view();
  1245. #endif 
  1246.             eRet = mmi_jmms_pre_entry_mms_view(&Content);
  1247.             if (eRet == JC_ERR_MMS_PARSE_PENDING)
  1248.             {
  1249.                 return;
  1250.             }
  1251.         }
  1252.     }
  1253.   END:
  1254.     if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  1255.     {
  1256.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1257.         g_jmms_context->msg_handle = NULL;
  1258.     }
  1259.     if (eRet != JC_OK)
  1260.     {
  1261.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1262.     }
  1263. }
  1264. /*****************************************************************************
  1265.  * FUNCTION
  1266.  *  mmi_jmms_inbox_reply
  1267.  * DESCRIPTION
  1268.  *  
  1269.  * PARAMETERS
  1270.  *  void
  1271.  * RETURNS
  1272.  *  void
  1273.  *****************************************************************************/
  1274. void mmi_jmms_inbox_reply(void)
  1275. {
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Local Variables                                                */
  1278.     /*----------------------------------------------------------------*/
  1279.     /*----------------------------------------------------------------*/
  1280.     /* Code Body                                                      */
  1281.     /*----------------------------------------------------------------*/
  1282.     mmi_jmms_reply_message(E_FALSE);
  1283. }
  1284. /*****************************************************************************
  1285.  * FUNCTION
  1286.  *  mmi_jmms_inbox_reply_all
  1287.  * DESCRIPTION
  1288.  *  
  1289.  * PARAMETERS
  1290.  *  void
  1291.  * RETURNS
  1292.  *  void
  1293.  *****************************************************************************/
  1294. void mmi_jmms_inbox_reply_all(void)
  1295. {
  1296.     /*----------------------------------------------------------------*/
  1297.     /* Local Variables                                                */
  1298.     /*----------------------------------------------------------------*/
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Code Body                                                      */
  1301.     /*----------------------------------------------------------------*/
  1302.     mmi_jmms_reply_message(E_TRUE);
  1303. }
  1304. /*****************************************************************************
  1305.  * FUNCTION
  1306.  *  mmi_jmms_reply_message
  1307.  * DESCRIPTION
  1308.  *  
  1309.  * PARAMETERS
  1310.  *  bReplyAll       [IN]        
  1311.  * RETURNS
  1312.  *  void
  1313.  *****************************************************************************/
  1314. void mmi_jmms_reply_message(JC_BOOLEAN bReplyAll)
  1315. {
  1316.     /*----------------------------------------------------------------*/
  1317.     /* Local Variables                                                */
  1318.     /*----------------------------------------------------------------*/
  1319.     CONTENT_DATA Content = {0, };
  1320.     MSG_HANDLE hTempMsg = NULL;
  1321.     S8 *temp_str = NULL;
  1322.     S8 *str = NULL;
  1323.     S32 len = 0;
  1324.     S32 start_index = 0;
  1325.     JC_RETCODE eRet = JC_OK;
  1326.     U8 ret = 0;
  1327.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1328.     MESSAGE_SEND *send_p = NULL;
  1329.     MMI_BOOL is_email = MMI_FALSE;
  1330.     S32 len_to_copy = 0;
  1331.     U8 number = 0;
  1332.     MMI_BOOL is_duplicate = MMI_FALSE;
  1333. #if 0  
  1334. /* under construction !*/
  1335. /* under construction !*/
  1336. #endif 
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Code Body                                                      */
  1339.     /*----------------------------------------------------------------*/
  1340.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  1341.     eRet = jdi_MsgInit(&hTempMsg, NULL);
  1342.     if (JC_OK != eRet)
  1343.     {
  1344.         mmi_jmms_error_handler(eRet);
  1345.         goto END;
  1346.     }
  1347.     Content.bIsStream = E_TRUE;
  1348.     eRet = mmi_jmms_get_message("Inbox", &Content, (number - g_jmms_context->nCurr_scr_hilited_index));
  1349.     if (eRet != JC_OK)
  1350.     {
  1351.         mmi_jmms_error_handler(eRet);
  1352.         goto END;
  1353.     }
  1354.     if (g_jmms_context->msg_handle != NULL)
  1355.     {
  1356.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1357.         g_jmms_context->msg_handle = NULL;
  1358.     }
  1359. #if 0
  1360. /* under construction !*/
  1361. /* under construction !*/
  1362. /* under construction !*/
  1363. /* under construction !*/
  1364. /* under construction !*/
  1365. /* under construction !*/
  1366. /* under construction !*/
  1367. /* under construction !*/
  1368. #endif 
  1369.     eRet = mmi_jmms_jdi_msg_reply(hTempMsg, &Content, bReplyAll, &(g_jmms_context->msg_handle));
  1370.     if (eRet != JC_OK)
  1371.     {
  1372.         mmi_jmms_error_handler(eRet);
  1373.         goto END;
  1374.     }
  1375.     eRet = mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_ERROR_IND, (void*)mmi_jmms_error_ind_cb);
  1376.     if (eRet != JC_OK)
  1377.     {
  1378.         mmi_jmms_error_handler(eRet);
  1379.         goto END;
  1380.     }
  1381.     eRet = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
  1382.     if (eRet != JC_OK)
  1383.     {
  1384.         mmi_jmms_error_handler(eRet);
  1385.         goto END;
  1386.     }
  1387.     eRet = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
  1388.     if (eRet != JC_OK)
  1389.     {
  1390.         mmi_jmms_error_handler(eRet);
  1391.         goto END;
  1392.     }
  1393.     eRet = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
  1394.     if (eRet != JC_OK)
  1395.     {
  1396.         mmi_jmms_error_handler(eRet);
  1397.         goto END;
  1398.     }
  1399.     eRet = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
  1400.     if (eRet != JC_OK)
  1401.     {
  1402.         mmi_jmms_error_handler(eRet);
  1403.         goto END;
  1404.     }
  1405.     eRet = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
  1406.     if (eRet != JC_OK)
  1407.     {
  1408.         mmi_jmms_error_handler(eRet);
  1409.         goto END;
  1410.     }
  1411.     eRet = mmi_jmms_jdi_msg_register_callback(
  1412.             g_jmms_context->msg_handle,
  1413.             E_CB_REPLY_CHARGING,
  1414.             (void*)mmi_jmms_reply_charging_ind_cb);
  1415.     if (eRet != JC_OK)
  1416.     {
  1417.         mmi_jmms_error_handler(eRet);
  1418.         goto END;
  1419.     }
  1420.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
  1421.     if (eRet != JC_OK || pMsgHeaders == NULL)
  1422.     {
  1423.         eRet = JC_ERR_STORE_FILE_CORRUPTED;
  1424.         mmi_jmms_error_handler(eRet);
  1425.         goto END;
  1426.     }
  1427.     if (pMsgHeaders->eMsgType != E_MSG_TYPE_SEND)
  1428.     {
  1429.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1430.         goto END;
  1431.     }
  1432.     send_p = (MESSAGE_SEND*) (pMsgHeaders->pHeaders);
  1433.     mmi_jmms_free_addresses_list();
  1434.     /* /Make the To Addresses list */
  1435.     if (send_p->pTo != NULL)
  1436.     {
  1437.         str = (S8*) (send_p->pTo);
  1438.         len = 0;
  1439.         start_index = 0;
  1440.         g_jmms_context->address_list_flag = E_TO_ADDRESSES;
  1441.         while (pfnUnicodeStrcmp(str, "") != 0)
  1442.         {
  1443.             while (((*str) != ';') && ((*str) != ''))
  1444.             {
  1445.                 if ((*str) == '@')
  1446.                 {
  1447.                     is_email = MMI_TRUE;
  1448.                 }
  1449.                 len++;
  1450.                 str = str + ENCODING_LENGTH;
  1451.             }
  1452.             if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1453.             {
  1454.                 len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1455.             }
  1456.             else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1457.             {
  1458.                 len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1459.             }
  1460.             else
  1461.             {
  1462.                 len_to_copy = len;
  1463.             }
  1464.             temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1465.             if (temp_str == NULL)
  1466.             {
  1467.                 DisplayPopup(
  1468.                     (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1469.                     IMG_GLOBAL_ERROR,
  1470.                     1,
  1471.                     JMMS_POPUP_TIME,
  1472.                     (U8) ERROR_TONE);
  1473.                 goto END;
  1474.             }
  1475.             pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pTo + start_index), len_to_copy);
  1476.             if ((is_duplicate = mmi_jmms_check_duplicate_address((U8*) temp_str,E_NONE_ADDRESSES,-1)) != MMI_TRUE)   // compiler warning removal
  1477.             {
  1478.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1479.                 if (ret != 0)
  1480.                 {
  1481.                     DisplayPopup(
  1482.                         (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1483.                         IMG_GLOBAL_ERROR,
  1484.                         1,
  1485.                         JMMS_POPUP_TIME,
  1486.                         (U8) ERROR_TONE);
  1487.                     goto END;
  1488.                 }
  1489.             }
  1490.             if (temp_str != NULL)
  1491.             {
  1492.                 jdd_MemFree(temp_str);
  1493.                 temp_str = NULL;
  1494.             }
  1495.             start_index = start_index + len + 1;
  1496.             len = 0;
  1497.             if ((*str) != '')
  1498.             {
  1499.                 str = str + ENCODING_LENGTH;
  1500.             }
  1501.         }
  1502.         if (temp_str != NULL)
  1503.         {
  1504.             jdd_MemFree(temp_str);
  1505.             temp_str = NULL;
  1506.         }
  1507.     }
  1508.     /* /Make the Cc Addresses list */
  1509.     if (send_p->pCc != NULL)
  1510.     {
  1511.         str = (S8*) (send_p->pCc);
  1512.         len = 0;
  1513.         start_index = 0;
  1514.         g_jmms_context->address_list_flag = E_CC_ADDRESSES;
  1515.         is_email = MMI_FALSE;
  1516.         while (pfnUnicodeStrcmp(str, "") != 0)
  1517.         {
  1518.             while (((*str) != ';') && ((*str) != ''))
  1519.             {
  1520.                 len++;
  1521.                 if ((*str) == '@')
  1522.                 {
  1523.                     is_email = MMI_TRUE;
  1524.                 }
  1525.                 str = str + ENCODING_LENGTH;
  1526.             }
  1527.             if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1528.             {
  1529.                 len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1530.             }
  1531.             else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1532.             {
  1533.                 len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1534.             }
  1535.             else
  1536.             {
  1537.                 len_to_copy = len;
  1538.             }
  1539.             temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1540.             if (temp_str == NULL)
  1541.             {
  1542.                 DisplayPopup(
  1543.                     (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1544.                     IMG_GLOBAL_ERROR,
  1545.                     1,
  1546.                     JMMS_POPUP_TIME,
  1547.                     (U8) ERROR_TONE);
  1548.                 goto END;
  1549.             }
  1550.             pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pCc + start_index), len_to_copy);
  1551.             if ((is_duplicate = mmi_jmms_check_duplicate_address((U8*) temp_str,E_NONE_ADDRESSES,-1)) != MMI_TRUE)  // compiler warning removal
  1552.             {
  1553.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1554.                 if (ret != 0)
  1555.                 {
  1556.                     DisplayPopup(
  1557.                         (U8*) GetString(STR_GLOBAL_ERROR),
  1558.                         IMG_GLOBAL_ERROR,
  1559.                         1,
  1560.                         JMMS_POPUP_TIME,
  1561.                         (U8) ERROR_TONE);
  1562.                     goto END;
  1563.                 }
  1564.             }
  1565.             if (temp_str != NULL)
  1566.             {
  1567.                 jdd_MemFree(temp_str);
  1568.                 temp_str = NULL;
  1569.             }
  1570.             start_index = start_index + len + 1;
  1571.             len = 0;
  1572.             if ((*str) != '')
  1573.             {
  1574.                 str = str + ENCODING_LENGTH;
  1575.             }
  1576.         }
  1577.         if (temp_str != NULL)
  1578.         {
  1579.             jdd_MemFree(temp_str);
  1580.             temp_str = NULL;
  1581.         }
  1582.     }
  1583.     /* /Make the BCc Addresses list */
  1584.     if (send_p->pBcc != NULL)
  1585.     {
  1586.         str = (S8*) (send_p->pBcc);
  1587.         len = 0;
  1588.         start_index = 0;
  1589.         g_jmms_context->address_list_flag = E_BCC_ADDRESSES;
  1590.         is_email = MMI_FALSE;
  1591.         while (pfnUnicodeStrcmp(str, "") != 0)
  1592.         {
  1593.             while (((*str) != ';') && ((*str) != ''))
  1594.             {
  1595.                 len++;
  1596.                 if ((*str) == '@')
  1597.                 {
  1598.                     is_email = MMI_TRUE;
  1599.                 }
  1600.                 str = str + ENCODING_LENGTH;
  1601.             }
  1602.             if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
  1603.             {
  1604.                 len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
  1605.             }
  1606.             else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
  1607.             {
  1608.                 len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
  1609.             }
  1610.             else
  1611.             {
  1612.                 len_to_copy = len;
  1613.             }
  1614.             temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
  1615.             if (temp_str == NULL)
  1616.             {
  1617.                 DisplayPopup(
  1618.                     (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
  1619.                     IMG_GLOBAL_ERROR,
  1620.                     1,
  1621.                     JMMS_POPUP_TIME,
  1622.                     (U8) ERROR_TONE);
  1623.                 goto END;
  1624.             }
  1625.             pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pBcc + start_index), len_to_copy);
  1626.             if ((is_duplicate = mmi_jmms_check_duplicate_address((U8*) temp_str,E_NONE_ADDRESSES,-1)) != MMI_TRUE) // compiler warning removal
  1627.             {
  1628.                 ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
  1629.                 if (ret != 0)
  1630.                 {
  1631.                     DisplayPopup(
  1632.                         (U8*) GetString(STR_GLOBAL_ERROR),
  1633.                         IMG_GLOBAL_ERROR,
  1634.                         1,
  1635.                         JMMS_POPUP_TIME,
  1636.                         (U8) ERROR_TONE);
  1637.                     goto END;
  1638.                 }
  1639.             }
  1640.             if (temp_str != NULL)
  1641.             {
  1642.                 jdd_MemFree(temp_str);
  1643.                 temp_str = NULL;
  1644.             }
  1645.             start_index = start_index + len + 1;
  1646.             len = 0;
  1647.             if ((*str) != '')
  1648.             {
  1649.                 str = str + ENCODING_LENGTH;
  1650.             }
  1651.         }
  1652.     }
  1653.     /* /Make the subject buffer */
  1654.     memset(g_jmms_context->subject_input_buffer, 0x00, (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH);
  1655.     if (send_p->pSubject != NULL)
  1656.     {
  1657.         len = (pfnUnicodeStrlen((S8*) (send_p->pSubject))) * ENCODING_LENGTH;
  1658.         if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  1659.         {
  1660.             memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, (MAX_SUBJECT_LENGTH * ENCODING_LENGTH));
  1661.         }
  1662.         else
  1663.         {
  1664.             memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, len);
  1665.         }
  1666.     }
  1667.     g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1668. //    g_jmms_context->g_use_local_send_setings = 0;
  1669. /* MAUI_00227929 Start */
  1670.     g_jmms_context->g_use_local_send_setings = 0;
  1671. mmi_jmms_fill_mms_sending_settings();        
  1672. /* MAUI_00227929 End */
  1673.     if (g_jmms_context->is_add_media_warning == 0)
  1674.     {
  1675.         mmi_jmms_entry_write_message_screen();
  1676.     }
  1677.     else
  1678.     {
  1679.         DisplayPopupCallBack(
  1680.             (PU8) GetString(STR_ID_JMMS_MMS_ERR_WARNING_CONTENT_CLASS),
  1681.             IMG_GLOBAL_WARNING,
  1682.             1,
  1683.             JMMS_POPUP_TIME,
  1684.             WARNING_TONE,
  1685.             mmi_jmms_entry_write_message_screen);
  1686.     }
  1687.   END:
  1688.     if (temp_str != NULL)
  1689.     {
  1690.         jdd_MemFree(temp_str);
  1691.         temp_str = NULL;
  1692.     }
  1693.     // TODO:: need to check whether this is to do or not
  1694.     if (hTempMsg != NULL)
  1695.     {
  1696.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1697.         hTempMsg = NULL;
  1698.     }
  1699.     if (Content.pFileName != NULL)
  1700.     {
  1701.         jdd_MemFree(Content.pFileName);
  1702.         Content.pFileName = NULL;
  1703.     }
  1704.     if (eRet != JC_OK)
  1705.     {
  1706.         mmi_jmms_deinit_mms_context(g_jmms_context);
  1707.     }
  1708.     g_jmms_context->is_add_media_warning = 0;
  1709. }
  1710. /*****************************************************************************
  1711.  * FUNCTION
  1712.  *  mmi_jmms_inbox_forward
  1713.  * DESCRIPTION
  1714.  *  
  1715.  * PARAMETERS
  1716.  *  void
  1717.  * RETURNS
  1718.  *  void
  1719.  *****************************************************************************/
  1720. void mmi_jmms_inbox_forward(void)
  1721. {
  1722.     /*----------------------------------------------------------------*/
  1723.     /* Local Variables                                                */
  1724.     /*----------------------------------------------------------------*/
  1725. #ifndef __MMI_UNIFIED_MESSAGE__
  1726.     U8 number = 0;
  1727. MSG_HANDLE hTempMsg = NULL;
  1728.     U8 msg_index = 0;
  1729.     MMI_BOOL is_msg_read = MMI_TRUE;
  1730. #else
  1731.     ECreationMode create_mode;
  1732. U8 curr_page = 0;
  1733. #endif
  1734. JC_RETCODE eRet = JC_OK;
  1735.     /*----------------------------------------------------------------*/
  1736.     /* Code Body                                                      */
  1737.     /*----------------------------------------------------------------*/
  1738. #ifndef __MMI_UNIFIED_MESSAGE__
  1739.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  1740.     eRet = jdi_MsgInit(&hTempMsg, NULL);
  1741.     if (JC_OK != eRet)
  1742.     {
  1743.         mmi_jmms_error_handler(eRet);
  1744.         goto END;
  1745.     }
  1746. if (g_jmms_context->pParseContent != NULL)
  1747.     {
  1748.         jdd_MemFree(g_jmms_context->pParseContent);
  1749.     }
  1750.     g_jmms_context->pParseContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
  1751.     g_jmms_context->pParseContent->bIsStream = E_TRUE;
  1752.     eRet = mmi_jmms_get_message(
  1753.             "Inbox",
  1754.             g_jmms_context->pParseContent,
  1755.             (number - g_jmms_context->nCurr_scr_hilited_index));
  1756.     if (eRet != JC_OK)
  1757.     {
  1758.         mmi_jmms_error_handler(eRet);
  1759.         goto END;
  1760.     }
  1761.     if (g_jmms_context->msg_handle != NULL)
  1762.     {
  1763.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1764.         g_jmms_context->msg_handle = NULL;
  1765.     }
  1766.     mmi_jmms_parsing_progressing_screen();
  1767. #if 0              /* Unread Status Icon will be change after user view the MMS */
  1768. /* under construction !*/
  1769. /* under construction !*/
  1770. /* under construction !*/
  1771. /* under construction !*/
  1772. /* under construction !*/
  1773. /* under construction !*/
  1774. /* under construction !*/
  1775. /* under construction !*/
  1776. #endif /* end Sachin */
  1777.     eRet = mmi_jmms_jdi_msg_forward(hTempMsg, g_jmms_context->pParseContent, &(g_jmms_context->msg_handle));
  1778.     if (hTempMsg != NULL)
  1779.     {
  1780.         mmi_jmms_jdi_msg_deinit(hTempMsg);
  1781.         hTempMsg = NULL;
  1782.     }
  1783. #ifdef __DRM_SUPPORT__
  1784.     mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_DRM_IND, (void*)jMMS_drm_indication_handler);
  1785.     mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_DRM_UPDATE_RIGHTS, (void*)jMMS_drm_rights_update_handler);
  1786.     mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_DRM_INFO_LIST, (void*)jMMS_drm_info_list_ind_handler);
  1787.     mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_DRM_CANCEL, (void*)jMMS_drm_cancel_parse_handler);
  1788. #endif /* __DRM_SUPPORT__ */ 
  1789.     mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_ERROR_IND, (void*)mmi_jmms_error_ind_cb);
  1790.     
  1791.     if (eRet == JC_ERR_MMS_PARSE_PENDING)
  1792.     {
  1793.         mmi_jmms_parse_continue_start_timer(g_jmms_context->msg_handle, mmi_jmms_inbox_forward_async_callback, mmi_jmms_only_abort_parsing_progress);
  1794.         return;
  1795.     }
  1796. #else /* #ifndef __MMI_UNIFIED_MESSAGE__ */ 
  1797. #ifdef __DRM_SUPPORT__
  1798.     if (mmi_jmms_is_drm_fwd_lock_media_in_mms(g_jmms_context->msg_handle, E_FALSE) == E_TRUE)
  1799.     {
  1800.        return;
  1801.     }
  1802. #endif  
  1803.     create_mode = mmi_jmms_compose_settings_creation_mode();
  1804.     if(IsMMSRestrictedMode(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS) != JC_OK)
  1805.     {
  1806.         if(create_mode == E_CREATION_MODE_RESTRICTED)
  1807.         {
  1808.             DisplayPopup(
  1809.                 (PU8) GetString(STR_ID_JMMS_MMS_ERR_RESTRICTED_CONTENT_CLASS),
  1810.                 IMG_GLOBAL_ERROR,
  1811.                 1,
  1812.                 JMMS_POPUP_TIME,
  1813.                 ERROR_TONE);
  1814.             return;
  1815.         }
  1816.         else if(create_mode == E_CREATION_MODE_WARNING)
  1817.         {
  1818.             g_jmms_context->is_add_media_warning = 1;
  1819.         }
  1820.     }
  1821. if(g_jmms_context->msg_handle)
  1822. mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  1823. g_jmms_context->edit_error_code=JC_OK;
  1824.     eRet = mmi_jmms_jdi_preforwardheader(&g_jmms_context->msg_handle); // Forward parsing
  1825.     if(eRet != JC_OK)
  1826.     {
  1827.         mmi_jmms_error_handler(eRet);
  1828. if(curr_page>1 && g_jmms_context->msg_handle)
  1829. {
  1830. gui_lock_double_buffer();
  1831. mmi_jmms_restore_view_callbacks();
  1832. mmi_jmms_jdi_view_event(g_jmms_context->msg_handle, E_VIEW_SET_ACTIVE_SLIDE, &curr_page);
  1833. gui_unlock_double_buffer();
  1834. }
  1835.         goto END;
  1836.     }
  1837.   
  1838. #endif 
  1839.     mmi_jmms_inbox_forward_async_callback(eRet);
  1840. #ifdef __MMI_UNIFIED_MESSAGE__
  1841. if(g_jmms_context->edit_error_code!=JC_OK && curr_page>1 && g_jmms_context->msg_handle)
  1842. {
  1843. gui_lock_double_buffer();
  1844. mmi_jmms_restore_view_callbacks();
  1845. mmi_jmms_jdi_view_event(g_jmms_context->msg_handle, E_VIEW_SET_ACTIVE_SLIDE, &curr_page);
  1846. gui_unlock_double_buffer();
  1847. }
  1848. #endif
  1849.     return;
  1850.   END:
  1851.     // TODO:: need to check whether this is to do or not
  1852. #ifndef __MMI_UNIFIED_MESSAGE__
  1853.     if (g_jmms_context->pParseContent != NULL)
  1854.     {
  1855.         if (g_jmms_context->pParseContent->pFileName != NULL)
  1856.         {
  1857.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  1858.             g_jmms_context->pParseContent->pFileName = NULL;
  1859.         }
  1860.         jdd_MemFree(g_jmms_context->pParseContent);
  1861.         g_jmms_context->pParseContent = NULL;
  1862.     }
  1863. if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  1864.     {
  1865.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  1866.         g_jmms_context->msg_handle = NULL;
  1867.     }
  1868. #endif
  1869.     g_jmms_context->is_add_media_warning = 0;
  1870. }
  1871. /*****************************************************************************
  1872.  * FUNCTION
  1873.  *  mmi_jmms_inbox_forward_async_callback
  1874.  * DESCRIPTION
  1875.  *  
  1876.  * PARAMETERS
  1877.  *  eRet        [IN]        
  1878.  * RETURNS
  1879.  *  void
  1880.  *****************************************************************************/
  1881. void mmi_jmms_inbox_forward_async_callback(JC_RETCODE eRet)
  1882. {
  1883.     /*----------------------------------------------------------------*/
  1884.     /* Local Variables                                                */
  1885.     /*----------------------------------------------------------------*/
  1886.     MESSAGE_HEADERS *pMsgHeaders = NULL;
  1887.     MESSAGE_SEND *send_p = NULL;
  1888.     S32 len = 0;
  1889.     /*----------------------------------------------------------------*/
  1890.     /* Code Body                                                      */
  1891.     /*----------------------------------------------------------------*/
  1892.     if (eRet != JC_OK)
  1893.     {
  1894.         if (GetActiveScreenId() == SCR_ID_JMMS_PARSING_PROGRESS)
  1895.         {
  1896.             mmi_jmms_error_handler(eRet);
  1897.         }
  1898.         goto END;
  1899.     }
  1900.     if (mmi_jmms_is_corrupted_video_media_in_mms(g_jmms_context->msg_handle) == E_TRUE)
  1901.     {
  1902.         eRet =-1;
  1903.         goto END;
  1904.     }
  1905.     eRet = mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_ERROR_IND, (void*)mmi_jmms_error_ind_cb);
  1906.     if (eRet != JC_OK)
  1907.     {
  1908.         mmi_jmms_error_handler(eRet);
  1909.         goto END;
  1910.     }
  1911.     eRet = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
  1912.     if (eRet != JC_OK)
  1913.     {
  1914.         mmi_jmms_error_handler(eRet);
  1915.         goto END;
  1916.     }
  1917.     eRet = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
  1918.     if (eRet != JC_OK)
  1919.     {
  1920.         mmi_jmms_error_handler(eRet);
  1921.         goto END;
  1922.     }
  1923.     eRet = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
  1924.     if (eRet != JC_OK)
  1925.     {
  1926.         mmi_jmms_error_handler(eRet);
  1927.         goto END;
  1928.     }
  1929.     eRet = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
  1930.     if (eRet != JC_OK)
  1931.     {
  1932.         mmi_jmms_error_handler(eRet);
  1933.         goto END;
  1934.     }
  1935.     eRet = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
  1936.     if (eRet != JC_OK)
  1937.     {
  1938.         mmi_jmms_error_handler(eRet);
  1939.         goto END;
  1940.     }
  1941.     eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
  1942.     if (eRet != JC_OK || pMsgHeaders == NULL)
  1943.     {
  1944.         eRet = JC_ERR_STORE_FILE_CORRUPTED;
  1945.         mmi_jmms_error_handler(eRet);
  1946.         goto END;
  1947.     }
  1948.     if (pMsgHeaders->eMsgType != E_MSG_TYPE_SEND)
  1949.     {
  1950.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  1951.         goto END;
  1952.     }
  1953.     send_p = (MESSAGE_SEND*) (pMsgHeaders->pHeaders);
  1954.     mmi_jmms_free_addresses_list();
  1955.     /* /Make the subject buffer */
  1956.     memset(g_jmms_context->subject_input_buffer, 0x00, (MAX_SUBJECT_LENGTH + 1) * ENCODING_LENGTH);
  1957.     if (send_p->pSubject != NULL)
  1958.     {
  1959.         len = (pfnUnicodeStrlen((S8*) (send_p->pSubject))) * ENCODING_LENGTH;
  1960.         if (len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
  1961.         {
  1962.             memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, (MAX_SUBJECT_LENGTH * ENCODING_LENGTH));
  1963.         }
  1964.         else
  1965.         {
  1966.             memcpy(g_jmms_context->subject_input_buffer, send_p->pSubject, len);
  1967.         }
  1968.     }
  1969.     g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
  1970.     /* PMT VIKAS START 20060405 */
  1971. //#ifdef __MMI_MMS_SIGNATURE__
  1972.     mmi_jmms_set_fw_flag_of_inbox();
  1973. //#endif 
  1974.     /* PMT VIKAS END 20060405 */
  1975.     mmi_jmms_set_fw_flag_of_message();
  1976. //    g_jmms_context->g_use_local_send_setings = 0;
  1977. /* MAUI_00227929 Start */
  1978. g_jmms_context->g_use_local_send_setings = 1;
  1979. mmi_jmms_fill_mms_sending_settings();        
  1980. /* MAUI_00227929 End */
  1981.     if (g_jmms_context->is_add_media_warning == 0)
  1982.     {
  1983.         mmi_jmms_entry_write_message_screen();
  1984.     }
  1985.     else
  1986.     {
  1987.         DisplayPopupCallBack(
  1988.             (PU8) GetString(STR_ID_JMMS_MMS_ERR_WARNING_CONTENT_CLASS),
  1989.             IMG_GLOBAL_WARNING,
  1990.             1,
  1991.             JMMS_POPUP_TIME,
  1992.             WARNING_TONE,
  1993.             mmi_jmms_entry_write_message_screen);
  1994.     }
  1995.   END:
  1996.     // TODO:: need to check whether this is to do or not
  1997. #ifndef __MMI_UNIFIED_MESSAGE__
  1998.     if (g_jmms_context->pParseContent != NULL)
  1999.     {
  2000.         if (g_jmms_context->pParseContent->pFileName != NULL)
  2001.         {
  2002.             jdd_MemFree(g_jmms_context->pParseContent->pFileName);
  2003.             g_jmms_context->pParseContent->pFileName = NULL;
  2004.         }
  2005.         jdd_MemFree(g_jmms_context->pParseContent);
  2006.         g_jmms_context->pParseContent = NULL;
  2007.     }
  2008.     if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  2009.     {
  2010.         eRet = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
  2011.         g_jmms_context->msg_handle = NULL;
  2012.     }
  2013. #endif 
  2014.     g_jmms_context->is_add_media_warning = 0;
  2015.     DeleteScreenIfPresent(SCR_ID_JMMS_PARSING_PROGRESS);
  2016. }
  2017. /*****************************************************************************
  2018.  * FUNCTION
  2019.  *  mmi_jmms_inbox_download
  2020.  * DESCRIPTION
  2021.  *  
  2022.  * PARAMETERS
  2023.  *  void
  2024.  * RETURNS
  2025.  *  void
  2026.  *****************************************************************************/
  2027. void mmi_jmms_inbox_download(void)
  2028. {
  2029.     /*----------------------------------------------------------------*/
  2030.     /* Local Variables                                                */
  2031.     /*----------------------------------------------------------------*/
  2032.     MESSAGE_NOTIFICATION *notification_p = NULL;
  2033.     JC_RETCODE eRet = JC_OK;
  2034.     U8 number = 0;
  2035.     RETRIEVE_FILTERS StoreRetFilter = {0, };
  2036.     MESSAGE_LIST *pMessageList = NULL;
  2037.     /*----------------------------------------------------------------*/
  2038.     /* Code Body                                                      */
  2039.     /*----------------------------------------------------------------*/
  2040.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  2041.     StoreRetFilter.uiStartIndex = number - g_jmms_context->nCurr_scr_hilited_index;
  2042.     StoreRetFilter.eRetrieve = E_RETRIEVE_BY_INDEX;
  2043.     StoreRetFilter.uiNumMessage = 1;
  2044.     eRet = mmi_jmms_get_messages_list(MMI_JMMS_INBOX, &pMessageList, &StoreRetFilter);
  2045.     if (pMessageList == NULL || eRet != JC_OK)
  2046.     {
  2047.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s: %d", "mmi_jmms_inbox_download error getting message list", eRet));
  2048.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  2049.         return;
  2050.     }
  2051.     if (pMessageList->pMessageHeaders->eMsgType != E_MSG_TYPE_NOTIFICATION)
  2052.     {
  2053.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_inbox_download error eMsgType is not E_MSG_TYPE_NOTIFICATION(%d)", pMessageList->pMessageHeaders->eMsgType));
  2054.         DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  2055.         return;
  2056.     }
  2057.     notification_p = (MESSAGE_NOTIFICATION*) (pMessageList->pMessageHeaders->pHeaders);
  2058. #ifdef __MMI_MMS_OMA_CONF_273__
  2059.     if (notification_p->uiMessageSize > MAX_MMS_MSG_SIZE)
  2060.     {
  2061.         DisplayPopup(
  2062.             (U8*) GetString(STR_ID_JMMS_OPTIONS_MSG_SIZE_EXCEED),
  2063.             IMG_GLOBAL_ERROR,
  2064.             1,
  2065.             JMMS_POPUP_TIME,
  2066.             (U8) ERROR_TONE);
  2067.         return;
  2068.     }
  2069. #endif /* __MMI_MMS_OMA_CONF_273__ */ 
  2070.     eRet = mmi_jmms_download_mms(
  2071.             (JC_INT8*) notification_p->pContentLocation,
  2072.             E_TYPE_DEFFERED_RETRIEVAL_FETCH,
  2073.             (number - g_jmms_context->nCurr_scr_hilited_index),
  2074.             1);
  2075.     if (eRet == JC_OK)
  2076.     {
  2077.         /* /added for retry mechanism */
  2078.         g_jmms_context->last_scr_id = GetActiveScreenId();
  2079.         g_jmms_context->progress_screen_title = STR_ID_JMMS_MMS_DOWNLOADING;
  2080.         memset(g_jmms_context->g_jmms_progress_str, 0x00, MAX_PROGRESS_SCREEN_HINT_LEN * ENCODING_LENGTH);
  2081.         mmi_jmms_entry_communication_progress_screen();
  2082.     }
  2083. }
  2084. /*****************************************************************************
  2085.  * FUNCTION
  2086.  *  mmi_jmms_inbox_pre_delete
  2087.  * DESCRIPTION
  2088.  *  
  2089.  * PARAMETERS
  2090.  *  void
  2091.  * RETURNS
  2092.  *  void
  2093.  *****************************************************************************/
  2094. void mmi_jmms_inbox_pre_delete(void)
  2095. {
  2096.     /*----------------------------------------------------------------*/
  2097.     /* Local Variables                                                */
  2098.     /*----------------------------------------------------------------*/
  2099.     /*----------------------------------------------------------------*/
  2100.     /* Code Body                                                      */
  2101.     /*----------------------------------------------------------------*/
  2102.     DisplayConfirm(
  2103.         STR_GLOBAL_YES,
  2104.         IMG_GLOBAL_YES,
  2105.         STR_GLOBAL_NO,
  2106.         IMG_GLOBAL_NO,
  2107.         get_string(STR_GLOBAL_DELETE),
  2108.         IMG_GLOBAL_QUESTION,
  2109.         WARNING_TONE);
  2110.     SetLeftSoftkeyFunction(mmi_jmms_inbox_delete, KEY_EVENT_UP);
  2111.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2112. }
  2113. /*****************************************************************************
  2114.  * FUNCTION
  2115.  *  mmi_jmms_inbox_delete
  2116.  * DESCRIPTION
  2117.  *  
  2118.  * PARAMETERS
  2119.  *  void
  2120.  * RETURNS
  2121.  *  void
  2122.  *****************************************************************************/
  2123. void mmi_jmms_inbox_delete(void)
  2124. {
  2125.     /*----------------------------------------------------------------*/
  2126.     /* Local Variables                                                */
  2127.     /*----------------------------------------------------------------*/
  2128.     U8 msg_index = 0;
  2129.     U8 index = 0;
  2130.     jmms_folder_msgs_list *node = NULL;
  2131.     MMI_BOOL is_msg_read = MMI_TRUE;
  2132.     JC_RETCODE eRet = JC_OK;
  2133.     CONTENT_DATA Content = {0, };
  2134.     U8 number = 0;
  2135.     /*----------------------------------------------------------------*/
  2136.     /* Code Body                                                      */
  2137.     /*----------------------------------------------------------------*/
  2138.     node = g_jmms_context->store_context->messages_list;
  2139.     while (index < g_jmms_context->nCurr_scr_hilited_index)
  2140.     {
  2141.         node = node->next;
  2142.         index++;
  2143.     }
  2144.     mmi_jmms_delete_progresing_screen(STR_ID_JMMS_INBOX, IMG_GLOBAL_DELETED);
  2145.     number = g_jmms_context->store_context->nMsgs_in_Current_folder;
  2146.     /* /set the msg status as read if first time read */
  2147.     msg_index = number - g_jmms_context->nCurr_scr_hilited_index;
  2148.     msg_index = msg_index - 1;
  2149.     is_msg_read = mmi_jmms_is_msg_read(msg_index);
  2150.     if (is_msg_read == MMI_FALSE && node->msg_type != E_MSG_DELIVERY_REPORT && node->msg_type != E_MSG_READ_REPORT)
  2151.     {
  2152.         Content.bIsStream = E_TRUE;
  2153.         eRet = mmi_jmms_get_message(
  2154.                 "Inbox",
  2155.                 &Content,
  2156.                 (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index));
  2157.         if (eRet != JC_OK)
  2158.         {
  2159.             goto END;
  2160.         }
  2161.         mmi_jmms_deinit_mms_context(g_jmms_context);
  2162.         eRet = mmi_jmms_jdi_parse_msg_buffer(&(g_jmms_context->msg_handle), &Content, E_TYPE_MMS, E_FALSE);
  2163.         /* Async changes start */
  2164.         while (eRet == JC_ERR_MMS_PARSE_PENDING)
  2165.         {
  2166.             eRet = mmi_jmms_jdi_msg_parse_continue(g_jmms_context->msg_handle);
  2167.         };
  2168.         /* Async changes end */
  2169.         if (JC_OK != eRet)
  2170.         {
  2171.             goto END;
  2172.         }
  2173.         eRet = mmi_jmms_jdi_get_msg_headers(
  2174.                 g_jmms_context->msg_handle,
  2175.                 (MESSAGE_HEADERS **) (&(g_jmms_context->MsgHeaders_p)));
  2176.         if (JC_OK != eRet)
  2177.         {
  2178.             goto END;
  2179.         }
  2180.         g_jmms_context->MsgHeader_type_p =
  2181.             (MESSAGE_RETRIEVAL*) ((MESSAGE_HEADERS*) g_jmms_context->MsgHeaders_p)->pHeaders;
  2182.     }
  2183.     eRet = mmi_jmms_delete_message(MMI_JMMS_INBOX, msg_index + 1);
  2184.     if (eRet == JC_OK)
  2185.     {
  2186.         mmi_jmms_delete_msg_status(msg_index);
  2187.     #ifdef __MMI_UNIFIED_MESSAGE__
  2188.         HistoryReplace(SCR_ID_UM_INBOX, SCR_ID_UM_INBOX, mmi_um_jmms_pre_entry_inbox);
  2189.     #else 
  2190.         HistoryReplace(SCR_ID_JMMS_INBOX, SCR_ID_JMMS_INBOX, mmi_jmms_entry_inbox);
  2191.     #endif 
  2192.     #ifdef __MMI_UNIFIED_MESSAGE__
  2193.         DeleteUptoScrID(SCR_ID_UM_INBOX);
  2194.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2195.         if (number <= 1)    /* /now folder will empty */
  2196.         {
  2197.             DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  2198.         }
  2199.         else
  2200.         {
  2201.             DeleteUptoScrID(SCR_ID_JMMS_INBOX);
  2202.         }
  2203.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2204. DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  2205.         if (is_msg_read == MMI_FALSE)
  2206.         {
  2207.             g_jmms_context->is_unread_msg_deleted = 1;
  2208.             mmi_jmms_handle_read_report(g_jmms_context->MsgHeader_type_p);
  2209.         }
  2210. if (g_jmms_context->MsgHeader_type_p != NULL)
  2211. {
  2212. g_jmms_context->MsgHeader_type_p = NULL;
  2213. }
  2214. if (g_jmms_context->MsgHeaders_p != NULL)
  2215. {
  2216. g_jmms_context->MsgHeaders_p = NULL;
  2217. }
  2218.     }
  2219.     else
  2220.     {
  2221.         goto END;
  2222.     }
  2223.     return;
  2224.   END:
  2225. if (g_jmms_context->MsgHeader_type_p != NULL)
  2226. {
  2227. g_jmms_context->MsgHeader_type_p = NULL;
  2228. }
  2229. if (g_jmms_context->MsgHeaders_p != NULL)
  2230. {
  2231. g_jmms_context->MsgHeaders_p = NULL;
  2232. }
  2233.     if (eRet != JC_OK && g_jmms_context->msg_handle != NULL)
  2234.     {
  2235.         mmi_jmms_deinit_mms_context(g_jmms_context);
  2236.         g_jmms_context->msg_handle = NULL;
  2237.     }
  2238.     DisplayPopup((U8*) GetString(STR_ID_JMMS_ERROR_MMS_DELETE), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
  2239. #ifdef __MMI_UNIFIED_MESSAGE__
  2240.     DeleteUptoScrID(SCR_ID_UM_INBOX);
  2241. #else 
  2242.     DeleteUptoScrID(SCR_ID_JMMS_INBOX);
  2243. #endif 
  2244. }
  2245. /*****************************************************************************
  2246.  * FUNCTION
  2247.  *  mmi_jmms_inbox_delete_all
  2248.  * DESCRIPTION
  2249.  *  
  2250.  * PARAMETERS
  2251.  *  void
  2252.  * RETURNS
  2253.  *  void
  2254.  *****************************************************************************/
  2255. void mmi_jmms_inbox_delete_all(void)
  2256. {
  2257.     /*----------------------------------------------------------------*/
  2258.     /* Local Variables                                                */
  2259.     /*----------------------------------------------------------------*/
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Code Body                                                      */
  2262.     /*----------------------------------------------------------------*/
  2263.     
  2264. #ifdef __MMI_UNIFIED_MESSAGE__
  2265.     /*Dilip 29 Aug 2006 */
  2266.     DisplayConfirm(
  2267.         STR_GLOBAL_YES,
  2268.         IMG_GLOBAL_YES,
  2269.         STR_GLOBAL_NO,
  2270.         IMG_GLOBAL_NO,
  2271.         get_string(STR_ID_JMMS_DELETE_ALL_UM_INBOX),
  2272.         IMG_GLOBAL_QUESTION,
  2273.         WARNING_TONE);
  2274.     /*Dilip 29 Aug 2006 */
  2275.     SetLeftSoftkeyFunction(mmi_um_jmms_delete_all, KEY_EVENT_UP);
  2276. #else 
  2277.     /*Dilip 29 Aug 2006 */
  2278.     DisplayConfirm(
  2279.         STR_GLOBAL_YES,
  2280.         IMG_GLOBAL_YES,
  2281.         STR_GLOBAL_NO,
  2282.         IMG_GLOBAL_NO,
  2283. /* MAUI_00018477 Start */
  2284.         get_string(STR_ID_JMMS_DELETE_ALL_UM_INBOX),
  2285. /* MAUI_00018477 End */
  2286.         IMG_GLOBAL_QUESTION,
  2287.         WARNING_TONE);
  2288.     /*Dilip 29 Aug 2006 */
  2289.     SetLeftSoftkeyFunction(mmi_jmms_delete_all_message_inbox, KEY_EVENT_UP);
  2290. #endif 
  2291.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2292. }
  2293. /*****************************************************************************
  2294.  * FUNCTION
  2295.  *  mmi_jmms_delete_all_message_inbox
  2296.  * DESCRIPTION
  2297.  *  
  2298.  * PARAMETERS
  2299.  *  void
  2300.  * RETURNS
  2301.  *  void
  2302.  *****************************************************************************/
  2303. void mmi_jmms_delete_all_message_inbox(void)
  2304. {
  2305.     /*----------------------------------------------------------------*/
  2306.     /* Local Variables                                                */
  2307.     /*----------------------------------------------------------------*/
  2308.     JC_RETCODE eRet = JC_OK;
  2309.     /*----------------------------------------------------------------*/
  2310.     /* Code Body                                                      */
  2311.     /*----------------------------------------------------------------*/
  2312.     mmi_jmms_delete_progresing_screen(STR_ID_JMMS_INBOX, IMG_GLOBAL_PROGRESS);
  2313. if(mmi_jmms_is_immediate_retrival_underway())
  2314.    {
  2315. eRet=-1;
  2316. }
  2317. else
  2318. {
  2319. eRet = mmi_jmms_delete_all_message(MMI_JMMS_INBOX);
  2320. }
  2321.     if (JC_OK != eRet)
  2322.     {
  2323.         DisplayPopup(
  2324.             (U8*) GetString(STR_ID_JMMS_ERROR_MMS_DELETE),
  2325.             IMG_GLOBAL_ERROR,
  2326.             1,
  2327.             JMMS_POPUP_TIME,
  2328.             (U8) ERROR_TONE);
  2329.         DeleteUptoScrID(SCR_ID_JMMS_INBOX);
  2330.     }
  2331.     else
  2332.     {
  2333.         /* /reset all msgs status as unread */
  2334.         mmi_jmms_delete_all_msgs_status();
  2335.         DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JMMS_POPUP_TIME, SUCCESS_TONE);
  2336.         DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
  2337.         mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));
  2338.     }
  2339. }
  2340. /*****************************************************************************
  2341.  * FUNCTION
  2342.  *  mmi_jmms_inbox_use_details
  2343.  * DESCRIPTION
  2344.  *  Pre entry fn for use details screen
  2345.  * PARAMETERS
  2346.  *  void
  2347.  * RETURNS
  2348.  *  void
  2349.  *****************************************************************************/
  2350. void mmi_jmms_inbox_use_details(void)
  2351. {
  2352.     /*----------------------------------------------------------------*/
  2353.     /* Local Variables                                                */
  2354.     /*----------------------------------------------------------------*/
  2355.     /*----------------------------------------------------------------*/
  2356.     /* Code Body                                                      */
  2357.     /*----------------------------------------------------------------*/
  2358.     mmi_jmms_pre_entry_use_details_screen(MMI_JMMS_INBOX);
  2359. }
  2360. /*****************************************************************************
  2361.  * FUNCTION
  2362.  *  mmi_jmms_inbox_properties
  2363.  * DESCRIPTION
  2364.  *  
  2365.  * PARAMETERS
  2366.  *  void
  2367.  * RETURNS
  2368.  *  void
  2369.  *****************************************************************************/
  2370. void mmi_jmms_inbox_properties(void)
  2371. {
  2372. #ifdef __MMI_UNIFIED_MESSAGE__
  2373. U16 msg_type = mmi_jmms_get_msg_type(g_jmms_context->nCurr_scr_hilited_index);
  2374. if( msg_type == E_MSG_NOTIFICATION || msg_type == E_MSG_JAVA_MESSAGE || msg_type == E_MSG_DELIVERY_REPORT || msg_type == E_MSG_READ_REPORT)
  2375. {
  2376. g_jmms_context->last_scr_id = SCR_ID_JMMS_INBOX_OPTIONS;
  2377. }
  2378.     mmi_jmms_show_mms_properties(msg_type, MMI_JMMS_INBOX);
  2379. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2380.     /*----------------------------------------------------------------*/
  2381.     /* Local Variables                                                */
  2382.     /*----------------------------------------------------------------*/
  2383.     U8 index = 0;
  2384.     jmms_folder_msgs_list *node = NULL;
  2385.     /*----------------------------------------------------------------*/
  2386.     /* Code Body                                                      */
  2387.     /*----------------------------------------------------------------*/
  2388.     node = g_jmms_context->store_context->messages_list;
  2389.     while (index < g_jmms_context->nCurr_scr_hilited_index)
  2390.     {
  2391.         node = node->next;
  2392.         index++;
  2393.     }
  2394.     mmi_jmms_show_mms_properties(node->msg_type, MMI_JMMS_INBOX);
  2395. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2396. }
  2397. /* /1 means read and 0 as unread */
  2398. /*****************************************************************************
  2399.  * FUNCTION
  2400.  *  mmi_jmms_set_msg_as_read
  2401.  * DESCRIPTION
  2402.  *  
  2403.  * PARAMETERS
  2404.  *  index       [IN]        
  2405.  * RETURNS
  2406.  *  void
  2407.  *****************************************************************************/
  2408. void mmi_jmms_set_msg_as_read(U8 index)
  2409. {
  2410.     /*----------------------------------------------------------------*/
  2411.     /* Local Variables                                                */
  2412.     /*----------------------------------------------------------------*/
  2413.     U8 byte_number;
  2414.     U8 bit_number;
  2415.     U8 oring_byte;
  2416.     S16 error;
  2417.     /*----------------------------------------------------------------*/
  2418.     /* Code Body                                                      */
  2419.     /*----------------------------------------------------------------*/
  2420.     byte_number = index / 8;
  2421.     bit_number = index % 8;
  2422.     oring_byte = (0x80 >> bit_number);
  2423.     g_jmms_context->store_context->inbox_msgs_read_status[byte_number] =
  2424.         g_jmms_context->store_context->inbox_msgs_read_status[byte_number] | oring_byte;
  2425.     WriteRecord(
  2426.         NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  2427.         1,
  2428.         (g_jmms_context->store_context->inbox_msgs_read_status),
  2429.         (U16) MAX_READ_UNREAD_STATUS_BYTES,
  2430.         &error);
  2431. }
  2432. /*****************************************************************************
  2433.  * FUNCTION
  2434.  *  mmi_jmms_set_msg_as_unread
  2435.  * DESCRIPTION
  2436.  *  
  2437.  * PARAMETERS
  2438.  *  index       [IN]        
  2439.  * RETURNS
  2440.  *  void
  2441.  *****************************************************************************/
  2442. void mmi_jmms_set_msg_as_unread(U8 index)
  2443. {
  2444.     /*----------------------------------------------------------------*/
  2445.     /* Local Variables                                                */
  2446.     /*----------------------------------------------------------------*/
  2447.     U8 byte_number;
  2448.     U8 bit_number;
  2449.     U8 oring_byte;
  2450.     S16 error;
  2451.     /*----------------------------------------------------------------*/
  2452.     /* Code Body                                                      */
  2453.     /*----------------------------------------------------------------*/
  2454.     byte_number = index / 8;
  2455.     bit_number = index % 8;
  2456.     oring_byte = (0x80 >> bit_number);
  2457.     g_jmms_context->store_context->inbox_msgs_read_status[byte_number] =
  2458.         g_jmms_context->store_context->inbox_msgs_read_status[byte_number] & (~oring_byte);
  2459.     WriteRecord(
  2460.         NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  2461.         1,
  2462.         (g_jmms_context->store_context->inbox_msgs_read_status),
  2463.         (U16) MAX_READ_UNREAD_STATUS_BYTES,
  2464.         &error);
  2465. }
  2466. /*****************************************************************************
  2467.  * FUNCTION
  2468.  *  mmi_jmms_is_msg_read
  2469.  * DESCRIPTION
  2470.  *  
  2471.  * PARAMETERS
  2472.  *  index       [IN]        
  2473.  * RETURNS
  2474.  *  
  2475.  *****************************************************************************/
  2476. MMI_BOOL mmi_jmms_is_msg_read(U8 index)
  2477. {
  2478.     /*----------------------------------------------------------------*/
  2479.     /* Local Variables                                                */
  2480.     /*----------------------------------------------------------------*/
  2481.     U8 byte_number;
  2482.     U8 bit_number;
  2483.     U8 temp_byte;
  2484.     U8 anding_byte;
  2485.     /*----------------------------------------------------------------*/
  2486.     /* Code Body                                                      */
  2487.     /*----------------------------------------------------------------*/
  2488.     byte_number = index / 8;
  2489.     bit_number = index % 8;
  2490.     temp_byte = g_jmms_context->store_context->inbox_msgs_read_status[byte_number];
  2491.     anding_byte = (0x80 >> bit_number);
  2492.     if ((temp_byte & anding_byte) == 0x00)
  2493.     {
  2494.         return MMI_FALSE;
  2495.     }
  2496.     else
  2497.     {
  2498.         return MMI_TRUE;
  2499.     }
  2500. }
  2501. /*****************************************************************************
  2502.  * FUNCTION
  2503.  *  mmi_jmms_delete_msg_status
  2504.  * DESCRIPTION
  2505.  *  
  2506.  * PARAMETERS
  2507.  *  index       [IN]        
  2508.  * RETURNS
  2509.  *  void
  2510.  *****************************************************************************/
  2511. void mmi_jmms_delete_msg_status(U8 index)
  2512. {
  2513.     /*----------------------------------------------------------------*/
  2514.     /* Local Variables                                                */
  2515.     /*----------------------------------------------------------------*/
  2516.     U8 temp1, temp2;
  2517.     U8 byte_number;
  2518.     U8 bit_number;
  2519.     U8 i = 0;
  2520.     S16 error;
  2521.     /*----------------------------------------------------------------*/
  2522.     /* Code Body                                                      */
  2523.     /*----------------------------------------------------------------*/
  2524.     byte_number = index / 8;
  2525.     bit_number = index % 8;
  2526.     temp1 = (g_jmms_context->store_context->inbox_msgs_read_status[byte_number]) >> (8 - bit_number);
  2527.     temp1 = temp1 << (8 - bit_number);
  2528.     temp2 = (g_jmms_context->store_context->inbox_msgs_read_status[byte_number]) << (bit_number + 1);
  2529.     temp2 = temp2 >> bit_number;
  2530.     g_jmms_context->store_context->inbox_msgs_read_status[byte_number] = temp1 | temp2;
  2531.     for (i = byte_number; i < (MAX_READ_UNREAD_STATUS_BYTES - 1); i++)
  2532.     {
  2533.         temp1 = (g_jmms_context->store_context->inbox_msgs_read_status[i + 1]) >> 7;
  2534.         g_jmms_context->store_context->inbox_msgs_read_status[i] =
  2535.             g_jmms_context->store_context->inbox_msgs_read_status[i] | temp1;
  2536.         g_jmms_context->store_context->inbox_msgs_read_status[i + 1] =
  2537.             (g_jmms_context->store_context->inbox_msgs_read_status[i + 1]) << 1;
  2538.     }
  2539.     /* WriteRecord(NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID, 1, &(g_jmms_context->store_context->inbox_read_status),MAX_READ_UNREAD_STATUS_BYTES, &error); */
  2540.     WriteRecord(
  2541.         NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  2542.         1,
  2543.         (g_jmms_context->store_context->inbox_msgs_read_status),
  2544.         (U16) MAX_READ_UNREAD_STATUS_BYTES,
  2545.         &error);
  2546.     mmi_jmms_update_pending_downloads(index+1);
  2547. }
  2548. /*****************************************************************************
  2549.  * FUNCTION
  2550.  *  mmi_jmms_delete_all_msgs_status
  2551.  * DESCRIPTION
  2552.  *  
  2553.  * PARAMETERS
  2554.  *  void
  2555.  * RETURNS
  2556.  *  void
  2557.  *****************************************************************************/
  2558. void mmi_jmms_delete_all_msgs_status(void)
  2559. {
  2560.     /*----------------------------------------------------------------*/
  2561.     /* Local Variables                                                */
  2562.     /*----------------------------------------------------------------*/
  2563.     U8 i = 0;
  2564.     S16 error;
  2565.     /*----------------------------------------------------------------*/
  2566.     /* Code Body                                                      */
  2567.     /*----------------------------------------------------------------*/
  2568.     for (i = 0; i < MAX_READ_UNREAD_STATUS_BYTES; i++)
  2569.     {
  2570.         g_jmms_context->store_context->inbox_msgs_read_status[i] = 0x00;
  2571.     }
  2572.     /* WriteRecord(NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID, 1, &(g_jmms_context->store_context->inbox_read_status),MAX_READ_UNREAD_STATUS_BYTES, &error); */
  2573.     WriteRecord(
  2574.         NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
  2575.         1,
  2576.         (g_jmms_context->store_context->inbox_msgs_read_status),
  2577.         (U16) MAX_READ_UNREAD_STATUS_BYTES,
  2578.         &error);
  2579. }
  2580. /*****************************************************************************
  2581.  * FUNCTION
  2582.  *  mmi_jmms_highlight_inbox_options_save_object
  2583.  * DESCRIPTION
  2584.  *  
  2585.  * PARAMETERS
  2586.  *  void
  2587.  * RETURNS
  2588.  *  void
  2589.  *****************************************************************************/
  2590. void mmi_jmms_highlight_inbox_options_save_object(void)
  2591. {
  2592.     /*----------------------------------------------------------------*/
  2593.     /* Local Variables                                                */
  2594.     /*----------------------------------------------------------------*/
  2595.     /*----------------------------------------------------------------*/
  2596.     /* Code Body                                                      */
  2597.     /*----------------------------------------------------------------*/
  2598.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2599.     SetLeftSoftkeyFunction(mmi_jmms_entry_save_object, KEY_EVENT_UP);
  2600.     SetKeyHandler(mmi_jmms_entry_save_object, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2601.     SetKeyHandler(mmi_jmms_entry_save_object, KEY_WAP, KEY_EVENT_DOWN);
  2602. }
  2603. #ifdef __MMI_UNIFIED_MESSAGE__
  2604. /*****************************************************************************
  2605.  * FUNCTION
  2606.  *  mmi_jmms_highlight_inbox_options_edit_message
  2607.  * DESCRIPTION
  2608.  *  
  2609.  * PARAMETERS
  2610.  *  void
  2611.  * RETURNS
  2612.  *  void
  2613.  *****************************************************************************/
  2614. void mmi_jmms_highlight_inbox_options_edit_message(void)
  2615. {
  2616.     /*----------------------------------------------------------------*/
  2617.     /* Local Variables                                                */
  2618.     /*----------------------------------------------------------------*/
  2619.     /*----------------------------------------------------------------*/
  2620.     /* Code Body                                                      */
  2621.     /*----------------------------------------------------------------*/
  2622.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2623.     SetLeftSoftkeyFunction(mmi_jmms_pre_inbox_edit_message, KEY_EVENT_UP);
  2624.     SetKeyHandler(mmi_jmms_pre_inbox_edit_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2625.     SetKeyHandler(mmi_jmms_pre_inbox_edit_message, KEY_WAP, KEY_EVENT_DOWN);
  2626. }
  2627. /*****************************************************************************
  2628.  * FUNCTION
  2629.  *  mmi_jmms_pre_inbox_edit_message
  2630.  * DESCRIPTION
  2631.  *  
  2632.  * PARAMETERS
  2633.  *  void
  2634.  * RETURNS
  2635.  *  void
  2636.  *****************************************************************************/
  2637. void mmi_jmms_pre_inbox_edit_message(void)
  2638. {
  2639.     /*----------------------------------------------------------------*/
  2640.     /* Local Variables                                                */
  2641.     /*----------------------------------------------------------------*/
  2642.     /*----------------------------------------------------------------*/
  2643.     /* Code Body                                                      */
  2644.     /*----------------------------------------------------------------*/
  2645. #ifdef __MMI_UNIFIED_MESSAGE__
  2646. U8 curr_page = 0;
  2647. if(g_jmms_context->msg_handle)
  2648. mmi_jmms_jdi_get_current_page_index(g_jmms_context->msg_handle, &curr_page);
  2649. g_jmms_context->edit_error_code=JC_OK;
  2650. #endif
  2651. #ifdef __DRM_SUPPORT__
  2652.     if (mmi_jmms_is_drm_fwd_lock_media_in_mms(g_jmms_context->msg_handle, E_TRUE) == E_TRUE)
  2653.     {
  2654.        return;
  2655.     }
  2656. #endif
  2657.     g_jmms_context->g_use_local_send_setings = 0;  // sanjeev  5/1/07  
  2658.     mmi_jmms_edit_message(MMI_JMMS_INBOX);
  2659. #ifdef __MMI_UNIFIED_MESSAGE__
  2660. if(g_jmms_context->edit_error_code!=JC_OK && curr_page>1 && g_jmms_context->msg_handle)
  2661. {
  2662. gui_lock_double_buffer();
  2663. mmi_jmms_jdi_view_event(g_jmms_context->msg_handle, E_VIEW_SET_ACTIVE_SLIDE, &curr_page);
  2664. gui_unlock_double_buffer();
  2665. }
  2666. #endif
  2667. }
  2668. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2669. #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */ 
  2670. #endif /* _MMI_JMMSINBOXSECMMI_C */