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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * JBrowserMMIRenderedPage.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intended for rendered page options implementation.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  *------------------------------------------------------------------------------
  100.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  101.  *============================================================================
  102.  ****************************************************************************/
  103. #ifndef _MMI_JBROWSERMMIRENDEREDPAGE_C
  104. #define _MMI_JBROWSERMMIRENDEREDPAGE_C
  105. /*  Include: MMI header file */
  106. #include "MMI_features.h"
  107. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  108. #include "PixtelDataTypes.h"
  109. #include "Unicodexdcl.h"
  110. #include "HistoryGprot.h"
  111. #include "GlobalDefs.h"
  112. #include "SettingProfile.h"
  113. #include "DebugInitDef.h"
  114. #include "CommonScreens.h"
  115. #include "EventsGprot.h"
  116. #include "wgui_inputs.h"
  117. #include "wgui_categories.h"
  118. #include "wgui_categories_inputs.h"
  119. #include "OrganizerDef.h"
  120. #include "DateTimeGprot.h"
  121. #include "TimerEvents.h"
  122. #include "wgui_categories_popup.h"
  123. #include "settingGprots.h"
  124. #include "wgui_status_icons.h"
  125. #include "JBrowserMMIDefs.h"
  126. #include "JBrowserMMIProts.h"
  127. #include "JBrowserMMITypes.h"
  128. #include "JBrowserMMIGprots.h"
  129. #include "JProfileHandlerTypes.h"
  130. #include "JProfileHandlerProts.h"
  131. #include "FileManagerGProt.h"
  132. #include "sat_def.h"
  133. #include "USBDeviceGprot.h"
  134. #ifdef __MMI_FILE_MANAGER__
  135. #include "FileMgr.h"
  136. #endif 
  137. #ifdef __MMI_IRDA_SUPPORT__
  138. #include "IrdaMMIGprots.h"
  139. #endif 
  140. /*  Include: NVRAM header file */
  141. #include "NVRAMType.h"
  142. #include "NVRAMProt.h"
  143. #include "NVRAMEnum.h"
  144. /* Included for file system */
  145. #include "fs_type.h"
  146. #include "drm_gprot.h"
  147. #include "fs_func.h"
  148. #include "ServiceDefs.h"        /* Added by Sandeep for Services menu Screen ID */
  149. #include "FileSystemDef.h"
  150. /*  Include: Jataayu header file */
  151. #include "ddl.h"
  152. #include "jcal.h"
  153. #include "jdd_memapi.h"
  154. #include "jdd_ui_datatypes.h"
  155. #include "jdd_ui_window.h"
  156. #include "jdd_ui_defs.h"
  157. /* Vivek - 30082006 */
  158. #ifdef __MMI_UNIFIED_MESSAGE__
  159. #include "UnifiedMessageDef.h"
  160. #endif
  161. /* local */
  162. U8 g_brw_showimgflag;
  163. BOOL g_option_refresh_page;
  164. static U8 gGotoMenuCount = 0;
  165. extern void mmi_brw_clear_brw_soft_keys(void);
  166. /*****************************************************************************
  167.  * FUNCTION
  168.  *  mmi_rendered_page_init
  169.  * DESCRIPTION
  170.  *  Set highlight handler for rendered page menu items
  171.  * PARAMETERS
  172.  *  void
  173.  * RETURNS
  174.  *  void
  175.  *****************************************************************************/
  176. void mmi_rendered_page_init(void)
  177. {
  178.     /*----------------------------------------------------------------*/
  179.     /* Local Variables                                                */
  180.     /*----------------------------------------------------------------*/
  181.     /*----------------------------------------------------------------*/
  182.     /* Code Body                                                      */
  183.     /*----------------------------------------------------------------*/
  184.  //   SetHiliteHandler(MENU_ID_BRW_REN_PAGE_GOTO, mmi_brw_ren_page_goto_highlight_hdlr);
  185.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_GOTO_HOMEPAGE, mmi_brw_ren_page_goto_homepage_highlight_hdlr);
  186.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_REFRESH, mmi_brw_refresh_menu_highlight_hdlr);
  187.     SetHiliteHandler(MENU_ID_BRW_DOWNLOAD, mmi_brw_download_menu_highlight_hdlr);
  188.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_BOOKMARK, mmi_brw_bookmark_menu_highlight_hdlr);
  189.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_RECENT_PAGES, mmi_brw_recent_pages_menu_highlight_hdlr);
  190.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_ENTER_ADDRESS, mmi_brw_enter_address_menu_highlight_hdlr);
  191.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SET_AS_HOMEPAGE, mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr);
  192.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SERVICE_INBOX, mmi_brw_service_inbox_menu_highlight_hdlr);
  193.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SETTINGS, mmi_brw_ren_page_setting_highlight_hdlr);
  194.     SetHiliteHandler(MENU_ID_BRW_REN_PAGE_EXIT, mmi_brw_exit_menu_highlight_hdlr);
  195. SetHiliteHandler(MENU_ID_BRW_REN_PAGE_ADD_TO_BOOKMARKS, mmi_brw_ren_page_add_to_bmk_highlight_hdlr);
  196. }
  197. /*****************************************************************************
  198.  * FUNCTION
  199.  *  mmi_brw_rendered_page_options
  200.  * DESCRIPTION
  201.  *  Deinitialize the browser application
  202.  * PARAMETERS
  203.  *  void
  204.  * RETURNS
  205.  *  void
  206.  *****************************************************************************/
  207. void mmi_brw_rendered_page_options(void)
  208. {
  209.     /*----------------------------------------------------------------*/
  210.     /* Local Variables                                                */
  211.     /*----------------------------------------------------------------*/
  212.     JC_RETCODE eRet;
  213.     JC_CTRL_INFO brw_ctrl_info_p;
  214.     JC_MIME_INFO pMimeInfo;
  215.     U16 Parent_MenuID;
  216.     U16 *UC_list_of_items;
  217.     U8 *guiBuffer;
  218.     S32 nNumofItem;
  219.     U16 i;
  220.     /*----------------------------------------------------------------*/
  221.     /* Code Body                                                      */
  222.     /*----------------------------------------------------------------*/
  223. gGotoMenuCount = 0;
  224.     /* Get the Control type */
  225.     eRet = jdi_BrowserGetCurrentControlInfo(pBrowserCtxt, &brw_ctrl_info_p);
  226.     if (eRet != JC_OK)
  227.     {
  228.         return;
  229.     }
  230.     if ((brw_ctrl_info_p.eControlType == E_IMAGE) && g_brw_cntx.show_images)
  231.     {
  232. if (g_brw_cntx.image_selection)
  233. {
  234. if (brw_ctrl_info_p.bIsSelectable)
  235. {
  236. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_2;
  237. gGotoMenuCount = 1;
  238. }
  239. else
  240. {
  241. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_1;
  242. }
  243. }
  244. else
  245. {
  246. if (brw_ctrl_info_p.bIsSelectable)
  247. {
  248. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  249. gGotoMenuCount = 1;
  250. }
  251. else
  252. {
  253. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  254. }
  255. }
  256.     }
  257.     else if ((brw_ctrl_info_p.eControlType == E_TEXT_BOX) || (brw_ctrl_info_p.eControlType == E_IMAGE_TEXT))
  258.     {
  259.         if (brw_ctrl_info_p.bIsSelectable)
  260.         {
  261.             Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  262. gGotoMenuCount = 1;
  263.         }
  264.         else
  265.         {
  266.             Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  267.         }
  268.     }
  269. /* [Sandeep Start:PMTSW00005879] */
  270. else if (brw_ctrl_info_p.eControlType == E_BUTTON)
  271. {
  272. if (brw_ctrl_info_p.bIsSelectable)
  273. {
  274. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  275. gGotoMenuCount = 1;
  276. }
  277. else
  278. {
  279. Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  280. }
  281. }
  282. /* [Sandeep End: PMTSW00005879] */
  283.     else
  284.     {
  285.         Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
  286.     }
  287.     jdi_BrowserGetCurrentControlMimeInfo(pBrowserCtxt, &pMimeInfo);
  288.     g_brw_cntx.used_do_element_count = g_brw_cntx.do_element_count;
  289.     nNumofItem = gGotoMenuCount + GetNumOfChild(Parent_MenuID) + g_brw_cntx.used_do_element_count;
  290.     if (nNumofItem > MAX_DO_ELEMENTS)
  291.     {
  292.         g_brw_cntx.used_do_element_count = MAX_DO_ELEMENTS - (GetNumOfChild(Parent_MenuID) + gGotoMenuCount);
  293.         nNumofItem = MAX_DO_ELEMENTS;
  294.     }
  295.     UC_list_of_items = (U16*) jdd_MemAlloc(nNumofItem, sizeof(U16));
  296.     if (UC_list_of_items == NULL)
  297.     {
  298.         jdd_MMINotificationMessage((JC_INT32) JC_ERR_MEMORY_ALLOCATION, E_NOTIFICATION_ERR, NULL, NULL);
  299.         return;
  300.     }
  301.     GetSequenceStringIds(Parent_MenuID, UC_list_of_items);
  302. /* This variable was set when we try to fetch a page through EnterAddress Option
  303. screen. Reset this flag to 0 when second page fetch from render page's Eneter Adress throws error. */
  304. g_brw_add_hist_flag = 0;
  305.     g_brw_enter_add_flag = 0;   /* added by tk */
  306. /*
  307.     nStrItemList = (PU8*) jdd_MemAlloc((nNumofItem + 1), sizeof(PU8));
  308.     if (nStrItemList == NULL)
  309.     {
  310.         if (UC_list_of_items != NULL)
  311.         {
  312.             jdd_MemFree(UC_list_of_items);
  313.             UC_list_of_items = NULL;
  314.         }
  315.         jdd_MMINotificationMessage((JC_INT32) JC_ERR_MEMORY_ALLOCATION, E_NOTIFICATION_ERR, NULL, NULL);
  316.         return;
  317.     }
  318. */
  319.     EntryNewScreen(SCR_ID_BRW_RENDERED_PAGE_OPTIONS, NULL, mmi_brw_rendered_page_options, NULL);
  320.     guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RENDERED_PAGE_OPTIONS);
  321.     SetParentHandler(Parent_MenuID);
  322. memset(subMenuDataPtrs , 0 , sizeof(subMenuDataPtrs));
  323. /*for Go To menu*/
  324. for (i = 0; i < gGotoMenuCount; i++)
  325.     {
  326.         subMenuDataPtrs[i] = (PU8) GetString(STR_ID_BRW_GOTO);
  327.     }
  328.     /* Do elements have to be shown in the begining of the list if exist on the page */
  329.     for (i = gGotoMenuCount; i < (g_brw_cntx.used_do_element_count+gGotoMenuCount); i++)
  330.     {
  331.         subMenuDataPtrs[i] = (PU8) g_brw_cntx.DoElementList[i-gGotoMenuCount]->pDoLabel;
  332.     }
  333.     for (i = (g_brw_cntx.used_do_element_count + gGotoMenuCount); i < nNumofItem; i++)
  334.     {
  335.         subMenuDataPtrs[i] = (PU8) GetString(UC_list_of_items[i - (g_brw_cntx.used_do_element_count+gGotoMenuCount)]);
  336.     }
  337.     if (UC_list_of_items != NULL)
  338.     {
  339.         jdd_MemFree(UC_list_of_items);
  340.         UC_list_of_items = NULL;
  341.     }
  342.     RegisterHighlightHandler(RenderedPageHighlightHdlr);
  343.     ShowCategory84Screen(
  344.         STR_ID_BRW_OPTION,
  345.         GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  346.         STR_GLOBAL_OK,
  347.         0,
  348.         STR_GLOBAL_BACK,
  349.         0,
  350.         nNumofItem,
  351. subMenuDataPtrs,
  352.         (U16*) gIndexIconsImageList,
  353.         0,
  354.         0,
  355.         guiBuffer);
  356.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  357.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  358.     mmi_brw_ren_page_handle_do_element();
  359. }
  360. /*****************************************************************************
  361.  * FUNCTION
  362.  *  RenderedPageHighlightHdlr
  363.  * DESCRIPTION
  364.  *  Highlight handler for rendered page are registered with this function
  365.  * PARAMETERS
  366.  *  index       [IN]        Index of highlighted item
  367.  * RETURNS
  368.  *  void
  369.  *****************************************************************************/
  370. void RenderedPageHighlightHdlr(S32 index)
  371. {
  372.     /*----------------------------------------------------------------*/
  373.     /* Local Variables                                                */
  374.     /*----------------------------------------------------------------*/
  375.     /*----------------------------------------------------------------*/
  376.     /* Code Body                                                      */
  377.     /*----------------------------------------------------------------*/
  378. if (index < gGotoMenuCount)
  379.     {
  380.         /* Do Nothing, Do element is present at the index */
  381.         SetLeftSoftkeyFunction(mmi_brw_ren_page_goto, KEY_EVENT_UP);
  382.     }
  383.     else if (index < (gGotoMenuCount + g_brw_cntx.used_do_element_count))
  384.     {
  385.         /* Do Nothing, Do element is present at the index */
  386.         SetLeftSoftkeyFunction(mmi_brw_ren_page_process_do_element, KEY_EVENT_UP);
  387.     }
  388.     else
  389.     {
  390.         ExecuteCurrHiliteHandler(index - (g_brw_cntx.used_do_element_count +gGotoMenuCount));
  391.     }
  392. }
  393. /*****************************************************************************
  394.  * FUNCTION
  395.  *  mmi_brw_download_menu_highlight_hdlr
  396.  * DESCRIPTION
  397.  *  Highlight handler for download option
  398.  * PARAMETERS
  399.  *  void
  400.  * RETURNS
  401.  *  void
  402.  *****************************************************************************/
  403. void mmi_brw_download_menu_highlight_hdlr(void)
  404. {
  405.     /*----------------------------------------------------------------*/
  406.     /* Local Variables                                                */
  407.     /*----------------------------------------------------------------*/
  408.     /*----------------------------------------------------------------*/
  409.     /* Code Body                                                      */
  410.     /*----------------------------------------------------------------*/
  411.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  412.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  413.     SetLeftSoftkeyFunction(mmi_brw_ren_page_download_image, KEY_EVENT_UP);
  414.     SetKeyHandler(mmi_brw_ren_page_download_image, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  415. }
  416. #if 0
  417. /* under construction !*/
  418. /* under construction !*/
  419. /* under construction !*/
  420. /* under construction !*/
  421. /* under construction !*/
  422. /* under construction !*/
  423. /* under construction !*/
  424. /* under construction !*/
  425. /* under construction !*/
  426. /* under construction !*/
  427. /* under construction !*/
  428. /* under construction !*/
  429. /* under construction !*/
  430. /* under construction !*/
  431. /* under construction !*/
  432. /* under construction !*/
  433. /* under construction !*/
  434. /* under construction !*/
  435. /* under construction !*/
  436. /* under construction !*/
  437. /* under construction !*/
  438. /* under construction !*/
  439. /* under construction !*/
  440. #endif
  441. /*****************************************************************************
  442.  * FUNCTION
  443.  *  mmi_brw_ren_page_goto
  444.  * DESCRIPTION
  445.  *  Function to fetch link from rendered page
  446.  * PARAMETERS
  447.  *  void
  448.  * RETURNS
  449.  *  void
  450.  *****************************************************************************/
  451. void mmi_brw_ren_page_goto(void)
  452. {
  453.     /*----------------------------------------------------------------*/
  454.     /* Local Variables                                                */
  455.     /*----------------------------------------------------------------*/
  456.     /*----------------------------------------------------------------*/
  457.     /* Code Body                                                      */
  458.     /*----------------------------------------------------------------*/
  459.     mmi_brw_fill_control_info_and_send_event_to_queue();
  460. g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
  461. mmi_brw_clear_brw_soft_keys();
  462.     GoBackHistory();
  463. }
  464. /*****************************************************************************
  465.  * FUNCTION
  466.  *  mmi_brw_ren_page_goto_homepage_highlight_hdlr
  467.  * DESCRIPTION
  468.  *  Highlight handler for goto homepage option
  469.  * PARAMETERS
  470.  *  void
  471.  * RETURNS
  472.  *  void
  473.  *****************************************************************************/
  474. void mmi_brw_ren_page_goto_homepage_highlight_hdlr(void)
  475. {
  476.     /*----------------------------------------------------------------*/
  477.     /* Local Variables                                                */
  478.     /*----------------------------------------------------------------*/
  479.     /*----------------------------------------------------------------*/
  480.     /* Code Body                                                      */
  481.     /*----------------------------------------------------------------*/
  482.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  483.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  484.     SetLeftSoftkeyFunction(mmi_brw_entry_ren_page_goto_homepage, KEY_EVENT_UP);
  485. }
  486. /*****************************************************************************
  487.  * FUNCTION
  488.  *  mmi_brw_entry_ren_page_goto_homepage
  489.  * DESCRIPTION
  490.  *  Highlight handler for goto homepage option
  491.  * PARAMETERS
  492.  *  void
  493.  * RETURNS
  494.  *  void
  495.  *****************************************************************************/
  496. void mmi_brw_entry_ren_page_goto_homepage(void)
  497. {
  498.     /*----------------------------------------------------------------*/
  499.     /* Local Variables                                                */
  500.     /*----------------------------------------------------------------*/
  501.     U8 curr_act_profile_url[BRW_WAP_PROFILE_HOMEPAGE_URL_LEN * ENCODING_LENGTH];
  502.     /*----------------------------------------------------------------*/
  503.     /* Code Body                                                      */
  504.     /*----------------------------------------------------------------*/
  505.     jc_strcpy(curr_act_profile_url, mmi_ph_brw_get_activated_profile_homepage());
  506.     AnsiiToUnicodeString((S8*) brw_current_url, (S8*) curr_act_profile_url);
  507.     mmi_brw_set_current_url((S8*) brw_current_url);
  508. g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
  509. mmi_brw_clear_brw_soft_keys();
  510. g_option_refresh_page = TRUE;/*This flag prevents to refresh the controls on current page*/
  511.     GoBackHistory();
  512.     g_option_refresh_page = FALSE;
  513. mmi_brw_goto_url();
  514.     
  515. }
  516. /*****************************************************************************
  517.  * FUNCTION
  518.  *  mmi_brw_refresh_menu_highlight_hdlr
  519.  * DESCRIPTION
  520.  *  Highlight handler for refresh option
  521.  * PARAMETERS
  522.  *  void
  523.  * RETURNS
  524.  *  void
  525.  *****************************************************************************/
  526. void mmi_brw_refresh_menu_highlight_hdlr(void)
  527. {
  528.     /*----------------------------------------------------------------*/
  529.     /* Local Variables                                                */
  530.     /*----------------------------------------------------------------*/
  531.     /*----------------------------------------------------------------*/
  532.     /* Code Body                                                      */
  533.     /*----------------------------------------------------------------*/
  534.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  535.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  536.     SetLeftSoftkeyFunction(mmi_brw_refresh_page, KEY_EVENT_UP);
  537. }
  538. /*****************************************************************************
  539.  * FUNCTION
  540.  *  mmi_brw_refresh_page
  541.  * DESCRIPTION
  542.  *  Handler for refresh option
  543.  * PARAMETERS
  544.  *  void
  545.  * RETURNS
  546.  *  void
  547.  *****************************************************************************/
  548. void mmi_brw_refresh_page(void)
  549. {
  550.     /*----------------------------------------------------------------*/
  551.     /* Local Variables                                                */
  552.     /*----------------------------------------------------------------*/
  553.     /*----------------------------------------------------------------*/
  554.     /* Code Body                                                      */
  555.     /*----------------------------------------------------------------*/
  556.     g_option_refresh_page = TRUE;
  557. g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
  558. mmi_brw_clear_brw_soft_keys();
  559.     GoBackHistory();
  560.     g_option_refresh_page = FALSE;
  561.     JBrowserRefreshPage();
  562. }
  563. /*****************************************************************************
  564.  * FUNCTION
  565.  *  IsRefreshPagePressed
  566.  * DESCRIPTION
  567.  *  Handler for refresh option
  568.  * PARAMETERS
  569.  *  void
  570.  * RETURNS
  571.  *  void
  572.  *****************************************************************************/
  573. BOOL IsRefreshPagePressed(void)
  574. {
  575.     /*----------------------------------------------------------------*/
  576.     /* Local Variables                                                */
  577.     /*----------------------------------------------------------------*/
  578.     /*----------------------------------------------------------------*/
  579.     /* Code Body                                                      */
  580.     /*----------------------------------------------------------------*/
  581.     return g_option_refresh_page;
  582. }
  583. /*****************************************************************************
  584.  * FUNCTION
  585.  *  mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr
  586.  * DESCRIPTION
  587.  *  Highlight handler set as homepage option
  588.  * PARAMETERS
  589.  *  void
  590.  * RETURNS
  591.  *  void
  592.  *****************************************************************************/
  593. void mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr(void)
  594. {
  595.     /*----------------------------------------------------------------*/
  596.     /* Local Variables                                                */
  597.     /*----------------------------------------------------------------*/
  598.     /*----------------------------------------------------------------*/
  599.     /* Code Body                                                      */
  600.     /*----------------------------------------------------------------*/
  601.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  602.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  603.     SetLeftSoftkeyFunction(mmi_brw_ren_page_set_as_hompage, KEY_EVENT_UP);
  604. }
  605. /*****************************************************************************
  606.  * FUNCTION
  607.  *  mmi_brw_ren_page_set_as_hompage
  608.  * DESCRIPTION
  609.  *  Handler for set as homepage option
  610.  * PARAMETERS
  611.  *  void
  612.  * RETURNS
  613.  *  void
  614.  *****************************************************************************/
  615. void mmi_brw_ren_page_set_as_hompage(void)
  616. {
  617.     /*----------------------------------------------------------------*/
  618.     /* Local Variables                                                */
  619.     /*----------------------------------------------------------------*/
  620.     JC_PAGE_INFO brwPageInfo;
  621.     U32 len = 0;
  622.     /*----------------------------------------------------------------*/
  623.     /* Code Body                                                      */
  624.     /*----------------------------------------------------------------*/
  625.     jdi_BrowserGetCurrentPageInfo(pBrowserCtxt, &brwPageInfo);
  626.     if (brwPageInfo.psUrl)
  627.     {
  628.         len = pfnUnicodeStrlen((S8*) brwPageInfo.psUrl);
  629.         if (len >= NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN)
  630.         {
  631.             DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  632.         }
  633.         else
  634.         {
  635.             pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) brwPageInfo.psUrl);
  636.             if (mmi_brw_validate_url(brw_current_url))
  637.             {
  638.                 mmi_brw_set_as_homepage(brw_current_url);
  639.             }
  640.             else
  641.             {
  642.                 DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  643.             }
  644.         }
  645.     }
  646.     else
  647.     {
  648.         DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  649.     }
  650. }
  651. /*****************************************************************************
  652.  * FUNCTION
  653.  *  mmi_brw_exit_menu_highlight_hdlr
  654.  * DESCRIPTION
  655.  *  Highlight handler for exit option
  656.  * PARAMETERS
  657.  *  void
  658.  * RETURNS
  659.  *  void
  660.  *****************************************************************************/
  661. void mmi_brw_exit_menu_highlight_hdlr(void)
  662. {
  663.     /*----------------------------------------------------------------*/
  664.     /* Local Variables                                                */
  665.     /*----------------------------------------------------------------*/
  666.     /*----------------------------------------------------------------*/
  667.     /* Code Body                                                      */
  668.     /*----------------------------------------------------------------*/
  669.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  670.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  671.     SetLeftSoftkeyFunction(mmi_brw_entry_exit_menu, KEY_EVENT_UP);
  672. }
  673. /*****************************************************************************
  674.  * FUNCTION
  675.  *  mmi_brw_entry_exit_menu
  676.  * DESCRIPTION
  677.  *  Exit menu handler
  678.  * PARAMETERS
  679.  *  void
  680.  * RETURNS
  681.  *  void
  682.  *****************************************************************************/
  683. void mmi_brw_entry_exit_menu(void)
  684. {
  685.     /*----------------------------------------------------------------*/
  686.     /* Local Variables                                                */
  687.     /*----------------------------------------------------------------*/
  688.     /*----------------------------------------------------------------*/
  689.     /* Code Body                                                      */
  690.     /*----------------------------------------------------------------*/
  691. mmi_brw_wap_deinit();
  692.     /* Free the DO List for last rendered page */
  693.     mmi_brw_free_do_list();
  694.     /* Delete the rendered page from history */
  695.     DeleteNHistory(1);
  696. #ifdef __SATC3__
  697.     if (g_brw_cntx.isSATURL == E_TRUE)
  698.     {
  699.         brw_send_termination_to_mmi(SAT_BROWSER_USER_TERMINATION);
  700.     }
  701. #endif /* __SATC3__ */ 
  702.     /* Go to services menu if entered from wap otherwise go to last screen before rendered page */
  703.     if (IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID))
  704.     {
  705.         GoBackToHistory(SERVICES_MAIN_MENU_SCREEN_ID);
  706.     }
  707.     else if (!IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID) && IsScreenPresent(SCR_ID_BRW_INTERNET_SERVICES))
  708.     {
  709.         DisplayIdleScreen();
  710.     }
  711.     else
  712.     {
  713.         GoBackHistory();
  714.     }
  715. }
  716. /*****************************************************************************
  717.  * FUNCTION
  718.  *  mmi_brw_ren_page_handle_do_element
  719.  * DESCRIPTION
  720.  *  Handle do tag
  721.  * PARAMETERS
  722.  *  void
  723.  * RETURNS
  724.  *  void
  725.  *****************************************************************************/
  726. void mmi_brw_ren_page_handle_do_element()
  727. {
  728.     /*----------------------------------------------------------------*/
  729.     /* Local Variables                                                */
  730.     /*----------------------------------------------------------------*/
  731.     U8 curr_highlighted_item;
  732.     /*----------------------------------------------------------------*/
  733.     /* Code Body                                                      */
  734.     /*----------------------------------------------------------------*/
  735.     curr_highlighted_item = GetHighlightedItem();
  736.     if ((curr_highlighted_item >= gGotoMenuCount) && (curr_highlighted_item <(g_brw_cntx.used_do_element_count + gGotoMenuCount)))
  737.     {
  738.         SetLeftSoftkeyFunction(mmi_brw_ren_page_process_do_element, KEY_EVENT_UP);
  739.     }
  740. }
  741. /*****************************************************************************
  742.  * FUNCTION
  743.  *  mmi_brw_ren_page_process_do_element
  744.  * DESCRIPTION
  745.  *  process the do element on the page
  746.  * PARAMETERS
  747.  *  void
  748.  * RETURNS
  749.  *  void
  750.  *****************************************************************************/
  751. void mmi_brw_ren_page_process_do_element()
  752. {
  753.     /*----------------------------------------------------------------*/
  754.     /* Local Variables                                                */
  755.     /*----------------------------------------------------------------*/
  756.     U8 curr_highlighted_index;
  757.     /*----------------------------------------------------------------*/
  758.     /* Code Body                                                      */
  759.     /*----------------------------------------------------------------*/
  760.     curr_highlighted_index = GetHighlightedItem();
  761. g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
  762. mmi_brw_clear_brw_soft_keys();
  763.     GoBackHistory();
  764.     jdi_BrowserProcessDoElement(pBrowserCtxt, g_brw_cntx.DoElementList[(curr_highlighted_index-gGotoMenuCount)]);
  765. }
  766. /*****************************************************************************
  767.  * FUNCTION
  768.  *  mmi_brw_free_do_list
  769.  * DESCRIPTION
  770.  *  Free the do element list
  771.  * PARAMETERS
  772.  *  void
  773.  * RETURNS
  774.  *  void
  775.  *****************************************************************************/
  776. void mmi_brw_free_do_list(void)
  777. {
  778.     /*----------------------------------------------------------------*/
  779.     /* Local Variables                                                */
  780.     /*----------------------------------------------------------------*/
  781.     S32 count = 0;
  782.     /*----------------------------------------------------------------*/
  783.     /* Code Body                                                      */
  784.     /*----------------------------------------------------------------*/
  785.     if (g_brw_cntx.DoElementList != NULL)
  786.     {
  787.         for (count = 0; count < g_brw_cntx.do_element_count; count++)
  788.         {
  789.             if (g_brw_cntx.DoElementList[count] != NULL)
  790.             {
  791.                 if (g_brw_cntx.DoElementList[count]->pDoLabel != NULL)
  792.                 {
  793.                     jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoLabel);
  794.                     g_brw_cntx.DoElementList[count]->pDoLabel = NULL;
  795.                 }
  796.                 if (g_brw_cntx.DoElementList[count]->pDoType != NULL)
  797.                 {
  798.                     jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoType);
  799.                     g_brw_cntx.DoElementList[count]->pDoType = NULL;
  800.                 }
  801.                 jdd_MemFree(g_brw_cntx.DoElementList[count]);
  802.                 g_brw_cntx.DoElementList[count] = NULL;
  803.             }
  804.         }
  805.         jdd_MemFree(g_brw_cntx.DoElementList);
  806.         g_brw_cntx.DoElementList = NULL;
  807.         g_brw_cntx.do_element_count = 0;
  808.     }
  809. }
  810. /*****************************************************************************
  811.  * FUNCTION
  812.  *  mmi_brw_ren_page_download_image
  813.  * DESCRIPTION
  814.  *  Function to doanload the embedded image
  815.  * PARAMETERS
  816.  *  void
  817.  * RETURNS
  818.  *  void
  819.  *****************************************************************************/
  820. void mmi_brw_ren_page_download_image(void)
  821. {
  822.     /*----------------------------------------------------------------*/
  823.     /* Local Variables                                                */
  824.     /*----------------------------------------------------------------*/
  825.     JC_RETCODE iRet;
  826.     JC_MIME_INFO pMimeInfo;
  827.     JC_MIME_INFO pMimeInfo_dl;
  828.     JC_CHAR *filename;
  829.     JDD_FSHANDLE fs_handle;
  830.     /*----------------------------------------------------------------*/
  831.     /* Code Body                                                      */
  832.     /*----------------------------------------------------------------*/
  833. #ifdef __USB_IN_NORMAL_MODE__
  834.     if (mmi_usb_is_in_mass_storage_mode())
  835.     {
  836.         mmi_usb_app_unavailable_popup(0);
  837.         return;
  838.     }
  839. #endif /* __USB_IN_NORMAL_MODE__ */
  840.     jdi_BrowserGetCurrentControlMimeInfo(pBrowserCtxt, &pMimeInfo);
  841.     jdd_FSGetDownloadFileName(&filename);
  842.     if ((iRet = jdd_FSInitialize(&fs_handle)) == JC_OK)
  843.     {
  844.         JC_CHAR *content_fname;
  845.         content_fname = (JC_CHAR*) jdd_FSFileNameTranslate(fs_handle, (JC_CHAR*) pMimeInfo.psFileName);
  846.         if (content_fname == NULL)
  847.         {
  848.             DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_NOT_ENOUGH_MEMORY), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  849.             jdd_FSDeinitialize(fs_handle);
  850.             return;
  851.         }
  852.         else
  853.         {
  854.             S32 result;
  855.             result = pCopyFile((PU8) content_fname, (PU8) filename, 0);
  856.             jdd_FSDeinitialize(fs_handle);
  857.             jdd_MemFree(content_fname);
  858.             if(result != FS_NO_ERROR)
  859.             {
  860.                 if(result == FS_DISK_FULL)
  861.                 {
  862.                     DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_FILE_SYSTEM_FULL), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  863.                 }
  864.                 else
  865.                 {
  866. DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SAVE_FAILED), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  867.                 }
  868.                 return;
  869.             }
  870.         }
  871.     }
  872.     else
  873.     {
  874.         DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  875.         return;
  876.     }
  877.     memset((void*)&pMimeInfo_dl, 0, sizeof(JC_MIME_INFO));
  878.     pMimeInfo_dl.psContentType = pMimeInfo.psContentType;
  879.     pMimeInfo_dl.psUrl = pMimeInfo.psUrl;
  880.     pMimeInfo_dl.iBufferLen = pMimeInfo.iBufferLen;
  881.     pMimeInfo_dl.psFileName = filename;
  882.     iRet = jdd_MimeHandler(&pMimeInfo_dl);
  883.     jdd_MemFree(filename);
  884.     if (iRet != JC_OK)
  885.     {
  886.         DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
  887.     }
  888. }
  889. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  890. #endif /* _MMI_JBROWSERMMIRENDEREDPAGE_C */