📄 jbrowsermmiaddresshistory.c
字号:
*img_buff_p = get_image(gIndexIconsImageList[item_index]);
return TRUE;
}
/*****************************************************************************
* FUNCTION
* mmi_brw_hist_highlighted_item
* DESCRIPTION
* Function to get the highlighted item and call appropriate function.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_brw_hist_highlighted_item(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_brw_cntx.index_highlighted_item = (U8) GetHighlightedItem();
if (g_brw_cntx.index_highlighted_item == 0)
{
/* open the editor to enter the url */
memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
AnsiiToUnicodeString((S8*) g_brw_hist_selected_url, (S8*) ("http://"));
mmi_brw_entry_enter_url();
}
else
{
mmi_brw_entry_enter_address_options();
}
}
/*****************************************************************************
* FUNCTION
* mmi_brw_entry_enter_address_options
* DESCRIPTION
* Entry function for Enter Address Options screen.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_brw_entry_enter_address_options(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 UC_list_of_items[5];
U8 *guiBuffer;
S32 num_of_items;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
EntryNewScreen(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS, NULL, mmi_brw_entry_enter_address_options, NULL);
guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_ADDRESS_OPTIONS);
num_of_items = GetNumOfChild(MENU_ID_BRW_ENTER_ADR_OPTIONS);
GetSequenceStringIds(MENU_ID_BRW_ENTER_ADR_OPTIONS, UC_list_of_items);
SetParentHandler(MENU_ID_BRW_ENTER_ADR_OPTIONS);
RegisterHighlightHandler(ExecuteCurrHiliteHandler);
ShowCategory15Screen(
STR_GLOBAL_OPTIONS,
GetRootTitleIcon(SERVICES_WAP_MENU_ID),
STR_GLOBAL_OPTIONS,
0,
STR_GLOBAL_BACK,
0,
num_of_items,
UC_list_of_items,
(U16*) gIndexIconsImageList,
LIST_MENU,
0,
guiBuffer);
ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
/*****************************************************************************
* FUNCTION
* mmi_brw_entry_enter_url
* DESCRIPTION
* Entry function for full screen editor to enter the url.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_brw_entry_enter_url(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
EntryNewScreen(SCR_ID_BRW_ENTER_URL, NULL, mmi_brw_entry_enter_url, NULL);
guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_ENTER_URL);
ShowCategory5Screen(
STR_ID_BRW_ENTER_ADDRESS,
GetRootTitleIcon(SERVICES_WAP_MENU_ID),
STR_GLOBAL_OK,
0,
STR_GLOBAL_BACK,
0,
INPUT_TYPE_ALPHANUMERIC_LOWERCASE | INPUT_TYPE_OVERRIDE_DEFAULT | INPUT_TYPE_USE_ONLY_ENGLISH_MODES,
(U8*) g_brw_hist_selected_url,
BRW_ADDRESS_HISTORY_MAX_URL_LENGTH,
guiBuffer);
SetLeftSoftkeyFunction(mmi_brw_add_address_history_item, KEY_EVENT_UP);
SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}
/*****************************************************************************
* FUNCTION
* mmi_brw_add_address_history_item
* DESCRIPTION
* Function to add new item to the address history list.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_brw_add_address_history_item(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 hist_count;
U16 record_count;
S16 NvramError;
MMI_BOOL IsValidURL;
S8 url_string[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
U16 tempCount = 0;
S8 titleString[NVRAM_BRW_ADDRESS_HISTORY_MAX_TITLE_LENGTH * 2];
S8 urlString[NVRAM_BRW_ADDRESS_HISTORY_MAX_URL_LENGTH * 2];
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
IsValidURL = mmi_brw_validate_url(g_brw_hist_selected_url);
if (IsValidURL == MMI_TRUE)
{
pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
g_brw_add_hist_flag = 1;
g_brw_enter_add_flag = 1;
/* added by tk to set the current fetch url */
mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
/* fetch the url */
mmi_brw_pre_entry_goto_url();
/* Check if URL already exists. If exists then do not add this URL to the list. */
for (hist_count = 0; hist_count < g_brw_cntx.total_address_history_items; ++hist_count)
{
AnsiiToUnicodeString((S8*) url_string,
(S8*)&g_brw_cntx.address_history_url_p[hist_count].url );
if ((pfnUnicodeStrcmp((S8 *)g_brw_hist_selected_url, (S8 *)url_string)) == 0)
{
// Sandeep Start
if (g_brw_cntx.address_history_title_p[hist_count].dcs == BRW_DCS_UCS)
{
pfnUnicodeStrcpy(
(S8*) titleString,
(S8*) g_brw_cntx.address_history_title_p[hist_count].title);
}
else
{
AnsiiToUnicodeString(
(S8*) titleString,
(S8*) g_brw_cntx.address_history_title_p[hist_count].title);
}
strcpy((S8*) urlString,
(S8*) g_brw_cntx.address_history_url_p[hist_count].url);
// Sandeep End
for (tempCount = hist_count; tempCount > 0; --tempCount)
{
memcpy(
&g_brw_cntx.address_history_title_p[tempCount],
&g_brw_cntx.address_history_title_p[tempCount - 1],
sizeof(g_brw_cntx.address_history_title_p[tempCount]));
memcpy(
&g_brw_cntx.address_history_url_p[tempCount],
&g_brw_cntx.address_history_url_p[tempCount - 1],
sizeof(g_brw_cntx.address_history_url_p[tempCount]));
}
// Sandeep Start
if (GetUCS2Flag((S8*) titleString))
{
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
}
else
{
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) titleString);
}
strcpy((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) urlString);
// Sandeep End
mmi_brw_write_enter_address_to_nvram();
DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
return;
}
}
if (g_brw_cntx.total_address_history_items == 0)
{
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
}
else
{
for (hist_count = g_brw_cntx.total_address_history_items; hist_count >= 1; hist_count--)
{
if (hist_count != BRW_MAX_ADDRESS_HISTORY)
{
memcpy(
&g_brw_cntx.address_history_title_p[hist_count],
&g_brw_cntx.address_history_title_p[hist_count - 1],
sizeof(g_brw_cntx.address_history_title_p[hist_count]));
memcpy(
&g_brw_cntx.address_history_url_p[hist_count],
&g_brw_cntx.address_history_url_p[hist_count - 1],
sizeof(g_brw_cntx.address_history_url_p[hist_count]));
}
}
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
}
for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
{
WriteRecord(
NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
record_count,
&g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
&NvramError);
}
for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
{
WriteRecord(
NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
record_count,
&g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
&NvramError);
}
if (g_brw_cntx.total_address_history_items != BRW_MAX_ADDRESS_HISTORY)
{
g_brw_cntx.total_address_history_items++;
}
DeleteScreenIfPresent(SCR_ID_BRW_ENTER_URL);
}
else
{
DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
}
}
/*****************************************************************************
* FUNCTION
* mmi_brw_update_address_history_list
* DESCRIPTION
* Function to update the address history list.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_brw_update_address_history_list(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 hist_count;
U16 record_count;
S16 NvramError;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_brw_add_hist_flag = 1;
g_brw_enter_add_flag = 1; /* added by tk */
/* EnterAddressOption Screen should not into history when we try to fetch url from
Enter Address list. */
ClearExitHandler();
if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
{
pfnUnicodeStrcpy(
(S8*) g_brw_hist_selected_title,
(S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
}
else
{
AnsiiToUnicodeString(
(S8*) g_brw_hist_selected_title,
(S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
}
AnsiiToUnicodeString(
(S8*) g_brw_hist_selected_url,
(S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) g_brw_hist_selected_url);
/* added by tk to set the current fetch url */
mmi_brw_set_current_url((S8*) g_brw_hist_selected_url);
mmi_brw_pre_entry_goto_url();
for (hist_count = g_brw_cntx.index_highlighted_item - 1; hist_count >= 1; hist_count--)
{
if (hist_count != BRW_MAX_ADDRESS_HISTORY)
{
memcpy(
&g_brw_cntx.address_history_title_p[hist_count],
&g_brw_cntx.address_history_title_p[hist_count - 1],
sizeof(g_brw_cntx.address_history_title_p[hist_count]));
memcpy(
&g_brw_cntx.address_history_url_p[hist_count],
&g_brw_cntx.address_history_url_p[hist_count - 1],
sizeof(g_brw_cntx.address_history_url_p[hist_count]));
}
}
if (GetUCS2Flag((S8*) g_brw_hist_selected_title))
{
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
}
else
{
g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) g_brw_hist_selected_title);
}
UnicodeToAnsii((S8*) g_brw_cntx.address_history_url_p[0].url, (S8*) g_brw_hist_selected_url);
for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
{
WriteRecord(
NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
record_count,
&g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
&NvramError);
}
for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
{
WriteRecord(
NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
record_count,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -