JBrowserMMIRenderedPage.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:34k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * JBrowserMMIRenderedPage.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intended for rendered page options implementation.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_JBROWSERMMIRENDEREDPAGE_C
- #define _MMI_JBROWSERMMIRENDEREDPAGE_C
- /* Include: MMI header file */
- #include "MMI_features.h"
- #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
- #include "PixtelDataTypes.h"
- #include "Unicodexdcl.h"
- #include "HistoryGprot.h"
- #include "GlobalDefs.h"
- #include "SettingProfile.h"
- #include "DebugInitDef.h"
- #include "CommonScreens.h"
- #include "EventsGprot.h"
- #include "wgui_inputs.h"
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- #include "OrganizerDef.h"
- #include "DateTimeGprot.h"
- #include "TimerEvents.h"
- #include "wgui_categories_popup.h"
- #include "settingGprots.h"
- #include "wgui_status_icons.h"
- #include "JBrowserMMIDefs.h"
- #include "JBrowserMMIProts.h"
- #include "JBrowserMMITypes.h"
- #include "JBrowserMMIGprots.h"
- #include "JProfileHandlerTypes.h"
- #include "JProfileHandlerProts.h"
- #include "FileManagerGProt.h"
- #include "sat_def.h"
- #include "USBDeviceGprot.h"
- #ifdef __MMI_FILE_MANAGER__
- #include "FileMgr.h"
- #endif
- #ifdef __MMI_IRDA_SUPPORT__
- #include "IrdaMMIGprots.h"
- #endif
- /* Include: NVRAM header file */
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- /* Included for file system */
- #include "fs_type.h"
- #include "drm_gprot.h"
- #include "fs_func.h"
- #include "ServiceDefs.h" /* Added by Sandeep for Services menu Screen ID */
- #include "FileSystemDef.h"
- /* Include: Jataayu header file */
- #include "ddl.h"
- #include "jcal.h"
- #include "jdd_memapi.h"
- #include "jdd_ui_datatypes.h"
- #include "jdd_ui_window.h"
- #include "jdd_ui_defs.h"
- /* Vivek - 30082006 */
- #ifdef __MMI_UNIFIED_MESSAGE__
- #include "UnifiedMessageDef.h"
- #endif
- /* local */
- U8 g_brw_showimgflag;
- BOOL g_option_refresh_page;
- static U8 gGotoMenuCount = 0;
- extern void mmi_brw_clear_brw_soft_keys(void);
- /*****************************************************************************
- * FUNCTION
- * mmi_rendered_page_init
- * DESCRIPTION
- * Set highlight handler for rendered page menu items
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_rendered_page_init(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- // SetHiliteHandler(MENU_ID_BRW_REN_PAGE_GOTO, mmi_brw_ren_page_goto_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_GOTO_HOMEPAGE, mmi_brw_ren_page_goto_homepage_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_REFRESH, mmi_brw_refresh_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_DOWNLOAD, mmi_brw_download_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_BOOKMARK, mmi_brw_bookmark_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_RECENT_PAGES, mmi_brw_recent_pages_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_ENTER_ADDRESS, mmi_brw_enter_address_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SET_AS_HOMEPAGE, mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SERVICE_INBOX, mmi_brw_service_inbox_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_SETTINGS, mmi_brw_ren_page_setting_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_EXIT, mmi_brw_exit_menu_highlight_hdlr);
- SetHiliteHandler(MENU_ID_BRW_REN_PAGE_ADD_TO_BOOKMARKS, mmi_brw_ren_page_add_to_bmk_highlight_hdlr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_rendered_page_options
- * DESCRIPTION
- * Deinitialize the browser application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_rendered_page_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- JC_CTRL_INFO brw_ctrl_info_p;
- JC_MIME_INFO pMimeInfo;
- U16 Parent_MenuID;
- U16 *UC_list_of_items;
- U8 *guiBuffer;
- S32 nNumofItem;
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gGotoMenuCount = 0;
- /* Get the Control type */
- eRet = jdi_BrowserGetCurrentControlInfo(pBrowserCtxt, &brw_ctrl_info_p);
- if (eRet != JC_OK)
- {
- return;
- }
- if ((brw_ctrl_info_p.eControlType == E_IMAGE) && g_brw_cntx.show_images)
- {
- if (g_brw_cntx.image_selection)
- {
- if (brw_ctrl_info_p.bIsSelectable)
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_2;
- gGotoMenuCount = 1;
- }
- else
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_1;
- }
- }
- else
- {
- if (brw_ctrl_info_p.bIsSelectable)
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- gGotoMenuCount = 1;
- }
- else
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- }
- }
- }
- else if ((brw_ctrl_info_p.eControlType == E_TEXT_BOX) || (brw_ctrl_info_p.eControlType == E_IMAGE_TEXT))
- {
- if (brw_ctrl_info_p.bIsSelectable)
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- gGotoMenuCount = 1;
- }
- else
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- }
- }
- /* [Sandeep Start:PMTSW00005879] */
- else if (brw_ctrl_info_p.eControlType == E_BUTTON)
- {
- if (brw_ctrl_info_p.bIsSelectable)
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- gGotoMenuCount = 1;
- }
- else
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- }
- }
- /* [Sandeep End: PMTSW00005879] */
- else
- {
- Parent_MenuID = MENU_ID_BRW_RENDERED_PAGE_OPTIONS_4;
- }
- jdi_BrowserGetCurrentControlMimeInfo(pBrowserCtxt, &pMimeInfo);
- g_brw_cntx.used_do_element_count = g_brw_cntx.do_element_count;
- nNumofItem = gGotoMenuCount + GetNumOfChild(Parent_MenuID) + g_brw_cntx.used_do_element_count;
- if (nNumofItem > MAX_DO_ELEMENTS)
- {
- g_brw_cntx.used_do_element_count = MAX_DO_ELEMENTS - (GetNumOfChild(Parent_MenuID) + gGotoMenuCount);
- nNumofItem = MAX_DO_ELEMENTS;
- }
- UC_list_of_items = (U16*) jdd_MemAlloc(nNumofItem, sizeof(U16));
- if (UC_list_of_items == NULL)
- {
- jdd_MMINotificationMessage((JC_INT32) JC_ERR_MEMORY_ALLOCATION, E_NOTIFICATION_ERR, NULL, NULL);
- return;
- }
- GetSequenceStringIds(Parent_MenuID, UC_list_of_items);
- /* This variable was set when we try to fetch a page through EnterAddress Option
- screen. Reset this flag to 0 when second page fetch from render page's Eneter Adress throws error. */
- g_brw_add_hist_flag = 0;
- g_brw_enter_add_flag = 0; /* added by tk */
- /*
- nStrItemList = (PU8*) jdd_MemAlloc((nNumofItem + 1), sizeof(PU8));
- if (nStrItemList == NULL)
- {
- if (UC_list_of_items != NULL)
- {
- jdd_MemFree(UC_list_of_items);
- UC_list_of_items = NULL;
- }
- jdd_MMINotificationMessage((JC_INT32) JC_ERR_MEMORY_ALLOCATION, E_NOTIFICATION_ERR, NULL, NULL);
- return;
- }
- */
- EntryNewScreen(SCR_ID_BRW_RENDERED_PAGE_OPTIONS, NULL, mmi_brw_rendered_page_options, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RENDERED_PAGE_OPTIONS);
- SetParentHandler(Parent_MenuID);
- memset(subMenuDataPtrs , 0 , sizeof(subMenuDataPtrs));
- /*for Go To menu*/
- for (i = 0; i < gGotoMenuCount; i++)
- {
- subMenuDataPtrs[i] = (PU8) GetString(STR_ID_BRW_GOTO);
- }
- /* Do elements have to be shown in the begining of the list if exist on the page */
- for (i = gGotoMenuCount; i < (g_brw_cntx.used_do_element_count+gGotoMenuCount); i++)
- {
- subMenuDataPtrs[i] = (PU8) g_brw_cntx.DoElementList[i-gGotoMenuCount]->pDoLabel;
- }
- for (i = (g_brw_cntx.used_do_element_count + gGotoMenuCount); i < nNumofItem; i++)
- {
- subMenuDataPtrs[i] = (PU8) GetString(UC_list_of_items[i - (g_brw_cntx.used_do_element_count+gGotoMenuCount)]);
- }
- if (UC_list_of_items != NULL)
- {
- jdd_MemFree(UC_list_of_items);
- UC_list_of_items = NULL;
- }
- RegisterHighlightHandler(RenderedPageHighlightHdlr);
- ShowCategory84Screen(
- STR_ID_BRW_OPTION,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- nNumofItem,
- subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- mmi_brw_ren_page_handle_do_element();
- }
- /*****************************************************************************
- * FUNCTION
- * RenderedPageHighlightHdlr
- * DESCRIPTION
- * Highlight handler for rendered page are registered with this function
- * PARAMETERS
- * index [IN] Index of highlighted item
- * RETURNS
- * void
- *****************************************************************************/
- void RenderedPageHighlightHdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index < gGotoMenuCount)
- {
- /* Do Nothing, Do element is present at the index */
- SetLeftSoftkeyFunction(mmi_brw_ren_page_goto, KEY_EVENT_UP);
- }
- else if (index < (gGotoMenuCount + g_brw_cntx.used_do_element_count))
- {
- /* Do Nothing, Do element is present at the index */
- SetLeftSoftkeyFunction(mmi_brw_ren_page_process_do_element, KEY_EVENT_UP);
- }
- else
- {
- ExecuteCurrHiliteHandler(index - (g_brw_cntx.used_do_element_count +gGotoMenuCount));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_download_menu_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for download option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_download_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_brw_ren_page_download_image, KEY_EVENT_UP);
- SetKeyHandler(mmi_brw_ren_page_download_image, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_goto
- * DESCRIPTION
- * Function to fetch link from rendered page
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_goto(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_brw_fill_control_info_and_send_event_to_queue();
- g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
- mmi_brw_clear_brw_soft_keys();
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_goto_homepage_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for goto homepage option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_goto_homepage_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_brw_entry_ren_page_goto_homepage, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_ren_page_goto_homepage
- * DESCRIPTION
- * Highlight handler for goto homepage option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_ren_page_goto_homepage(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 curr_act_profile_url[BRW_WAP_PROFILE_HOMEPAGE_URL_LEN * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jc_strcpy(curr_act_profile_url, mmi_ph_brw_get_activated_profile_homepage());
- AnsiiToUnicodeString((S8*) brw_current_url, (S8*) curr_act_profile_url);
- mmi_brw_set_current_url((S8*) brw_current_url);
- g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
- mmi_brw_clear_brw_soft_keys();
- g_option_refresh_page = TRUE;/*This flag prevents to refresh the controls on current page*/
- GoBackHistory();
- g_option_refresh_page = FALSE;
- mmi_brw_goto_url();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_refresh_menu_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for refresh option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_refresh_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_brw_refresh_page, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_refresh_page
- * DESCRIPTION
- * Handler for refresh option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_refresh_page(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_option_refresh_page = TRUE;
- g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
- mmi_brw_clear_brw_soft_keys();
- GoBackHistory();
- g_option_refresh_page = FALSE;
- JBrowserRefreshPage();
- }
- /*****************************************************************************
- * FUNCTION
- * IsRefreshPagePressed
- * DESCRIPTION
- * Handler for refresh option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL IsRefreshPagePressed(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return g_option_refresh_page;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr
- * DESCRIPTION
- * Highlight handler set as homepage option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_set_as_homepage_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_brw_ren_page_set_as_hompage, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_set_as_hompage
- * DESCRIPTION
- * Handler for set as homepage option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_set_as_hompage(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_PAGE_INFO brwPageInfo;
- U32 len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserGetCurrentPageInfo(pBrowserCtxt, &brwPageInfo);
- if (brwPageInfo.psUrl)
- {
- len = pfnUnicodeStrlen((S8*) brwPageInfo.psUrl);
- if (len >= NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN)
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) brwPageInfo.psUrl);
- if (mmi_brw_validate_url(brw_current_url))
- {
- mmi_brw_set_as_homepage(brw_current_url);
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_exit_menu_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for exit option
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_exit_menu_highlight_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
- SetLeftSoftkeyFunction(mmi_brw_entry_exit_menu, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_exit_menu
- * DESCRIPTION
- * Exit menu handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_exit_menu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_brw_wap_deinit();
- /* Free the DO List for last rendered page */
- mmi_brw_free_do_list();
- /* Delete the rendered page from history */
- DeleteNHistory(1);
- #ifdef __SATC3__
- if (g_brw_cntx.isSATURL == E_TRUE)
- {
- brw_send_termination_to_mmi(SAT_BROWSER_USER_TERMINATION);
- }
- #endif /* __SATC3__ */
- /* Go to services menu if entered from wap otherwise go to last screen before rendered page */
- if (IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID))
- {
- GoBackToHistory(SERVICES_MAIN_MENU_SCREEN_ID);
- }
- else if (!IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID) && IsScreenPresent(SCR_ID_BRW_INTERNET_SERVICES))
- {
- DisplayIdleScreen();
- }
- else
- {
- GoBackHistory();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_handle_do_element
- * DESCRIPTION
- * Handle do tag
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_handle_do_element()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 curr_highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- curr_highlighted_item = GetHighlightedItem();
- if ((curr_highlighted_item >= gGotoMenuCount) && (curr_highlighted_item <(g_brw_cntx.used_do_element_count + gGotoMenuCount)))
- {
- SetLeftSoftkeyFunction(mmi_brw_ren_page_process_do_element, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_process_do_element
- * DESCRIPTION
- * process the do element on the page
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_process_do_element()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 curr_highlighted_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- curr_highlighted_index = GetHighlightedItem();
- g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
- mmi_brw_clear_brw_soft_keys();
- GoBackHistory();
- jdi_BrowserProcessDoElement(pBrowserCtxt, g_brw_cntx.DoElementList[(curr_highlighted_index-gGotoMenuCount)]);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_free_do_list
- * DESCRIPTION
- * Free the do element list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_free_do_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_cntx.DoElementList != NULL)
- {
- for (count = 0; count < g_brw_cntx.do_element_count; count++)
- {
- if (g_brw_cntx.DoElementList[count] != NULL)
- {
- if (g_brw_cntx.DoElementList[count]->pDoLabel != NULL)
- {
- jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoLabel);
- g_brw_cntx.DoElementList[count]->pDoLabel = NULL;
- }
- if (g_brw_cntx.DoElementList[count]->pDoType != NULL)
- {
- jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoType);
- g_brw_cntx.DoElementList[count]->pDoType = NULL;
- }
- jdd_MemFree(g_brw_cntx.DoElementList[count]);
- g_brw_cntx.DoElementList[count] = NULL;
- }
- }
- jdd_MemFree(g_brw_cntx.DoElementList);
- g_brw_cntx.DoElementList = NULL;
- g_brw_cntx.do_element_count = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_ren_page_download_image
- * DESCRIPTION
- * Function to doanload the embedded image
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_ren_page_download_image(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet;
- JC_MIME_INFO pMimeInfo;
- JC_MIME_INFO pMimeInfo_dl;
- JC_CHAR *filename;
- JDD_FSHANDLE fs_handle;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- mmi_usb_app_unavailable_popup(0);
- return;
- }
- #endif /* __USB_IN_NORMAL_MODE__ */
- jdi_BrowserGetCurrentControlMimeInfo(pBrowserCtxt, &pMimeInfo);
- jdd_FSGetDownloadFileName(&filename);
- if ((iRet = jdd_FSInitialize(&fs_handle)) == JC_OK)
- {
- JC_CHAR *content_fname;
- content_fname = (JC_CHAR*) jdd_FSFileNameTranslate(fs_handle, (JC_CHAR*) pMimeInfo.psFileName);
- if (content_fname == NULL)
- {
- DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_NOT_ENOUGH_MEMORY), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- jdd_FSDeinitialize(fs_handle);
- return;
- }
- else
- {
- S32 result;
- result = pCopyFile((PU8) content_fname, (PU8) filename, 0);
- jdd_FSDeinitialize(fs_handle);
- jdd_MemFree(content_fname);
- if(result != FS_NO_ERROR)
- {
- if(result == FS_DISK_FULL)
- {
- DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_FILE_SYSTEM_FULL), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SAVE_FAILED), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- return;
- }
- }
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- return;
- }
- memset((void*)&pMimeInfo_dl, 0, sizeof(JC_MIME_INFO));
- pMimeInfo_dl.psContentType = pMimeInfo.psContentType;
- pMimeInfo_dl.psUrl = pMimeInfo.psUrl;
- pMimeInfo_dl.iBufferLen = pMimeInfo.iBufferLen;
- pMimeInfo_dl.psFileName = filename;
- iRet = jdd_MimeHandler(&pMimeInfo_dl);
- jdd_MemFree(filename);
- if (iRet != JC_OK)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */
- #endif /* _MMI_JBROWSERMMIRENDEREDPAGE_C */