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

📄 jbrowsermmirenderedpage.c

📁 MTK_MMI的部分源代码,从code中大致了解到MMI的执行流程
💻 C
📖 第 1 页 / 共 3 页
字号:

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_ren_page_set_as_hompage
 * DESCRIPTION
 *  Handler for set as homepage option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_ren_page_set_as_hompage(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    JC_PAGE_INFO brwPageInfo;
    U32 len = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    jdi_BrowserGetCurrentPageInfo(pBrowserCtxt, &brwPageInfo);
    if (brwPageInfo.psUrl)
    {
        len = pfnUnicodeStrlen((S8*) brwPageInfo.psUrl);
        if (len >= NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN)
        {
            DisplayPopup((PU8) GetString(STR_ID_BRW_URL_LEN_EXCEED), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
        }
        else
        {
            pfnUnicodeStrcpy((S8*) brw_current_url, (S8*) brwPageInfo.psUrl);

            if (mmi_brw_validate_url(brw_current_url))
            {
                mmi_brw_set_as_homepage(brw_current_url);
            }
            else
            {
                DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
            }

        }
    }
    else
    {
        DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_exit_menu_highlight_hdlr
 * DESCRIPTION
 *  Highlight handler for exit option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_exit_menu_highlight_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
    SetLeftSoftkeyFunction(mmi_brw_entry_exit_menu, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_entry_exit_menu
 * DESCRIPTION
 *  Exit menu handler
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_entry_exit_menu(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
	mmi_brw_wap_deinit();
    /* Free the DO List for last rendered page */
    mmi_brw_free_do_list();

    /* Delete the rendered page from history */
    DeleteNHistory(1);

#ifdef __SATC3__
    if (g_brw_cntx.isSATURL == E_TRUE)
    {
        brw_send_termination_to_mmi(SAT_BROWSER_USER_TERMINATION);
    }
#endif /* __SATC3__ */ 

    /* Go to services menu if entered from wap otherwise go to last screen before rendered page */
    if (IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID))
    {
        GoBackToHistory(SERVICES_MAIN_MENU_SCREEN_ID);
    }
    else if (!IsScreenPresent(SERVICES_MAIN_MENU_SCREEN_ID) && IsScreenPresent(SCR_ID_BRW_INTERNET_SERVICES))
    {
        DisplayIdleScreen();
    }
    else
    {
        GoBackHistory();
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_ren_page_handle_do_element
 * DESCRIPTION
 *  Handle do tag
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_ren_page_handle_do_element()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 curr_highlighted_item;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    curr_highlighted_item = GetHighlightedItem();

    if ((curr_highlighted_item >= gGotoMenuCount) && (curr_highlighted_item <(g_brw_cntx.used_do_element_count + gGotoMenuCount)))
    {
        SetLeftSoftkeyFunction(mmi_brw_ren_page_process_do_element, KEY_EVENT_UP);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_ren_page_process_do_element
 * DESCRIPTION
 *  process the do element on the page
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_ren_page_process_do_element()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 curr_highlighted_index;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    curr_highlighted_index = GetHighlightedItem();
	g_brw_page_cntx.brw_isRefreshDisplay = MMI_TRUE;
	mmi_brw_clear_brw_soft_keys();

    GoBackHistory();

    jdi_BrowserProcessDoElement(pBrowserCtxt, g_brw_cntx.DoElementList[(curr_highlighted_index-gGotoMenuCount)]);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_free_do_list
 * DESCRIPTION
 *  Free the do element list
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_free_do_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 count = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_brw_cntx.DoElementList != NULL)
    {
        for (count = 0; count < g_brw_cntx.do_element_count; count++)
        {
            if (g_brw_cntx.DoElementList[count] != NULL)
            {
                if (g_brw_cntx.DoElementList[count]->pDoLabel != NULL)
                {
                    jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoLabel);
                    g_brw_cntx.DoElementList[count]->pDoLabel = NULL;
                }

                if (g_brw_cntx.DoElementList[count]->pDoType != NULL)
                {
                    jdd_MemFree(g_brw_cntx.DoElementList[count]->pDoType);
                    g_brw_cntx.DoElementList[count]->pDoType = NULL;
                }

                jdd_MemFree(g_brw_cntx.DoElementList[count]);
                g_brw_cntx.DoElementList[count] = NULL;
            }
        }

        jdd_MemFree(g_brw_cntx.DoElementList);
        g_brw_cntx.DoElementList = NULL;
        g_brw_cntx.do_element_count = 0;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_ren_page_download_image
 * DESCRIPTION
 *  Function to doanload the embedded image
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_ren_page_download_image(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    JC_RETCODE iRet;
    JC_MIME_INFO pMimeInfo;
    JC_MIME_INFO pMimeInfo_dl;
    JC_CHAR *filename;
    JDD_FSHANDLE fs_handle;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __USB_IN_NORMAL_MODE__
    if (mmi_usb_is_in_mass_storage_mode())
    {
        mmi_usb_app_unavailable_popup(0);
        return;
    }
#endif /* __USB_IN_NORMAL_MODE__ */

    jdi_BrowserGetCurrentControlMimeInfo(pBrowserCtxt, &pMimeInfo);
    jdd_FSGetDownloadFileName(&filename);

    if ((iRet = jdd_FSInitialize(&fs_handle)) == JC_OK)
    {
        JC_CHAR *content_fname;

        content_fname = (JC_CHAR*) jdd_FSFileNameTranslate(fs_handle, (JC_CHAR*) pMimeInfo.psFileName);
        if (content_fname == NULL)
        {
            DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_NOT_ENOUGH_MEMORY), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
            jdd_FSDeinitialize(fs_handle);
            return;
        }
        else
        {
            S32 result;

            result = pCopyFile((PU8) content_fname, (PU8) filename, 0);
            jdd_FSDeinitialize(fs_handle);
            jdd_MemFree(content_fname);

            if(result != FS_NO_ERROR)
            {
                if(result == FS_DISK_FULL)
                {
                    DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_FILE_SYSTEM_FULL), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
                }
                else
                {
					DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SAVE_FAILED), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
                }
                return;
            }
        }
    }
    else
    {
        DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
        return;
    }

    memset((void*)&pMimeInfo_dl, 0, sizeof(JC_MIME_INFO));

    pMimeInfo_dl.psContentType = pMimeInfo.psContentType;
    pMimeInfo_dl.psUrl = pMimeInfo.psUrl;
    pMimeInfo_dl.iBufferLen = pMimeInfo.iBufferLen;
    pMimeInfo_dl.psFileName = filename;

    iRet = jdd_MimeHandler(&pMimeInfo_dl);
    jdd_MemFree(filename);

    if (iRet != JC_OK)
    {
        DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
    }
}
#endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
#endif /* _MMI_JBROWSERMMIRENDEREDPAGE_C */ 

⌨️ 快捷键说明

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