⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jbrowsermmiaddresshistory.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
            &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
            &NvramError);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_save_page_title_to_nvram
 * DESCRIPTION
 *  Function to save title in NVRAM.
 * PARAMETERS
 *  title_p     [?]     title to be saved
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_save_page_title_to_nvram(U8 *title_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 record_count;
    S16 NvramError;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (GetUCS2Flag((S8*) title_p))
    {
        g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_UCS;
        pfnUnicodeStrcpy((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
    }
    else
    {
        g_brw_cntx.address_history_title_p[0].dcs = BRW_DCS_ASCII;
        UnicodeToAnsii((S8*) g_brw_cntx.address_history_title_p[0].title, (S8*) title_p);
    }

    /* Only Title needs to be updated */
    for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
    {
        WriteRecord(
            NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
            record_count,
            &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
            &NvramError);
    }

    g_brw_add_hist_flag = 0;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_enter_address_delete_confirm
 * DESCRIPTION
 *  This function displays the confirmation screen for deletion of enter address url.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_enter_address_delete_confirm(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    DisplayConfirm(
        STR_GLOBAL_YES,
        IMG_GLOBAL_YES,
        STR_GLOBAL_NO,
        IMG_GLOBAL_NO,
        get_string(STR_ID_BRW_ENTER_ADR_DELETE),
        IMG_GLOBAL_QUESTION,
        WARNING_TONE);

    SetLeftSoftkeyFunction(mmi_brw_delete_enter_address, KEY_EVENT_UP);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_delete_enter_address
 * DESCRIPTION
 *  Delete the selected enter address url.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_delete_enter_address(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = g_brw_cntx.index_highlighted_item - 1; count < g_brw_cntx.total_address_history_items - 1; ++count)
    {
        memcpy(
            &g_brw_cntx.address_history_title_p[count],
            &g_brw_cntx.address_history_title_p[count + 1],
            sizeof(g_brw_cntx.address_history_title_p[count]));
        memcpy(
            &g_brw_cntx.address_history_url_p[count],
            &g_brw_cntx.address_history_url_p[count + 1],
            sizeof(g_brw_cntx.address_history_url_p[count]));
    }

    /* Set the last bookmark item as 0 */
    memset(
        &g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1],
        0,
        sizeof(g_brw_cntx.address_history_title_p[g_brw_cntx.total_address_history_items - 1]));
    memset(
        &g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1],
        0,
        sizeof(g_brw_cntx.address_history_url_p[g_brw_cntx.total_address_history_items - 1]));

    mmi_brw_write_enter_address_to_nvram();

    g_brw_cntx.total_address_history_items--;

    DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
	if (g_brw_cntx.total_address_history_items > 0)
	{
		DeleteUptoScrID(SCR_ID_BRW_ENTER_ADDRESS);
	}
	else
	{
		DeleteNHistory(2);
	}
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_write_enter_address_to_nvram
 * DESCRIPTION
 *  This function writes enter address url/title data to NVRAM
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_write_enter_address_to_nvram(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 record_count;
    S16 NvramError;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Read bookmarks from NVRAM if not already read */
    for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
    {
        WriteRecord(
            NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
            record_count,
            &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
            &NvramError);
    }

    for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
    {
        WriteRecord(
            NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
            record_count,
            &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
            &NvramError);
    }
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_enter_address_delete_all_confirm
 * DESCRIPTION
 *  This function displays the confirmation screen for deletion of enter address url List.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_enter_address_delete_all_confirm(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    DisplayConfirm(
        STR_GLOBAL_YES,
        IMG_GLOBAL_YES,
        STR_GLOBAL_NO,
        IMG_GLOBAL_NO,
        get_string(STR_ID_BRW_ENTER_ADR_DELETE_ALL),
        IMG_GLOBAL_QUESTION,
        WARNING_TONE);

    SetLeftSoftkeyFunction(mmi_brw_setting_delete_history_all, KEY_EVENT_UP);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_pre_entry_add_enter_address_bookmark
 * DESCRIPTION
 *  Pre Entry function for Enter Address Add To Bookmarks screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_pre_entry_add_enter_address_bookmark(void)
{
	U32 length = 0;

	length = strlen((PS8) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
	// Fill the bookmark list.
	mmi_brw_read_bookmark_from_nvram();

	if (length >= BRW_BKM_MAX_URL_LENGTH)
	{
		DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR,
			1, JBROWSER_POPUP_TIME, ERROR_TONE);
	}
	else if (g_brw_cntx.total_bookmark_items >= BRW_MAX_BOOKMARKS)
    {
		DisplayPopup((PU8) GetString(STR_ID_BRW_BOOKMARK_FULL),
			IMG_GLOBAL_ERROR,
			1,
			JBROWSER_POPUP_TIME,
			ERROR_TONE);

        SetLeftSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    }
	else {
		if (g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].dcs == BRW_DCS_UCS)
		{
			pfnUnicodeStrcpy((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
		}
		else
		{
			AnsiiToUnicodeString((S8*) g_brw_bkm_selected_title, (S8*) g_brw_cntx.address_history_title_p[g_brw_cntx.index_highlighted_item - 1].title);
		}
		AnsiiToUnicodeString((S8*) g_brw_bkm_selected_url,
			(S8*) g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1].url);
		/* Set edit flag */
		edit_flag = BRW_STATUS_FROM_ENTER_ADDRESS;

	mmi_brw_entry_add_bookmark_screen_for_all();
	}
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_enter_address_edit_menu
 * DESCRIPTION
 *  Entry function for Enter Address Edit Menu Item.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_enter_address_edit_menu(void)
{
	/* Open the editor to enter the url */
    memset(g_brw_hist_selected_title, 0, sizeof(g_brw_hist_selected_title));
    AnsiiToUnicodeString((S8*) g_brw_hist_selected_url,
		(S8*)&g_brw_cntx.address_history_url_p[g_brw_cntx.index_highlighted_item - 1] );
	/* EnterAddressOption Screen should not into history when we try to fetch url from
	Enter Address list. */
	ClearExitHandler();
    mmi_brw_entry_enter_url();
}

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_setting_delete_history_all
 * DESCRIPTION
 *  Deletes the Browser Setting History(Enter address list)
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_setting_delete_history_all(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 NvramError;
    U16 record_count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ((g_brw_cntx.address_history_title_p == NULL) && (g_brw_cntx.address_history_url_p == NULL))
    {
        g_brw_cntx.address_history_title_p =
            (nvram_brw_hist_title_struct*) jdd_MemAlloc(
                                            NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS,
                                            NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE);
        g_brw_cntx.address_history_url_p =
            (nvram_brw_hist_url_struct*) jdd_MemAlloc(
                                            NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS,
                                            NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE);
    }

    memset(
        g_brw_cntx.address_history_title_p,
        0,
        NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS);
    memset(
        g_brw_cntx.address_history_url_p,
        0,
        NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE * NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS);

    for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_TITLE_RECORDS; record_count++)
    {
        WriteRecord(
            NVRAM_EF_BRW_ADDRESS_HISTORY_TITLE_LID,
            record_count,
            &g_brw_cntx.address_history_title_p[(record_count - 1) * TITLES_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_TITLE_SIZE,
            &NvramError);
    }

    for (record_count = 1; record_count <= NVRAM_BRW_NUM_ADDRESS_HISTORY_URL_RECORDS; record_count++)
    {
        WriteRecord(
            NVRAM_EF_BRW_ADDRESS_HISTORY_URL_LID,
            record_count,
            &g_brw_cntx.address_history_url_p[(record_count - 1) * URLS_PER_RECORD],
            NVRAM_BRW_ADDRESS_HISTORY_URL_SIZE,
            &NvramError);
    }

    /* Free memory allocated to address history title */
    if (g_brw_cntx.address_history_title_p != NULL)
    {
        jdd_MemFree(g_brw_cntx.address_history_title_p);
        g_brw_cntx.address_history_title_p = NULL;
    }

    /* Free memory allocated to address history url */
    if (g_brw_cntx.address_history_url_p != NULL)
    {
        jdd_MemFree(g_brw_cntx.address_history_url_p);
        g_brw_cntx.address_history_url_p = NULL;
    }

    g_brw_cntx.total_address_history_items = 0;

    DisplayPopup(
        (PU8) GetString(STR_GLOBAL_DONE),
        IMG_GLOBAL_ACTIVATED,
        0,
        JBROWSER_POPUP_TIME,
        SUCCESS_TONE);

	DeleteNHistory(2);
}

#endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 

#endif /* _MMI_JBROWSERMMIADDRESSHISTORY_C */ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -