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

📄 jbrowsermmibookmarks.c

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

⌨️ 快捷键说明

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