JBrowserMMIRecentPages.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:20k
源码类别:
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:
- * ---------
- * JBrowserMMIRecentPages.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for recent pages 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_JBROWSERMMIRECENTPAGES_C
- #define _MMI_JBROWSERMMIRECENTPAGES_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 "JBrowserMMIDefs.h"
- #include "JBrowserMMIProts.h"
- #include "JBrowserMMITypes.h"
- #include "JBrowserMMIGprots.h"
- /* Include: NVRAM header file */
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- /* Include: Jataayu header file */
- #include "ddl.h"
- #include "jcal.h"
- #include "jdd_memapi.h"
- #include "browserlayout.h"
- #include "jdi_servicehandler.h"
- #include "jdi_browserinterface.h"
- #include "fsm.h"
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_recent_page_list
- * DESCRIPTION
- * Entry function for recent page list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_recent_page_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- JC_UINT32 brw_rpl_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserGetHistoryCount(pBrowserCtxt, &brw_rpl_count);
- /* Display 'Enter Address' if no address history items are present */
- if ((brw_rpl_count) == 0)
- {
- /* added by tk */
- if (GetCurrScrnId() == SCR_ID_BRW_RECENT_PAGES)
- {
- DeleteNHistory(1);
- }
- DisplayPopup((PU8) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, JBROWSER_POPUP_TIME, EMPTY_LIST_TONE);
- }
- else
- {
- EntryNewScreen(SCR_ID_BRW_RECENT_PAGES, NULL, mmi_brw_entry_recent_page_list, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RECENT_PAGES);
- // SetParentHandler(0);//comment by tk
- // RegisterHighlightHandler(ExecuteCurrHiliteHandler);//comment by tk
- ShowCategory184Screen(
- STR_ID_BRW_RECENT_PAGES,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- brw_rpl_count,
- mmi_brw_recent_pages_list_get_item,
- 0,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_brw_highlighted_recent_page, KEY_EVENT_UP);
- SetKeyHandler(mmi_brw_highlighted_recent_page, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_recent_pages_list_get_item
- * DESCRIPTION
- * Item call back function for dynamic list of recent pages
- * PARAMETERS
- * item_index [IN] Highlighted item index
- * str_buff [IN] Buffer to be shown
- * img_buff_p [?] [?] image to be shown
- * str_img_mask [IN]
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL mmi_brw_recent_pages_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_URL_HISTORY brw_rpl_list_p;
- S8 pOutBuffer[8];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserGetHistoryByIndex(pBrowserCtxt, item_index, &brw_rpl_list_p);
- /* Display URL if settings option is set as 'Show history by URL'*/
- if (g_brw_cntx.show_history_as_url)
- {
- if (pfnUnicodeStrlen((S8*) brw_rpl_list_p.pmURL) > MAX_SUBMENU_CHARACTERS)
- {
- pfnUnicodeStrncpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmURL, BRW_MAX_VISIBLE_URL_LENGTH - 1);
- AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
- pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmURL);
- }
- }
- else /* Display Title if settings option is set as 'Show history by title'*/
- {
- if (pfnUnicodeStrlen((S8*) brw_rpl_list_p.pmTitle) != 0)
- {
- if(pfnUnicodeStrlen((S8*) brw_rpl_list_p.pmTitle) > MAX_SUBMENU_CHARACTERS)
- {
- pfnUnicodeStrncpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmTitle, BRW_MAX_VISIBLE_URL_LENGTH - 1);
- AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
- pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmTitle);
- }
- }
- else
- {
- if (pfnUnicodeStrlen((S8*) brw_rpl_list_p.pmURL) > MAX_SUBMENU_CHARACTERS)
- {
- pfnUnicodeStrncpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmURL, BRW_MAX_VISIBLE_URL_LENGTH - 1);
- AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
- pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) brw_rpl_list_p.pmURL);
- }
- }
- }
- *img_buff_p = get_image(gIndexIconsImageList[item_index]);
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_highlighted_recent_page
- * DESCRIPTION
- * Function to get the highlighted item and call appropriate function.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_highlighted_recent_page(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.index_highlighted_item = (U8) GetHighlightedItem();
- mmi_brw_entry_recent_page_options();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_recent_page_options
- * DESCRIPTION
- * Entry function for recent page options screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_recent_page_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 UC_list_of_items[3];
- U8 *guiBuffer;
- S32 num_of_items;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_BRW_RECENT_PAGE_OPTIONS, NULL, mmi_brw_entry_recent_page_options, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RECENT_PAGE_OPTIONS);
- num_of_items = GetNumOfChild(MENU_ID_BRW_RECENT_PAGE_OPTIONS);
- GetSequenceStringIds(MENU_ID_BRW_RECENT_PAGE_OPTIONS, UC_list_of_items);
- SetParentHandler(MENU_ID_BRW_RECENT_PAGE_OPTIONS);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_ID_BRW_OPTION,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- num_of_items,
- UC_list_of_items,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_confirm_delete_recent_page
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of currently selected recent page.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_confirm_delete_recent_page(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- // U16 stringID = 0;
- U8 *guiBuffer;
- JC_INT8 unicodeBuf[100] = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- // stringID = STR_ID_BRW_DELETE_RECENT_PAGE_ENTRY;
- EntryNewScreen(SCR_ID_BRW_DELETE_RECENT_PAGE_SCREEN, NULL, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RECENT_PAGES);
- pfnUnicodeStrcpy(unicodeBuf, GetString(STR_ID_BRW_DELETE_RECENT_PAGE_ENTRY));
- ShowCategory74Screen(
- STR_GLOBAL_DELETE,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- (PU8) unicodeBuf,
- pfnUnicodeStrlen(unicodeBuf),
- guiBuffer);
- mmi_brw_clear_key_handler(KEY_VOL_UP);
- mmi_brw_clear_key_handler(KEY_VOL_DOWN);
- }
- else
- {
- //stringID = STR_GLOBAL_DELETE;
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_GLOBAL_DELETE),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- }
- SetLeftSoftkeyFunction(mmi_brw_delete_recent_page, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); /* added by tk */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_recent_page
- * DESCRIPTION
- * Deletes the selected recent page from the list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_delete_recent_page(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserClearHistoryByIndex(pBrowserCtxt, g_brw_cntx.index_highlighted_item);
- jdi_BrowserHistorySave(pBrowserCtxt);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- /* DeleteUptoScrID(SCR_ID_BRW_INTERNET_SERVICES); */
- DeleteUptoScrID(SCR_ID_BRW_RECENT_PAGES); /* added by tk */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_confirm_delete_all_recent_pages
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of entire recent page list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_confirm_delete_all_recent_pages(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- // U16 stringID = 0;
- U8 *guiBuffer;
- JC_INT8 unicodeBuf[100] = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- // stringID = STR_ID_BRW_DELETE_ALL_RECENT_PAGE_ENTRY;
- EntryNewScreen(SCR_ID_BRW_DELETE_RECENT_PAGE_SCREEN, NULL, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_RECENT_PAGES);
- pfnUnicodeStrcpy(unicodeBuf, GetString(STR_ID_BRW_DELETE_ALL_RECENT_PAGE_ENTRY));
- ShowCategory74Screen(
- STR_GLOBAL_DELETE_ALL,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- (PU8) unicodeBuf,
- pfnUnicodeStrlen(unicodeBuf),
- guiBuffer);
- mmi_brw_clear_key_handler(KEY_VOL_UP);
- mmi_brw_clear_key_handler(KEY_VOL_DOWN);
- }
- else
- {
- // stringID = STR_GLOBAL_DELETE_ALL;
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_GLOBAL_DELETE_ALL),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- }
- SetLeftSoftkeyFunction(mmi_brw_delete_all_recent_pages, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); /* added by tk */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_all_recent_pages
- * DESCRIPTION
- * Deletes the entire recent page list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_delete_all_recent_pages(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserClearHistory(pBrowserCtxt);
- jdi_BrowserHistorySave(pBrowserCtxt);
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- /* DeleteUptoScrID(SCR_ID_BRW_INTERNET_SERVICES); */
- DeleteUptoScrID(SCR_ID_BRW_RECENT_PAGES); /* added by tk */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_goto_highlighted_recent_page
- * DESCRIPTION
- * This function fetches the current url
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_goto_highlighted_recent_page(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_URL_HISTORY brw_rpl_list_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserGetHistoryByIndex(pBrowserCtxt, g_brw_cntx.index_highlighted_item, &brw_rpl_list_p);
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /* added by tk to set the current fetch url */
- mmi_brw_set_current_url((S8*) brw_rpl_list_p.pmURL);
- /* jdi call to fetch the url */
- mmi_brw_pre_entry_goto_url();
- }
- #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */
- #endif /* _MMI_JBROWSERMMIRECENTPAGES_C */