JBrowserMMIAddressHistory.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:43k
源码类别:
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:
- * ---------
- * JBrowserMMIAddressHistory.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for address history 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_JBROWSERMMIADDRESSHISTORY_C
- #define _MMI_JBROWSERMMIADDRESSHISTORY_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 "fsm.h"
- U8 g_brw_add_hist_flag;
- static U8 g_brw_hist_selected_title[(BRW_ADDRESS_HISTORY_MAX_TITLE_LENGTH) * ENCODING_LENGTH];
- static U8 g_brw_hist_selected_url[(BRW_ADDRESS_HISTORY_MAX_URL_LENGTH) * ENCODING_LENGTH];
- U8 g_brw_enter_add_flag; /* added by tk to set the highlighter to a 2nd position */
- /* Extern Function,variables */
- extern pBOOL GetUCS2Flag(PS8 buffer);
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_enter_address
- * DESCRIPTION
- * Entry function for enter address menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_enter_address(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer = NULL;
- U16 record_count;
- S16 NvramError;
- U8 highlight_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Read address history list from NVRAM if not already read */
- if ((g_brw_cntx.address_history_title_p == NULL) && (g_brw_cntx.address_history_url_p == NULL))
- {
- g_brw_cntx.address_history_title_p =
- (nvram_brw_hist_title_struct*) jdd_MemAlloc(
- NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS,
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE);
- g_brw_cntx.address_history_url_p =
- (nvram_brw_hist_url_struct*) jdd_MemAlloc(
- NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS,
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE);
- memset(
- g_brw_cntx.address_history_title_p,
- 0,
- (NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS));
- memset(
- g_brw_cntx.address_history_url_p,
- 0,
- (NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS));
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- ReadRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
- {
- ReadRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
- record_count,
- &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
- &NvramError);
- }
- /* Calculate the number of entries */
- mmi_brw_calculate_number_of_address_history_items_stored();
- }
- /* Open editor if no entries are present */
- if (g_brw_cntx.total_address_history_items == 0)
- {
- AnsiiToUnicodeString((S8*) g_brw_hist_selected_url, (S8*) ("http://"));
- mmi_brw_entry_enter_url();
- }
- else
- {
- EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS, NULL, mmi_brw_entry_enter_address, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS);
- /* added by tk */
- if (g_brw_enter_add_flag/* && guiBuffer != NULL && guiBuffer[2] != 0*/)
- {
- guiBuffer = NULL;
- g_brw_enter_add_flag = 0;
- highlight_index = 1;
- }
- RegisterHighlightHandler(mmi_brw_enter_address_scr_highlight_hdlr);
- ShowCategory184Screen(
- STR_ID_BRW_ENTER_ADDRESS,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- g_brw_cntx.total_address_history_items + 1,
- mmi_brw_address_history_list_get_item,
- 0,
- highlight_index,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_brw_hist_highlighted_item, KEY_EVENT_UP);
- SetKeyHandler(mmi_brw_hist_highlighted_item, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_enter_address_scr_highlight_hdlr
- * DESCRIPTION
- * --
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_enter_address_scr_highlight_hdlr(S32 index)
- {
- if(index == 0)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- }
- else
- {
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_calculate_number_of_address_history_items_stored
- * DESCRIPTION
- * Function to calculate the total number of address history items stored
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_calculate_number_of_address_history_items_stored(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 history_count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (history_count = 0; history_count < BRW_MAX_ADDRESS_HISTORY; history_count++)
- {
- if ((strlen((S8*) g_brw_cntx.address_history_title_p[history_count].title)) == 0)
- {
- /* If both title and url are '0' exit the loop */
- if ((strlen((S8*) g_brw_cntx.address_history_url_p[history_count].url)) == 0)
- {
- break;
- }
- }
- g_brw_cntx.total_address_history_items++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_address_history_list_get_item
- * DESCRIPTION
- * Item call back function for dynamic list of address history
- * 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_address_history_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 pOutBuffer[8];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((item_index < 0) || (item_index > BRW_MAX_ADDRESS_HISTORY))
- {
- return FALSE;
- }
- if (item_index == 0)
- {
- pfnUnicodeStrcpy((S8*) str_buff, GetString(STR_ID_BRW_ENTER_ADDRESS));
- }
- else
- {
- /* Display title if settings option is 'Show history by title' */
- /* added by tk */
- if (g_brw_cntx.show_history_as_url)
- {
- /* truncate the URL to 38 charactes and append three '.'(dots) if the length of URL exceeds
- MAX_SUBMENU_CHARACTERS charactes */
- if (strlen((S8*) g_brw_cntx.address_history_url_p[item_index - 1].url) > MAX_SUBMENU_CHARACTERS)
- {
- AnsiiNToUnicodeString(
- (S8*) str_buff,
- (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url,
- BRW_MAX_VISIBLE_URL_LENGTH);
- str_buff[BRW_MAX_VISIBLE_URL_LENGTH] = ' ';
- AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
- pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
- }
- else
- {
- AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url);
- }
- }
- else
- {
- if ((g_brw_cntx.address_history_title_p[item_index - 1].dcs == BRW_DCS_ASCII) &&
- (strlen((S8*) g_brw_cntx.address_history_title_p[item_index - 1].title) != 0))
- {
- AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_title_p[item_index - 1].title);
- }
- else if ((g_brw_cntx.address_history_title_p[item_index - 1].dcs == BRW_DCS_UCS) &&
- (pfnUnicodeStrlen((S8*) g_brw_cntx.address_history_title_p[item_index - 1].title) != 0))
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_cntx.address_history_title_p[item_index - 1].title);
- }
- /* tk end */
- else
- {
- /* truncate the URL to 38 charactes and append three '.'(dots) if the length of URL exceeds
- MAX_SUBMENU_CHARACTERS charactes */
- if (strlen((S8*) g_brw_cntx.address_history_url_p[item_index - 1].url) > MAX_SUBMENU_CHARACTERS)
- {
- AnsiiNToUnicodeString(
- (S8*) str_buff,
- (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url,
- BRW_MAX_VISIBLE_URL_LENGTH);
- str_buff[BRW_MAX_VISIBLE_URL_LENGTH] = ' ';
- AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
- pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
- }
- else
- {
- AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url);
- }
- }
- }
- }
- *img_buff_p = get_image(gIndexIconsImageList[item_index]);
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_hist_highlighted_item
- * DESCRIPTION
- * Function to get the highlighted item and call appropriate function.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_hist_highlighted_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.index_highlighted_item = (U8) GetHighlightedItem();
- if (g_brw_cntx.index_highlighted_item == 0)
- {
- /* open the editor to enter the url */
- memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
- AnsiiToUnicodeString((S8*) g_brw_hist_selected_url, (S8*) ("http://"));
- mmi_brw_entry_enter_url();
- }
- else
- {
- mmi_brw_entry_enter_address_options();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_enter_address_options
- * DESCRIPTION
- * Entry function for Enter Address Options screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_enter_address_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 UC_list_of_items[5];
- U8 *guiBuffer;
- S32 num_of_items;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS, NULL, mmi_brw_entry_enter_address_options, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS);
- num_of_items = GetNumOfChild(MENU_ID_BRW_ENTER_ADR_OPTIONS);
- GetSequenceStringIds(MENU_ID_BRW_ENTER_ADR_OPTIONS, UC_list_of_items);
- SetParentHandler(MENU_ID_BRW_ENTER_ADR_OPTIONS);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_GLOBAL_OPTIONS,
- 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);
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_enter_url
- * DESCRIPTION
- * Entry function for full screen editor to enter the url.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_enter_url(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_BRW_ENTER_URL, NULL, mmi_brw_entry_enter_url, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_URL);
- ShowCategory5Screen(
- STR_ID_BRW_ENTER_ADDRESS,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- INPUT_TYPE_ALPHANUMERIC_LOWERCASE | INPUT_TYPE_OVERRIDE_DEFAULT | INPUT_TYPE_USE_ONLY_ENGLISH_MODES,
- (U8*) g_brw_hist_selected_url,
- BRW_ADDRESS_HISTORY_MAX_URL_LENGTH,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_brw_add_address_history_item, KEY_EVENT_UP);
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_add_address_history_item
- * DESCRIPTION
- * Function to add new item to the address history list.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_add_address_history_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 hist_count;
- U16 record_count;
- S16 NvramError;
- MMI_BOOL IsValidURL;
- S8 url_string[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
- U16 tempCount = 0;
- S8 titleString[NVRAM_BRW_ADDRESS_HISTORY_MAX_TITLE_LENGTH * 2];
- S8 urlString[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IsValidURL = mmi_brw_validate_url(g_brw_hist_selected_url);
- if (IsValidURL == MMI_TRUE)
- {
- pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
- g_brw_add_hist_flag = 1;
- g_brw_enter_add_flag = 1;
- /* added by tk to set the current fetch url */
- mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
- /* fetch the url */
- mmi_brw_pre_entry_goto_url();
- /* Check if URL already exists. If exists then do not add this URL to the list. */
- for (hist_count = 0; hist_count < g_brw_cntx.total_address_history_items; ++hist_count)
- {
- AnsiiToUnicodeString((S8*) url_string,
- (S8*)&g_brw_cntx.address_history_url_p[hist_count].url );
- if ((pfnUnicodeStrcmp((S8 *)g_brw_hist_selected_url, (S8 *)url_string)) == 0)
- {
- // Sandeep Start
- if (g_brw_cntx.address_history_title_p[hist_count].dcs == BRW_DCS_UCS)
- {
- pfnUnicodeStrcpy(
- (S8*) titleString,
- (S8*) g_brw_cntx.address_history_title_p[hist_count].title);
- }
- else
- {
- AnsiiToUnicodeString(
- (S8*) titleString,
- (S8*) g_brw_cntx.address_history_title_p[hist_count].title);
- }
- strcpy((S8*) urlString,
- (S8*) g_brw_cntx.address_history_url_p[hist_count].url);
- // Sandeep End
- for (tempCount = hist_count; tempCount > 0; --tempCount)
- {
- memcpy(
- &g_brw_cntx.address_history_title_p[tempCount],
- &g_brw_cntx.address_history_title_p[tempCount - 1],
- sizeof(g_brw_cntx.address_history_title_p[tempCount]));
- memcpy(
- &g_brw_cntx.address_history_url_p[tempCount],
- &g_brw_cntx.address_history_url_p[tempCount - 1],
- sizeof(g_brw_cntx.address_history_url_p[tempCount]));
- }
- // Sandeep Start
- if (GetUCS2Flag((S8*) titleString))
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
- pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
- }
- else
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
- }
- strcpy((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) urlString);
- // Sandeep End
- mmi_brw_write_enter_address_to_nvram();
- DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
- return;
- }
- }
- if (g_brw_cntx.total_address_history_items == 0)
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
- }
- else
- {
- for (hist_count = g_brw_cntx.total_address_history_items; hist_count >= 1; hist_count--)
- {
- if (hist_count != BRW_MAX_ADDRESS_HISTORY)
- {
- memcpy(
- &g_brw_cntx.address_history_title_p[hist_count],
- &g_brw_cntx.address_history_title_p[hist_count - 1],
- sizeof(g_brw_cntx.address_history_title_p[hist_count]));
- memcpy(
- &g_brw_cntx.address_history_url_p[hist_count],
- &g_brw_cntx.address_history_url_p[hist_count - 1],
- sizeof(g_brw_cntx.address_history_url_p[hist_count]));
- }
- }
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
- record_count,
- &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
- &NvramError);
- }
- if (g_brw_cntx.total_address_history_items != BRW_MAX_ADDRESS_HISTORY)
- {
- g_brw_cntx.total_address_history_items++;
- }
- DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_update_address_history_list
- * DESCRIPTION
- * Function to update the address history list.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_update_address_history_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 hist_count;
- U16 record_count;
- S16 NvramError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_add_hist_flag = 1;
- g_brw_enter_add_flag = 1; /* added by tk */
- /* EnterAddressOption Screen should not into history when we try to fetch url from
- Enter Address list. */
- ClearExitHandler();
- if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
- {
- pfnUnicodeStrcpy(
- (S8*) g_brw_hist_selected_title,
- (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
- }
- else
- {
- AnsiiToUnicodeString(
- (S8*) g_brw_hist_selected_title,
- (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
- }
- AnsiiToUnicodeString(
- (S8*) g_brw_hist_selected_url,
- (S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
- pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
- /* added by tk to set the current fetch url */
- mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
- mmi_brw_pre_entry_goto_url();
- for (hist_count = g_brw_cntx.index_highlighted_item - 1; hist_count >= 1; hist_count--)
- {
- if (hist_count != BRW_MAX_ADDRESS_HISTORY)
- {
- memcpy(
- &g_brw_cntx.address_history_title_p[hist_count],
- &g_brw_cntx.address_history_title_p[hist_count - 1],
- sizeof(g_brw_cntx.address_history_title_p[hist_count]));
- memcpy(
- &g_brw_cntx.address_history_url_p[hist_count],
- &g_brw_cntx.address_history_url_p[hist_count - 1],
- sizeof(g_brw_cntx.address_history_url_p[hist_count]));
- }
- }
- if (GetUCS2Flag((S8*) g_brw_hist_selected_title))
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
- pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
- }
- else
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
- }
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
- record_count,
- &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
- &NvramError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_page_title_to_nvram
- * DESCRIPTION
- * Function to save title in NVRAM.
- * PARAMETERS
- * title_p [?] title to be saved
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_page_title_to_nvram(U8 *title_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 record_count;
- S16 NvramError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetUCS2Flag((S8*) title_p))
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
- pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
- }
- else
- {
- g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
- }
- /* Only Title needs to be updated */
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- g_brw_add_hist_flag = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_enter_address_delete_confirm
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of enter address url.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_enter_address_delete_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_ID_BRW_ENTER_ADR_DELETE),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_brw_delete_enter_address, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_enter_address
- * DESCRIPTION
- * Delete the selected enter address url.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_delete_enter_address(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (count = g_brw_cntx.index_highlighted_item - 1; count < g_brw_cntx.total_address_history_items - 1; ++count)
- {
- memcpy(
- &g_brw_cntx.address_history_title_p[count],
- &g_brw_cntx.address_history_title_p[count + 1],
- sizeof(g_brw_cntx.address_history_title_p[count]));
- memcpy(
- &g_brw_cntx.address_history_url_p[count],
- &g_brw_cntx.address_history_url_p[count + 1],
- sizeof(g_brw_cntx.address_history_url_p[count]));
- }
- /* Set the last bookmark item as 0 */
- memset(
- &g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1],
- 0,
- sizeof(g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1]));
- memset(
- &g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1],
- 0,
- sizeof(g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1]));
- mmi_brw_write_enter_address_to_nvram();
- g_brw_cntx.total_address_history_items--;
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- if (g_brw_cntx.total_address_history_items > 0)
- {
- DeleteUptoScrID(SCR_ID_BRW_ENTER_ADDRESS);
- }
- else
- {
- DeleteNHistory(2);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_write_enter_address_to_nvram
- * DESCRIPTION
- * This function writes enter address url/title data to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_write_enter_address_to_nvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 record_count;
- S16 NvramError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Read bookmarks from NVRAM if not already read */
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
- record_count,
- &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
- &NvramError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_enter_address_delete_all_confirm
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of enter address url List.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_enter_address_delete_all_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_ID_BRW_ENTER_ADR_DELETE_ALL),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_brw_setting_delete_history_all, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_pre_entry_add_enter_address_bookmark
- * DESCRIPTION
- * Pre Entry function for Enter Address Add To Bookmarks screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_pre_entry_add_enter_address_bookmark(void)
- {
- U32 length = 0;
- length = strlen((PS8) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
- // Fill the bookmark list.
- mmi_brw_read_bookmark_from_nvram();
- if (length >= BRW_BKM_MAX_URL_LENGTH)
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR,
- 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- else if (g_brw_cntx.total_bookmark_items >= BRW_MAX_BOOKMARKS)
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_BOOKMARK_FULL),
- IMG_GLOBAL_ERROR,
- 1,
- JBROWSER_POPUP_TIME,
- ERROR_TONE);
- SetLeftSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- else {
- if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
- {
- pfnUnicodeStrcpy((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
- }
- else
- {
- AnsiiToUnicodeString((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
- }
- AnsiiToUnicodeString((S8*) g_brw_bkm_selected_url,
- (S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
- /* Set edit flag */
- edit_flag = BRW_STATUS_FROM_ENTER_ADDRESS;
- mmi_brw_entry_add_bookmark_screen_for_all();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_enter_address_edit_menu
- * DESCRIPTION
- * Entry function for Enter Address Edit Menu Item.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_enter_address_edit_menu(void)
- {
- /* Open the editor to enter the url */
- memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
- AnsiiToUnicodeString((S8*) g_brw_hist_selected_url,
- (S8*)&g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1] );
- /* EnterAddressOption Screen should not into history when we try to fetch url from
- Enter Address list. */
- ClearExitHandler();
- mmi_brw_entry_enter_url();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_setting_delete_history_all
- * DESCRIPTION
- * Deletes the Browser Setting History(Enter address list)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_setting_delete_history_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 NvramError;
- U16 record_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((g_brw_cntx.address_history_title_p == NULL) && (g_brw_cntx.address_history_url_p == NULL))
- {
- g_brw_cntx.address_history_title_p =
- (nvram_brw_hist_title_struct*) jdd_MemAlloc(
- NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS,
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE);
- g_brw_cntx.address_history_url_p =
- (nvram_brw_hist_url_struct*) jdd_MemAlloc(
- NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS,
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE);
- }
- memset(
- g_brw_cntx.address_history_title_p,
- 0,
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS);
- memset(
- g_brw_cntx.address_history_url_p,
- 0,
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS);
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
- record_count,
- &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
- record_count,
- &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
- &NvramError);
- }
- /* Free memory allocated to address history title */
- if (g_brw_cntx.address_history_title_p != NULL)
- {
- jdd_MemFree(g_brw_cntx.address_history_title_p);
- g_brw_cntx.address_history_title_p = NULL;
- }
- /* Free memory allocated to address history url */
- if (g_brw_cntx.address_history_url_p != NULL)
- {
- jdd_MemFree(g_brw_cntx.address_history_url_p);
- g_brw_cntx.address_history_url_p = NULL;
- }
- g_brw_cntx.total_address_history_items = 0;
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 0,
- JBROWSER_POPUP_TIME,
- SUCCESS_TONE);
- DeleteNHistory(2);
- }
- #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */
- #endif /* _MMI_JBROWSERMMIADDRESSHISTORY_C */