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

📄 jprofileuihandler.c

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

    U16 activated_profile_image[NVRAM_WAP_PROFILE_MAX] = {0, };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
	g_prov_pend_set = 0;

    activated_index = mmi_ph_get_activated_profile_index();

    activated_profile_image[activated_index] = IMG_ID_PROF_HDLR_SET_ACTIVATED_PROFILE;

    EntryNewScreen(SCR_ID_PROF_HDLR_PROF_LIST, NULL, mmi_ph_entry_show_profile_list_menu, NULL);

    gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_PROF_LIST);

    RegisterHighlightHandler(mmi_ph_highlight_select_profile);

    mmi_ph_get_profile_name_list();

    ShowCategory53Screen(
        STR_ID_PROF_HDLR_SELECT_PROF_CAPTION,
       // GetRootTitleIcon(SERVICES_WAP_MENU_ID),
	   GetRootTitleIcon(g_ph_title_img_id),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        NVRAM_WAP_PROFILE_MAX,
        (U8 **) subMenuDataPtrs,
        (PU16) activated_profile_image,
        0,
        0,
        activated_index,
        gui_buffer_p);

    /* Register function for left soft key */

    if ((g_ph_cntx.profile_module == PH_BROWSER_PROV_PROFILE) || (g_ph_cntx.profile_module == PH_MMS_PROV_PROFILE))/*This will handle the provising setting*/
    {
        SetLeftSoftkeyFunction(mmi_prov_get_dataaccount_data, KEY_EVENT_UP);
        SetKeyHandler(mmi_prov_get_dataaccount_data, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

        /* Register function for right soft key */
        SetRightSoftkeyFunction(mmi_prov_handle_back, KEY_EVENT_UP);
        SetKeyHandler(mmi_prov_handle_back, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

        SetKeyHandler(mmi_prov_handle_cancel, KEY_END, KEY_EVENT_DOWN);
    }
    else
    {
        SetLeftSoftkeyFunction(mmi_ph_entry_select_editable_profile, KEY_EVENT_UP);
        SetKeyHandler(mmi_ph_entry_select_editable_profile, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

        /* Register function for right soft key */
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_entry_select_editable_profile
 * DESCRIPTION
 *  This is entry function for the screen showing menu items (Activate ,Edit profile )
 *  for any selected profile
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_entry_select_editable_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    U8 *gui_buffer_p;   /* Buffer holding history data */
    S32 num_of_item;    /* Stores no of children in the submenu */
    S8 profile_name_string[(NVRAM_WAP_PROFILE_NAME_LEN + 1) * ENCODING_LENGTH];
    U32 count;
    U16 nStrItemList[2];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_PROF_HDLR_SELECTED_PROFILE, NULL, mmi_ph_entry_select_editable_profile, NULL);

    gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_SELECTED_PROFILE);

    num_of_item = GetNumOfChild(MENU_ID_PH_SELECT_PROFILE);
    GetSequenceStringIds(MENU_ID_PH_SELECT_PROFILE, nStrItemList);
    SetParentHandler(MENU_ID_PH_SELECT_PROFILE);

    for (count = 0; count < num_of_item; count++)
    {
        memset((S8*) subMenuDataPtrs[count], 0, MAX_SUB_MENU_SIZE);
        pfnUnicodeStrncpy((S8*) subMenuDataPtrs[count], (S8*) GetString(nStrItemList[count]), MAX_SUBMENU_CHARACTERS);
    }

    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
    {
        if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
        {
            AnsiiToUnicodeString(
                (S8*) profile_name_string,
                (S8*) g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name);
        }
        else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
        {
            UCS2Strcpy(
                (S8*) profile_name_string,
                (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name));
        }
    }
    else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
    {
        if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
        {
            AnsiiToUnicodeString(
                (S8*) profile_name_string,
                (S8*) g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name);
        }
        else if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
        {
            UCS2Strcpy(
                (S8*) profile_name_string,
                (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name));
        }
    }

    ShowCategory353Screen(
        (U8*) (profile_name_string),
        //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
		GetRootTitleIcon(g_ph_title_img_id),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        num_of_item,
        (U8 **) subMenuDataPtrs,
        (U16*) gIndexIconsImageList,
        NULL,
        0,
        0,
        gui_buffer_p);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_activate_profile_highlight_hdlr
 * DESCRIPTION
 *  It is the highlight handler for the MENU_ID_PH_SELECT_PROFILE_ACTIVATE menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_activate_profile_highlight_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);

    SetLeftSoftkeyFunction(mmi_ph_entry_activate_selected_profile, KEY_EVENT_UP);
    /* SetKeyHandler(mmi_ph_entry_activate_selected_profile,KEY_RIGHT_ARROW,KEY_EVENT_DOWN); */

}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_edit_profile_highlight_hdlr
 * DESCRIPTION
 *  *  It is the highlight handler for the MENU_ID_PH_SELECT_PROFILE_EDIT menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_edit_profile_highlight_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
    ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);

    SetLeftSoftkeyFunction(mmi_ph_pre_entry_edit_selected_profile, KEY_EVENT_UP);
    SetKeyHandler(mmi_ph_pre_entry_edit_selected_profile, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_highlight_select_profile
 * DESCRIPTION
 *  This gets the highlighted index and stores it into global profile index
 * PARAMETERS
 *  index       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_highlight_select_profile(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_ph_cntx.profile_index = (U8) index;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_pre_entry_edit_selected_profile
 * DESCRIPTION
 *  It is the pre entry function for the edit profile screen,in this the profiel content data is
 *  extracted from the NVRAM & data account info is requested ,on the response of data account
 *  edit profile entry function is called
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_pre_entry_edit_selected_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_ph_done_flag = 0x00;
    mmi_ph_get_selected_profile_content_data(g_ph_cntx.profile_index);
    DataAccountReadyCheck(mmi_ph_handle_get_data_account_name);
    /* mmi_ph_handle_get_data_account_name(); */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_entry_edit_selected_profile
 * DESCRIPTION
 *  It is the entry function for the edit profile screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_entry_edit_selected_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *input_buffer_p; /* added for inline edit history */
    U8 *gui_buffer_p;   /* Buffer holding history data */
    U16 input_buffer_size;
    U16 EditProfileIconList[MAX_INLINE_ITEM_EDIT_PROFILE_LIST] = {IMG_GLOBAL_L1, 0, IMG_GLOBAL_L2, 0,
        IMG_GLOBAL_L3, 0, IMG_GLOBAL_L4, 0,
        IMG_GLOBAL_L5, 0, IMG_GLOBAL_L6, 0
    };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_PROF_HDLR_EDIT_PROFILE, mmi_ph_exit_edit_selected_profile, NULL, NULL);

    InitializeCategory57Screen();

    gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_EDIT_PROFILE);
    input_buffer_p = GetCurrNInputBuffer(SCR_ID_PROF_HDLR_EDIT_PROFILE, &input_buffer_size);    /* added for inline edit history */

    mmi_ph_selected_profile_fill_inline_struct();

    if (input_buffer_p != NULL)
    {
        SetCategory57Data(wgui_inline_items, MAX_INLINE_ITEM_EDIT_PROFILE_LIST, input_buffer_p);
    }

    if ((GetInlineDoneFlag(gui_buffer_p) == 0) && (g_ph_done_flag == 0x01))
    {
        SetInlineDoneFlag(gui_buffer_p);
    }

    RegisterHighlightHandler(mmi_ph_highlight_inline_item);

    ShowCategory57Screen(
        STR_ID_BRW_EDIT_PROFILE,
        //GetRootTitleIcon(SERVICES_WAP_MENU_ID), /* modified by tk */
		GetRootTitleIcon(g_ph_title_img_id),
        STR_GLOBAL_EDIT,
        NULL,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        MAX_INLINE_ITEM_EDIT_PROFILE_LIST,
        EditProfileIconList,
        wgui_inline_items,
        0,
        gui_buffer_p);

    SetCategory57RightSoftkeyFunctions(mmi_ph_save_selected_profile_changes, GoBackHistory);

}


/*****************************************************************************

⌨️ 快捷键说明

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