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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*******************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  * JBrowserStartup.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *   
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *   Shantanu Meher -20051012
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  * removed!
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  * removed!
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  * removed!
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  * removed!
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  *------------------------------------------------------------------------------
  126.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  127.  *============================================================================== 
  128.  *******************************************************************************/
  129. #ifndef _MMI_JBROWSERSTARTUP_C
  130. #define _MMI_JBROWSERSTARTUP_C
  131. /*  Include: MMI header file */
  132. #include "MMI_features.h"
  133. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  134. #include "PixtelDataTypes.h"
  135. #include "KeyBrd.h"     /* Added By Vivek */
  136. #include "wgui_status_icons.h"
  137. #include "wgui_softkeys.h"
  138. #include "Unicodexdcl.h"
  139. #include "HistoryGprot.h"
  140. #include "GlobalDefs.h"
  141. #include "CommonScreens.h"
  142. #include "DebugInitDef.h"
  143. #include "JBrowserMMIDefs.h"
  144. #include "JBrowserMMIProts.h"
  145. #include "JBrowserMMITypes.h"
  146. #include "JBrowserMMIGProts.h"
  147. #include "IdleAppDef.h"
  148. #include "JProfileHandlerTypes.h"
  149. #include "JProfileHandlerProts.h"
  150. #include "JProvProts.h"
  151. #include "jdd_ui_datatypes.h"
  152. #include "IdleAppDef.h"
  153. #include "SettingProfile.h"
  154. #include "JPushInboxCommonUI.h"
  155. #include "JPushInboxCommonAPIs.h"
  156. #include "JBrowserDRMHandler.h"
  157. #include "JPushInboxUM.h"
  158. #include "jdd_MMIapi.h"
  159. #include "jdd_ui_input_ctrl.h"
  160. #include "jdd_ui_window.h"      /* Added by Shantanu - 20060808 */
  161. #include "jdd_ui_img_ctrl.h"
  162. #include "jdd_audioapi.h"
  163. #include "jdd_dataconnection.h"
  164. #include "TimerEvents.h"
  165. #include "SmsGuiInterfaceType.h"        /* Added by Vivek 29 June 2006 */
  166. #include "SmsGuiInterfaceProt.h"
  167. #include "UnifiedMessageDef.h"  /* Added by Vivek 21072006 */
  168. #include "wgui_categories_inputs.h"     /* Added by pawan 31-07-06 */
  169. #include "wgui_categories_popup.h"
  170. #include "ProfileGprots.h"      /* playRequestedTone() */
  171. #include "gpioInc.h"
  172. #include "content_type.h"
  173. #include "CallManagementGprot.h"
  174. #include "CallStructureManagementProt.h"
  175. #include "sat_def.h"
  176. #include "ServiceDefs.h"
  177. #include "USBDeviceGprot.h"
  178. #include "FileManagerDef.h"
  179. #include "jdd_ui_defs.h"
  180. #include "JMMSResEnum.h"
  181. #ifdef JBROWSER_USE_ASM
  182. #include "App_mem.h"
  183. #endif /* ifdef JBROWSER_USE_ASM */
  184. #include "wapadp.h"
  185. #ifdef __JBROWSER_DLS_SUPPORT__
  186. brw_dls_context_struct g_brw_dls_cntx;
  187. #endif /* __JBROWSER_DLS_SUPPORT__*/
  188. JC_BROWSER_CONTEXT pBrowserCtxt;
  189. static JC_CHAR *g_pmMsg = NULL;
  190. static JC_CHAR *g_pmDefaultValue = NULL;
  191. void *pArg;
  192. BROWSER_CONFIRM_CB gCallBackConfirm;
  193. BROWSER_PROMPT_CB gCallBackPrompt;
  194. BROWSER_ALERT_CB gCallBackAlert;
  195. /* Extern function, variables */
  196. extern JC_FETCH_URL_INFO fetchUrlInfo;
  197. extern JC_UINT32 mmi_jdd_ui_get_appWindowID(ETaskID eSrcTaskID);
  198. extern void mmi_brw_rendered_page_options(void);
  199. extern void mmi_brw_read_arrived_push_message(void);
  200. extern void EntryScrAfterPessingRSK(void);
  201. extern void mmi_brw_entry_auth_handler(void);
  202. extern void jdd_MemSetActiveModuleID(ETaskID taskId);
  203. /* added by tk */
  204. extern U32 mmi_brw_delete_push_msg(U32 pos);
  205. extern pBOOL isInCall(void); /* Vivek - 8nov2006 */
  206. extern FuncPtr g_brw_LskFunPtr;
  207. extern FuncPtr g_brw_RskFunPtr;
  208. extern U16 g_brw_LskLabel;
  209. extern U16 g_brw_RskLabel;
  210. extern U8 g_brw_showimgflag;
  211. extern U8 g_brw_notificationFlag;
  212. extern kal_uint8 custom_get_csd_profile_num(void);
  213. extern JC_BOOLEAN mmi_jdd_ui_is_entry_notification_screen_present(void);
  214. BOOL g_CSDcall_aborted_status = FALSE;/*Added to handle the csd call aborted state*/
  215. BOOL g_BrwCsdCallDisconnect = FALSE; /*It is being set when csd call get disconnected*/
  216. BOOL g_EndKey_pressed = FALSE; /*Added to process the end key through internal queue*/
  217. /* Himanshu - Stores the current title icon animation status */
  218. MMI_BOOL g_brw_title_icon_animation_status = MMI_FALSE;
  219. #ifdef JBROWSER_USE_ASM
  220. void *wap_heap_space = NULL;
  221. #endif /* ifdef JBROWSER_USE_ASM */
  222. /*****************************************************************************
  223.  * FUNCTION
  224.  *  mmi_jbrowser_startup
  225.  * DESCRIPTION
  226.  *  Startup Event.
  227.  * PARAMETERS
  228.  *  void
  229.  * RETURNS
  230.  *  void
  231.  *****************************************************************************/
  232. void mmi_jbrowser_startup(void)
  233. {
  234.     /*----------------------------------------------------------------*/
  235.     /* Local Variables                                                */
  236.     /*----------------------------------------------------------------*/
  237.     JC_RETCODE eRet = JC_OK;
  238.     JC_EVENT_DATA eventData = {0, };
  239.     /*----------------------------------------------------------------*/
  240.     /* Code Body                                                      */
  241.     /*----------------------------------------------------------------*/
  242.     /* send browser start up event */
  243.     eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
  244.     eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  245.     eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
  246.     eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  247.     eventData.uiEventInfoSize = 0;
  248.     eventData.iEventType = E_BRW_STARTUP_EVENT;
  249.     eRet = jdd_QueueCreate(E_TASK_BROWSER_CORE, "BrwCoreQ", sizeof(JC_EVENT_DATA), 128, E_FALSE);
  250.     eRet = jdd_QueueCreate(E_TASK_BROWSER_UI, "BrwUIQ", sizeof(JC_EVENT_DATA), 128, E_FALSE);
  251.     eRet = jdd_QueueSend(&eventData);
  252.     if (JC_OK != eRet)
  253.     {
  254.         return;
  255.     }
  256. }
  257. /*****************************************************************************
  258.  * FUNCTION
  259.  *  mmi_jdd_browser_core_events_hdlr
  260.  * DESCRIPTION
  261.  *  Core Event Handler
  262.  * PARAMETERS
  263.  *  pEventData      [?]     
  264.  * RETURNS
  265.  *  void
  266.  *****************************************************************************/
  267. void mmi_jdd_browser_core_events_hdlr(JC_EVENT_DATA *pEventData)
  268. {
  269.     /*----------------------------------------------------------------*/
  270.     /* Local Variables                                                */
  271.     /*----------------------------------------------------------------*/
  272.     JC_RETCODE iRet = JC_OK;
  273.     /*----------------------------------------------------------------*/
  274.     /* Code Body                                                      */
  275.     /*----------------------------------------------------------------*/
  276.     if (E_TASK_TRANSPORT == pEventData->srcTaskInfo.iTaskID)
  277.     {
  278.         iRet = jdi_BrowserHandleTransportResponse(pBrowserCtxt, pEventData);
  279.     }
  280. }
  281. /*****************************************************************************
  282.  * FUNCTION
  283.  *  JBrowserKeyLeftArrowEventHdlr
  284.  * DESCRIPTION
  285.  *  JBrowserKeyLeftArrowEventHdlr
  286.  * PARAMETERS
  287.  *  void
  288.  * RETURNS
  289.  *  void
  290.  *****************************************************************************/
  291. void JBrowserKeyLeftArrowEventHdlr(void)
  292. {
  293.     /*----------------------------------------------------------------*/
  294.     /* Local Variables                                                */
  295.     /*----------------------------------------------------------------*/
  296.     EJCScrollDirection eScrollDirection;
  297.     JC_RETCODE iRet = JC_OK;
  298.     /*----------------------------------------------------------------*/
  299.     /* Code Body                                                      */
  300.     /*----------------------------------------------------------------*/
  301.     eScrollDirection = E_JC_SCROLL_LEFT;
  302.     iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
  303.     if (JC_OK != iRet)
  304.     {
  305.         jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
  306.     }
  307. }
  308. /*****************************************************************************
  309.  * FUNCTION
  310.  *  JBrowserKeyRightArrowEventHdlr
  311.  * DESCRIPTION
  312.  *  JBrowserKeyRightArrowEventHdlr
  313.  * PARAMETERS
  314.  *  void
  315.  * RETURNS
  316.  *  void
  317.  *****************************************************************************/
  318. void JBrowserKeyRightArrowEventHdlr(void)
  319. {
  320.     /*----------------------------------------------------------------*/
  321.     /* Local Variables                                                */
  322.     /*----------------------------------------------------------------*/
  323.     EJCScrollDirection eScrollDirection;
  324.     JC_RETCODE iRet = JC_OK;
  325.     /*----------------------------------------------------------------*/
  326.     /* Code Body                                                      */
  327.     /*----------------------------------------------------------------*/
  328.     eScrollDirection = E_JC_SCROLL_RIGHT;
  329.     iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
  330.     if (JC_OK != iRet)
  331.     {
  332.         jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
  333.     }
  334. }
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  JBrowserKeyUpArrowEventHdlr
  338.  * DESCRIPTION
  339.  *  JBrowserKeyUpArrowEventHdlr
  340.  * PARAMETERS
  341.  *  void
  342.  * RETURNS
  343.  *  void
  344.  *****************************************************************************/
  345. void JBrowserKeyUpArrowEventHdlr(void)
  346. {
  347.     /*----------------------------------------------------------------*/
  348.     /* Local Variables                                                */
  349.     /*----------------------------------------------------------------*/
  350.     EJCScrollDirection eScrollDirection;
  351.     JC_RETCODE iRet = JC_OK;
  352.     /*----------------------------------------------------------------*/
  353.     /* Code Body                                                      */
  354.     /*----------------------------------------------------------------*/
  355.     eScrollDirection = E_JC_SCROLL_UP;
  356.     iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
  357.     if (JC_OK != iRet)
  358.     {
  359.         jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
  360.     }
  361. }
  362. /*****************************************************************************
  363.  * FUNCTION
  364.  *  JBrowserKeyDownArrowEventHdlr
  365.  * DESCRIPTION
  366.  *  JBrowserKeyDownArrowEventHdlr
  367.  * PARAMETERS
  368.  *  void
  369.  * RETURNS
  370.  *  void
  371.  *****************************************************************************/
  372. void JBrowserKeyDownArrowEventHdlr(void)
  373. {
  374.     /*----------------------------------------------------------------*/
  375.     /* Local Variables                                                */
  376.     /*----------------------------------------------------------------*/
  377.     EJCScrollDirection eScrollDirection;
  378.     JC_RETCODE iRet = JC_OK;
  379.     /*----------------------------------------------------------------*/
  380.     /* Code Body                                                      */
  381.     /*----------------------------------------------------------------*/
  382.     eScrollDirection = E_JC_SCROLL_DOWN;
  383.     iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
  384.     if (JC_OK != iRet)
  385.     {
  386.         jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
  387.     }
  388. }
  389. /*****************************************************************************
  390.  * FUNCTION
  391.  *  JBrowserGoEvent
  392.  * DESCRIPTION
  393.  *  Go event handler
  394.  * PARAMETERS
  395.  *  void
  396.  * RETURNS
  397.  *  void
  398.  *****************************************************************************/
  399. void JBrowserGoEvent(void)
  400. {
  401.     /*----------------------------------------------------------------*/
  402.     /* Local Variables                                                */
  403.     /*----------------------------------------------------------------*/
  404.     JC_RETCODE iRet = JC_OK;
  405.     JC_EVENT_DATA eventData = {0, };
  406.     /*----------------------------------------------------------------*/
  407.     /* Code Body                                                      */
  408.     /*----------------------------------------------------------------*/
  409.     eventData.pEventInfo = NULL;
  410.     eventData.uiEventInfoSize = 0;
  411.     eventData.iEventType = E_BRW_START_FETCH_EVENT;
  412.     eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
  413.     eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  414.     eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
  415.     eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  416.     iRet = jdd_QueueSend(&eventData);
  417.     if (JC_OK != iRet)
  418.     {
  419.         return;
  420.     }
  421. }
  422. /*****************************************************************************
  423.  * FUNCTION
  424.  *  mmi_brw_deinit_event
  425.  * DESCRIPTION
  426.  *  Deinit event handler
  427.  * PARAMETERS
  428.  *  void
  429.  * RETURNS
  430.  *  void
  431.  *****************************************************************************/
  432. void mmi_brw_deinit_event(void)
  433. {
  434.     /*----------------------------------------------------------------*/
  435.     /* Local Variables                                                */
  436.     /*----------------------------------------------------------------*/
  437.     JC_RETCODE iRet = JC_OK;
  438.     JC_EVENT_DATA eventData = {0, };
  439.     /*----------------------------------------------------------------*/
  440.     /* Code Body                                                      */
  441.     /*----------------------------------------------------------------*/
  442.     eventData.pEventInfo = NULL;
  443.     eventData.uiEventInfoSize = 0;
  444.     eventData.iEventType = E_BRW_DEINIT_EVENT;
  445.     eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
  446.     eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  447.     eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
  448.     eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  449.     iRet = jdd_QueueSend(&eventData);
  450.     if (JC_OK != iRet)
  451.     {
  452.         return;
  453.     }
  454. }
  455. /*****************************************************************************
  456.  * FUNCTION
  457.  *  mmi_brw_dataconn_auto_disc_timeout_event
  458.  * DESCRIPTION
  459.  *  Dataconn auto disconnect event handler.It disconn csd call on the basic 
  460.  *  of timeout event handler
  461.  * PARAMETERS
  462.  *  void
  463.  * RETURNS
  464.  *  void
  465.  *****************************************************************************/
  466. void mmi_brw_dataconn_auto_disc_timeout_event(void)
  467. {
  468.     /*----------------------------------------------------------------*/
  469.     /* Local Variables                                                */
  470.     /*----------------------------------------------------------------*/
  471.     JC_RETCODE iRet = JC_OK;
  472.     JC_EVENT_DATA eventData = {0, };
  473.     /*----------------------------------------------------------------*/
  474.     /* Code Body                                                      */
  475.     /*----------------------------------------------------------------*/
  476.     eventData.pEventInfo = NULL;
  477.     eventData.uiEventInfoSize = 0;
  478.     eventData.iEventType = E_BRW_DATACONN_AUTO_DISC_TIMEOUT_EVENT;
  479.     eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
  480.     eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  481.     eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
  482.     eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
  483.     iRet = jdd_QueueSend(&eventData);
  484.     if (JC_OK != iRet)
  485.     {
  486.         return;
  487.     }
  488. }
  489. /*****************************************************************************
  490.  * FUNCTION
  491.  *  JBrowserRefreshDisplayHdlr
  492.  * DESCRIPTION
  493.  *  Refresh event handler
  494.  * PARAMETERS
  495.  *  void
  496.  * RETURNS
  497.  *  void
  498.  *****************************************************************************/
  499. void JBrowserRefreshDisplayHdlr(void)
  500. {
  501.     /*----------------------------------------------------------------*/
  502.     /* Local Variables                                                */
  503.     /*----------------------------------------------------------------*/
  504.     JC_RETCODE iRet = JC_OK;
  505.     /*----------------------------------------------------------------*/
  506.     /* Code Body                                                      */
  507.     /*----------------------------------------------------------------*/
  508. jdd_MemSetActiveModuleID(E_TASK_BROWSER_CORE);
  509.     iRet = jdi_BrowserRefreshDisplay(pBrowserCtxt);
  510.     if (JC_OK != iRet)
  511.     {
  512.         jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
  513.     }
  514. }
  515. /*****************************************************************************
  516.  * FUNCTION
  517.  *  mmi_brw_multimedia_callback_hdlr
  518.  * DESCRIPTION
  519.  *  
  520.  * PARAMETERS
  521.  *  pAppArg         [?]     
  522.  *  pObjectInfo     [?]     
  523.  * RETURNS
  524.  *  
  525.  *****************************************************************************/
  526. JC_RETCODE mmi_brw_multimedia_callback_hdlr(void *pAppArg, JC_OBJECT_INFO *pObjectInfo)
  527. {
  528.     /*----------------------------------------------------------------*/
  529.     /* Local Variables                                                */
  530.     /*----------------------------------------------------------------*/
  531.     JC_RETCODE eRet;
  532.     /*----------------------------------------------------------------*/
  533.     /* Code Body                                                      */
  534.     /*----------------------------------------------------------------*/
  535.     if (pObjectInfo)
  536.     {
  537.         eRet = mmi_jdd_audio_play(pObjectInfo);
  538.     }
  539.     else
  540.     {
  541.         eRet = mmi_jdd_audio_stop();
  542.     }
  543.     if (eRet != JC_OK)
  544.     {
  545.         jdd_MMINotificationMessage((JC_INT32) eRet, E_NOTIFICATION_ERR, NULL, NULL);
  546.     }
  547.     return JC_OK;
  548. }
  549. /*****************************************************************************
  550.  * FUNCTION
  551.  *  mmi_brw_mime_content_callback_hdlr
  552.  * DESCRIPTION
  553.  *  mime callback handler for cached content
  554.  * PARAMETERS
  555.  *  pAppArg                     [?]     
  556.  *  pMimeContent                [?]     
  557.  * RETURNS
  558.  *  void
  559.  *****************************************************************************/
  560. void mmi_brw_mime_content_callback_hdlr(void *pAppArg, COMM_URL_IND *pMimeContent)
  561. {
  562.     S8 download_msg[200] = {0};
  563.     S8 tmp_str_ascii[50] = {0};
  564.     S8 tmp_str_ucs2[100] = {0};
  565.     
  566.     g_brw_cntx.isDownloading = FALSE;
  567.     memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
  568.     g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pMimeContent->pszContentType);
  569.     if(!g_brw_cntx.dwnld_mime_info.psContentType)
  570.     {
  571.         goto error_handle;
  572.     }
  573.     g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pMimeContent->psUrl);
  574.     if(!g_brw_cntx.dwnld_mime_info.psUrl)
  575.     {
  576.         goto error_handle;
  577.     }
  578.     g_brw_cntx.dwnld_mime_info.pBuffer = jdd_MemAlloc(pMimeContent->uiLength, 1);
  579.     if(!g_brw_cntx.dwnld_mime_info.pBuffer)
  580.     {
  581.         goto error_handle;
  582.     }
  583.     memcpy(g_brw_cntx.dwnld_mime_info.pBuffer, pMimeContent->pBuffer, pMimeContent->uiLength);
  584.     g_brw_cntx.dwnld_mime_info.iBufferLen = pMimeContent->uiLength;
  585.     pfnUnicodeStrcpy(download_msg, GetString(STR_ID_BRW_DOWNLOAD_QUERY));
  586.     pfnUnicodeStrcat(download_msg, "n");
  587.     if (pMimeContent->uiLength)
  588.     {
  589.         pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_CONTENT_SIZE));
  590.         pfnUnicodeStrcat(download_msg, ":");
  591.         if (pMimeContent->uiLength >= 1000)
  592.         {
  593.             sprintf(tmp_str_ascii, "%.1f ", (pMimeContent->uiLength / 1024.0));
  594.         }
  595.         else
  596.         {
  597.             sprintf(tmp_str_ascii, "%d ", pMimeContent->uiLength);
  598.         }
  599.         AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  600.         pfnUnicodeStrcat(download_msg, tmp_str_ucs2);
  601.         if (pMimeContent->uiLength >= 1000)
  602.         {
  603.             pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_KB));
  604.         }
  605.         else
  606.         {
  607.             pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_BYTES));
  608.         }
  609.     }
  610.     mmi_brw_entry_download_confirm((UI_string_type) download_msg, mmi_brw_save_mime_content, mmi_brw_cancel_save_mime_content);
  611.     return;
  612. error_handle:
  613.     mmi_brw_free_dwnld_info_memory();
  614.     DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_NOT_ENOUGH_MEMORY), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  615. }
  616. /*****************************************************************************
  617.  * FUNCTION
  618.  *  mmi_brw_save_mime_content
  619.  * DESCRIPTION
  620.  *  Save mime content
  621.  * PARAMETERS
  622.  *  void
  623.  * RETURNS
  624.  *  void
  625.  *****************************************************************************/
  626. void mmi_brw_save_mime_content(void)
  627. {
  628.     /*----------------------------------------------------------------*/
  629.     /* Local Variables                                                */
  630.     /*----------------------------------------------------------------*/
  631.     JC_CHAR *filename;
  632.     JC_RETCODE eRet;
  633.     JC_UINT32 navlist_count;
  634.     /*----------------------------------------------------------------*/
  635.     /* Code Body                                                      */
  636.     /*----------------------------------------------------------------*/
  637.     g_brw_cntx.isDownloading = TRUE;
  638.     jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  639.     if (!navlist_count)
  640.     {
  641.         DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
  642.     }
  643. #ifdef __USB_IN_NORMAL_MODE__
  644.     if (mmi_usb_is_in_mass_storage_mode())
  645.     {
  646.         mmi_usb_app_unavailable_popup(0);
  647.         g_brw_cntx.isDownloading = FALSE;
  648.         goto error_handle;
  649.     }
  650. #endif /* __USB_IN_NORMAL_MODE__ */
  651.     if (jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle) == JC_OK)
  652.     {
  653.         jdd_FSGetDownloadFileName(&filename);
  654.         g_brw_cntx.dwnld_mime_info.psFileName = filename;
  655.         g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
  656.         if (g_brw_cntx.dwnld_file_handle)
  657.         {
  658.             eRet = jdd_FSWrite(
  659.                 (void*)g_brw_cntx.dwnld_mime_info.pBuffer,
  660.                 g_brw_cntx.dwnld_mime_info.iBufferLen,
  661.                 1, g_brw_cntx.dwnld_file_handle);
  662.             if (eRet != 1)
  663.             {
  664.                 jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  665.                 jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
  666.                 jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  667.                 DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_FULL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  668.             }
  669.             else
  670.             {
  671.                 if (!navlist_count)
  672.                 {
  673. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  674.                     mmi_brw_deinit_all();
  675.                 }
  676.                 jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  677.                 jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  678.                 eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
  679.                 if (eRet != JC_OK)
  680.                 {
  681.                     DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  682.                 }
  683.             }
  684.         }
  685.         else
  686.         {
  687.             DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  688.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  689.         }
  690.     }
  691.     else
  692.     {
  693.         DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  694.     }
  695. error_handle:
  696.     mmi_brw_free_dwnld_info_memory();
  697. }
  698. /*****************************************************************************
  699.  * FUNCTION
  700.  *  mmi_brw_cancel_save_mime_content
  701.  * DESCRIPTION
  702.  *  Dont save mime content
  703.  * PARAMETERS
  704.  *  void
  705.  * RETURNS
  706.  *  void
  707.  *****************************************************************************/
  708. void mmi_brw_cancel_save_mime_content(void)
  709. {
  710.     /*----------------------------------------------------------------*/
  711.     /* Local Variables                                                */
  712.     /*----------------------------------------------------------------*/
  713.     JC_UINT32 navlist_count;
  714.     /*----------------------------------------------------------------*/
  715.     /* Code Body                                                      */
  716.     /*----------------------------------------------------------------*/
  717.     mmi_brw_free_dwnld_info_memory();
  718.     jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  719.     if (navlist_count)
  720.     {
  721.         GoBackHistory();
  722.     }
  723.     else
  724.     {
  725. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  726.         mmi_brw_deinit_all();
  727.         GoBacknHistory(1);
  728.     }
  729. }
  730. /*****************************************************************************
  731.  * FUNCTION
  732.  *  mmi_brw_mime_callback_hdlr
  733.  * DESCRIPTION
  734.  *  mime callback handler
  735.  * PARAMETERS
  736.  *  pAppArg                     [?]     
  737.  *  pMimeInfo                   [?]     
  738.  *  pBrowserFetchCallBacks      [?]     
  739.  * RETURNS
  740.  *  
  741.  *****************************************************************************/
  742. JC_RETCODE mmi_brw_mime_callback_hdlr(
  743.             void *pAppArg,
  744.             JC_BROWSER_MIME_INFO *pMimeInfo,
  745.             JC_BROWSER_FETCH_CALLBACKS *pBrowserFetchCallBacks)
  746. {
  747.     /*----------------------------------------------------------------*/
  748.     /* Local Variables                                                */
  749.     /*----------------------------------------------------------------*/
  750.     /*----------------------------------------------------------------*/
  751.     /* Code Body                                                      */
  752.     /*----------------------------------------------------------------*/
  753.     if (!(pMimeInfo->psContentType) || !pfnUnicodeStrlen(pMimeInfo->psContentType))
  754.     {
  755.         jdd_MMINotificationMessage(JC_ERR_UNKNOWN_CONTENT_TYPE, E_NOTIFICATION_ERR, NULL, NULL);
  756.         return JC_ERR_UNKNOWN_CONTENT_TYPE;
  757.     }
  758. #ifndef WAP_SEC_SUPPORT
  759. if (jc_strcmp(pMimeInfo->psContentType, APPLICATION_X_X509_CA_CERT_VALUE) == 0
  760. || jc_strcmp(pMimeInfo->psContentType, APPLICATION_X_X509_USER_CERT_VALUE) == 0
  761. || jc_strcmp(pMimeInfo->psContentType, APPLICATION_VND_WAP_WTLS_CA_CERTIFICATE_VALUE) == 0
  762. || jc_strcmp(pMimeInfo->psContentType, APPLICATION_VND_WAP_WTLS_USER_CERTIFICATE_VALUE) == 0)
  763.     {
  764.         jdd_MMINotificationMessage(JC_ERR_UNKNOWN_CONTENT_TYPE_PROCESSED, E_NOTIFICATION_ERR, NULL, NULL);
  765.         return JC_ERR_UNKNOWN_CONTENT_TYPE;
  766.     }
  767. #endif // if defined WAP_SEC_SUPPORT
  768.     if ((jdi_UtilsStartsWith(pMimeInfo->psContentType, "application/vnd.oma.drm.rights+xml") == 0) ||
  769.         (jdi_UtilsStartsWith(pMimeInfo->psContentType, "application/vnd.oma.drm.rights+wbxml") == 0))
  770.     {
  771.         pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_drm_rights_header_info_callback_hdlr;
  772.         pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_drm_rights_fetch_indication_info_callback_hdlr;
  773.         pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_drm_rights_fetch_error_info_callback_hdlr;
  774.     }
  775.     else
  776.     {
  777.         g_brw_cntx.isDownloading = FALSE;
  778.         g_brw_cntx.isDownloadSuspended = FALSE;
  779.         g_brw_cntx.showDownloadAbortedPopup = FALSE;
  780. #ifdef __JBROWSER_DLS_SUPPORT__
  781.         pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_dls_header_info_callback_hdlr;
  782.         pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_dls_fetch_indication_info_callback_hdlr;
  783.         pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_dls_fetch_error_info_callback_hdlr;
  784. #else
  785.         pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_header_info_callback_hdlr;
  786.         pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_fetch_indication_info_callback_hdlr;
  787.         pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_fetch_error_info_callback_hdlr;
  788. #endif /* __JBROWSER_DLS_SUPPORT__*/
  789.     }
  790.     return JC_OK;
  791. }
  792. /*****************************************************************************
  793.  * FUNCTION
  794.  *  mmi_brw_drm_rights_header_info_callback_hdlr
  795.  * DESCRIPTION
  796.  *  
  797.  * PARAMETERS
  798.  *  pAppArg                         [?]     
  799.  *  pBrowserHeaderIndication        [?]     
  800.  * RETURNS
  801.  *  
  802.  *****************************************************************************/
  803. JC_RETCODE mmi_brw_drm_rights_header_info_callback_hdlr(
  804.             void *pAppArg,
  805.             COMM_HEADER_INDICATION *pBrowserHeaderIndication)
  806. {
  807.     /*----------------------------------------------------------------*/
  808.     /* Local Variables                                                */
  809.     /*----------------------------------------------------------------*/
  810.     JC_CHAR *filename;
  811.     JC_RETCODE eRet = JC_OK;
  812.     /*----------------------------------------------------------------*/
  813.     /* Code Body                                                      */
  814.     /*----------------------------------------------------------------*/
  815.     g_brw_cntx.showDownloadAbortedPopup = TRUE;
  816. #ifdef __USB_IN_NORMAL_MODE__
  817.     if (mmi_usb_is_in_mass_storage_mode())
  818.     {
  819.         mmi_usb_app_unavailable_popup(0);
  820.         jdi_BrowserFetchStop(pBrowserCtxt);
  821.         g_brw_cntx.showDownloadAbortedPopup = FALSE;
  822.         goto error_handle;
  823.     }
  824. #endif /* __USB_IN_NORMAL_MODE__ */
  825.     memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
  826.     eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle); 
  827.     if (eRet == JC_OK)
  828.     {
  829.         jdd_FSGetDownloadFileName(&filename);
  830.         g_brw_cntx.dwnld_mime_info.psFileName = filename;
  831.         g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
  832.         if (!g_brw_cntx.dwnld_file_handle)
  833.         {
  834.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  835.             eRet = JC_ERR_FILE_OPEN;
  836.             goto error_handle;
  837.         }
  838.     }
  839.     else
  840.     {
  841.         goto error_handle;
  842.     }
  843.     g_brw_cntx.total_content_length = 0;
  844.     g_brw_cntx.downloaded_content_length = 0;
  845.     g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pBrowserHeaderIndication->pszContentType);
  846.     g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pBrowserHeaderIndication->psUrl);
  847.     if (pBrowserHeaderIndication->uiContentLength)
  848.     {
  849.         g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
  850.         g_brw_cntx.dwnld_mime_info.iBufferLen = pBrowserHeaderIndication->uiContentLength;
  851.     }
  852.     g_brw_page_cntx.brw_PageFetchStatus = 0;
  853.     return JC_OK;
  854.   error_handle:
  855.     if(g_brw_cntx.dwnld_mime_info.psFileName)
  856.     {
  857.         jdd_MemFree(g_brw_cntx.dwnld_mime_info.psFileName);
  858.         g_brw_cntx.dwnld_mime_info.psFileName = NULL;
  859.     }
  860.     return eRet;
  861. }
  862. /*****************************************************************************
  863.  * FUNCTION
  864.  *  mmi_brw_drm_rights_fetch_indication_info_callback_hdlr
  865.  * DESCRIPTION
  866.  *  
  867.  * PARAMETERS
  868.  *  pAppArg                     [?]     
  869.  *  pBrowserFetchURLIndResp     [?]     
  870.  * RETURNS
  871.  *  
  872.  *****************************************************************************/
  873. JC_RETCODE mmi_brw_drm_rights_fetch_indication_info_callback_hdlr(
  874.             void *pAppArg,
  875.             COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
  876. {
  877.     /*----------------------------------------------------------------*/
  878.     /* Local Variables                                                */
  879.     /*----------------------------------------------------------------*/
  880.     JC_RETCODE eRet;
  881.     JC_UINT32 navlist_count;
  882.     /*----------------------------------------------------------------*/
  883.     /* Code Body                                                      */
  884.     /*----------------------------------------------------------------*/
  885.     if ((pBrowserFetchURLIndResp->bHasMoreData)
  886.         || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
  887.     {
  888.         g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
  889.         eRet = jdd_FSWrite(
  890.                 (void*)pBrowserFetchURLIndResp->pucBuffer,
  891.                 pBrowserFetchURLIndResp->uiCurrentLength,
  892.                 1,
  893.                 g_brw_cntx.dwnld_file_handle);
  894.         if (eRet != 1)
  895.         {
  896.             jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  897.             jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
  898.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  899.             if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
  900.             {
  901.                 g_brw_page_cntx.brw_pageRenderStatus = 1;
  902.             }
  903.             goto error_handle;
  904.         }
  905.     }
  906.     if (!pBrowserFetchURLIndResp->bHasMoreData)
  907.     {
  908.         jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  909.         jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  910.         if(IsScreenPresent(SCR_FMGR_DA_FILE_OPTION))
  911.         {
  912.             ClearExitHandler();
  913.         }
  914.         jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  915.         if (!navlist_count)
  916.         {
  917.             mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  918.             mmi_brw_deinit_event();
  919.         }
  920.         if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
  921.         {
  922.             g_brw_page_cntx.brw_pageRenderStatus = 1;
  923.         }
  924.         eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
  925.         goto error_handle;
  926.     }
  927.     return JC_OK;
  928.   
  929.   error_handle:
  930.     mmi_brw_free_dwnld_info_memory();
  931.     return eRet;
  932. }
  933. /*****************************************************************************
  934.  * FUNCTION
  935.  *  mmi_brw_drm_rights_fetch_error_info_callback_hdlr
  936.  * DESCRIPTION
  937.  *  
  938.  * PARAMETERS
  939.  *  pAppArg             [?]         
  940.  *  uiReferenceID       [IN]        
  941.  *  eRet                [IN]        
  942.  * RETURNS
  943.  *  void
  944.  *****************************************************************************/
  945. void mmi_brw_drm_rights_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
  946. {
  947.     /*----------------------------------------------------------------*/
  948.     /* Local Variables                                                */
  949.     /*----------------------------------------------------------------*/
  950.     /*----------------------------------------------------------------*/
  951.     /* Code Body                                                      */
  952.     /*----------------------------------------------------------------*/
  953.     if (g_brw_cntx.dwnld_file_handle)
  954.     {
  955.         jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  956.         jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
  957.     }
  958.     mmi_brw_free_dwnld_info_memory();
  959.     if (g_brw_cntx.dwnld_fs_handle)
  960.     {
  961.         jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  962.     }
  963.     if(g_brw_cntx.showDownloadAbortedPopup)
  964.     {
  965.         DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  966.     }
  967. }
  968. #ifdef __JBROWSER_DLS_SUPPORT__
  969. /*****************************************************************************
  970.  * FUNCTION
  971.  *  mmi_brw_dls_header_info_callback_hdlr
  972.  * DESCRIPTION
  973.  *  
  974.  * PARAMETERS
  975.  *  pAppArg [?]         
  976.  *  pBrowserHeaderIndication [?]           
  977.  * RETURNS
  978.  *  JC_RETCODE
  979.  *****************************************************************************/
  980. JC_RETCODE mmi_brw_dls_header_info_callback_hdlr(void *pAppArg, COMM_HEADER_INDICATION *pBrowserHeaderIndication)
  981. {
  982.     /*----------------------------------------------------------------*/
  983.     /* Local Variables                                                */
  984.     /*----------------------------------------------------------------*/
  985.  JC_RETCODE eRet;
  986.  JC_UINT32 navlist_count;
  987.  
  988. /*----------------------------------------------------------------*/
  989.     /* Code Body                                                      */
  990.     /*----------------------------------------------------------------*/
  991.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ENTER: mmi_brw_dls_header_info_callback_hdlr"));
  992. eRet = jdi_BrowserSuspendRequest(pBrowserCtxt);
  993. if (eRet != JC_OK)
  994. {
  995. jdi_BrowserFetchStop(pBrowserCtxt);
  996. return eRet;
  997. }
  998.     g_brw_cntx.isDownloadSuspended = TRUE;
  999.     g_brw_cntx.total_content_length = 0;
  1000.     g_brw_cntx.downloaded_content_length = 0;
  1001. g_brw_dls_cntx.session_id = pBrowserHeaderIndication->uiRequestID;
  1002. g_brw_dls_cntx.seq_num = 0;
  1003. g_brw_dls_cntx.progress_flag = TRUE;
  1004.     if (pBrowserHeaderIndication->uiContentLength)
  1005.     {
  1006.         g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
  1007.     }
  1008.     g_brw_page_cntx.brw_PageFetchStatus = 0;
  1009. // PMTSW00006571 Start
  1010. jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  1011.     if (!navlist_count)
  1012.     {
  1013.         ClearExitHandler();
  1014.     }
  1015. // PMTSW00006571 End
  1016. mmi_brw_dls_send_file_dl_ind(pBrowserHeaderIndication);
  1017.     return JC_OK;
  1018. }
  1019. /*****************************************************************************
  1020.  * FUNCTION
  1021.  *  mmi_brw_dls_fetch_indication_info_callback_hdlr
  1022.  * DESCRIPTION
  1023.  *  
  1024.  * PARAMETERS
  1025.  *  pAppArg [?]         
  1026.  *  pBrowserFetchURLIndResp [?]        
  1027.  * RETURNS
  1028.  *  void
  1029.  *****************************************************************************/
  1030. JC_RETCODE mmi_brw_dls_fetch_indication_info_callback_hdlr(void *pAppArg, COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
  1031. {
  1032.    /*----------------------------------------------------------------*/
  1033.     /* Local Variables                                                */
  1034.     /*----------------------------------------------------------------*/
  1035.     JC_RETCODE eRet;
  1036.     /*----------------------------------------------------------------*/
  1037.     /* Code Body                                                      */
  1038.     /*----------------------------------------------------------------*/
  1039. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_fetch_indication_info_callback_hdlr", pBrowserFetchURLIndResp->uiCurrentLength, pBrowserFetchURLIndResp->bHasMoreData));
  1040.     
  1041. if (g_brw_cntx.isDownloading == TRUE )
  1042. {
  1043. if ((pBrowserFetchURLIndResp->bHasMoreData)
  1044.         || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
  1045.     {
  1046.         g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
  1047.         eRet = jdd_FSWrite(
  1048.                 (void*)pBrowserFetchURLIndResp->pucBuffer,
  1049.                 pBrowserFetchURLIndResp->uiCurrentLength,
  1050.                 1,
  1051.                 g_brw_cntx.dwnld_file_handle);
  1052.         if (eRet == 1)
  1053.         {
  1054. if ( g_brw_dls_cntx.progress_flag == TRUE )
  1055. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_DOWNLOADING,WAP_DL_ERROR_OK);
  1056.         }
  1057.         else
  1058.         {
  1059. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ERROR: jdd_FSWrite", eRet));
  1060. g_brw_cntx.isDownloading = FALSE;
  1061.             jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1062. g_brw_cntx.dwnld_file_handle = NULL;
  1063. if (g_brw_dls_cntx.p_file_name != NULL)
  1064. {
  1065. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1066. g_brw_dls_cntx.p_file_name = NULL;
  1067. }
  1068.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1069. g_brw_cntx.dwnld_fs_handle = NULL;
  1070. jdi_BrowserFetchStop(pBrowserCtxt);
  1071. switch (eRet)
  1072. {
  1073. case JC_ERR_FILE_INVALID_PATH:
  1074. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_INVALID_FILE);
  1075. break;
  1076. case JC_ERR_FILE_FULL:
  1077. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_DISK_FULL);
  1078. break;
  1079. case JC_ERR_FILE_INVALID_ACCESS:
  1080. default:
  1081. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_FILE_ACCESS);
  1082. break;
  1083. }
  1084.     return eRet;
  1085.         }
  1086.     }
  1087.     if (!pBrowserFetchURLIndResp->bHasMoreData)
  1088.     {
  1089. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Download Complete"));
  1090. g_brw_cntx.isDownloading = FALSE;
  1091.         if (g_brw_cntx.dwnld_file_handle)
  1092. {
  1093. jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1094. g_brw_cntx.dwnld_file_handle = NULL;
  1095. if (g_brw_dls_cntx.p_file_name!=NULL)
  1096. {
  1097. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1098. g_brw_dls_cntx.p_file_name = NULL;
  1099. }
  1100. }
  1101. if (g_brw_cntx.dwnld_fs_handle)
  1102. {
  1103. jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1104. g_brw_cntx.dwnld_fs_handle = NULL;
  1105. }
  1106.         if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
  1107.         {
  1108.             g_brw_page_cntx.brw_pageRenderStatus = 1;
  1109.         }
  1110. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_COMPLETE,WAP_DL_ERROR_OK);
  1111.     }
  1112. }
  1113. else
  1114.     {
  1115. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "EXIT: mmi_brw_dls_fetch_indication_info_callback_hdlr and g_brw_cntx.isDownloading is False" ));
  1116. return JC_OK;
  1117. }
  1118. return JC_OK;
  1119. }
  1120. /*****************************************************************************
  1121.  * FUNCTION
  1122.  *  mmi_brw_dls_fetch_error_info_callback_hdlr
  1123.  * DESCRIPTION
  1124.  *  
  1125.  * PARAMETERS
  1126.  *  pAppArg             [?]         
  1127.  *  uiReferenceID       [IN]        
  1128.  *  eRet                [IN]        
  1129.  * RETURNS
  1130.  *  void
  1131.  *****************************************************************************/
  1132. void mmi_brw_dls_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
  1133. {
  1134.    /*----------------------------------------------------------------*/
  1135.     /* Local Variables                                                */
  1136.     /*----------------------------------------------------------------*/
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_fetch_error_info_callback_hdlr", g_brw_cntx.isDownloading, g_brw_cntx.isDownloadSuspended));
  1141.     
  1142. if ( g_brw_cntx.isDownloading == TRUE )  // Connection loss while downloading
  1143. {
  1144. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_CONNECTION_CLOSED);
  1145. }
  1146. g_brw_cntx.isDownloading = FALSE;
  1147. g_brw_cntx.isDownloadSuspended = FALSE;
  1148.     if (g_brw_cntx.dwnld_file_handle)
  1149.     {
  1150.         jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1151. g_brw_cntx.dwnld_file_handle = NULL;
  1152. if (g_brw_dls_cntx.p_file_name != NULL && g_brw_cntx.dwnld_fs_handle != NULL)
  1153. {
  1154. jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_dls_cntx.p_file_name); // Delete file
  1155. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1156. g_brw_dls_cntx.p_file_name = NULL;
  1157. }
  1158.     }
  1159.     if (g_brw_cntx.dwnld_fs_handle)
  1160.     {
  1161.         jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1162. g_brw_cntx.dwnld_fs_handle = NULL;
  1163.     }
  1164. }
  1165. /*****************************************************************************
  1166.  * FUNCTION
  1167.  *  mmi_brw_dls_send_file_dl_ind
  1168.  * DESCRIPTION
  1169.  *  To send file download indication to DA
  1170.  * PARAMETERS
  1171.  *  pBrowserHeaderIndication             [?]            
  1172.  * RETURNS
  1173.  *  void
  1174.  *****************************************************************************/
  1175. void mmi_brw_dls_send_file_dl_ind(COMM_HEADER_INDICATION *pBrowserHeaderIndication)
  1176. {
  1177. /*----------------------------------------------------------------*/
  1178.     /* Local Variables                                                */
  1179.     /*----------------------------------------------------------------*/
  1180. MYQUEUE Message;
  1181. wap_mmi_file_dl_ind_struct *p_dl_ind_st = NULL;
  1182. wap_mmi_file_dl_var_struct *p_dl_var_st = NULL;
  1183. peer_buff_struct *peer_buff_ptr = NULL;
  1184. U16 peer_pdu_len = 0;
  1185. JC_CHAR *tempFileName;
  1186. FS_HANDLE fHandle;
  1187.     /*----------------------------------------------------------------*/
  1188.     /* Code Body                                                      */
  1189.     /*----------------------------------------------------------------*/
  1190. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ENTER: mmi_brw_dls_send_file_dl_ind"));
  1191. p_dl_ind_st = (wap_mmi_file_dl_ind_struct*) construct_local_para(sizeof(wap_mmi_file_dl_ind_struct), TD_CTRL);
  1192. p_dl_ind_st->session_id = pBrowserHeaderIndication->uiRequestID;
  1193. pfnUnicodeStrcpy((S8*)p_dl_ind_st->url, (S8*) pBrowserHeaderIndication->psUrl);
  1194.  
  1195. mmi_brw_dls_set_file_name(p_dl_ind_st->url, '/');  // Get file name in g_brw_dls_cntx.p_file_name
  1196. if(g_brw_dls_cntx.p_file_name != NULL)
  1197. {
  1198. fHandle = FS_GetAttributes (g_brw_dls_cntx.p_file_name);
  1199. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "FS_GetAttributes  returns", fHandle));
  1200. }
  1201. if ( g_brw_dls_cntx.p_file_name == NULL || fHandle == FS_INVALID_FILENAME )
  1202. {
  1203. // File Name is not valid. Creating a temp file name
  1204. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Invalid file name"));
  1205. if (g_brw_dls_cntx.p_file_name != NULL )
  1206. {
  1207. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1208. g_brw_dls_cntx.p_file_name = NULL;
  1209. }
  1210. jdd_FSGetDownloadFileName(&tempFileName);
  1211. mmi_brw_dls_set_file_name((U8*)tempFileName, '\'); // Get file name in g_brw_dls_cntx.p_file_name
  1212. jdd_MemFree(tempFileName);
  1213. }
  1214. pfnUnicodeStrcpy((S8*)p_dl_ind_st->file_name ,(S8*) g_brw_dls_cntx.p_file_name);
  1215. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1216. g_brw_dls_cntx.p_file_name = NULL;
  1217. pfnUnicodeStrcpy((S8*)p_dl_ind_st->mime_type,  pBrowserHeaderIndication->pszContentType);
  1218. p_dl_ind_st->file_length = pBrowserHeaderIndication->uiContentLength;
  1219. peer_buff_ptr = (peer_buff_struct*)construct_peer_buff(sizeof(wap_mmi_file_dl_var_struct), 0, 0, TD_CTRL);
  1220. p_dl_var_st = get_pdu_ptr(peer_buff_ptr, &peer_pdu_len);
  1221. if(p_dl_var_st)
  1222. {
  1223. p_dl_var_st->content_len = pBrowserHeaderIndication->uiHeaderLength;
  1224.         pfnUnicodeStrcpy((S8*)p_dl_var_st->content, (S8*)pBrowserHeaderIndication->pucHeader ) ;
  1225. }
  1226.     Message.oslSrcId = MOD_WAP;
  1227.     Message.oslDestId = MOD_MMI;
  1228.     Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_IND;
  1229.     Message.oslDataPtr = (oslParaType*) p_dl_ind_st;
  1230.     Message.oslPeerBuffPtr = peer_buff_ptr;
  1231.     OslMsgSendExtQueue(&Message);
  1232. }
  1233. /*****************************************************************************
  1234.  * FUNCTION
  1235.  *  mmi_brw_dls_file_dl_res_hdlr
  1236.  * DESCRIPTION
  1237.  *  To handle response message of file download indication from DA
  1238.  * PARAMETERS
  1239.  *  Msg             [?]               
  1240.  * RETURNS
  1241.  *  void
  1242.  *****************************************************************************/
  1243. void mmi_brw_dls_file_dl_res_hdlr(void *Msg)
  1244. {
  1245. /*----------------------------------------------------------------*/
  1246.     /* Local Variables                                                */
  1247.     /*----------------------------------------------------------------*/
  1248.     JC_RETCODE eRet;
  1249. wap_mmi_file_dl_res_struct * p_dl_res_st = (wap_mmi_file_dl_res_struct *) Msg;
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Code Body                                                      */
  1252.     /*----------------------------------------------------------------*/
  1253. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_file_dl_res_hdlr", p_dl_res_st->result, g_brw_cntx.isDownloadSuspended));
  1254.  
  1255. if ( g_brw_cntx.isDownloadSuspended == TRUE )
  1256. {
  1257. if ( p_dl_res_st->result == WAP_DL_ERROR_CANCELLED)
  1258. {
  1259. g_brw_cntx.isDownloading = FALSE;
  1260. g_brw_cntx.isDownloadSuspended = FALSE;
  1261. jdi_BrowserFetchStop(pBrowserCtxt);      // Download Cancel 
  1262. }
  1263. else if ( p_dl_res_st->result == WAP_DL_ERROR_OK) // Start Download
  1264. {
  1265. if(p_dl_res_st->session_id == g_brw_dls_cntx.session_id )
  1266. {
  1267. if (g_brw_cntx.total_content_length != 0 && mmi_brw_dls_is_free_space_available(p_dl_res_st->file_path) == FALSE) // Free Space not available
  1268. {
  1269. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ERROR: mmi_brw_dls_is_free_space_available"));
  1270. g_brw_cntx.isDownloading = FALSE;
  1271. g_brw_cntx.isDownloadSuspended = FALSE;
  1272. jdi_BrowserFetchStop(pBrowserCtxt);    
  1273. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_DISK_FULL);
  1274. }
  1275. else
  1276. {
  1277. eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle);
  1278. if (eRet == JC_OK)
  1279. {
  1280. g_brw_dls_cntx.p_file_name = (JC_CHAR *)jdd_MemAlloc(pfnUnicodeStrlen((S8* )p_dl_res_st->file_path) * ENCODING_LENGTH + 2, sizeof(S8));
  1281. pfnUnicodeStrcpy ((S8*)g_brw_dls_cntx.p_file_name, (S8*) p_dl_res_st->file_path);
  1282. g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, p_dl_res_st->file_path, E_CREATE_WRITE_MODE);
  1283. if (!g_brw_cntx.dwnld_file_handle)
  1284. {
  1285. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ERROR: jdd_FSOpen"));
  1286. g_brw_cntx.isDownloading = FALSE;
  1287. g_brw_cntx.isDownloadSuspended = FALSE;
  1288. jdi_BrowserFetchStop(pBrowserCtxt);
  1289. if (g_brw_dls_cntx.p_file_name!=NULL)
  1290. {
  1291. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1292. g_brw_dls_cntx.p_file_name = NULL;
  1293. }
  1294. jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1295. g_brw_cntx.dwnld_fs_handle = NULL;
  1296. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_INVALID_FILE);
  1297. }
  1298. else
  1299. {
  1300. g_brw_cntx.isDownloadSuspended = FALSE;
  1301. g_brw_cntx.isDownloading = TRUE;
  1302. jdi_BrowserResumeRequest(pBrowserCtxt);      // Download Start
  1303. }
  1304. }
  1305. else
  1306. {
  1307. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ERROR: jdd_FSInitialize", eRet));
  1308. g_brw_cntx.isDownloading = FALSE;
  1309. g_brw_cntx.isDownloadSuspended = FALSE;
  1310. jdi_BrowserFetchStop(pBrowserCtxt);
  1311. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_FILE_ACCESS); 
  1312. }
  1313. }
  1314. }
  1315. else
  1316. {
  1317. g_brw_cntx.isDownloading = FALSE;
  1318. g_brw_cntx.isDownloadSuspended = FALSE;
  1319. jdi_BrowserFetchStop(pBrowserCtxt);
  1320. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_INVALID_SESSION_ID); // WAP_DL_STATUS_ABORT && WAP_DL_ERROR_INVALID_SESSION_ID
  1321. }
  1322. }
  1323. else // Result is other than WAP_DL_ERROR_OK and WAP_DL_ERROR_CANCELLED.
  1324. {
  1325. g_brw_cntx.isDownloading = FALSE;
  1326. g_brw_cntx.isDownloadSuspended = FALSE;
  1327. jdi_BrowserFetchStop(pBrowserCtxt);
  1328. }
  1329. }
  1330. else
  1331. {
  1332. if ( p_dl_res_st->result == WAP_DL_ERROR_OK)
  1333. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_CONNECTION_CLOSED);
  1334. }
  1335. }
  1336. /*****************************************************************************
  1337.  * FUNCTION
  1338.  *  mmi_brw_dls_send_file_dl_progress_ind
  1339.  * DESCRIPTION
  1340.  *  To send file progress information to DA
  1341.  * PARAMETERS
  1342.  *  status      [?]         
  1343.  *  cause       [?]             
  1344.  * RETURNS
  1345.  *  void
  1346.  *****************************************************************************/
  1347. void mmi_brw_dls_send_file_dl_progress_ind(U8 status, U8 cause)
  1348. {
  1349. /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352. MYQUEUE Message;
  1353. wap_mmi_file_dl_progress_ind_struct *p_dl_prg_ind_st = NULL;
  1354.     /*----------------------------------------------------------------*/
  1355.     /* Code Body                                                      */
  1356.     /*----------------------------------------------------------------*/
  1357. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_send_file_dl_progress_ind", status, cause));
  1358. p_dl_prg_ind_st = (wap_mmi_file_dl_progress_ind_struct*) construct_local_para(sizeof(wap_mmi_file_dl_progress_ind_struct), TD_CTRL);
  1359. g_brw_dls_cntx.progress_flag = FALSE;
  1360. g_brw_dls_cntx.seq_num++;
  1361. p_dl_prg_ind_st->session_id = g_brw_dls_cntx.session_id;
  1362. p_dl_prg_ind_st->seq_num = g_brw_dls_cntx.seq_num;
  1363. p_dl_prg_ind_st->status = status;
  1364. p_dl_prg_ind_st->cause = cause;
  1365. p_dl_prg_ind_st->acc_size = g_brw_cntx.downloaded_content_length;
  1366.     Message.oslSrcId = MOD_WAP;
  1367.     Message.oslDestId = MOD_MMI;
  1368.     Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_PROGRESS_IND;
  1369.     Message.oslDataPtr = (oslParaType*) p_dl_prg_ind_st;
  1370.     Message.oslPeerBuffPtr = NULL;
  1371.     OslMsgSendExtQueue(&Message);
  1372. }
  1373. /*****************************************************************************
  1374.  * FUNCTION
  1375.  *  mmi_brw_dls_file_dl_progress_res_hdlr
  1376.  * DESCRIPTION
  1377.  *  To handle response message of file progress information from DA
  1378.  * PARAMETERS
  1379.  *  Msg             [?]              
  1380.  * RETURNS
  1381.  *  void
  1382.  *****************************************************************************/
  1383. void mmi_brw_dls_file_dl_progress_res_hdlr(void *Msg)
  1384. /*----------------------------------------------------------------*/
  1385.     /* Local Variables                                                */
  1386.     /*----------------------------------------------------------------*/
  1387. wap_mmi_file_dl_progress_res_struct *p_dl_prg_res_st = (wap_mmi_file_dl_progress_res_struct*) Msg;
  1388.     /*----------------------------------------------------------------*/
  1389.     /* Code Body                                                      */
  1390.     /*----------------------------------------------------------------*/
  1391. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ENTER: mmi_brw_dls_file_dl_progress_res_hdlr", g_brw_cntx.isDownloading));
  1392. if ( g_brw_cntx.isDownloading == TRUE)
  1393. {
  1394. if (g_brw_dls_cntx.session_id != p_dl_prg_res_st->session_id )
  1395. {
  1396. g_brw_cntx.isDownloadSuspended = FALSE;
  1397. g_brw_cntx.isDownloading = FALSE;
  1398. jdi_BrowserFetchStop(pBrowserCtxt);
  1399. mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_INVALID_SESSION_ID); // WAP_DL_STATUS_ABORT && WAP_DL_ERROR_INVALID_SESSION_ID
  1400. }
  1401. else
  1402. {
  1403. g_brw_dls_cntx.progress_flag = TRUE ;
  1404. }
  1405. }
  1406. }
  1407. /*****************************************************************************
  1408.  * FUNCTION
  1409.  *  mmi_brw_dls_file_dl_stop_req_hdlr
  1410.  * DESCRIPTION
  1411.  *  To handle file download request message from DA
  1412.  * PARAMETERS
  1413.  *  Msg             [?]         
  1414.  * RETURNS
  1415.  *  void
  1416.  *****************************************************************************/
  1417. void mmi_brw_dls_file_dl_stop_req_hdlr(void *Msg)
  1418. {
  1419. /*----------------------------------------------------------------*/
  1420.     /* Local Variables                                                */
  1421.     /*----------------------------------------------------------------*/
  1422. wap_mmi_file_dl_stop_req_struct *p_dl_stop_req = (wap_mmi_file_dl_stop_req_struct *) Msg;
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Code Body                                                      */
  1425.     /*----------------------------------------------------------------*/
  1426. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ENTER: mmi_brw_dls_file_dl_stop_req_hdlr", g_brw_cntx.isDownloading));
  1427. if ( g_brw_cntx.isDownloading == TRUE)
  1428. {
  1429. if (g_brw_dls_cntx.session_id != p_dl_stop_req->session_id )
  1430. {
  1431. mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_DOWNLOADING, WAP_DL_ERROR_INVALID_SESSION_ID);
  1432. }
  1433. else
  1434. {
  1435. jdi_BrowserFetchStop(pBrowserCtxt);
  1436. g_brw_cntx.isDownloading = FALSE;
  1437. g_brw_cntx.isDownloadSuspended = FALSE;
  1438. if (g_brw_cntx.dwnld_file_handle)
  1439. {
  1440. jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1441. g_brw_cntx.dwnld_file_handle = NULL;
  1442. if (g_brw_dls_cntx.p_file_name != NULL)
  1443. {
  1444. jdd_MemFree(g_brw_dls_cntx.p_file_name);
  1445. g_brw_dls_cntx.p_file_name = NULL;
  1446. }
  1447. }
  1448. if (g_brw_cntx.dwnld_fs_handle)
  1449. {
  1450. jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1451. g_brw_cntx.dwnld_fs_handle = NULL;
  1452. }
  1453. mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_CANCELLED, WAP_DL_ERROR_OK);
  1454. }
  1455. }
  1456. else
  1457. {
  1458. mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_COMPLETE,WAP_DL_ERROR_CANCELLED);
  1459. }
  1460. }
  1461. /*****************************************************************************
  1462.  * FUNCTION
  1463.  *  mmi_brw_dls_send_file_dl_stop_rsp
  1464.  * DESCRIPTION
  1465.  *  To send response of file donwload request to DA
  1466.  * PARAMETERS
  1467.  *  status      [?]         
  1468.  *  cause       [?]             
  1469.  * RETURNS
  1470.  *  void
  1471.  *****************************************************************************/
  1472. void mmi_brw_dls_send_file_dl_stop_rsp(U8 status, U8 cause)
  1473. {
  1474. /*----------------------------------------------------------------*/
  1475.     /* Local Variables                                                */
  1476.     /*----------------------------------------------------------------*/
  1477. MYQUEUE Message;
  1478. wap_mmi_file_dl_stop_rsp_struct *p_dl_stop_rsp = (wap_mmi_file_dl_stop_rsp_struct *)construct_local_para(sizeof(wap_mmi_file_dl_stop_rsp_struct), TD_CTRL);
  1479.     /*----------------------------------------------------------------*/
  1480.     /* Code Body                                                      */
  1481.     /*----------------------------------------------------------------*/
  1482. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_send_file_dl_stop_rsp", status, cause));
  1483. p_dl_stop_rsp->session_id = g_brw_dls_cntx.session_id;
  1484. p_dl_stop_rsp->seq_num = g_brw_dls_cntx.seq_num;
  1485. p_dl_stop_rsp->status = status;
  1486. p_dl_stop_rsp->cause = cause;
  1487. p_dl_stop_rsp->acc_size = g_brw_cntx.downloaded_content_length;
  1488.     Message.oslSrcId = MOD_WAP;
  1489.     Message.oslDestId = MOD_MMI;
  1490.     Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_STOP_RSP;
  1491.     Message.oslDataPtr = (oslParaType*) p_dl_stop_rsp;
  1492.     Message.oslPeerBuffPtr = NULL;
  1493.     OslMsgSendExtQueue(&Message);
  1494. }
  1495. /*****************************************************************************
  1496.  * FUNCTION
  1497.  *  mmi_brw_dls_set_file_name
  1498.  * DESCRIPTION
  1499.  *  This function is used to extract the file name from the given url and to set global variable g_brw_dls_cntx.p_file_name
  1500.  * PARAMETERS
  1501.  *  url              
  1502.  *  delim
  1503.  * RETURNS
  1504.  *  void
  1505.  *****************************************************************************/
  1506. void mmi_brw_dls_set_file_name(U8 *url, U8 delim)
  1507. {
  1508.     /*----------------------------------------------------------------*/
  1509.     /* Local Variables                                                */
  1510.     /*----------------------------------------------------------------*/
  1511. U16 url_len, file_name_len, file_ext_len, indexOfDelim, indexOfDot, indexOfFileNameEnd;
  1512. S16 i;
  1513.     /*----------------------------------------------------------------*/
  1514.     /* Code Body                                                      */
  1515.     /*----------------------------------------------------------------*/
  1516. ASSERT(url);
  1517. url_len = (pfnUnicodeStrlen((S8*) url)) * ENCODING_LENGTH;
  1518. file_name_len = indexOfDelim = indexOfDot = 0;
  1519. indexOfFileNameEnd = url_len;  // Here indexOfFileNameEnd is that index in the url which is either NULL character or special character like '?'
  1520. for( i = url_len - 1 * ENCODING_LENGTH; i >= 0 ; i--)
  1521. {
  1522. if(*(url + i) == '?')
  1523. {
  1524. indexOfFileNameEnd = i;   // '?' symbol present in the url. Ignore characters after '?' symbol
  1525. }
  1526. if(*(url + i) == '.')
  1527. {
  1528. indexOfDot = i;
  1529. }
  1530. if( *(url + i) == delim)
  1531. {
  1532. indexOfDelim = i;
  1533. break;
  1534. }
  1535. }
  1536. if (indexOfDelim == 0 || indexOfDot == 0 || indexOfDot < indexOfDelim || indexOfFileNameEnd < indexOfDot || indexOfFileNameEnd < indexOfDelim) // Invalid URL. 
  1537. {
  1538. PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)(%d)", "ERROR:mmi_brw_dls_set_file_name", indexOfDelim, indexOfDot, indexOfFileNameEnd));
  1539. return;
  1540. }
  1541. file_ext_len =  indexOfFileNameEnd - indexOfDot;
  1542. file_name_len = indexOfDot - indexOfDelim - (1 * ENCODING_LENGTH);
  1543. if(file_name_len + (1 * ENCODING_LENGTH) > WAP_DL_MAX_FILE_NAME_LEN - file_ext_len)   // If file name length exceeds
  1544. {
  1545. file_name_len = WAP_DL_MAX_FILE_NAME_LEN - file_ext_len;
  1546. }
  1547. g_brw_dls_cntx.p_file_name = (JC_CHAR *)jdd_MemAlloc(file_name_len + file_ext_len + (1 * ENCODING_LENGTH), sizeof(S8));
  1548. // Copying file_name_len characters from the url
  1549. for (i = indexOfDelim + (1 * ENCODING_LENGTH); i < url_len ; i++)
  1550. {
  1551. *( (S8*) g_brw_dls_cntx.p_file_name + i - indexOfDelim - (1 * ENCODING_LENGTH) ) = *(url + i);
  1552. if ( i - indexOfDelim - (1 * ENCODING_LENGTH) == file_name_len )  // break if file_name_len characters are copied
  1553. {
  1554. break;
  1555. }
  1556. }
  1557. // Copying file_ext_len characters from the url
  1558. for (i = 0; i < file_ext_len; i++)
  1559. {
  1560. *( (S8*) g_brw_dls_cntx.p_file_name + file_name_len + i) = *(url + indexOfDot + i);
  1561. }
  1562. *((S8*)g_brw_dls_cntx.p_file_name + file_name_len + file_ext_len) = '';
  1563. *((S8*)g_brw_dls_cntx.p_file_name + file_name_len + file_ext_len + 1) = '';
  1564. }
  1565. /*****************************************************************************
  1566.  * FUNCTION
  1567.  *  mmi_brw_dls_is_free_space_available
  1568.  * DESCRIPTION
  1569.  *  To determine if free space is available for download
  1570.  * PARAMETERS
  1571.  *  file_path        
  1572.  * RETURNS
  1573.  *  BOOL
  1574.  *****************************************************************************/
  1575. BOOL mmi_brw_dls_is_free_space_available(void *file_path)
  1576. {
  1577. /*----------------------------------------------------------------*/
  1578.     /* Local Variables                                                */
  1579.     /*----------------------------------------------------------------*/
  1580. S32 fs_ret;
  1581.     FS_DiskInfo disk_info;
  1582.     S8 drv_name[16];
  1583.     S32 disk_free_space = 0;
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Code Body                                                      */
  1586.     /*----------------------------------------------------------------*/
  1587. memset(drv_name, 0, sizeof(drv_name));
  1588. UCS2Strncpy((PS8) drv_name, (PS8) file_path, 3);
  1589. fs_ret = FS_GetDiskInfo((PU16) drv_name, &disk_info, FS_DI_BASIC_INFO | FS_DI_FREE_SPACE);
  1590. if (fs_ret >= 0)
  1591. {
  1592. disk_free_space = disk_info.FreeClusters * disk_info.SectorsPerCluster * disk_info.BytesPerSector;
  1593. if (disk_free_space > g_brw_cntx.total_content_length)
  1594. return TRUE;
  1595. else
  1596. return FALSE;
  1597. }
  1598. else
  1599. return FALSE;
  1600. }
  1601. #endif /* __JBROWSER_DLS_SUPPORT__ */
  1602. /*****************************************************************************
  1603.  * FUNCTION
  1604.  *  mmi_brw_header_info_callback_hdlr
  1605.  * DESCRIPTION
  1606.  *  
  1607.  * PARAMETERS
  1608.  *  pAppArg                         [?]     
  1609.  *  pBrowserHeaderIndication        [?]     
  1610.  * RETURNS
  1611.  *  
  1612.  *****************************************************************************/
  1613. JC_RETCODE mmi_brw_header_info_callback_hdlr(void *pAppArg, COMM_HEADER_INDICATION *pBrowserHeaderIndication)
  1614. {
  1615.     /*----------------------------------------------------------------*/
  1616.     /* Local Variables                                                */
  1617.     /*----------------------------------------------------------------*/
  1618.     S8 download_msg[200] = {0};
  1619.     S8 tmp_str_ascii[50] = {0};
  1620.     S8 tmp_str_ucs2[100] = {0};
  1621.     /*----------------------------------------------------------------*/
  1622.     /* Code Body                                                      */
  1623.     /*----------------------------------------------------------------*/
  1624.     jdi_BrowserSuspendRequest(pBrowserCtxt);
  1625.     g_brw_cntx.isDownloadSuspended = TRUE;
  1626.     g_brw_cntx.total_content_length = 0;
  1627.     g_brw_cntx.downloaded_content_length = 0;
  1628.     memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
  1629.     g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pBrowserHeaderIndication->pszContentType);
  1630.     g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pBrowserHeaderIndication->psUrl);
  1631.     g_brw_cntx.downloadSizeInKB = FALSE;
  1632.     if (pBrowserHeaderIndication->uiContentLength)
  1633.     {
  1634.         g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
  1635.         if (g_brw_cntx.total_content_length >= 1000)
  1636.         {
  1637.             g_brw_cntx.downloadSizeInKB = TRUE;
  1638.         }
  1639.         else
  1640.         {
  1641.             g_brw_cntx.downloadSizeInKB = FALSE;
  1642.         }
  1643.         g_brw_cntx.dwnld_mime_info.iBufferLen = pBrowserHeaderIndication->uiContentLength;
  1644.     }
  1645.     pfnUnicodeStrcpy(download_msg, GetString(STR_ID_BRW_DOWNLOAD_QUERY));
  1646.     pfnUnicodeStrcat(download_msg, "n");
  1647.     if (g_brw_cntx.total_content_length)
  1648.     {
  1649.         pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_CONTENT_SIZE));
  1650.         pfnUnicodeStrcat(download_msg, ":");
  1651.         if (g_brw_cntx.downloadSizeInKB)
  1652.         {
  1653.             sprintf(tmp_str_ascii, "%.1f ", (g_brw_cntx.total_content_length / 1024.0));
  1654.         }
  1655.         else
  1656.         {
  1657.             sprintf(tmp_str_ascii, "%d ", g_brw_cntx.total_content_length);
  1658.         }
  1659.         AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  1660.         pfnUnicodeStrcat(download_msg, tmp_str_ucs2);
  1661.         if (g_brw_cntx.downloadSizeInKB)
  1662.         {
  1663.             pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_KB));
  1664.         }
  1665.         else
  1666.         {
  1667.             pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_BYTES));
  1668.         }
  1669.     }
  1670.     g_brw_page_cntx.brw_PageFetchStatus = 0;
  1671.     mmi_brw_entry_download_confirm((UI_string_type) download_msg, mmi_brw_start_dwnld, mmi_brw_cancel_dwnld_and_goback);
  1672.     return JC_OK;
  1673. }
  1674. /*****************************************************************************
  1675.  * FUNCTION
  1676.  *  mmi_brw_entry_download_confirm
  1677.  * DESCRIPTION
  1678.  *  Entry screen for download confirmation
  1679.  * PARAMETERS
  1680.  *  message     [IN]        
  1681.  *  lsk_hdlr    [IN]        
  1682.  *  rsk_hdlr    [IN]        
  1683.  * RETURNS
  1684.  *  void
  1685.  *****************************************************************************/
  1686. void mmi_brw_entry_download_confirm(UI_string_type message, FuncPtr lsk_hdlr, FuncPtr rsk_hdlr)
  1687. {
  1688.     /*----------------------------------------------------------------*/
  1689.     /* Local Variables                                                */
  1690.     /*----------------------------------------------------------------*/
  1691.     U8 *guiBuffer;
  1692.     /*----------------------------------------------------------------*/
  1693.     /* Code Body                                                      */
  1694.     /*----------------------------------------------------------------*/
  1695.     guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_WAP_DOWNLOAD_CONFIRM);
  1696.     EntryNewScreen(SCR_ID_BRW_WAP_DOWNLOAD_CONFIRM, mmi_brw_exit_download_confirm, NULL, NULL);
  1697.     ShowCategory165Screen(
  1698.         STR_GLOBAL_YES,
  1699.         IMG_GLOBAL_YES,
  1700.         STR_GLOBAL_NO,
  1701.         IMG_GLOBAL_NO,
  1702.         message,
  1703.         IMG_GLOBAL_QUESTION,
  1704.         guiBuffer);
  1705.     SetLeftSoftkeyFunction(lsk_hdlr, KEY_EVENT_UP);
  1706.     SetRightSoftkeyFunction(rsk_hdlr, KEY_EVENT_UP);
  1707.     playRequestedTone(WARNING_TONE);
  1708. }
  1709. /*****************************************************************************
  1710.  * FUNCTION
  1711.  *  mmi_brw_exit_download_confirm
  1712.  * DESCRIPTION
  1713.  *  Exit screen for download confirmation
  1714.  * PARAMETERS
  1715.  *  void
  1716.  * RETURNS
  1717.  *  void
  1718.  *****************************************************************************/
  1719. void mmi_brw_exit_download_confirm(void)
  1720. {
  1721.     /*----------------------------------------------------------------*/
  1722.     /* Local Variables                                                */
  1723.     /*----------------------------------------------------------------*/
  1724.      JC_UINT32 navlist_count;
  1725.     /*----------------------------------------------------------------*/
  1726.     /* Code Body                                                      */
  1727.     /*----------------------------------------------------------------*/
  1728.     if (!g_brw_cntx.isDownloading)
  1729.     {
  1730.         jdi_BrowserFetchStop(pBrowserCtxt);
  1731.         mmi_brw_free_dwnld_info_memory();
  1732.         jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  1733.         if (!navlist_count)
  1734.         {
  1735.              DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
  1736.         }
  1737.     }
  1738.     stopRequestedTone(WARNING_TONE);
  1739. }
  1740. /*****************************************************************************
  1741.  * FUNCTION
  1742.  *  mmi_brw_fetch_indication_info_callback_hdlr
  1743.  * DESCRIPTION
  1744.  *  
  1745.  * PARAMETERS
  1746.  *  pAppArg                     [?]     
  1747.  *  pBrowserFetchURLIndResp     [?]     
  1748.  * RETURNS
  1749.  *  
  1750.  *****************************************************************************/
  1751. JC_RETCODE mmi_brw_fetch_indication_info_callback_hdlr(void *pAppArg, COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
  1752. {
  1753.     /*----------------------------------------------------------------*/
  1754.     /* Local Variables                                                */
  1755.     /*----------------------------------------------------------------*/
  1756.     JC_RETCODE eRet;
  1757.     /*----------------------------------------------------------------*/
  1758.     /* Code Body                                                      */
  1759.     /*----------------------------------------------------------------*/
  1760.     if ((pBrowserFetchURLIndResp->bHasMoreData)
  1761.         || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
  1762.     {
  1763.         g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
  1764.         eRet = jdd_FSWrite(
  1765.                 (void*)pBrowserFetchURLIndResp->pucBuffer,
  1766.                 pBrowserFetchURLIndResp->uiCurrentLength,
  1767.                 1,
  1768.                 g_brw_cntx.dwnld_file_handle);
  1769.         if (eRet == 1)
  1770.         {
  1771.             mmi_brw_update_downloading_msg();
  1772.             if (GetActiveScreenId() == SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS)
  1773.             {
  1774.                 cat66_update_progress_string();
  1775.             }
  1776.         }
  1777.         else
  1778.         {
  1779.             g_brw_cntx.isDownloading = FALSE;
  1780.             jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1781.             jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
  1782.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1783.             if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
  1784.             {
  1785.                 g_brw_page_cntx.brw_pageRenderStatus = 1;
  1786.             }
  1787.             GoBackHistory();
  1788.             goto error_handle;
  1789.         }
  1790.     }
  1791.     if (!pBrowserFetchURLIndResp->bHasMoreData)
  1792.     {
  1793.         JC_UINT32 navlist_count;
  1794.         g_brw_cntx.isDownloading = FALSE;
  1795.         jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1796.         jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1797.         if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
  1798.         {
  1799.             g_brw_page_cntx.brw_pageRenderStatus = 1;
  1800.         }
  1801.         DeleteScreenIfPresent(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS);
  1802.         jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  1803.         if (!navlist_count)
  1804.         {
  1805. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  1806.             mmi_brw_deinit_event();
  1807.         }
  1808.         eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
  1809.         goto error_handle;
  1810.     }
  1811.     return JC_OK;
  1812.   
  1813. error_handle:
  1814.     mmi_brw_free_dwnld_info_memory();
  1815.     return eRet;
  1816. }
  1817. /*****************************************************************************
  1818.  * FUNCTION
  1819.  *  mmi_brw_fetch_error_info_callback_hdlr
  1820.  * DESCRIPTION
  1821.  *  
  1822.  * PARAMETERS
  1823.  *  pAppArg             [?]         
  1824.  *  uiReferenceID       [IN]        
  1825.  *  eRet                [IN]        
  1826.  * RETURNS
  1827.  *  void
  1828.  *****************************************************************************/
  1829. void mmi_brw_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
  1830. {
  1831.     /*----------------------------------------------------------------*/
  1832.     /* Local Variables                                                */
  1833.     /*----------------------------------------------------------------*/
  1834.     /*----------------------------------------------------------------*/
  1835.     /* Code Body                                                      */
  1836.     /*----------------------------------------------------------------*/
  1837.     g_brw_cntx.isDownloading = FALSE;
  1838.     mmi_brw_free_dwnld_info_memory();
  1839.     if (g_brw_cntx.dwnld_file_handle)
  1840.     {
  1841.         jdd_FSClose(g_brw_cntx.dwnld_file_handle);
  1842.         jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
  1843.     }
  1844.     if (g_brw_cntx.dwnld_fs_handle)
  1845.     {
  1846.         jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1847.     }
  1848.     if (g_brw_cntx.showDownloadAbortedPopup)
  1849.     {
  1850.         DisplayPopup((PU8) GetString(STR_ID_BRW_DOWNLOAD_ABORTED), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  1851.     }
  1852.     else
  1853.     {
  1854.         g_brw_cntx.showDownloadAbortedPopup = TRUE;
  1855.     }
  1856.     DeleteScreenIfPresent(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS);
  1857. }
  1858. /*****************************************************************************
  1859.  * FUNCTION
  1860.  *  mmi_brw_start_dwnld
  1861.  * DESCRIPTION
  1862.  *  
  1863.  * PARAMETERS
  1864.  *  void
  1865.  * RETURNS
  1866.  *  void
  1867.  *****************************************************************************/
  1868. void mmi_brw_start_dwnld(void)
  1869. {
  1870.     /*----------------------------------------------------------------*/
  1871.     /* Local Variables                                                */
  1872.     /*----------------------------------------------------------------*/
  1873.     JC_CHAR *filename;
  1874.     JC_UINT32 navlist_count;
  1875.     JC_RETCODE eRet;
  1876.     /*----------------------------------------------------------------*/
  1877.     /* Code Body                                                      */
  1878.     /*----------------------------------------------------------------*/
  1879.     g_brw_cntx.isDownloading = TRUE;
  1880.     g_brw_cntx.showDownloadAbortedPopup = TRUE;
  1881.     jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  1882.     if (!navlist_count)
  1883.     {
  1884.         DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
  1885.     }
  1886. #ifdef __USB_IN_NORMAL_MODE__
  1887.     if (mmi_usb_is_in_mass_storage_mode())
  1888.     {
  1889.         mmi_usb_app_unavailable_popup(0);
  1890.         jdi_BrowserFetchStop(pBrowserCtxt);
  1891.         g_brw_cntx.showDownloadAbortedPopup = FALSE;
  1892.         goto error_handle;
  1893.     }
  1894. #endif /* __USB_IN_NORMAL_MODE__ */
  1895.     
  1896.     eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle);
  1897.     if (eRet == JC_OK)
  1898.     {
  1899.         jdd_FSGetDownloadFileName(&filename);
  1900.         g_brw_cntx.dwnld_mime_info.psFileName = filename;
  1901.         g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
  1902.         if (!g_brw_cntx.dwnld_file_handle)
  1903.         {
  1904.             jdi_BrowserFetchStop(pBrowserCtxt);
  1905.             g_brw_cntx.showDownloadAbortedPopup = FALSE;
  1906.             jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
  1907.             DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  1908.             goto error_handle;
  1909.         }
  1910.     }
  1911.     else
  1912.     {
  1913.         jdi_BrowserFetchStop(pBrowserCtxt);
  1914.         g_brw_cntx.showDownloadAbortedPopup = FALSE;
  1915.         DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  1916.         goto error_handle;
  1917.     }
  1918.     mmi_brw_entry_dwnld_progress();
  1919.     return;
  1920.   error_handle:
  1921.     mmi_brw_free_dwnld_info_memory();
  1922. }
  1923. /*****************************************************************************
  1924.  * FUNCTION
  1925.  *  mmi_brw_cancel_dwnld_and_goback
  1926.  * DESCRIPTION
  1927.  *  
  1928.  * PARAMETERS
  1929.  *  void
  1930.  * RETURNS
  1931.  *  void
  1932.  *****************************************************************************/
  1933. void mmi_brw_cancel_dwnld_and_goback(void)
  1934. {
  1935.     /*----------------------------------------------------------------*/
  1936.     /* Local Variables                                                */
  1937.     /*----------------------------------------------------------------*/
  1938.     JC_UINT32 navlist_count;
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Code Body                                                      */
  1941.     /*----------------------------------------------------------------*/
  1942.     g_brw_cntx.isDownloading = FALSE;
  1943.     g_brw_cntx.isDownloadSuspended = FALSE;
  1944.     g_brw_cntx.showDownloadAbortedPopup = FALSE;
  1945.     
  1946.     mmi_brw_free_dwnld_info_memory();
  1947.     jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
  1948.     if (navlist_count)
  1949.     {
  1950.         GoBackHistory();
  1951.     }
  1952.     else
  1953.     {
  1954. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  1955.         mmi_brw_deinit_all();
  1956.         GoBacknHistory(1);
  1957.     }
  1958. }
  1959. /*****************************************************************************
  1960.  * FUNCTION
  1961.  *  mmi_brw_update_downloading_msg
  1962.  * DESCRIPTION
  1963.  *  
  1964.  * PARAMETERS
  1965.  *  void
  1966.  * RETURNS
  1967.  *  void
  1968.  *****************************************************************************/
  1969. void mmi_brw_update_downloading_msg(void)
  1970. {
  1971.     /*----------------------------------------------------------------*/
  1972.     /* Local Variables                                                */
  1973.     /*----------------------------------------------------------------*/
  1974.     S8 tmp_str_ascii[50];
  1975.     S8 tmp_str_ucs2[100];
  1976.     /*----------------------------------------------------------------*/
  1977.     /* Code Body                                                      */
  1978.     /*----------------------------------------------------------------*/
  1979.     if (g_brw_cntx.total_content_length)
  1980.     {
  1981.         if (g_brw_cntx.downloadSizeInKB)
  1982.         {
  1983.             sprintf(
  1984.                 tmp_str_ascii,
  1985.                 "%.1f/%.1f",
  1986.                 (g_brw_cntx.downloaded_content_length / 1024.0),
  1987.                 (g_brw_cntx.total_content_length / 1024.0));
  1988.             AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  1989.             pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
  1990.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
  1991.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_KB));
  1992.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
  1993.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
  1994.         }
  1995.         else
  1996.         {
  1997.             sprintf(tmp_str_ascii, "%d/%d", g_brw_cntx.downloaded_content_length, g_brw_cntx.total_content_length);
  1998.             AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  1999.             pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
  2000.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
  2001.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_BYTES));
  2002.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
  2003.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
  2004.         }
  2005.     }
  2006.     else
  2007.     {
  2008.         if (g_brw_cntx.downloaded_content_length >= 1000)
  2009.         {
  2010.             sprintf(tmp_str_ascii, "%.1f", (g_brw_cntx.downloaded_content_length / 1024.0));
  2011.             AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  2012.             pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
  2013.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
  2014.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_KB));
  2015.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
  2016.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
  2017.         }
  2018.         else
  2019.         {
  2020.             sprintf(tmp_str_ascii, "%d", g_brw_cntx.downloaded_content_length);
  2021.             AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
  2022.             pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
  2023.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
  2024.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_BYTES));
  2025.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
  2026.             pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
  2027.         }
  2028.     }
  2029. }
  2030. /*****************************************************************************
  2031.  * FUNCTION
  2032.  *  mmi_brw_entry_dwnld_progress
  2033.  * DESCRIPTION
  2034.  *  
  2035.  * PARAMETERS
  2036.  *  void
  2037.  * RETURNS
  2038.  *  void
  2039.  *****************************************************************************/
  2040. void mmi_brw_entry_dwnld_progress(void)
  2041. {
  2042.     /*----------------------------------------------------------------*/
  2043.     /* Local Variables                                                */
  2044.     /*----------------------------------------------------------------*/
  2045.     U16 title_icon = 0;
  2046.     nvram_wap_profile_content_struct *activated_wap_profile;
  2047.     activated_wap_profile = mmi_ph_get_activated_wap_profile();
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Code Body                                                      */
  2050.     /*----------------------------------------------------------------*/
  2051.     if (g_brw_cntx.isDownloadSuspended)
  2052.     {
  2053.         jdi_BrowserResumeRequest(pBrowserCtxt);
  2054.         g_brw_cntx.isDownloadSuspended = FALSE;
  2055.     }
  2056.     mmi_brw_update_downloading_msg();
  2057.     EntryNewScreen(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS, mmi_brw_exit_dwnld_progress, NULL, NULL);
  2058.     if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
  2059.     {
  2060.         title_icon = IMG_ID_BRW_CONNECTION_STATUS_CSD;
  2061.     }
  2062.     else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
  2063.     {
  2064.         title_icon = IMG_ID_BRW_CONNECTION_STATUS_GPRS;
  2065.     }
  2066.     ShowCategory66Screen(
  2067.         STR_ID_BRW_INTERNET_SERVICES,
  2068.         title_icon,
  2069.         0,
  2070.         0,
  2071.         STR_GLOBAL_ABORT,
  2072.         IMG_GLOBAL_BACK,
  2073.         (U8*) g_brw_cntx.dwnld_progress_str,
  2074.         IMG_ID_BRW_SAT_WAIT,
  2075.         NULL);
  2076.     ClearAllKeyHandler();
  2077.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  2078.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2079.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  2080.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  2081.     ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_UP);
  2082.     ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
  2083.     ClearKeyHandler(KEY_VOL_UP, KEY_LONG_PRESS);
  2084.     ClearKeyHandler(KEY_VOL_UP, KEY_REPEAT);
  2085.     ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_UP);
  2086.     ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_DOWN);
  2087.     ClearKeyHandler(KEY_VOL_DOWN, KEY_LONG_PRESS);
  2088.     ClearKeyHandler(KEY_VOL_DOWN, KEY_REPEAT);
  2089.     SetRightSoftkeyFunction(mmi_brw_abort_dwnld, KEY_EVENT_UP);
  2090. }
  2091. /*****************************************************************************
  2092.  * FUNCTION
  2093.  *  mmi_brw_exit_dwnld_progress
  2094.  * DESCRIPTION
  2095.  *  
  2096.  * PARAMETERS
  2097.  *  void
  2098.  * RETURNS
  2099.  *  void
  2100.  *****************************************************************************/
  2101. void mmi_brw_exit_dwnld_progress(void)
  2102. {
  2103.     /*----------------------------------------------------------------*/
  2104.     /* Local Variables                                                */
  2105.     /*----------------------------------------------------------------*/
  2106.     history h;
  2107.     S16 nHistory = 0;
  2108.     /*----------------------------------------------------------------*/
  2109.     /* Code Body                                                      */
  2110.     /*----------------------------------------------------------------*/
  2111.     if (g_brw_cntx.isDownloading)
  2112.     {
  2113.         jdi_BrowserSuspendRequest(pBrowserCtxt);
  2114.         g_brw_cntx.isDownloadSuspended = TRUE;
  2115.         h.scrnID = SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS;
  2116.         h.entryFuncPtr = mmi_brw_entry_dwnld_progress;
  2117.         pfnUnicodeStrcpy((PS8) h.inputBuffer, (PS8) & nHistory);
  2118.         GetCategoryHistory(h.guiBuffer);
  2119.         AddHistory(h);
  2120.     }
  2121. }
  2122. /*****************************************************************************
  2123.  * FUNCTION
  2124.  *  mmi_brw_abort_dwnld
  2125.  * DESCRIPTION
  2126.  *  
  2127.  * PARAMETERS
  2128.  *  void
  2129.  * RETURNS
  2130.  *  void
  2131.  *****************************************************************************/
  2132. void mmi_brw_abort_dwnld(void)
  2133. {
  2134.     /*----------------------------------------------------------------*/
  2135.     /* Local Variables                                                */
  2136.     /*----------------------------------------------------------------*/
  2137.     /*----------------------------------------------------------------*/
  2138.     /* Code Body                                                      */
  2139.     /*----------------------------------------------------------------*/
  2140.     g_brw_cntx.isDownloading = FALSE;
  2141.     g_brw_cntx.isDownloadSuspended = FALSE;
  2142.     mmi_brw_free_dwnld_info_memory();
  2143.     jdi_BrowserFetchStop(pBrowserCtxt);
  2144.     GoBackHistory();
  2145. }
  2146. /*****************************************************************************
  2147.  * FUNCTION
  2148.  *  mmi_brw_free_dwnld_info_memory
  2149.  * DESCRIPTION
  2150.  *  Init function for browser application
  2151.  * PARAMETERS
  2152.  *  void
  2153.  * RETURNS
  2154.  *  void
  2155.  *****************************************************************************/
  2156. void mmi_brw_free_dwnld_info_memory(void)
  2157. {
  2158.     /*----------------------------------------------------------------*/
  2159.     /* Local Variables                                                */
  2160.     /*----------------------------------------------------------------*/
  2161.     /*----------------------------------------------------------------*/
  2162.     /* Code Body                                                      */
  2163.     /*----------------------------------------------------------------*/
  2164.     if(g_brw_cntx.dwnld_mime_info.psContentType)
  2165.     {
  2166.         jdd_MemFree(g_brw_cntx.dwnld_mime_info.psContentType);
  2167.         g_brw_cntx.dwnld_mime_info.psContentType = NULL;
  2168.     }
  2169.     if(g_brw_cntx.dwnld_mime_info.pBuffer)
  2170.     {
  2171.         jdd_MemFree(g_brw_cntx.dwnld_mime_info.pBuffer);
  2172.         g_brw_cntx.dwnld_mime_info.pBuffer = NULL;
  2173.     }
  2174.     if(g_brw_cntx.dwnld_mime_info.psUrl)
  2175.     {
  2176.         jdd_MemFree(g_brw_cntx.dwnld_mime_info.psUrl);
  2177.         g_brw_cntx.dwnld_mime_info.psUrl = NULL;
  2178.     }
  2179.     if(g_brw_cntx.dwnld_mime_info.psFileName)
  2180.     {
  2181.         jdd_MemFree(g_brw_cntx.dwnld_mime_info.psFileName);
  2182.         g_brw_cntx.dwnld_mime_info.psFileName = NULL;
  2183.     }
  2184. }
  2185. #ifdef BROWSER_PUSH_ENABLE
  2186. /*****************************************************************************
  2187.  * FUNCTION
  2188.  *  is_mmi_in_idle_state
  2189.  * DESCRIPTION
  2190.  *  This API checks whether mmi is idle state or not.
  2191.  * PARAMETERS
  2192.  *  void
  2193.  * RETURNS
  2194.  *  return 1 if mmi is in idle state else return  0.
  2195.  *****************************************************************************/
  2196. static U16 is_mmi_in_idle_state(void)
  2197. {
  2198.     /*----------------------------------------------------------------*/
  2199.     /* Local Variables                                                */
  2200.     /*----------------------------------------------------------------*/
  2201.     /*----------------------------------------------------------------*/
  2202.     /* Code Body                                                      */
  2203.     /*----------------------------------------------------------------*/
  2204.     if ((IDLE_SCREEN_ID == GetActiveScreenId()) || g_idle_context.ScreenSaverRunFlag)
  2205.     {
  2206.         return 1;
  2207.     }
  2208.     else
  2209.     {
  2210.         return 0;
  2211.     }
  2212. }
  2213. /*****************************************************************************
  2214.  * FUNCTION
  2215.  *  mmi_brw_push_callback
  2216.  * DESCRIPTION
  2217.  *  Push callback
  2218.  * PARAMETERS
  2219.  *  pAppArg             [?]         
  2220.  *  pServiceValue       [?]         
  2221.  *  cbConfirm           [IN]        
  2222.  * RETURNS
  2223.  *  void
  2224.  *****************************************************************************/
  2225. JC_RETCODE mmi_brw_push_callback(
  2226.             void *pAppArg,
  2227.             SERVICE_VALUE *pServiceValue,
  2228.             CB_BROWSER_PUSH_RESPONSE_HANDLER cbConfirm)
  2229. {
  2230.     /*----------------------------------------------------------------*/
  2231.     /* Local Variables                                                */
  2232.     /*----------------------------------------------------------------*/
  2233. #ifdef __MMI_UNIFIED_MESSAGE__
  2234.     MMI_ALERT_TYPE alertType;
  2235. #endif
  2236.     JC_UINT32 brw_total_msg_count;
  2237.     JC_UINT32 brw_unread_msg_count;
  2238.     /*----------------------------------------------------------------*/
  2239.     /* Code Body                                                      */
  2240.     /*----------------------------------------------------------------*/
  2241.     if (ACTION_SIGNAL_NONE_VAL == pServiceValue->eActionSignal)
  2242.     { 
  2243.         mmi_brw_delete_push_msg(0);
  2244.         return JC_OK;
  2245.     }
  2246.     mmi_brw_create_push_msg_list();
  2247. #ifndef __MMI_UNIFIED_MESSAGE__
  2248.     TurnOnBacklight(1);
  2249.     if (is_mmi_in_idle_state())
  2250.     {
  2251.         PlayMessageArrivalTone();
  2252.         mmi_brw_new_push_msg_ind_on_idlescreen(); 
  2253.             g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
  2254.         }
  2255.     else if(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetActiveScreenId())
  2256.     {
  2257.         PlayMessageArrivalTone();
  2258.         g_brw_cntx.push_msg_rcvd_flag = MMI_TRUE;
  2259.         GoBackHistory();
  2260.     }
  2261.     else if(MMI_FALSE == g_mmi_brw_delete_push_notification)
  2262.     {
  2263.         /*
  2264.         if (POPUP_SCREENID == GetActiveScreenId()) 
  2265.         {
  2266.             EntryNewScreen(SCR_ID_BRW_WAP_PUSH_POPUP_DUMMY_SCREEN, NULL, NULL, NULL);
  2267.         }
  2268.         */
  2269.         ShowStatusIcon(STATUS_ICON_WAP);
  2270.         UpdateStatusIcons();
  2271.         mmi_msg_entry_new_msg_popup(MSG_NEW_PUSH);  
  2272.         g_brw_cntx.push_msg_rcvd_flag = MMI_TRUE;
  2273.         /* As we are adding the new message at the top of message list, So 
  2274.            if a new message come Nth message will become the (N+1)th message. 
  2275.            Vivek - 01082006 */
  2276.         if ((TRUE == IsScreenPresent(SCR_ID_BRW_SERVICE_INBOX)) || (SCR_ID_BRW_SERVICE_INBOX == GetActiveScreenId()))
  2277.         {
  2278.             g_brw_index_current_highlighted_item++;
  2279.         }
  2280.     }
  2281. #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2282.     TurnOnBacklight(1);
  2283.     /* PlayMessageArrivalTone(); */
  2284.     if (!isInCall())
  2285.     {
  2286.         if ((!is_mmi_in_idle_state()) &&
  2287.             (SCR_ID_UM_NEW_MSG_IND != GetActiveScreenId()) &&
  2288.             (MMI_FALSE == g_mmi_brw_delete_push_notification)
  2289.            )
  2290.         {
  2291.             /*
  2292.             if (POPUP_SCREENID == GetActiveScreenId()) 
  2293.             {
  2294.                 EntryNewScreen(SCR_ID_BRW_WAP_PUSH_POPUP_DUMMY_SCREEN, NULL, NULL, NULL);
  2295.             }
  2296.             */
  2297.             ShowStatusIcon(STATUS_ICON_WAP);
  2298.             UpdateStatusIcons();
  2299.             mmi_msg_entry_new_msg_popup(MSG_NEW_PUSH); 
  2300.         }
  2301.     }
  2302.     else
  2303.     {
  2304.         alertType = GetMtCallAlertTypeEnum();
  2305.         if (alertType == MMI_VIBRATION_AND_RING || alertType == MMI_VIBRATION_THEN_RING || alertType == MMI_RING)
  2306.         {
  2307.             playRequestedTone((U8) SMS_IN_CALL_TONE);
  2308.         }
  2309.     }
  2310.     if ((TRUE == IsScreenPresent(SCR_ID_UM_INBOX)) || (SCR_ID_UM_INBOX == GetActiveScreenId()))
  2311.     {
  2312.         g_brw_index_current_highlighted_item++;
  2313.     }
  2314.     mmi_um_brw_new_push_message_ind(pServiceValue);
  2315. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2316.     /* Save to persistant storage */
  2317.     jdi_BrowserPushSaveCurrentInfo(pBrowserCtxt);
  2318.     jdi_BrowserPushGetStatistics(pBrowserCtxt, &brw_total_msg_count, &brw_unread_msg_count);
  2319.     if (brw_unread_msg_count > 0)
  2320.     {
  2321.         /* Display unread message icon on idle screen */
  2322.         ShowStatusIcon(STATUS_ICON_WAP);
  2323.     }
  2324.     else
  2325.     {
  2326.         /* hide unread push message icon on idle screen */
  2327.         HideStatusIcon(STATUS_ICON_WAP);
  2328.     }
  2329. g_mmi_brw_delete_push_notification = MMI_FALSE;
  2330.     return JC_ERR_WAIT_USER_ACTION;
  2331. }
  2332. /*****************************************************************************
  2333.  * FUNCTION
  2334.  *  mmi_brw_push_PPG_validate_callback
  2335.  * DESCRIPTION
  2336.  *  Push PPG validate  callback
  2337.  * PARAMETERS
  2338.  *  pAppArg                 [?]         
  2339.  *  bIsPPGAddress           [IN]        
  2340.  *  pcPPGHostAddress        [?]         
  2341.  * RETURNS
  2342.  *  void
  2343.  *****************************************************************************/
  2344. JC_BOOLEAN mmi_brw_push_PPG_validate_callback(void *pAppArg, JC_BOOLEAN bIsPPGAddress, JC_INT8 *pcPPGHostAddress)
  2345. {
  2346.     /*----------------------------------------------------------------*/
  2347.     /* Local Variables                                                */
  2348.     /*----------------------------------------------------------------*/
  2349.     JC_BOOLEAN bIsPPGValid = E_TRUE;
  2350.     /*----------------------------------------------------------------*/
  2351.     /* Code Body                                                      */
  2352.     /*----------------------------------------------------------------*/
  2353.     if (bIsPPGAddress)
  2354.     {
  2355.         bIsPPGValid = mmi_brw_check_ip((PS8) pcPPGHostAddress);
  2356.     }
  2357.     return bIsPPGValid;
  2358. }
  2359. /*****************************************************************************
  2360.  * FUNCTION
  2361.  *  mmi_brw_push_inbox_full_callback
  2362.  * DESCRIPTION
  2363.  *  Push Inbox Full callback
  2364.  * PARAMETERS
  2365.  *  pAppArg             [?]         
  2366.  *  pServiceValue       [?]         
  2367.  *  cbConfirm           [IN]        
  2368.  * RETURNS
  2369.  *  void
  2370.  *****************************************************************************/
  2371. JC_RETCODE mmi_brw_push_inbox_full_callback(
  2372.             void *pAppArg,
  2373.             SERVICE_VALUE *pServiceValue,
  2374.             CB_BROWSER_PUSHFULL_RESPONSE_HANDLER cbConfirm)
  2375. {
  2376.     /*----------------------------------------------------------------*/
  2377.     /* Local Variables                                                */
  2378.     /*----------------------------------------------------------------*/
  2379.     U32 brw_total_msg_count, brw_unread_msg_count;
  2380.     /*----------------------------------------------------------------*/
  2381.     /* Code Body                                                      */
  2382.     /*----------------------------------------------------------------*/
  2383.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  2384.     
  2385.     if (ACTION_SIGNAL_NONE_VAL == pServiceValue->eActionSignal)
  2386.     { 
  2387.         return JC_ERR_NOT_SUPPORTED;
  2388.     }
  2389.     else 
  2390.     {
  2391.         mmi_brw_delete_push_msg(brw_total_msg_count - 1);
  2392.     }
  2393.     return JC_OK;
  2394. }
  2395. /*****************************************************************************
  2396.  * FUNCTION
  2397.  *  mmi_brw_push_inbox_max_size_callback
  2398.  * DESCRIPTION
  2399.  *  Push Inbox max size reached callback
  2400.  * PARAMETERS
  2401.  *  pCtxt       [?]     
  2402.  * RETURNS
  2403.  *  void
  2404.  *****************************************************************************/
  2405. void mmi_brw_push_inbox_max_size_callback(void *pCtxt)
  2406. {
  2407.     /*----------------------------------------------------------------*/
  2408.     /* Local Variables                                                */
  2409.     /*----------------------------------------------------------------*/
  2410.     /*----------------------------------------------------------------*/
  2411.     /* Code Body                                                      */
  2412.     /*----------------------------------------------------------------*/
  2413. }
  2414. /*****************************************************************************
  2415.  * FUNCTION
  2416.  *  mmi_brw_push_with_delete_action
  2417.  * DESCRIPTION
  2418.  *  Push Inbox callback when core will get the push with
  2419.  *  delete action.
  2420.  * PARAMETERS
  2421.  *  pCtxt       [?]     
  2422.  * RETURNS
  2423.  *  void
  2424.  *****************************************************************************/
  2425. void mmi_brw_push_with_delete_action(void *pCtxt)
  2426. {
  2427.     /*----------------------------------------------------------------*/
  2428.     /* Local Variables                                                */
  2429.     /*----------------------------------------------------------------*/
  2430.     JC_UINT32 brw_total_msg_count = 0;
  2431.     JC_UINT32 brw_unread_msg_count = 0;
  2432.     /*----------------------------------------------------------------*/
  2433.     /* Code Body                                                      */
  2434.     /*----------------------------------------------------------------*/
  2435.     jdi_BrowserPushGetStatistics(pBrowserCtxt, &brw_total_msg_count, &brw_unread_msg_count);
  2436.     if (brw_unread_msg_count > 0)
  2437.     {
  2438.         /* Display unread message icon on idle screen */
  2439.         ShowStatusIcon(STATUS_ICON_WAP);
  2440.     }
  2441.     else
  2442.     {
  2443.         /* hide unread push message icon on idle screen */
  2444.         HideStatusIcon(STATUS_ICON_WAP);
  2445.         /* Added by Vivek 26072006 */
  2446.         g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
  2447.     }
  2448.     UpdateStatusIcons();
  2449.     mmi_brw_create_push_msg_list();
  2450.     if ((SCR_ID_BRW_READ_SERVICE_MESSAGE == GetActiveScreenId()) || 
  2451.         (SCR_ID_BRW_PUSH_MESSAGE_READ_OPTIONS == GetActiveScreenId()) ||
  2452.         ((SCR_CONFIRM_SCREEN == GetActiveScreenId()) && (SCR_ID_BRW_PUSH_MESSAGE_READ_OPTIONS == GetCurrScrnId()))
  2453.        ) 
  2454.      {
  2455. g_mmi_brw_delete_push_notification = MMI_TRUE;
  2456.         /* DisplayPopup((PU8) GetString(STR_GLOBAL_DELETE), IMG_GLOBAL_DELETED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE); */
  2457.         DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
  2458.     #ifndef __MMI_UNIFIED_MESSAGE__
  2459.         DeleteUptoScrID(SCR_ID_BRW_SERVICE_INBOX);
  2460.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2461.         DeleteUptoScrID(SCR_ID_UM_INBOX);
  2462.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2463.     }
  2464.     else
  2465.     {
  2466.     #ifndef __MMI_UNIFIED_MESSAGE__
  2467.         if ((SCR_ID_BRW_SERVICE_INBOX_OPTIONS == GetActiveScreenId()) ||
  2468.             ((SCR_CONFIRM_SCREEN == GetActiveScreenId()) &&
  2469.              (SCR_ID_BRW_SERVICE_INBOX_OPTIONS == GetCurrScrnId())
  2470.             ))
  2471.         {
  2472.             g_mmi_brw_delete_push_notification = MMI_TRUE;
  2473.             DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
  2474.             DeleteUptoScrID(SCR_ID_BRW_SERVICE_INBOX);
  2475.             }
  2476.         else if((SCR_ID_BRW_SERVICE_INBOX == GetActiveScreenId()) ||
  2477.                 (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetActiveScreenId())  ||
  2478.                 (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
  2479.                )
  2480.         {
  2481.     g_mmi_brw_delete_push_notification = MMI_TRUE;
  2482.             DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
  2483.          }
  2484.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  2485.         if ((SCR_ID_UM_MAIN == GetActiveScreenId()) || 
  2486.             (SCR_ID_UM_INBOX == GetActiveScreenId()) ||
  2487.             (SCR_ID_UM_NEW_MSG_IND == GetActiveScreenId())
  2488.            )
  2489.         {
  2490.     g_mmi_brw_delete_push_notification = MMI_TRUE;
  2491.             DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
  2492.         }
  2493.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2494.     }
  2495. }
  2496. #endif /* BROWSER_PUSH_ENABLE */ 
  2497. /*****************************************************************************
  2498.  * FUNCTION
  2499.  *  mmi_brw_show_progress_bar_callback
  2500.  * DESCRIPTION
  2501.  *  Show progress bar callback
  2502.  * PARAMETERS
  2503.  *  pAppArg                 [?]     
  2504.  *  pProgressBarInfo        [?]     
  2505.  * RETURNS
  2506.  *  void
  2507.  *****************************************************************************/
  2508. JC_RETCODE mmi_brw_show_progress_bar_callback(void *pAppArg, JC_PROGRESSBAR_INFO *pProgressBarInfo)
  2509. {
  2510.     /*----------------------------------------------------------------*/
  2511.     /* Local Variables                                                */
  2512.     /*----------------------------------------------------------------*/
  2513.     /*----------------------------------------------------------------*/
  2514.     /* Code Body                                                      */
  2515.     /*----------------------------------------------------------------*/
  2516.     return JC_OK;
  2517. }
  2518. /*****************************************************************************
  2519.  * FUNCTION
  2520.  *  mmi_brw_page_rendering_status_callback
  2521.  * DESCRIPTION
  2522.  *  Page rendering status callback
  2523.  * PARAMETERS
  2524.  *  pAppArg                     [?]         
  2525.  *  ePageRenderingStatus        [IN]        
  2526.  * RETURNS
  2527.  *  void
  2528.  *****************************************************************************/
  2529. void mmi_brw_page_rendering_status_callback(void *pAppArg, EPageRenderingStatus ePageRenderingStatus)
  2530. {
  2531.     /*----------------------------------------------------------------*/
  2532.     /* Local Variables                                                */
  2533.     /*----------------------------------------------------------------*/
  2534.     /*----------------------------------------------------------------*/
  2535.     /* Code Body                                                      */
  2536.     /*----------------------------------------------------------------*/
  2537.     return;
  2538. }
  2539. /*****************************************************************************
  2540.  * FUNCTION
  2541.  *  mmi_brw_show_animated_title
  2542.  * DESCRIPTION
  2543.  *  Showing title with appropiate icon and animation
  2544.  * PARAMETERS
  2545.  *  void
  2546.  * RETURNS
  2547.  *  void
  2548.  *****************************************************************************/
  2549. void mmi_brw_show_animated_title(void)
  2550. {
  2551.     /*----------------------------------------------------------------*/
  2552.     /* Local Variables                                                */
  2553.     /*----------------------------------------------------------------*/
  2554.     nvram_wap_profile_content_struct *activated_wap_profile;
  2555.     /*----------------------------------------------------------------*/
  2556.     /* Code Body                                                      */
  2557.     /*----------------------------------------------------------------*/
  2558.     if (g_brw_page_cntx.brw_PageStatusCodeStack[1] == E_BROWSER_FETCH_BEGIN)
  2559.     {
  2560.         activated_wap_profile = mmi_ph_get_activated_wap_profile();
  2561.        if (mmi_brw_is_animated_title() == MMI_FALSE)
  2562.    {
  2563.         if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
  2564.         {
  2565.             MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_CSD);
  2566.         }
  2567.         else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
  2568.         {
  2569.             MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_GPRS);
  2570.         }
  2571.         else
  2572.         {
  2573.             /* Error */
  2574.         }
  2575.         g_brw_title_icon_animation_status = MMI_TRUE;
  2576.         if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
  2577.         {
  2578.             draw_title();
  2579.         }
  2580.     }
  2581.     }
  2582. else if ((g_brw_page_cntx.brw_PageStatusCodeStack[0] == E_BROWSER_PAGE_REQUEST_BEGIN) && (g_brw_page_cntx.brw_PageStatusCodeStack[1] != E_BROWSER_FETCH_BEGIN)
  2583. && (g_brw_page_cntx.brw_PageStatusCodeStack[2] == E_BROWSER_RENDERING_BEGIN))
  2584. {
  2585.         MMI_title_icon = (PU8)get_image(GetRootTitleIcon(SERVICES_WAP_MENU_ID));
  2586. g_brw_title_icon_animation_status = MMI_FALSE;
  2587.         
  2588. if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
  2589.         {
  2590.             draw_title();
  2591.         }
  2592. }
  2593. else
  2594. {
  2595. if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
  2596.         {
  2597.     mmi_brw_show_normal_title();
  2598.     }
  2599.     }
  2600. }
  2601. /*****************************************************************************
  2602.  * FUNCTION
  2603.  *  mmi_brw_show_normal_title
  2604.  * DESCRIPTION
  2605.  *  Showing title with appropiate normal title icon.
  2606.  * PARAMETERS
  2607.  *  void
  2608.  * RETURNS
  2609.  *  void
  2610.  *****************************************************************************/
  2611. void mmi_brw_show_normal_title(void)
  2612. {
  2613.     /*----------------------------------------------------------------*/
  2614.     /* Local Variables                                                */
  2615.     /*----------------------------------------------------------------*/
  2616.     nvram_wap_profile_content_struct *activated_wap_profile;
  2617.     /*----------------------------------------------------------------*/
  2618.     /* Code Body                                                      */
  2619.     /*----------------------------------------------------------------*/
  2620.     g_brw_title_icon_animation_status = MMI_FALSE;
  2621.     activated_wap_profile = mmi_ph_get_activated_wap_profile();
  2622.     if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
  2623.     {
  2624.         MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_CSD_STATIC);
  2625.     }
  2626.     else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
  2627.     {
  2628.         MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_GPRS_STATIC);
  2629.     }
  2630.     draw_title();
  2631. }
  2632. /*****************************************************************************
  2633.  * FUNCTION
  2634.  *  mmi_brw_is_animated_title
  2635.  * DESCRIPTION
  2636.  *  Showing title with appropiate normal title icon.
  2637.  * PARAMETERS
  2638.  *  void
  2639.  * RETURNS
  2640.  *  void
  2641.  *****************************************************************************/
  2642. MMI_BOOL mmi_brw_is_animated_title(void)
  2643. {
  2644.     return g_brw_title_icon_animation_status;
  2645. }
  2646. /*****************************************************************************
  2647.  * FUNCTION
  2648.  *  mmi_brw_empty_navlist_callback
  2649.  * DESCRIPTION
  2650.  *  Empty Navigation List  callback
  2651.  * PARAMETERS
  2652.  *  pAppArg     [?]     
  2653.  * RETURNS
  2654.  *  void
  2655.  *****************************************************************************/
  2656. void mmi_brw_empty_navlist_callback(void *pAppArg)
  2657. {
  2658.     /*----------------------------------------------------------------*/
  2659.     /* Local Variables                                                */
  2660.     /*----------------------------------------------------------------*/
  2661.     /*----------------------------------------------------------------*/
  2662.     /* Code Body                                                      */
  2663.     /*----------------------------------------------------------------*/
  2664.     g_brw_LskLabel = STR_GLOBAL_OPTIONS;
  2665.     g_brw_LskFunPtr = mmi_brw_rendered_page_options;
  2666.     g_brw_RskLabel = 0;
  2667.     g_brw_RskFunPtr = NULL;
  2668.     if (E_TRUE == mmi_brw_is_back())
  2669.     {
  2670.         g_brw_RskLabel = STR_GLOBAL_BACK;
  2671.         g_brw_RskFunPtr = mmi_brw_goto_prev_page;
  2672.     }
  2673.     if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
  2674.     {
  2675.         ChangeRightSoftkey(g_brw_RskLabel, 0);
  2676.         ChangeLeftSoftkey(g_brw_LskLabel, 0);
  2677.         SetLeftSoftkeyFunction((FuncPtr) g_brw_LskFunPtr, KEY_EVENT_UP);
  2678.         SetRightSoftkeyFunction((FuncPtr) g_brw_RskFunPtr, KEY_EVENT_UP);
  2679.     }
  2680. }
  2681. /*****************************************************************************
  2682.  * FUNCTION
  2683.  *  mmi_brw_handle_page_request_begin
  2684.  * DESCRIPTION
  2685.  *  It handle the page request begin status
  2686.  * PARAMETERS
  2687.  *  void  
  2688.  * RETURNS
  2689.  *  void
  2690.  *****************************************************************************/
  2691. void mmi_brw_handle_page_request_begin(void)
  2692. {
  2693.     /*----------------------------------------------------------------*/
  2694.     /* Local Variables                                                */
  2695.     /*----------------------------------------------------------------*/
  2696.     /*----------------------------------------------------------------*/
  2697.     /* Code Body                                                      */
  2698.     /*----------------------------------------------------------------*/
  2699. memset(g_brw_page_cntx.brw_PageStatusCodeStack, -1, sizeof(g_brw_page_cntx.brw_PageStatusCodeStack));
  2700.         /* In case of auto page refresh and current screen is rendered page option screen */
  2701.         if (GetActiveScreenId() == SCR_ID_BRW_RENDERED_PAGE_OPTIONS)
  2702.         {
  2703.             GoBackHistory();
  2704.         }
  2705.         else
  2706.         {
  2707.             DeleteScreenIfPresent(SCR_ID_BRW_RENDERED_PAGE_OPTIONS);
  2708.         }
  2709.         /* The function below added by Shantanu(PMT) - 20060808 */
  2710.         /* This function will check the active screen.And if the active screen is not browser
  2711.            it will make browser screen the active screen.Specially for listbox */
  2712.         mmi_jdd_ui_goback_to_browser_screen();
  2713.         /* This flag will intimate the user that the page content has been refreshed if
  2714.            while the user is inside the fullscreen editor and when selects done from the 
  2715.            input editor option screen */
  2716.         mmi_jdd_ui_set_jdd_flag(JDD_AUTO_REFRESH_FLAG, E_TRUE);
  2717.         /* We will not allow the user to enter the fullscreen editor if submit button is clicked */
  2718.         mmi_jdd_ui_set_jdd_flag(JDD_MANUAL_REFRESH_FLAG, E_TRUE);
  2719.         
  2720.         jdi_BrowserSuspendMarqueeTimer(pBrowserCtxt);
  2721.         
  2722.     g_brw_page_cntx.brw_PageStatusCodeStack[0] = E_BROWSER_PAGE_REQUEST_BEGIN;
  2723.     g_brw_page_cntx.brw_PageFetchStatus = 1;
  2724. g_brw_page_cntx.brw_isRefreshDisplay = MMI_FALSE;
  2725.         g_brw_showimgflag = g_brw_cntx.show_images;
  2726.         g_brw_LskLabel = 0;
  2727.         g_brw_RskLabel = STR_GLOBAL_CANCEL;
  2728.         g_brw_LskFunPtr = NULL;
  2729.         g_brw_RskFunPtr = mmi_brw_stop_fetch;
  2730.     }
  2731. /*****************************************************************************
  2732.  * FUNCTION
  2733.  *  mmi_brw_handle_page_request_terminated
  2734.  * DESCRIPTION
  2735.  *  It handle the page request terminated status
  2736.  * PARAMETERS
  2737.  *  void  
  2738.  * RETURNS
  2739.  *  void
  2740.  *****************************************************************************/
  2741. void mmi_brw_handle_page_request_terminated(void)
  2742.     {
  2743.     /*----------------------------------------------------------------*/
  2744.     /* Local Variables                                                */
  2745.     /*----------------------------------------------------------------*/
  2746.     /*----------------------------------------------------------------*/
  2747.     /* Code Body                                                      */
  2748.     /*----------------------------------------------------------------*/
  2749. if(g_EndKey_pressed)
  2750. {
  2751. DisplayIdleScreen();
  2752. return;
  2753. }
  2754. if (g_brw_page_cntx.brw_pageRenderStatus == 1 || g_brw_page_cntx.brw_cancel_flag)
  2755.         {
  2756.         if (g_brw_page_cntx.brw_pageRenderStatus)
  2757.             {
  2758.             g_brw_page_cntx.brw_Pre_PageRenderStatus = 1;
  2759.             }
  2760.             if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)       
  2761.             {
  2762.                 mmi_brw_show_normal_title();
  2763.             }
  2764.             if (E_TRUE == mmi_brw_is_back())
  2765.             {
  2766.                 g_brw_LskLabel = STR_GLOBAL_OPTIONS;
  2767.                 g_brw_RskLabel = STR_GLOBAL_BACK;
  2768.                 g_brw_LskFunPtr = mmi_brw_rendered_page_options;
  2769.                 g_brw_RskFunPtr = mmi_brw_goto_prev_page;
  2770.             }
  2771.             else
  2772.             {
  2773.                 if (g_brw_page_cntx.brw_cancel_flag)
  2774.                 {
  2775.                 if (g_brw_cntx.page_fetch_event == BRW_START_FETCH_EVENT && g_brw_page_cntx.brw_pageRenderStatus != 1 &&
  2776.                     !g_brw_page_cntx.brw_Pre_PageRenderStatus)
  2777.                     {
  2778.                         g_brw_page_cntx.brw_cancel_flag = 0;
  2779.                     g_brw_page_cntx.brw_pageRenderStatus = 0;
  2780.                     g_brw_page_cntx.brw_PageFetchStatus = 0;
  2781.                     g_brw_page_cntx.brw_Pre_PageRenderStatus = 0;
  2782.                         if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
  2783.                         {
  2784. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  2785.                             mmi_brw_deinit_all();
  2786.                             GoBackHistory();
  2787.                         }
  2788. else
  2789. {
  2790. mmi_brw_set_data_connection_deactive_flag(E_TRUE);
  2791.  mmi_brw_deinit_all();
  2792. DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
  2793. }
  2794.                         jdi_BrowserHistorySave(pBrowserCtxt);
  2795.                         return;
  2796.                     }
  2797.                 }
  2798.                     g_brw_LskLabel = STR_GLOBAL_OPTIONS;
  2799.                     g_brw_RskLabel = 0;
  2800.                     g_brw_LskFunPtr = mmi_brw_rendered_page_options;
  2801.                     g_brw_RskFunPtr = NULL;
  2802.                 }
  2803. g_brw_add_hist_flag = 0;// added by tk
  2804. g_brw_enter_add_flag = 0;
  2805.             }
  2806.         g_brw_page_cntx.brw_cancel_flag = 0;
  2807.     g_brw_page_cntx.brw_pageRenderStatus = 0;
  2808.     g_brw_page_cntx.brw_PageFetchStatus = 0;
  2809.         /* Added By Shantanu - 20060810 */
  2810.         /* We have to reset the flag so that the user can enter the fullscreen editor */
  2811.         mmi_jdd_ui_set_jdd_flag(JDD_MANUAL_REFRESH_FLAG, E_FALSE);
  2812.     
  2813.     jdi_BrowserResumeMarqueeTimer(pBrowserCtxt);
  2814.     memset(g_brw_page_cntx.brw_PageStatusCodeStack, -1, sizeof(g_brw_page_cntx.brw_PageStatusCodeStack));
  2815.         jdi_BrowserHistorySave(pBrowserCtxt);
  2816.     }
  2817. /*****************************************************************************
  2818.  * FUNCTION
  2819.  *  mmi_brw_handle_page_fetch_begin
  2820.  * DESCRIPTION
  2821.  *  It handle the page fetch begin status
  2822.  * PARAMETERS
  2823.  *  void  
  2824.  * RETURNS
  2825.  *  void
  2826.  *****************************************************************************/
  2827. void mmi_brw_handle_page_fetch_begin(void)
  2828.         {