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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * JBrowserMMIAddressHistory.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for address history implementation.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  *------------------------------------------------------------------------------
  72.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  73.  *============================================================================
  74.  ****************************************************************************/
  75. #ifndef _MMI_JBROWSERMMIADDRESSHISTORY_C
  76. #define _MMI_JBROWSERMMIADDRESSHISTORY_C
  77. /*  Include: MMI header file */
  78. #include "MMI_features.h"
  79. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  80. #include "PixtelDataTypes.h"
  81. #include "Unicodexdcl.h"
  82. #include "HistoryGprot.h"
  83. #include "GlobalDefs.h"
  84. #include "SettingProfile.h"
  85. #include "DebugInitDef.h"
  86. #include "CommonScreens.h"
  87. #include "EventsGprot.h"
  88. #include "wgui_inputs.h"
  89. #include "wgui_categories.h"
  90. #include "wgui_categories_inputs.h"
  91. #include "OrganizerDef.h"
  92. #include "DateTimeGprot.h"
  93. #include "TimerEvents.h"
  94. #include "wgui_categories_popup.h"
  95. #include "settingGprots.h"
  96. #include "JBrowserMMIDefs.h"
  97. #include "JBrowserMMIProts.h"
  98. #include "JBrowserMMITypes.h"
  99. #include "JBrowserMMIGprots.h"
  100. /*  Include: NVRAM header file */
  101. #include "NVRAMType.h"
  102. #include "NVRAMProt.h"
  103. #include "NVRAMEnum.h"
  104. /*  Include: Jataayu header file */
  105. #include "ddl.h"
  106. #include "jcal.h"
  107. #include "jdd_memapi.h"
  108. #include "browserlayout.h"
  109. #include "jdi_servicehandler.h"
  110. #include "fsm.h"
  111. U8 g_brw_add_hist_flag;
  112. static U8 g_brw_hist_selected_title[(BRW_ADDRESS_HISTORY_MAX_TITLE_LENGTH) * ENCODING_LENGTH];
  113. static U8 g_brw_hist_selected_url[(BRW_ADDRESS_HISTORY_MAX_URL_LENGTH) * ENCODING_LENGTH];
  114. U8 g_brw_enter_add_flag;    /* added by tk to set the highlighter to a 2nd position */
  115. /* Extern Function,variables */
  116. extern pBOOL GetUCS2Flag(PS8 buffer);
  117. /*****************************************************************************
  118.  * FUNCTION
  119.  *  mmi_brw_entry_enter_address
  120.  * DESCRIPTION
  121.  *  Entry function for enter address menu
  122.  * PARAMETERS
  123.  *  void
  124.  * RETURNS
  125.  *  void
  126.  *****************************************************************************/
  127. void mmi_brw_entry_enter_address(void)
  128. {
  129.     /*----------------------------------------------------------------*/
  130.     /* Local Variables                                                */
  131.     /*----------------------------------------------------------------*/
  132.     U8 *guiBuffer = NULL;
  133.     U16 record_count;
  134.     S16 NvramError;
  135.     U8 highlight_index = 0;
  136.     /*----------------------------------------------------------------*/
  137.     /* Code Body                                                      */
  138.     /*----------------------------------------------------------------*/
  139.     /* Read address history list from NVRAM if not already read */
  140.     if ((g_brw_cntx.address_history_title_p == NULL) && (g_brw_cntx.address_history_url_p == NULL))
  141.     {
  142.         g_brw_cntx.address_history_title_p =
  143.             (nvram_brw_hist_title_struct*) jdd_MemAlloc(
  144.                                             NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS,
  145.                                             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE);
  146.         g_brw_cntx.address_history_url_p =
  147.             (nvram_brw_hist_url_struct*) jdd_MemAlloc(
  148.                                             NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS,
  149.                                             NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE);
  150.         memset(
  151.             g_brw_cntx.address_history_title_p,
  152.             0,
  153.             (NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS));
  154.         memset(
  155.             g_brw_cntx.address_history_url_p,
  156.             0,
  157.             (NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS));
  158.         for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  159.         {
  160.             ReadRecord(
  161.                 NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  162.                 record_count,
  163.                 &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  164.                 NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  165.                 &NvramError);
  166.         }
  167.         for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
  168.         {
  169.             ReadRecord(
  170.                 NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
  171.                 record_count,
  172.                 &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
  173.                 NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
  174.                 &NvramError);
  175.         }
  176.         /* Calculate the number of entries */
  177.         mmi_brw_calculate_number_of_address_history_items_stored();
  178.     }
  179.     /* Open editor if no entries are present */
  180.     if (g_brw_cntx.total_address_history_items == 0)
  181.     {
  182.         AnsiiToUnicodeString((S8*) g_brw_hist_selected_url, (S8*) ("http://"));
  183.         mmi_brw_entry_enter_url();
  184.     }
  185.     else
  186.     {
  187.         EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS, NULL, mmi_brw_entry_enter_address, NULL);
  188.         guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS);
  189.         /* added by tk */
  190.         if (g_brw_enter_add_flag/* && guiBuffer != NULL && guiBuffer[2] != 0*/)
  191.         {
  192.             guiBuffer = NULL;
  193.             g_brw_enter_add_flag = 0;
  194.             highlight_index = 1;
  195.         }
  196.         
  197. RegisterHighlightHandler(mmi_brw_enter_address_scr_highlight_hdlr);
  198.         ShowCategory184Screen(
  199.             STR_ID_BRW_ENTER_ADDRESS,
  200.             GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  201.             STR_GLOBAL_OK,
  202.             0,
  203.             STR_GLOBAL_BACK,
  204.             0,
  205.             g_brw_cntx.total_address_history_items + 1,
  206.             mmi_brw_address_history_list_get_item,
  207.             0,
  208.             highlight_index,
  209.             guiBuffer);
  210.         SetLeftSoftkeyFunction(mmi_brw_hist_highlighted_item, KEY_EVENT_UP);
  211.         SetKeyHandler(mmi_brw_hist_highlighted_item, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  212.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  213.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  214.     }
  215. }
  216. /*****************************************************************************
  217.  * FUNCTION
  218.  *  mmi_brw_enter_address_scr_highlight_hdlr
  219.  * DESCRIPTION
  220.  *   --
  221.  * PARAMETERS
  222.  *  index [IN]
  223.  * RETURNS
  224.  *  void
  225.  *****************************************************************************/
  226. void mmi_brw_enter_address_scr_highlight_hdlr(S32 index)
  227. {
  228. if(index == 0)
  229. {
  230. ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  231. }
  232. else
  233. {
  234. ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  235. }
  236. }
  237. /*****************************************************************************
  238.  * FUNCTION
  239.  *  mmi_brw_calculate_number_of_address_history_items_stored
  240.  * DESCRIPTION
  241.  *  Function to calculate the total number of address history items stored
  242.  * PARAMETERS
  243.  *  void
  244.  * RETURNS
  245.  *  void
  246.  *****************************************************************************/
  247. void mmi_brw_calculate_number_of_address_history_items_stored(void)
  248. {
  249.     /*----------------------------------------------------------------*/
  250.     /* Local Variables                                                */
  251.     /*----------------------------------------------------------------*/
  252.     U16 history_count = 0;
  253.     /*----------------------------------------------------------------*/
  254.     /* Code Body                                                      */
  255.     /*----------------------------------------------------------------*/
  256.     for (history_count = 0; history_count < BRW_MAX_ADDRESS_HISTORY; history_count++)
  257.     {
  258.         if ((strlen((S8*) g_brw_cntx.address_history_title_p[history_count].title)) == 0)
  259.         {
  260.             /* If both title and url are '0' exit the loop */
  261.             if ((strlen((S8*) g_brw_cntx.address_history_url_p[history_count].url)) == 0)
  262.             {
  263.                 break;
  264.             }
  265.         }
  266.         g_brw_cntx.total_address_history_items++;
  267.     }
  268. }
  269. /*****************************************************************************
  270.  * FUNCTION
  271.  *  mmi_brw_address_history_list_get_item
  272.  * DESCRIPTION
  273.  *  Item call back function for dynamic list of address history
  274.  * PARAMETERS
  275.  *  item_index          [IN]        Highlighted item index
  276.  *  str_buff            [IN]        Buffer to be shown
  277.  *  img_buff_p          [?]         [?]         image to be shown
  278.  *  str_img_mask        [IN]        
  279.  * RETURNS
  280.  *  void
  281.  *****************************************************************************/
  282. pBOOL mmi_brw_address_history_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  283. {
  284.     /*----------------------------------------------------------------*/
  285.     /* Local Variables                                                */
  286.     /*----------------------------------------------------------------*/
  287.     S8 pOutBuffer[8];
  288.     /*----------------------------------------------------------------*/
  289.     /* Code Body                                                      */
  290.     /*----------------------------------------------------------------*/
  291.     if ((item_index < 0) || (item_index > BRW_MAX_ADDRESS_HISTORY))
  292.     {
  293.         return FALSE;
  294.     }
  295.     if (item_index == 0)
  296.     {
  297.         pfnUnicodeStrcpy((S8*) str_buff, GetString(STR_ID_BRW_ENTER_ADDRESS));
  298.     }
  299.     else
  300.     {
  301.         /* Display title if settings option is 'Show history by title' */
  302.         /* added by tk */
  303.         if (g_brw_cntx.show_history_as_url)
  304.             {
  305.                 /* truncate the URL to 38 charactes and append three '.'(dots) if the length of URL exceeds 
  306.                    MAX_SUBMENU_CHARACTERS charactes */
  307.                 if (strlen((S8*) g_brw_cntx.address_history_url_p[item_index - 1].url) > MAX_SUBMENU_CHARACTERS)
  308.                 {
  309.                     AnsiiNToUnicodeString(
  310.                         (S8*) str_buff,
  311.                         (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url,
  312.                         BRW_MAX_VISIBLE_URL_LENGTH);
  313.                     str_buff[BRW_MAX_VISIBLE_URL_LENGTH] = '';
  314.                     AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
  315.                     pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
  316.                 }
  317.                 else
  318.                 {
  319.                     AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url);
  320.                 }
  321.             }
  322.         else
  323.         {
  324.             if ((g_brw_cntx.address_history_title_p[item_index - 1].dcs == BRW_DCS_ASCII) &&
  325.                 (strlen((S8*) g_brw_cntx.address_history_title_p[item_index - 1].title) != 0))
  326.             {
  327.                 AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_title_p[item_index - 1].title);
  328.         }
  329.             else if ((g_brw_cntx.address_history_title_p[item_index - 1].dcs == BRW_DCS_UCS) &&
  330.                      (pfnUnicodeStrlen((S8*) g_brw_cntx.address_history_title_p[item_index - 1].title) != 0))
  331.             {
  332.                 pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_cntx.address_history_title_p[item_index - 1].title);
  333.             }
  334.             /* tk end */
  335.         else
  336.         {
  337.             /* truncate the URL to 38 charactes and append three '.'(dots) if the length of URL exceeds 
  338.                MAX_SUBMENU_CHARACTERS charactes */
  339.             if (strlen((S8*) g_brw_cntx.address_history_url_p[item_index - 1].url) > MAX_SUBMENU_CHARACTERS)
  340.             {
  341.                 AnsiiNToUnicodeString(
  342.                     (S8*) str_buff,
  343.                     (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url,
  344.                     BRW_MAX_VISIBLE_URL_LENGTH);
  345.                 str_buff[BRW_MAX_VISIBLE_URL_LENGTH] = '';
  346.                 AnsiiToUnicodeString(pOutBuffer, (S8*) "...");
  347.                 pfnUnicodeStrcat((S8*) str_buff, (S8*) pOutBuffer);
  348.             }
  349.             else
  350.             {
  351.                 AnsiiToUnicodeString((S8*) str_buff, (S8*) g_brw_cntx.address_history_url_p[item_index - 1].url);
  352.             }
  353.         }
  354.     }
  355.     }
  356.     *img_buff_p = get_image(gIndexIconsImageList[item_index]);
  357.     return TRUE;
  358. }
  359. /*****************************************************************************
  360.  * FUNCTION
  361.  *  mmi_brw_hist_highlighted_item
  362.  * DESCRIPTION
  363.  *  Function to get the highlighted item and call appropriate function.
  364.  * PARAMETERS
  365.  *  void
  366.  * RETURNS
  367.  *  void
  368.  *****************************************************************************/
  369. void mmi_brw_hist_highlighted_item(void)
  370. {
  371.     /*----------------------------------------------------------------*/
  372.     /* Local Variables                                                */
  373.     /*----------------------------------------------------------------*/
  374.     /*----------------------------------------------------------------*/
  375.     /* Code Body                                                      */
  376.     /*----------------------------------------------------------------*/
  377.     g_brw_cntx.index_highlighted_item = (U8) GetHighlightedItem();
  378.     if (g_brw_cntx.index_highlighted_item == 0)
  379.     {
  380.         /* open the editor to enter the url */
  381.         memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
  382.         AnsiiToUnicodeString((S8*) g_brw_hist_selected_url, (S8*) ("http://"));
  383.         mmi_brw_entry_enter_url();
  384.     }
  385.     else
  386.     {
  387. mmi_brw_entry_enter_address_options();
  388.     }
  389. }
  390. /*****************************************************************************
  391.  * FUNCTION
  392.  *  mmi_brw_entry_enter_address_options
  393.  * DESCRIPTION
  394.  *  Entry function for Enter Address Options screen.
  395.  * PARAMETERS
  396.  *  void
  397.  * RETURNS
  398.  *  void
  399.  *****************************************************************************/
  400. void mmi_brw_entry_enter_address_options(void)
  401. {
  402.     /*----------------------------------------------------------------*/
  403.     /* Local Variables                                                */
  404.     /*----------------------------------------------------------------*/
  405.     U16 UC_list_of_items[5];
  406.     U8 *guiBuffer;
  407.     S32 num_of_items;
  408.     /*----------------------------------------------------------------*/
  409.     /* Code Body                                                      */
  410.     /*----------------------------------------------------------------*/
  411.     EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS, NULL, mmi_brw_entry_enter_address_options, NULL);
  412.     guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS);
  413.     num_of_items = GetNumOfChild(MENU_ID_BRW_ENTER_ADR_OPTIONS);
  414.     GetSequenceStringIds(MENU_ID_BRW_ENTER_ADR_OPTIONS, UC_list_of_items);
  415.     SetParentHandler(MENU_ID_BRW_ENTER_ADR_OPTIONS);
  416.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  417.     ShowCategory15Screen(
  418.         STR_GLOBAL_OPTIONS,
  419.         GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  420.         STR_GLOBAL_OPTIONS,
  421.         0,
  422.         STR_GLOBAL_BACK,
  423.         0,
  424.         num_of_items,
  425.         UC_list_of_items,
  426.         (U16*) gIndexIconsImageList,
  427.         LIST_MENU,
  428.         0,
  429.         guiBuffer);
  430. ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  431.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  432.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  433. }
  434. /*****************************************************************************
  435.  * FUNCTION
  436.  *  mmi_brw_entry_enter_url
  437.  * DESCRIPTION
  438.  *  Entry function for full screen editor to enter the url.
  439.  * PARAMETERS
  440.  *  void
  441.  * RETURNS
  442.  *  void
  443.  *****************************************************************************/
  444. void mmi_brw_entry_enter_url(void)
  445. {
  446.     /*----------------------------------------------------------------*/
  447.     /* Local Variables                                                */
  448.     /*----------------------------------------------------------------*/
  449.     U8 *guiBuffer;
  450.     /*----------------------------------------------------------------*/
  451.     /* Code Body                                                      */
  452.     /*----------------------------------------------------------------*/
  453.     EntryNewScreen(SCR_ID_BRW_ENTER_URL, NULL, mmi_brw_entry_enter_url, NULL);
  454.     guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_URL);
  455.     ShowCategory5Screen(
  456.         STR_ID_BRW_ENTER_ADDRESS,
  457.         GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  458.         STR_GLOBAL_OK,
  459.         0,
  460.         STR_GLOBAL_BACK,
  461.         0,
  462.         INPUT_TYPE_ALPHANUMERIC_LOWERCASE | INPUT_TYPE_OVERRIDE_DEFAULT | INPUT_TYPE_USE_ONLY_ENGLISH_MODES,
  463.         (U8*) g_brw_hist_selected_url,
  464.         BRW_ADDRESS_HISTORY_MAX_URL_LENGTH,
  465.         guiBuffer);
  466.     SetLeftSoftkeyFunction(mmi_brw_add_address_history_item, KEY_EVENT_UP);
  467.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  468. }
  469. /*****************************************************************************
  470.  * FUNCTION
  471.  *  mmi_brw_add_address_history_item
  472.  * DESCRIPTION
  473.  *  Function to add new item to the address history list.
  474.  * PARAMETERS
  475.  *  void
  476.  * RETURNS
  477.  *  void
  478.  *****************************************************************************/
  479. void mmi_brw_add_address_history_item(void)
  480. {
  481.     /*----------------------------------------------------------------*/
  482.     /* Local Variables                                                */
  483.     /*----------------------------------------------------------------*/
  484.     U16 hist_count;
  485.     U16 record_count;
  486.     S16 NvramError;
  487.     MMI_BOOL IsValidURL;
  488. S8 url_string[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
  489. U16 tempCount = 0;
  490. S8 titleString[NVRAM_BRW_ADDRESS_HISTORY_MAX_TITLE_LENGTH * 2];
  491. S8 urlString[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
  492.     /*----------------------------------------------------------------*/
  493.     /* Code Body                                                      */
  494.     /*----------------------------------------------------------------*/
  495.     IsValidURL = mmi_brw_validate_url(g_brw_hist_selected_url);
  496.     if (IsValidURL == MMI_TRUE)
  497.     {
  498.         pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
  499. g_brw_add_hist_flag = 1;
  500. g_brw_enter_add_flag = 1; 
  501.         
  502.         /* added by tk to set the current fetch url */
  503.         mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
  504.         /* fetch the url */
  505.         mmi_brw_pre_entry_goto_url();
  506. /* Check if URL already exists. If exists then do not add this URL to the list. */
  507. for (hist_count = 0; hist_count < g_brw_cntx.total_address_history_items; ++hist_count)
  508.         {
  509. AnsiiToUnicodeString((S8*) url_string,
  510. (S8*)&g_brw_cntx.address_history_url_p[hist_count].url );
  511. if ((pfnUnicodeStrcmp((S8 *)g_brw_hist_selected_url, (S8 *)url_string)) == 0)
  512. {
  513. // Sandeep Start
  514.     if (g_brw_cntx.address_history_title_p[hist_count].dcs == BRW_DCS_UCS)
  515. {
  516. pfnUnicodeStrcpy(
  517. (S8*) titleString,
  518. (S8*) g_brw_cntx.address_history_title_p[hist_count].title);
  519. }
  520. else
  521. {
  522. AnsiiToUnicodeString(
  523. (S8*) titleString,
  524. (S8*) g_brw_cntx.address_history_title_p[hist_count].title);
  525. }
  526. strcpy((S8*) urlString,
  527. (S8*) g_brw_cntx.address_history_url_p[hist_count].url);
  528. // Sandeep End
  529. for (tempCount = hist_count; tempCount > 0; --tempCount)
  530. {
  531. memcpy(
  532.                         &g_brw_cntx.address_history_title_p[tempCount],
  533.                         &g_brw_cntx.address_history_title_p[tempCount - 1],
  534.                         sizeof(g_brw_cntx.address_history_title_p[tempCount]));
  535.                     memcpy(
  536.                         &g_brw_cntx.address_history_url_p[tempCount],
  537.                         &g_brw_cntx.address_history_url_p[tempCount - 1],
  538.                         sizeof(g_brw_cntx.address_history_url_p[tempCount]));
  539. }
  540. // Sandeep Start
  541. if (GetUCS2Flag((S8*) titleString))
  542. {
  543. g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
  544. pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
  545. }
  546. else
  547. {
  548. g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
  549. UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
  550. }
  551. strcpy((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) urlString);
  552. // Sandeep End
  553. mmi_brw_write_enter_address_to_nvram();
  554. DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
  555. return;
  556. }
  557. }
  558.         if (g_brw_cntx.total_address_history_items == 0)
  559.         {
  560.             g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
  561.             UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
  562.             UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
  563.         }
  564.         else
  565.         {
  566.             for (hist_count = g_brw_cntx.total_address_history_items; hist_count >= 1; hist_count--)
  567.             {
  568.                 if (hist_count != BRW_MAX_ADDRESS_HISTORY)
  569.                 {
  570.                     memcpy(
  571.                         &g_brw_cntx.address_history_title_p[hist_count],
  572.                         &g_brw_cntx.address_history_title_p[hist_count - 1],
  573.                         sizeof(g_brw_cntx.address_history_title_p[hist_count]));
  574.                     memcpy(
  575.                         &g_brw_cntx.address_history_url_p[hist_count],
  576.                         &g_brw_cntx.address_history_url_p[hist_count - 1],
  577.                         sizeof(g_brw_cntx.address_history_url_p[hist_count]));
  578.                 }
  579.             }
  580.             g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
  581.             UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
  582.             UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
  583.         }
  584.         for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  585.         {
  586.             WriteRecord(
  587.                 NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  588.                 record_count,
  589.                 &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  590.                 NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  591.                 &NvramError);
  592.         }
  593.         for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
  594.         {
  595.             WriteRecord(
  596.                 NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
  597.                 record_count,
  598.                 &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
  599.                 NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
  600.                 &NvramError);
  601.         }
  602.         if (g_brw_cntx.total_address_history_items != BRW_MAX_ADDRESS_HISTORY)
  603.         {
  604.             g_brw_cntx.total_address_history_items++;
  605.         }
  606.         DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
  607.     }
  608.     else
  609.     {
  610.         DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  611.     }
  612. }
  613. /*****************************************************************************
  614.  * FUNCTION
  615.  *  mmi_brw_update_address_history_list
  616.  * DESCRIPTION
  617.  *  Function to update the address history list.
  618.  * PARAMETERS
  619.  *  void
  620.  * RETURNS
  621.  *  void
  622.  *****************************************************************************/
  623. void mmi_brw_update_address_history_list(void)
  624. {
  625.     /*----------------------------------------------------------------*/
  626.     /* Local Variables                                                */
  627.     /*----------------------------------------------------------------*/
  628.     U16 hist_count;
  629.     U16 record_count;
  630.     S16 NvramError;
  631.     /*----------------------------------------------------------------*/
  632.     /* Code Body                                                      */
  633.     /*----------------------------------------------------------------*/
  634.     g_brw_add_hist_flag = 1;
  635.     g_brw_enter_add_flag = 1;   /* added by tk */
  636. /* EnterAddressOption Screen should not into history when we try to fetch url from
  637. Enter Address list. */
  638. ClearExitHandler();
  639.     if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
  640.     {
  641.         pfnUnicodeStrcpy(
  642.             (S8*) g_brw_hist_selected_title,
  643.             (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
  644.     }
  645.     else
  646.     {
  647.         AnsiiToUnicodeString(
  648.             (S8*) g_brw_hist_selected_title,
  649.             (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
  650.     }
  651.     AnsiiToUnicodeString(
  652.         (S8*) g_brw_hist_selected_url,
  653.         (S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
  654.     pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
  655.     /* added by tk to set the current fetch url */
  656.     mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
  657.     mmi_brw_pre_entry_goto_url();
  658.     for (hist_count = g_brw_cntx.index_highlighted_item - 1; hist_count >= 1; hist_count--)
  659.     {
  660.         if (hist_count != BRW_MAX_ADDRESS_HISTORY)
  661.         {
  662.             memcpy(
  663.                 &g_brw_cntx.address_history_title_p[hist_count],
  664.                 &g_brw_cntx.address_history_title_p[hist_count - 1],
  665.                 sizeof(g_brw_cntx.address_history_title_p[hist_count]));
  666.             memcpy(
  667.                 &g_brw_cntx.address_history_url_p[hist_count],
  668.                 &g_brw_cntx.address_history_url_p[hist_count - 1],
  669.                 sizeof(g_brw_cntx.address_history_url_p[hist_count]));
  670.         }
  671.     }
  672.     if (GetUCS2Flag((S8*) g_brw_hist_selected_title))
  673.     {
  674.         g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
  675.         pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
  676.     }
  677.     else
  678.     {
  679.         g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
  680.         UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
  681.     }
  682.     UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
  683.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  684.     {
  685.         WriteRecord(
  686.             NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  687.             record_count,
  688.             &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  689.             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  690.             &NvramError);
  691.     }
  692.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
  693.     {
  694.         WriteRecord(
  695.             NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
  696.             record_count,
  697.             &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
  698.             NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
  699.             &NvramError);
  700.     }
  701. }
  702. /*****************************************************************************
  703.  * FUNCTION
  704.  *  mmi_brw_save_page_title_to_nvram
  705.  * DESCRIPTION
  706.  *  Function to save title in NVRAM.
  707.  * PARAMETERS
  708.  *  title_p     [?]     title to be saved
  709.  * RETURNS
  710.  *  void
  711.  *****************************************************************************/
  712. void mmi_brw_save_page_title_to_nvram(U8 *title_p)
  713. {
  714.     /*----------------------------------------------------------------*/
  715.     /* Local Variables                                                */
  716.     /*----------------------------------------------------------------*/
  717.     U16 record_count;
  718.     S16 NvramError;
  719.     /*----------------------------------------------------------------*/
  720.     /* Code Body                                                      */
  721.     /*----------------------------------------------------------------*/
  722.     if (GetUCS2Flag((S8*) title_p))
  723.     {
  724.         g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
  725.         pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
  726.     }
  727.     else
  728.     {
  729.         g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
  730.         UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
  731.     }
  732.     /* Only Title needs to be updated */
  733.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  734.     {
  735.         WriteRecord(
  736.             NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  737.             record_count,
  738.             &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  739.             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  740.             &NvramError);
  741.     }
  742.     g_brw_add_hist_flag = 0;
  743. }
  744. /*****************************************************************************
  745.  * FUNCTION
  746.  *  mmi_brw_enter_address_delete_confirm
  747.  * DESCRIPTION
  748.  *  This function displays the confirmation screen for deletion of enter address url.
  749.  * PARAMETERS
  750.  *  void
  751.  * RETURNS
  752.  *  void
  753.  *****************************************************************************/
  754. void mmi_brw_enter_address_delete_confirm(void)
  755. {
  756.     /*----------------------------------------------------------------*/
  757.     /* Local Variables                                                */
  758.     /*----------------------------------------------------------------*/
  759.     /*----------------------------------------------------------------*/
  760.     /* Code Body                                                      */
  761.     /*----------------------------------------------------------------*/
  762.     DisplayConfirm(
  763.         STR_GLOBAL_YES,
  764.         IMG_GLOBAL_YES,
  765.         STR_GLOBAL_NO,
  766.         IMG_GLOBAL_NO,
  767.         get_string(STR_ID_BRW_ENTER_ADR_DELETE),
  768.         IMG_GLOBAL_QUESTION,
  769.         WARNING_TONE);
  770.     SetLeftSoftkeyFunction(mmi_brw_delete_enter_address, KEY_EVENT_UP);
  771.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  772. }
  773. /*****************************************************************************
  774.  * FUNCTION
  775.  *  mmi_brw_delete_enter_address
  776.  * DESCRIPTION
  777.  *  Delete the selected enter address url.
  778.  * PARAMETERS
  779.  *  void
  780.  * RETURNS
  781.  *  void
  782.  *****************************************************************************/
  783. void mmi_brw_delete_enter_address(void)
  784. {
  785.     /*----------------------------------------------------------------*/
  786.     /* Local Variables                                                */
  787.     /*----------------------------------------------------------------*/
  788.     U16 count;
  789.     /*----------------------------------------------------------------*/
  790.     /* Code Body                                                      */
  791.     /*----------------------------------------------------------------*/
  792.     for (count = g_brw_cntx.index_highlighted_item - 1; count < g_brw_cntx.total_address_history_items - 1; ++count)
  793.     {
  794.         memcpy(
  795.             &g_brw_cntx.address_history_title_p[count],
  796.             &g_brw_cntx.address_history_title_p[count + 1],
  797.             sizeof(g_brw_cntx.address_history_title_p[count]));
  798.         memcpy(
  799.             &g_brw_cntx.address_history_url_p[count],
  800.             &g_brw_cntx.address_history_url_p[count + 1],
  801.             sizeof(g_brw_cntx.address_history_url_p[count]));
  802.     }
  803.     /* Set the last bookmark item as 0 */
  804.     memset(
  805.         &g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1],
  806.         0,
  807.         sizeof(g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1]));
  808.     memset(
  809.         &g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1],
  810.         0,
  811.         sizeof(g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1]));
  812.     mmi_brw_write_enter_address_to_nvram();
  813.     g_brw_cntx.total_address_history_items--;
  814.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
  815. if (g_brw_cntx.total_address_history_items > 0)
  816. {
  817. DeleteUptoScrID(SCR_ID_BRW_ENTER_ADDRESS);
  818. }
  819. else
  820. {
  821. DeleteNHistory(2);
  822. }
  823. }
  824. /*****************************************************************************
  825.  * FUNCTION
  826.  *  mmi_brw_write_enter_address_to_nvram
  827.  * DESCRIPTION
  828.  *  This function writes enter address url/title data to NVRAM
  829.  * PARAMETERS
  830.  *  void
  831.  * RETURNS
  832.  *  void
  833.  *****************************************************************************/
  834. void mmi_brw_write_enter_address_to_nvram(void)
  835. {
  836.     /*----------------------------------------------------------------*/
  837.     /* Local Variables                                                */
  838.     /*----------------------------------------------------------------*/
  839.     U16 record_count;
  840.     S16 NvramError;
  841.     /*----------------------------------------------------------------*/
  842.     /* Code Body                                                      */
  843.     /*----------------------------------------------------------------*/
  844.     /* Read bookmarks from NVRAM if not already read */
  845.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  846.     {
  847.         WriteRecord(
  848.             NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  849.             record_count,
  850.             &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  851.             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  852.             &NvramError);
  853.     }
  854.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
  855.     {
  856.         WriteRecord(
  857.             NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
  858.             record_count,
  859.             &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
  860.             NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
  861.             &NvramError);
  862.     }
  863. }
  864. /*****************************************************************************
  865.  * FUNCTION
  866.  *  mmi_brw_enter_address_delete_all_confirm
  867.  * DESCRIPTION
  868.  *  This function displays the confirmation screen for deletion of enter address url List.
  869.  * PARAMETERS
  870.  *  void
  871.  * RETURNS
  872.  *  void
  873.  *****************************************************************************/
  874. void mmi_brw_enter_address_delete_all_confirm(void)
  875. {
  876.     /*----------------------------------------------------------------*/
  877.     /* Local Variables                                                */
  878.     /*----------------------------------------------------------------*/
  879.     /*----------------------------------------------------------------*/
  880.     /* Code Body                                                      */
  881.     /*----------------------------------------------------------------*/
  882.     DisplayConfirm(
  883.         STR_GLOBAL_YES,
  884.         IMG_GLOBAL_YES,
  885.         STR_GLOBAL_NO,
  886.         IMG_GLOBAL_NO,
  887.         get_string(STR_ID_BRW_ENTER_ADR_DELETE_ALL),
  888.         IMG_GLOBAL_QUESTION,
  889.         WARNING_TONE);
  890.     SetLeftSoftkeyFunction(mmi_brw_setting_delete_history_all, KEY_EVENT_UP);
  891.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  892. }
  893. /*****************************************************************************
  894.  * FUNCTION
  895.  *  mmi_brw_pre_entry_add_enter_address_bookmark
  896.  * DESCRIPTION
  897.  *  Pre Entry function for Enter Address Add To Bookmarks screen
  898.  * PARAMETERS
  899.  *  void
  900.  * RETURNS
  901.  *  void
  902.  *****************************************************************************/
  903. void mmi_brw_pre_entry_add_enter_address_bookmark(void)
  904. {
  905. U32 length = 0;
  906. length = strlen((PS8) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
  907. // Fill the bookmark list.
  908. mmi_brw_read_bookmark_from_nvram();
  909. if (length >= BRW_BKM_MAX_URL_LENGTH)
  910. {
  911. DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR,
  912. 1, JBROWSER_POPUP_TIME, ERROR_TONE);
  913. }
  914. else if (g_brw_cntx.total_bookmark_items >= BRW_MAX_BOOKMARKS)
  915.     {
  916. DisplayPopup((PU8) GetString(STR_ID_BRW_BOOKMARK_FULL),
  917. IMG_GLOBAL_ERROR,
  918. 1,
  919. JBROWSER_POPUP_TIME,
  920. ERROR_TONE);
  921.         SetLeftSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  922.     }
  923. else {
  924. if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
  925. {
  926. pfnUnicodeStrcpy((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
  927. }
  928. else
  929. {
  930. AnsiiToUnicodeString((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
  931. }
  932. AnsiiToUnicodeString((S8*) g_brw_bkm_selected_url,
  933. (S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
  934. /* Set edit flag */
  935. edit_flag = BRW_STATUS_FROM_ENTER_ADDRESS;
  936. mmi_brw_entry_add_bookmark_screen_for_all();
  937. }
  938. }
  939. /*****************************************************************************
  940.  * FUNCTION
  941.  *  mmi_brw_enter_address_edit_menu
  942.  * DESCRIPTION
  943.  *  Entry function for Enter Address Edit Menu Item.
  944.  * PARAMETERS
  945.  *  void
  946.  * RETURNS
  947.  *  void
  948.  *****************************************************************************/
  949. void mmi_brw_enter_address_edit_menu(void)
  950. {
  951. /* Open the editor to enter the url */
  952.     memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
  953.     AnsiiToUnicodeString((S8*) g_brw_hist_selected_url,
  954. (S8*)&g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1] );
  955. /* EnterAddressOption Screen should not into history when we try to fetch url from
  956. Enter Address list. */
  957. ClearExitHandler();
  958.     mmi_brw_entry_enter_url();
  959. }
  960. /*****************************************************************************
  961.  * FUNCTION
  962.  *  mmi_brw_setting_delete_history_all
  963.  * DESCRIPTION
  964.  *  Deletes the Browser Setting History(Enter address list)
  965.  * PARAMETERS
  966.  *  void
  967.  * RETURNS
  968.  *  void
  969.  *****************************************************************************/
  970. void mmi_brw_setting_delete_history_all(void)
  971. {
  972.     /*----------------------------------------------------------------*/
  973.     /* Local Variables                                                */
  974.     /*----------------------------------------------------------------*/
  975.     S16 NvramError;
  976.     U16 record_count;
  977.     /*----------------------------------------------------------------*/
  978.     /* Code Body                                                      */
  979.     /*----------------------------------------------------------------*/
  980.     if ((g_brw_cntx.address_history_title_p == NULL) && (g_brw_cntx.address_history_url_p == NULL))
  981.     {
  982.         g_brw_cntx.address_history_title_p =
  983.             (nvram_brw_hist_title_struct*) jdd_MemAlloc(
  984.                                             NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS,
  985.                                             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE);
  986.         g_brw_cntx.address_history_url_p =
  987.             (nvram_brw_hist_url_struct*) jdd_MemAlloc(
  988.                                             NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS,
  989.                                             NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE);
  990.     }
  991.     memset(
  992.         g_brw_cntx.address_history_title_p,
  993.         0,
  994.         NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS);
  995.     memset(
  996.         g_brw_cntx.address_history_url_p,
  997.         0,
  998.         NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS);
  999.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
  1000.     {
  1001.         WriteRecord(
  1002.             NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
  1003.             record_count,
  1004.             &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
  1005.             NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
  1006.             &NvramError);
  1007.     }
  1008.     for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
  1009.     {
  1010.         WriteRecord(
  1011.             NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
  1012.             record_count,
  1013.             &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
  1014.             NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
  1015.             &NvramError);
  1016.     }
  1017.     /* Free memory allocated to address history title */
  1018.     if (g_brw_cntx.address_history_title_p != NULL)
  1019.     {
  1020.         jdd_MemFree(g_brw_cntx.address_history_title_p);
  1021.         g_brw_cntx.address_history_title_p = NULL;
  1022.     }
  1023.     /* Free memory allocated to address history url */
  1024.     if (g_brw_cntx.address_history_url_p != NULL)
  1025.     {
  1026.         jdd_MemFree(g_brw_cntx.address_history_url_p);
  1027.         g_brw_cntx.address_history_url_p = NULL;
  1028.     }
  1029.     g_brw_cntx.total_address_history_items = 0;
  1030.     DisplayPopup(
  1031.         (PU8) GetString(STR_GLOBAL_DONE),
  1032.         IMG_GLOBAL_ACTIVATED,
  1033.         0,
  1034.         JBROWSER_POPUP_TIME,
  1035.         SUCCESS_TONE);
  1036. DeleteNHistory(2);
  1037. }
  1038. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  1039. #endif /* _MMI_JBROWSERMMIADDRESSHISTORY_C */