JBrowserMMIBookmarks.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:50k
源码类别:
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:
- * ---------
- * JBrowserMMIBookmarks.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for bookmark 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_JBROWSERMMIBOOKMARKS_C
- #define _MMI_JBROWSERMMIBOOKMARKS_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 "JProvWap.h"
- #include "jdd_ui_datatypes.h"
- #include "jdd_ui_utils.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"
- U8 g_brw_bkm_selected_title[(BRW_BKM_MAX_TITLE_LENGTH) * ENCODING_LENGTH];
- U8 g_brw_bkm_selected_url[(BRW_BKM_MAX_URL_LENGTH) * ENCODING_LENGTH]; /* Dara changed as will be used in other file */
- brw_status_enum edit_flag; /* Dara changed as will be used in other file */
- PROV_RETCODE mmi_brw_add_prov_bookmark(U8 *, U8 *);
- /* Extern Function,variables */
- extern pBOOL GetUCS2Flag(PS8 buffer);
- static U8 g_brw_bkm_add_flag;
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_bookmark_list
- * DESCRIPTION
- * Entry function for Bookmark list screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_bookmark_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nEmptyId = STR_ID_BRW_EMPTY;
- U8 highlight_index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_BRW_BOOKMARKS, NULL, mmi_brw_entry_bookmark_list, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_BOOKMARKS);
- // SetParentHandler(0);//comment by tk
- // RegisterHighlightHandler(ExecuteCurrHiliteHandler);//comment by tk
- /* read bookmark from NVRAM */
- mmi_brw_read_bookmark_from_nvram();
- /* Display 'Empty' if no bookmarks are present */
- if (g_brw_cntx.total_bookmark_items == 0)
- {
- ShowCategory15Screen(
- STR_ID_BRW_BOOKMARKS,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- 1,
- &nEmptyId,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_brw_pre_entry_bookmark_options, KEY_EVENT_UP);
- SetKeyHandler(mmi_brw_pre_entry_bookmark_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- if (guiBuffer != NULL)
- {
- if (g_brw_bkm_add_flag)
- {
- guiBuffer = NULL;
- highlight_index = g_brw_cntx.index_highlighted_item;
- g_brw_bkm_add_flag = 0;
- }
- }
- ShowCategory184Screen(
- STR_ID_BRW_BOOKMARKS,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_BACK,
- 0,
- g_brw_cntx.total_bookmark_items,
- mmi_brw_bookmark_list_get_item,
- 0,
- highlight_index,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_brw_pre_entry_bookmark_options, KEY_EVENT_UP);
- SetKeyHandler(mmi_brw_pre_entry_bookmark_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_bookmark_list_get_item
- * DESCRIPTION
- * Item call back function for dynamic list of bookmarks
- * 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_bookmark_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_BOOKMARKS))
- {
- return FALSE;
- }
- /* Display title if settings option is 'Show history by title'*/
- 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.bookmark_url_p[item_index].url) > MAX_SUBMENU_CHARACTERS)
- {
- AnsiiNToUnicodeString(
- (S8*) str_buff,
- (S8*) g_brw_cntx.bookmark_url_p[item_index].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.bookmark_url_p[item_index].url);
- }
- }
- else
- {
- if ((g_brw_cntx.bookmark_title_p[item_index].dcs == BRW_DCS_ASCII) &&
- (strlen((S8*) g_brw_cntx.bookmark_title_p[item_index].title)) != 0)
- {
- AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.bookmark_title_p[item_index].title);
- }
- else if ((g_brw_cntx.bookmark_title_p[item_index].dcs == BRW_DCS_UCS) &&
- (pfnUnicodeStrlen((S8*) g_brw_cntx.bookmark_title_p[item_index].title)) != 0)
- {
- pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_cntx.bookmark_title_p[item_index].title);
- }
- /* 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.bookmark_url_p[item_index].url) > MAX_SUBMENU_CHARACTERS)
- {
- AnsiiNToUnicodeString(
- (S8*) str_buff,
- (S8*) g_brw_cntx.bookmark_url_p[item_index].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.bookmark_url_p[item_index].url);
- }
- }
- }
- *img_buff_p = get_image(gIndexIconsImageList[item_index]);
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_calculate_number_of_bookmarks_stored
- * DESCRIPTION
- * Function to calculate the total number of bookmarks stored
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_calculate_number_of_bookmarks_stored(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 bkm_count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (bkm_count = 0; bkm_count < BRW_MAX_BOOKMARKS; bkm_count++)
- {
- if ((strlen((S8*) g_brw_cntx.bookmark_title_p[bkm_count].title)) == 0)
- {
- /* If both title and url are '0' exit the loop */
- if ((strlen((S8*) g_brw_cntx.bookmark_url_p[bkm_count].url)) == 0)
- {
- break;
- }
- }
- g_brw_cntx.total_bookmark_items++;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_pre_entry_bookmark_options
- * DESCRIPTION
- * Pre Entry function for Bookmark options screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_pre_entry_bookmark_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Get the current highlited bookmark index */
- g_brw_cntx.index_highlighted_item = (U8) GetHighlightedItem();
- mmi_brw_entry_bookmark_options();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_bookmark_options
- * DESCRIPTION
- * Entry function for Bookmark options screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_bookmark_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 UC_list_of_items[6];
- U8 *guiBuffer;
- S32 num_of_items;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_BRW_BOOKMARK_OPTIONS, NULL, mmi_brw_entry_bookmark_options, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_BOOKMARK_OPTIONS);
- /* If no bookmarks are present, Display scren with only one option i.e 'Add bookmark' */
- if (g_brw_cntx.total_bookmark_items == 0)
- {
- num_of_items = GetNumOfChild(MENU_ID_BRW_BKM_OPTIONS_1);
- GetSequenceStringIds(MENU_ID_BRW_BKM_OPTIONS_1, UC_list_of_items);
- SetParentHandler(MENU_ID_BRW_BKM_OPTIONS_1);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_ID_BRW_OPTION,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- num_of_items,
- UC_list_of_items,
- (U16*) gIndexIconsImageList,
- LIST_MENU,
- 0,
- guiBuffer);
- }
- else
- {
- num_of_items = GetNumOfChild(MENU_ID_BRW_BKM_OPTIONS_2);
- GetSequenceStringIds(MENU_ID_BRW_BKM_OPTIONS_2, UC_list_of_items);
- SetParentHandler(MENU_ID_BRW_BKM_OPTIONS_2);
- RegisterHighlightHandler(ExecuteCurrHiliteHandler);
- ShowCategory15Screen(
- STR_ID_BRW_OPTION,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- 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_pre_entry_add_bookmark
- * DESCRIPTION
- * Pre Entry function for Add bookmark screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_pre_entry_add_bookmark(void)
- {
- /* If Bookmark list is full, Dispaly 'Bookmark list is full' */
- 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);
- }
- else
- {
- memset(g_brw_bkm_selected_title, 0, sizeof(g_brw_bkm_selected_title));
- AnsiiToUnicodeString((S8*) g_brw_bkm_selected_url, (S8*) ("http://"));
- /* Set edit flag */
- edit_flag = BRW_STATUS_NO;
- mmi_brw_entry_add_bookmark_screen_for_all();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_add_bookmark_screen_for_all
- * DESCRIPTION
- * Entry function for Add bookmark screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_add_bookmark_screen_for_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- InlineItem brw_bookmark_inline_edit_list[4];
- U16 IconsImageList[4] = {0};
- U16 stringID = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(brw_bookmark_inline_edit_list, 0, sizeof(brw_bookmark_inline_edit_list));
- EntryNewScreen(SCR_ID_BRW_ADD_BOOKMARK, mmi_brw_exit_add_bookmark_screen_for_all, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ADD_BOOKMARK);
- InitializeCategory57Screen();
- /* For title caption */
- SetInlineItemActivation(
- &brw_bookmark_inline_edit_list[BRW_INLINE_TITLE_CAPTION],
- INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
- 0);
- SetInlineItemCaption(
- &brw_bookmark_inline_edit_list[BRW_INLINE_TITLE_CAPTION],
- (U8*) GetString(STR_ID_BRW_TITLE));
- /* For title string */
- SetInlineItemActivation(&brw_bookmark_inline_edit_list[BRW_INLINE_TITLE], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &brw_bookmark_inline_edit_list[BRW_INLINE_TITLE],
- STR_ID_BRW_EDIT,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- (U8*) g_brw_bkm_selected_title,
- BRW_BKM_MAX_TITLE_LENGTH,
- INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ONE_LESS_CHARACTER);
- SetInlineFullScreenEditCustomFunction(
- &brw_bookmark_inline_edit_list[BRW_INLINE_TITLE],
- mmi_brw_full_screen_edit);
- /* For Address caption */
- SetInlineItemActivation(
- &brw_bookmark_inline_edit_list[BRW_INLINE_ADDRESS_CAPTION],
- INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
- 0);
- SetInlineItemCaption(
- &brw_bookmark_inline_edit_list[BRW_INLINE_ADDRESS_CAPTION],
- (U8*) GetString(STR_ID_BRW_ADDRESS));
- /* For Address string (URL) */
- SetInlineItemActivation(&brw_bookmark_inline_edit_list[BRW_INLINE_URL], KEY_LSK, KEY_EVENT_UP);
- SetInlineItemFullScreenEdit(
- &brw_bookmark_inline_edit_list[BRW_INLINE_URL],
- STR_ID_BRW_EDIT,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- (U8*) g_brw_bkm_selected_url,
- BRW_BKM_MAX_URL_LENGTH,
- INPUT_TYPE_ALPHANUMERIC_LOWERCASE | INPUT_TYPE_OVERRIDE_DEFAULT | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
- SetInlineFullScreenEditCustomFunction(&brw_bookmark_inline_edit_list[BRW_INLINE_URL], mmi_brw_full_screen_edit);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_BRW_ADD_BOOKMARK, &inputBufferSize);
- if (inputBuffer != NULL)
- {
- SetCategory57Data(brw_bookmark_inline_edit_list, 4, inputBuffer);
- }
- SetParentHandler(0);
- /* Set the softkey label to be displayed in Category57 screen */
- RegisterHighlightHandler(mmi_brw_change_label_highlight_hdlr);
- IconsImageList[0] = gIndexIconsImageList[0];
- IconsImageList[2] = gIndexIconsImageList[1];
- if (edit_flag == BRW_STATUS_FROM_ENTER_ADDRESS || edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- if ((GetInlineDoneFlag(guiBuffer) == 0))
- {
- SetInlineDoneFlag(guiBuffer);
- }
- set_wgui_inline_list_menu_status(1);
- }
- if (edit_flag == BRW_STATUS_NO || edit_flag == BRW_STATUS_FROM_ENTER_ADDRESS
- || edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- stringID = STR_ID_BRW_ADD_BOOKMARK;
- }
- else if (edit_flag == BRW_STATUS_YES)
- {
- stringID = STR_ID_BRW_EDIT_BOOKMARK;
- }
- ShowCategory57Screen(
- stringID,
- GetRootTitleIcon(SERVICES_WAP_MENU_ID),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- 4,
- (U16*) IconsImageList,
- brw_bookmark_inline_edit_list,
- 0,
- guiBuffer);
- /* Register function for right soft key */
- SetCategory57RightSoftkeyFunctions(mmi_brw_entry_confirmation_hdlr, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_exit_add_bookmark_screen_for_all
- * DESCRIPTION
- * Exit function for Add/Edit bookmark screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_exit_add_bookmark_screen_for_all(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history Scr;
- S16 nHistory = 0;
- U16 inputBufferSize; /* added for inline edit history */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Scr.scrnID = SCR_ID_BRW_ADD_BOOKMARK;
- CloseCategory57Screen();
- Scr.entryFuncPtr = mmi_brw_entry_add_bookmark_screen_for_all;
- pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
- GetCategory57History(Scr.guiBuffer);
- inputBufferSize = (U16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) Scr.inputBuffer); /* added for inline edit history */
- AddNHistory(Scr, (U16) inputBufferSize); /* added for inline edit history */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_pre_entry_edit_bookmark
- * DESCRIPTION
- * Pre Entry function for Edit bookmark screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_pre_entry_edit_bookmark(void)
- {
- if (g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].dcs == BRW_DCS_UCS)
- {
- pfnUnicodeStrcpy(
- (S8*) g_brw_bkm_selected_title,
- (S8*) g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].title);
- }
- else
- {
- AnsiiToUnicodeString(
- (S8*) g_brw_bkm_selected_title,
- (S8*) g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].title);
- }
- AnsiiToUnicodeString(
- (S8*) g_brw_bkm_selected_url,
- (S8*) g_brw_cntx.bookmark_url_p[g_brw_cntx.index_highlighted_item].url);
- /* Set edit flag */
- edit_flag = BRW_STATUS_YES;
- mmi_brw_entry_add_bookmark_screen_for_all();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_change_label_highlight_hdlr
- * DESCRIPTION
- * Custom Highlight handler to change the label of LSK in case of inline edit screen.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_change_label_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((index == BRW_INLINE_TITLE) || (index == BRW_INLINE_URL))
- {
- /* Change the softkey label to 'Edit' */
- ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_full_screen_edit
- * DESCRIPTION
- * Callback for full screen edit from inline edit screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_full_screen_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
- SetInputMethodAndDoneCaptionIcon(GetRootTitleIcon(SERVICES_WAP_MENU_ID));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_confirmation_hdlr
- * DESCRIPTION
- * Entry screen for confirmation
- * PARAMETERS
- * void
- * a(?) [IN/OUT]
- * b(?) [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_confirmation_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_ID_BRW_SAVE_BOOKMARK),
- IMG_GLOBAL_QUESTION,
- 0);
- SetLeftSoftkeyFunction(mmi_brw_save_bookmark, KEY_EVENT_UP);
- SetRightSoftkeyFunction(brw_GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * brw_GoBackHistory
- * DESCRIPTION
- * To go back to history
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void brw_GoBackHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- GoBacknHistory(1);
- }
- else
- {
- GoBacknHistory(2);
- }
- edit_flag = BRW_STATUS_NO;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_bookmark
- * DESCRIPTION
- * Function to save the bookmark to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_BOOL IsValidURL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IsValidURL = mmi_brw_validate_url(g_brw_bkm_selected_url);
- if (IsValidURL == MMI_TRUE)
- {
- mmi_brw_save_bookmark_item();
- g_brw_bkm_add_flag = 1;
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- if (edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- DeleteNHistory(1);
- }
- else
- {
- DeleteNHistory(2);
- }
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_bookmark_item
- * DESCRIPTION
- * Function to save particular bookmark item to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_bookmark_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* New bookmark is to be added (Add Bookmark menu) */
- if (edit_flag == BRW_STATUS_NO || edit_flag == BRW_STATUS_FROM_ENTER_ADDRESS
- || edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- if (GetUCS2Flag((S8*) g_brw_bkm_selected_title))
- {
- g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items].dcs = BRW_DCS_UCS;
- pfnUnicodeStrcpy(
- (S8*) (g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items].title),
- (S8*) g_brw_bkm_selected_title);
- }
- else
- {
- g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii(
- (S8*) (g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items].title),
- (S8*) g_brw_bkm_selected_title);
- }
- UnicodeToAnsii(
- (S8*) (g_brw_cntx.bookmark_url_p[g_brw_cntx.total_bookmark_items].url),
- (S8*) g_brw_bkm_selected_url);
- g_brw_cntx.index_highlighted_item = g_brw_cntx.total_bookmark_items;
- }
- /* Existing bookmark is to be edited (Edit menu) */
- else
- {
- if (GetUCS2Flag((S8*) g_brw_bkm_selected_title))
- {
- g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].dcs = BRW_DCS_UCS;
- pfnUnicodeStrcpy(
- (S8*) (g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].title),
- (S8*) g_brw_bkm_selected_title);
- }
- else
- {
- g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].dcs = BRW_DCS_ASCII;
- UnicodeToAnsii(
- (S8*) (g_brw_cntx.bookmark_title_p[g_brw_cntx.index_highlighted_item].title),
- (S8*) g_brw_bkm_selected_title);
- }
- UnicodeToAnsii(
- (S8*) (g_brw_cntx.bookmark_url_p[g_brw_cntx.index_highlighted_item].url),
- (S8*) g_brw_bkm_selected_url);
- }
- mmi_brw_write_bookmark_to_nvram();
- if (edit_flag == BRW_STATUS_NO || edit_flag == BRW_STATUS_FROM_ENTER_ADDRESS
- || edit_flag == BRW_ADD_BKM_FROM_USE_URL)
- {
- g_brw_cntx.total_bookmark_items++;
- }
- else
- {
- edit_flag = BRW_STATUS_NO;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_confirm
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of bookmark
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_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_DELETE_BOOKMARK),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_brw_delete_bookmark, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_bookmark
- * DESCRIPTION
- * Delete the selected bookmark
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_delete_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 bkm_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (bkm_count = g_brw_cntx.index_highlighted_item; bkm_count < g_brw_cntx.total_bookmark_items - 1; bkm_count++)
- {
- memcpy(
- &g_brw_cntx.bookmark_title_p[bkm_count],
- &g_brw_cntx.bookmark_title_p[bkm_count + 1],
- sizeof(g_brw_cntx.bookmark_title_p[bkm_count]));
- memcpy(
- &g_brw_cntx.bookmark_url_p[bkm_count],
- &g_brw_cntx.bookmark_url_p[bkm_count + 1],
- sizeof(g_brw_cntx.bookmark_url_p[bkm_count]));
- }
- /* Set the last bookmark item as 0 */
- memset(
- &g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items - 1],
- 0,
- sizeof(g_brw_cntx.bookmark_title_p[g_brw_cntx.total_bookmark_items - 1]));
- memset(
- &g_brw_cntx.bookmark_url_p[g_brw_cntx.total_bookmark_items - 1],
- 0,
- sizeof(g_brw_cntx.bookmark_url_p[g_brw_cntx.total_bookmark_items - 1]));
- mmi_brw_write_bookmark_to_nvram();
- g_brw_cntx.total_bookmark_items--;
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_BRW_BOOKMARKS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_confirm_delete_all_bookmark
- * DESCRIPTION
- * This function displays the confirmation screen for deletion of all the bookmarks
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_confirm_delete_all_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- get_string(STR_ID_BRW_DELETE_ALL_BOOKMARK),
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_brw_delete_all_bookmark, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_delete_all_bookmark
- * DESCRIPTION
- * Deletes all the bookmarks
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_delete_all_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Set all the bookmark entries as '0' */
- memset(g_brw_cntx.bookmark_title_p, 0, (NVRAM_BRW_BOOKMARK_TITLE_SIZE * NVRAM_BRW_NUM_BOOKMARK_TITLE_RECORDS));
- memset(g_brw_cntx.bookmark_url_p, 0, (NVRAM_BRW_BOOKMARK_URL_SIZE * NVRAM_BRW_NUM_BOOKMARK_URL_RECORDS));
- mmi_brw_write_bookmark_to_nvram();
- g_brw_cntx.total_bookmark_items = 0;
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_BRW_BOOKMARKS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_goto_highlighted_bookmark
- * DESCRIPTION
- * This function fetches the current highlighted bookmark url
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_goto_highlighted_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AnsiiToUnicodeString(
- (S8*) brw_current_url,
- (S8*) g_brw_cntx.bookmark_url_p[g_brw_cntx.index_highlighted_item].url);
- /* added by tk to set the current fetch url */
- mmi_brw_set_current_url((S8*) brw_current_url);
- /* jdi call to fetch the url */
- mmi_brw_pre_entry_goto_url();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_read_bookmark_from_nvram
- * DESCRIPTION
- * This function reads bookmark from NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_read_bookmark_from_nvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 record_count;
- S16 NvramError;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Read bookmarks from NVRAM if not already read */
- if ((g_brw_cntx.bookmark_title_p == NULL) && (g_brw_cntx.bookmark_url_p == NULL))
- {
- g_brw_cntx.bookmark_title_p =
- (nvram_brw_bkm_title_struct*) jdd_MemAlloc(
- NVRAM_BRW_NUM_BOOKMARK_TITLE_RECORDS,
- NVRAM_BRW_BOOKMARK_TITLE_SIZE);
- g_brw_cntx.bookmark_url_p =
- (nvram_brw_bkm_url_struct*) jdd_MemAlloc(NVRAM_BRW_NUM_BOOKMARK_URL_RECORDS, NVRAM_BRW_BOOKMARK_URL_SIZE);
- memset(g_brw_cntx.bookmark_title_p, 0, (NVRAM_BRW_BOOKMARK_TITLE_SIZE * NVRAM_BRW_NUM_BOOKMARK_TITLE_RECORDS));
- memset(g_brw_cntx.bookmark_url_p, 0, (NVRAM_BRW_BOOKMARK_URL_SIZE * NVRAM_BRW_NUM_BOOKMARK_URL_RECORDS));
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_BOOKMARK_TITLE_RECORDS; record_count++)
- {
- ReadRecord(
- NVRAM_EF_BRW_BOOKMARK_TITLE_LID,
- record_count,
- &g_brw_cntx.bookmark_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_BOOKMARK_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_BOOKMARK_URL_RECORDS; record_count++)
- {
- ReadRecord(
- NVRAM_EF_BRW_BOOKMARK_URL_LID,
- record_count,
- &g_brw_cntx.bookmark_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_BOOKMARK_URL_SIZE,
- &NvramError);
- }
- mmi_brw_calculate_number_of_bookmarks_stored();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_write_bookmark_to_nvram
- * DESCRIPTION
- * This function writes bookmark data to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_write_bookmark_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_BOOKMARK_TITLE_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_BOOKMARK_TITLE_LID,
- record_count,
- &g_brw_cntx.bookmark_title_p[(record_count - 1) * TITLES_PER_RECORD],
- NVRAM_BRW_BOOKMARK_TITLE_SIZE,
- &NvramError);
- }
- for (record_count = 1; record_count <= NVRAM_BRW_NUM_BOOKMARK_URL_RECORDS; record_count++)
- {
- WriteRecord(
- NVRAM_EF_BRW_BOOKMARK_URL_LID,
- record_count,
- &g_brw_cntx.bookmark_url_p[(record_count - 1) * URLS_PER_RECORD],
- NVRAM_BRW_BOOKMARK_URL_SIZE,
- &NvramError);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_add_prov_bookmark
- * DESCRIPTION
- * This function provides external interface to save a bookmark
- * PARAMETERS
- * bkm_title_p [?]
- * bkm_url_p [?]
- * RETURNS
- * void
- *****************************************************************************/
- PROV_RETCODE mmi_brw_add_prov_bookmark(U8 *bkm_title_p, U8 *bkm_url_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 length = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_brw_read_bookmark_from_nvram();
- /* Bookmark list is full */
- if (g_brw_cntx.total_bookmark_items >= BRW_MAX_BOOKMARKS)
- {
- return PROV_BKM_FULL;
- }
- length = pfnUnicodeStrlen((PS8) bkm_title_p);
- memset((void*)g_brw_bkm_selected_title, 0, sizeof(g_brw_bkm_selected_title));
- if (GetUCS2Flag((S8*) bkm_title_p))
- {
- if (length > ((BRW_BKM_MAX_TITLE_LENGTH / 2) - 1))
- {
- length = ((BRW_BKM_MAX_TITLE_LENGTH / 2) - 1);
- }
- }
- else
- {
- if (length > (BRW_BKM_MAX_TITLE_LENGTH - 1))
- {
- length = (BRW_BKM_MAX_TITLE_LENGTH - 1);
- }
- }
- pfnUnicodeStrncpy((S8*) g_brw_bkm_selected_title, (S8*) bkm_title_p, length);
- memset((void*)g_brw_bkm_selected_url, 0, (BRW_BKM_MAX_URL_LENGTH) * ENCODING_LENGTH);
- length = pfnUnicodeStrlen((PS8) bkm_url_p);
- if ((pfnUnicodeStrncmp((PS8) bkm_url_p, (PS8) L"http://", 7) != 0) &&
- (pfnUnicodeStrncmp((PS8) bkm_url_p, (PS8) L"https://", 8) != 0))
- {
- AnsiiToUnicodeString((S8*) g_brw_bkm_selected_url, (S8*) ("http://"));
- length += 7;
- if (length >= BRW_BKM_MAX_URL_LENGTH)
- {
- length = BRW_BKM_MAX_URL_LENGTH - 1;
- }
- pfnUnicodeStrncat((S8*) g_brw_bkm_selected_url, (S8*) bkm_url_p, length - 7);
- }
- else
- {
- if (length >= BRW_BKM_MAX_URL_LENGTH)
- {
- length = BRW_BKM_MAX_URL_LENGTH - 1;
- }
- pfnUnicodeStrncat((S8*) g_brw_bkm_selected_url, (S8*) bkm_url_p, length);
- }
- /* Bookmark is to be added */
- edit_flag = BRW_STATUS_NO;
- if (mmi_brw_validate_url(g_brw_bkm_selected_url))
- {
- mmi_brw_save_bookmark_item();
- return PROV_BKM_OK;
- }
- else
- {
- return PROV_BKM_INVALID;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_bookmark_set_as_homepage
- * DESCRIPTION
- * This function sets the bookmark url as homepage
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_bookmark_set_as_homepage(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AnsiiToUnicodeString(
- (S8*) brw_current_url,
- (S8*) g_brw_cntx.bookmark_url_p[g_brw_cntx.index_highlighted_item].url);
- mmi_brw_set_as_homepage(brw_current_url);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_page_url_title_to_bookmark
- * DESCRIPTION
- * This function saves the current url title string and url string to bookmarklist.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_page_url_title_to_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* MMI_JDD_UI_WINDOW_INFO_STRUCT *jdd_window_info_struct_p = NULL; */
- JC_UINT32 uiWindowID = 0;
- U16 length = 0;
- U16 titleLength = 0;
- JC_PAGE_INFO PageInfo;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- uiWindowID = mmi_jdd_ui_get_appWindowID(E_TASK_BROWSER_CORE);
- mmi_brw_read_bookmark_from_nvram();
- /* If Bookmark list is full, Dispaly 'Bookmark list is full' */
- 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
- {
- jdi_BrowserGetCurrentPageInfo (pBrowserCtxt,&PageInfo);
- length = pfnUnicodeStrlen((PS8) PageInfo.psUrl);
- 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
- {
- titleLength = pfnUnicodeStrlen((PS8) PageInfo.psTitle);
- memset((void*)g_brw_bkm_selected_title, 0, sizeof(g_brw_bkm_selected_title));
- if (GetUCS2Flag((S8*) PageInfo.psTitle))
- {
- if (titleLength > ((BRW_BKM_MAX_TITLE_LENGTH / 2) - 1))
- {
- titleLength = ((BRW_BKM_MAX_TITLE_LENGTH / 2) - 1);
- }
- }
- else
- {
- if (titleLength > (BRW_BKM_MAX_TITLE_LENGTH - 1))
- {
- titleLength = (BRW_BKM_MAX_TITLE_LENGTH - 1);
- }
- }
- edit_flag = BRW_STATUS_NO;
- pfnUnicodeStrncpy(
- (S8*) g_brw_bkm_selected_title,
- (S8*) PageInfo.psTitle, titleLength);
- pfnUnicodeStrcpy((S8*) g_brw_bkm_selected_url, (S8*) PageInfo.psUrl);
- mmi_brw_save_ren_page_to_bookmark();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_ren_page_to_bookmark
- * DESCRIPTION
- * Function to save the Rendered page URL/Title to bookmark List.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_ren_page_to_bookmark(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_BOOL IsValidURL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IsValidURL = mmi_brw_validate_url(g_brw_bkm_selected_url);
- if (IsValidURL == MMI_TRUE)
- {
- mmi_brw_save_bookmark_item();
- g_brw_bkm_add_flag = 1;
- DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */
- #endif /* _MMI_JBROWSERMMIBOOKMARKS_C */