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

📄 jbrowsermmibookmarks.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
    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
 *****************************************************************************/

⌨️ 快捷键说明

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