JProfileUIHandler.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:110k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * JProfileUIHandler.C
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This is source file for UI handling for the profile handler
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  * removed!
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  *------------------------------------------------------------------------------
  70.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  71.  *============================================================================
  72.  ****************************************************************************/
  73. #ifndef _JPROFILEUIHANDLER_C
  74. #define _JPROFILEUIHANDLER_C
  75. #include "MMI_features.h"
  76. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  77. #include "PixtelDataTypes.h"
  78. #include "kal_release.h"
  79. #include "stack_config.h"
  80. #include "stack_common.h"
  81. #include "stack_msgs.h"
  82. #include "app_ltlcom.h" /* local/peer struct */
  83. #include "ProtocolEvents.h"
  84. #include "DebugInitDef.h"       /* Debug Info */
  85. #include "wap_ps_struct.h"
  86. #include "Ucs2prot.h"
  87. #include "Unicodexdcl.h"
  88. #include "GlobalDefs.h"
  89. #include "KeyBrd.h"
  90. #include "wgui_categories.h"
  91. #include "wgui_categories_inputsenum.h"
  92. #include "wgui_categories_inputs.h"
  93. #include "wgui_inline_edit.h"
  94. #include "SettingProfile.h"
  95. #include "ServiceDefs.h"
  96. #include "HistoryGprot.h"
  97. #include "CommonScreens.h"
  98. #include "DataAccount.h"
  99. #include "JProfileHandlerTypes.h"
  100. #include "JProfileHandlerProts.h"
  101. #include "JProfileHandlerDefs.h"
  102. #include "JProvWap.h"
  103. #include "JProvProts.h"
  104. #include "JBrowserMMITypes.h"   /* Added by Sandeep for connection active flag */
  105. #include "JBrowserMMIDefs.h"    /* Added by Tk for string ID */
  106. #include "custom_nvram_editor_data_item.h"
  107. #include "NVRAMType.h"
  108. #include "NVRAMEnum.h"
  109. #include "NVRAMProt.h"
  110. ph_context_struct g_ph_cntx;
  111. static U8 g_ph_conn_index;
  112. static U8 g_ph_done_flag;
  113. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  114. nvram_wap_profile_content_struct *g_ph_wap_profile_p = NULL;
  115. nvram_wap_profile_name_array_struct *g_ph_wap_prof_name_arr_p = NULL;
  116. nvram_wap_profile_content_struct *g_ph_activated_wap_profile = NULL;
  117. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  118. nvram_mms_profile_content_struct *g_ph_mms_profile_p = NULL;
  119. nvram_mms_profile_content_struct *g_ph_activated_mms_profile = NULL;
  120. nvram_mms_profile_name_array_struct *g_ph_mms_prof_name_arr_p = NULL;
  121. extern void EntryDTCNTMain(void);
  122. #if defined(MMS_SUPPORT)/*dilip*/
  123. extern void mmi_jmms_set_profile(void);
  124. #endif
  125. extern void mmi_brw_set_connection_active_flag(JC_BOOLEAN);
  126. extern MMI_BOOL mmi_brw_validate_url(U8 *url_p);
  127. extern void jdd_MemSetActiveModuleID(ETaskID taskId);
  128. extern U8 g_prov_pend_set;
  129. U16 g_ph_title_img_id;
  130. /*****************************************************************************
  131.  * FUNCTION
  132.  *  mmi_ph_deinit_profiles
  133.  * DESCRIPTION
  134.  *  This is the deinitialization routine,to free the memory  & reset values used by profile handler
  135.  * PARAMETERS
  136.  *  void
  137.  * RETURNS
  138.  *  void
  139.  *****************************************************************************/
  140. void mmi_ph_deinit_profiles(void)
  141. {
  142.     /*----------------------------------------------------------------*/
  143.     /* Local Variables                                                */
  144.     /*----------------------------------------------------------------*/
  145.     /*----------------------------------------------------------------*/
  146.     /* Code Body                                                      */
  147.     /*----------------------------------------------------------------*/
  148.     if (g_ph_wap_prof_name_arr_p != NULL)
  149.     {
  150.         jdd_MemFree(g_ph_wap_prof_name_arr_p);
  151.         g_ph_wap_prof_name_arr_p = NULL;
  152.     }
  153.     if (g_ph_mms_prof_name_arr_p != NULL)
  154.     {
  155.         jdd_MemFree(g_ph_mms_prof_name_arr_p);
  156.         g_ph_mms_prof_name_arr_p = NULL;
  157.     }
  158.     if (g_ph_cntx.profile_display_p != NULL)
  159.     {
  160.         jdd_MemFree(g_ph_cntx.profile_display_p);
  161.         g_ph_cntx.profile_display_p = NULL;
  162.     }
  163.     if (g_ph_wap_profile_p != NULL)
  164.     {
  165.         jdd_MemFree(g_ph_wap_profile_p);
  166.         g_ph_wap_profile_p = NULL;
  167.     }
  168.     if (g_ph_mms_profile_p != NULL)
  169.     {
  170.         jdd_MemFree(g_ph_mms_profile_p);
  171.         g_ph_mms_profile_p = NULL;
  172.     }
  173. }
  174. /*****************************************************************************
  175.  * FUNCTION
  176.  *  mmi_ph_init
  177.  * DESCRIPTION
  178.  *  This is the profile handler Initialization API
  179.  * PARAMETERS
  180.  *  void
  181.  * RETURNS
  182.  *  void
  183.  *****************************************************************************/
  184. void mmi_ph_init(void)
  185. {
  186.     /*----------------------------------------------------------------*/
  187.     /* Local Variables                                                */
  188.     /*----------------------------------------------------------------*/
  189.     S16 error;
  190.     /*----------------------------------------------------------------*/
  191.     /* Code Body                                                      */
  192.     /*----------------------------------------------------------------*/
  193.     jdd_MemSetActiveModuleID(E_TASK_BROWSER_UI);
  194.     if (g_ph_activated_wap_profile == NULL)
  195.     {
  196.         g_ph_activated_wap_profile =
  197.             (nvram_wap_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_CONTENT_SIZE, 1);
  198.     }
  199.     ReadValue(NVRAM_PH_ACTIVATED_WAP_PROFILE_INDEX, &g_ph_cntx.wap_actived_profile_index, DS_BYTE, &error);
  200.     if (g_ph_cntx.wap_actived_profile_index == 0xFF)
  201.     {
  202.         g_ph_cntx.wap_actived_profile_index = 0x00;
  203.         WriteValue(NVRAM_PH_ACTIVATED_WAP_PROFILE_INDEX, &g_ph_cntx.wap_actived_profile_index, DS_BYTE, &error);
  204.     }
  205.     mmi_ph_get_activated_profile_data(PH_BROWSER_PROFILE, g_ph_cntx.wap_actived_profile_index);
  206.     if (g_ph_activated_mms_profile == NULL)
  207.     {
  208.         g_ph_activated_mms_profile =
  209.             (nvram_mms_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_MMS_PROFILE_CONTENT_SIZE, 1);
  210.     }
  211.     ReadValue(NVRAM_PH_ACTIVATED_MMS_PROFILE_INDEX, &g_ph_cntx.mms_actived_profile_index, DS_BYTE, &error);
  212.     if (g_ph_cntx.mms_actived_profile_index == 0xFF)
  213.     {
  214.         g_ph_cntx.mms_actived_profile_index = 0x00;
  215.         WriteValue(NVRAM_PH_ACTIVATED_MMS_PROFILE_INDEX, &g_ph_cntx.mms_actived_profile_index, DS_BYTE, &error);
  216.     }
  217.     mmi_ph_get_activated_profile_data(PH_MMS_PROFILE, g_ph_cntx.mms_actived_profile_index);
  218.     /* Set Highlight handlers */
  219.     SetHiliteHandler(MENU_ID_PH_SELECT_PROFILE_ACTIVATE, mmi_ph_activate_profile_highlight_hdlr);
  220.     SetHiliteHandler(MENU_ID_PH_SELECT_PROFILE_EDIT, mmi_ph_edit_profile_highlight_hdlr);
  221. }
  222. /*****************************************************************************
  223.  * FUNCTION
  224.  *  mmi_ph_pre_entry_show_profile_list_menu
  225.  * DESCRIPTION
  226.  *  It is an pre entry function for showing profile name list.
  227.  *  This makes the global profile name data ready to be displayed
  228.  * PARAMETERS
  229.  *  profile     [IN]        Profile Type (Browser or MMS)
  230.  * RETURNS
  231.  *  void
  232.  *****************************************************************************/
  233. #if defined MMS_SUPPORT
  234. extern U16 mmi_jmms_get_profile_title_icon(void);
  235. #endif
  236. void mmi_ph_pre_entry_show_profile_list_menu(ph_profile_enum profile)
  237. {
  238.     /*----------------------------------------------------------------*/
  239.     /* Local Variables                                                */
  240.     /*----------------------------------------------------------------*/
  241.     /*----------------------------------------------------------------*/
  242.     /* Code Body                                                      */
  243.     /*----------------------------------------------------------------*/
  244. if(profile == PH_MMS_PROFILE || profile == PH_MMS_PROV_PROFILE)
  245. {
  246. #if defined MMS_SUPPORT
  247. g_ph_title_img_id = mmi_jmms_get_profile_title_icon();
  248. #endif
  249. }
  250. else
  251. {
  252. g_ph_title_img_id = SERVICES_WAP_MENU_ID;
  253. }
  254.     if (profile == PH_BROWSER_PROFILE)
  255.     {
  256.         g_ph_cntx.profile_module = PH_BROWSER_PROFILE;
  257.         mmi_ph_get_brw_profile_name_list();
  258.     }
  259.     else if (profile == PH_MMS_PROFILE)
  260.     {
  261.         g_ph_cntx.profile_module = PH_MMS_PROFILE;
  262.         mmi_ph_get_mms_profile_name_list();
  263.     }
  264.     else if (profile == PH_BROWSER_PROV_PROFILE)
  265.     {
  266.         g_ph_cntx.profile_module = PH_BROWSER_PROV_PROFILE;
  267.         mmi_ph_get_brw_profile_name_list();
  268.     }
  269.     else if (profile == PH_MMS_PROV_PROFILE)
  270.     {
  271.         g_ph_cntx.profile_module = PH_MMS_PROV_PROFILE;
  272.         mmi_ph_get_mms_profile_name_list();
  273.     }
  274.     mmi_ph_entry_show_profile_list_menu();
  275. }
  276. /*****************************************************************************
  277.  * FUNCTION
  278.  *  mmi_ph_entry_show_profile_list_menu
  279.  * DESCRIPTION
  280.  *  Entry function to show profile name list
  281.  * PARAMETERS
  282.  *  void
  283.  * RETURNS
  284.  *  void
  285.  *****************************************************************************/
  286. void mmi_ph_entry_show_profile_list_menu(void)
  287. {
  288.     /*----------------------------------------------------------------*/
  289.     /* Local Variables                                                */
  290.     /*----------------------------------------------------------------*/
  291.     U8 *gui_buffer_p = NULL;
  292.     S32 activated_index = 0;
  293.     U16 activated_profile_image[NVRAM_WAP_PROFILE_MAX] = {0, };
  294.     /*----------------------------------------------------------------*/
  295.     /* Code Body                                                      */
  296.     /*----------------------------------------------------------------*/
  297. g_prov_pend_set = 0;
  298.     activated_index = mmi_ph_get_activated_profile_index();
  299.     activated_profile_image[activated_index] = IMG_ID_PROF_HDLR_SET_ACTIVATED_PROFILE;
  300.     EntryNewScreen(SCR_ID_PROF_HDLR_PROF_LIST, NULL, mmi_ph_entry_show_profile_list_menu, NULL);
  301.     gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_PROF_LIST);
  302.     RegisterHighlightHandler(mmi_ph_highlight_select_profile);
  303.     mmi_ph_get_profile_name_list();
  304.     ShowCategory53Screen(
  305.         STR_ID_PROF_HDLR_SELECT_PROF_CAPTION,
  306.        // GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  307.    GetRootTitleIcon(g_ph_title_img_id),
  308.         STR_GLOBAL_OK,
  309.         IMG_GLOBAL_OK,
  310.         STR_GLOBAL_BACK,
  311.         IMG_GLOBAL_BACK,
  312.         NVRAM_WAP_PROFILE_MAX,
  313.         (U8 **) subMenuDataPtrs,
  314.         (PU16) activated_profile_image,
  315.         0,
  316.         0,
  317.         activated_index,
  318.         gui_buffer_p);
  319.     /* Register function for left soft key */
  320.     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*/
  321.     {
  322.         SetLeftSoftkeyFunction(mmi_prov_get_dataaccount_data, KEY_EVENT_UP);
  323.         SetKeyHandler(mmi_prov_get_dataaccount_data, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  324.         /* Register function for right soft key */
  325.         SetRightSoftkeyFunction(mmi_prov_handle_back, KEY_EVENT_UP);
  326.         SetKeyHandler(mmi_prov_handle_back, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  327.         SetKeyHandler(mmi_prov_handle_cancel, KEY_END, KEY_EVENT_DOWN);
  328.     }
  329.     else
  330.     {
  331.         SetLeftSoftkeyFunction(mmi_ph_entry_select_editable_profile, KEY_EVENT_UP);
  332.         SetKeyHandler(mmi_ph_entry_select_editable_profile, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  333.         /* Register function for right soft key */
  334.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  335.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  336.     }
  337. }
  338. /*****************************************************************************
  339.  * FUNCTION
  340.  *  mmi_ph_entry_select_editable_profile
  341.  * DESCRIPTION
  342.  *  This is entry function for the screen showing menu items (Activate ,Edit profile )
  343.  *  for any selected profile
  344.  * PARAMETERS
  345.  *  void
  346.  * RETURNS
  347.  *  void
  348.  *****************************************************************************/
  349. void mmi_ph_entry_select_editable_profile(void)
  350. {
  351.     /*----------------------------------------------------------------*/
  352.     /* Local Variables                                                */
  353.     /*----------------------------------------------------------------*/
  354.     U8 *gui_buffer_p;   /* Buffer holding history data */
  355.     S32 num_of_item;    /* Stores no of children in the submenu */
  356.     S8 profile_name_string[(NVRAM_WAP_PROFILE_NAME_LEN + 1) * ENCODING_LENGTH];
  357.     U32 count;
  358.     U16 nStrItemList[2];
  359.     /*----------------------------------------------------------------*/
  360.     /* Code Body                                                      */
  361.     /*----------------------------------------------------------------*/
  362.     EntryNewScreen(SCR_ID_PROF_HDLR_SELECTED_PROFILE, NULL, mmi_ph_entry_select_editable_profile, NULL);
  363.     gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_SELECTED_PROFILE);
  364.     num_of_item = GetNumOfChild(MENU_ID_PH_SELECT_PROFILE);
  365.     GetSequenceStringIds(MENU_ID_PH_SELECT_PROFILE, nStrItemList);
  366.     SetParentHandler(MENU_ID_PH_SELECT_PROFILE);
  367.     for (count = 0; count < num_of_item; count++)
  368.     {
  369.         memset((S8*) subMenuDataPtrs[count], 0, MAX_SUB_MENU_SIZE);
  370.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[count], (S8*) GetString(nStrItemList[count]), MAX_SUBMENU_CHARACTERS);
  371.     }
  372.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  373.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  374.     {
  375.         if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
  376.         {
  377.             AnsiiToUnicodeString(
  378.                 (S8*) profile_name_string,
  379.                 (S8*) g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name);
  380.         }
  381.         else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
  382.         {
  383.             UCS2Strcpy(
  384.                 (S8*) profile_name_string,
  385.                 (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name));
  386.         }
  387.     }
  388.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  389.     {
  390.         if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
  391.         {
  392.             AnsiiToUnicodeString(
  393.                 (S8*) profile_name_string,
  394.                 (S8*) g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name);
  395.         }
  396.         else if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
  397.         {
  398.             UCS2Strcpy(
  399.                 (S8*) profile_name_string,
  400.                 (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name));
  401.         }
  402.     }
  403.     ShowCategory353Screen(
  404.         (U8*) (profile_name_string),
  405.         //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  406. GetRootTitleIcon(g_ph_title_img_id),
  407.         STR_GLOBAL_OK,
  408.         IMG_GLOBAL_OK,
  409.         STR_GLOBAL_BACK,
  410.         IMG_GLOBAL_BACK,
  411.         num_of_item,
  412.         (U8 **) subMenuDataPtrs,
  413.         (U16*) gIndexIconsImageList,
  414.         NULL,
  415.         0,
  416.         0,
  417.         gui_buffer_p);
  418.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  419.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  420. }
  421. /*****************************************************************************
  422.  * FUNCTION
  423.  *  mmi_ph_activate_profile_highlight_hdlr
  424.  * DESCRIPTION
  425.  *  It is the highlight handler for the MENU_ID_PH_SELECT_PROFILE_ACTIVATE menu item
  426.  * PARAMETERS
  427.  *  void
  428.  * RETURNS
  429.  *  void
  430.  *****************************************************************************/
  431. void mmi_ph_activate_profile_highlight_hdlr(void)
  432. {
  433.     /*----------------------------------------------------------------*/
  434.     /* Local Variables                                                */
  435.     /*----------------------------------------------------------------*/
  436.     /*----------------------------------------------------------------*/
  437.     /* Code Body                                                      */
  438.     /*----------------------------------------------------------------*/
  439.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  440.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  441.     SetLeftSoftkeyFunction(mmi_ph_entry_activate_selected_profile, KEY_EVENT_UP);
  442.     /* SetKeyHandler(mmi_ph_entry_activate_selected_profile,KEY_RIGHT_ARROW,KEY_EVENT_DOWN); */
  443. }
  444. /*****************************************************************************
  445.  * FUNCTION
  446.  *  mmi_ph_edit_profile_highlight_hdlr
  447.  * DESCRIPTION
  448.  *  *  It is the highlight handler for the MENU_ID_PH_SELECT_PROFILE_EDIT menu item
  449.  * PARAMETERS
  450.  *  void
  451.  * RETURNS
  452.  *  void
  453.  *****************************************************************************/
  454. void mmi_ph_edit_profile_highlight_hdlr(void)
  455. {
  456.     /*----------------------------------------------------------------*/
  457.     /* Local Variables                                                */
  458.     /*----------------------------------------------------------------*/
  459.     /*----------------------------------------------------------------*/
  460.     /* Code Body                                                      */
  461.     /*----------------------------------------------------------------*/
  462.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  463.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  464.     SetLeftSoftkeyFunction(mmi_ph_pre_entry_edit_selected_profile, KEY_EVENT_UP);
  465.     SetKeyHandler(mmi_ph_pre_entry_edit_selected_profile, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  466. }
  467. /*****************************************************************************
  468.  * FUNCTION
  469.  *  mmi_ph_highlight_select_profile
  470.  * DESCRIPTION
  471.  *  This gets the highlighted index and stores it into global profile index
  472.  * PARAMETERS
  473.  *  index       [IN]        
  474.  * RETURNS
  475.  *  void
  476.  *****************************************************************************/
  477. void mmi_ph_highlight_select_profile(S32 index)
  478. {
  479.     /*----------------------------------------------------------------*/
  480.     /* Local Variables                                                */
  481.     /*----------------------------------------------------------------*/
  482.     /*----------------------------------------------------------------*/
  483.     /* Code Body                                                      */
  484.     /*----------------------------------------------------------------*/
  485.     g_ph_cntx.profile_index = (U8) index;
  486. }
  487. /*****************************************************************************
  488.  * FUNCTION
  489.  *  mmi_ph_pre_entry_edit_selected_profile
  490.  * DESCRIPTION
  491.  *  It is the pre entry function for the edit profile screen,in this the profiel content data is
  492.  *  extracted from the NVRAM & data account info is requested ,on the response of data account
  493.  *  edit profile entry function is called
  494.  * PARAMETERS
  495.  *  void
  496.  * RETURNS
  497.  *  void
  498.  *****************************************************************************/
  499. void mmi_ph_pre_entry_edit_selected_profile(void)
  500. {
  501.     /*----------------------------------------------------------------*/
  502.     /* Local Variables                                                */
  503.     /*----------------------------------------------------------------*/
  504.     /*----------------------------------------------------------------*/
  505.     /* Code Body                                                      */
  506.     /*----------------------------------------------------------------*/
  507.     g_ph_done_flag = 0x00;
  508.     mmi_ph_get_selected_profile_content_data(g_ph_cntx.profile_index);
  509.     DataAccountReadyCheck(mmi_ph_handle_get_data_account_name);
  510.     /* mmi_ph_handle_get_data_account_name(); */
  511. }
  512. /*****************************************************************************
  513.  * FUNCTION
  514.  *  mmi_ph_entry_edit_selected_profile
  515.  * DESCRIPTION
  516.  *  It is the entry function for the edit profile screen
  517.  * PARAMETERS
  518.  *  void
  519.  * RETURNS
  520.  *  void
  521.  *****************************************************************************/
  522. void mmi_ph_entry_edit_selected_profile(void)
  523. {
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     U8 *input_buffer_p; /* added for inline edit history */
  528.     U8 *gui_buffer_p;   /* Buffer holding history data */
  529.     U16 input_buffer_size;
  530.     U16 EditProfileIconList[MAX_INLINE_ITEM_EDIT_PROFILE_LIST] = {IMG_GLOBAL_L1, 0, IMG_GLOBAL_L2, 0,
  531.         IMG_GLOBAL_L3, 0, IMG_GLOBAL_L4, 0,
  532.         IMG_GLOBAL_L5, 0, IMG_GLOBAL_L6, 0
  533.     };
  534.     /*----------------------------------------------------------------*/
  535.     /* Code Body                                                      */
  536.     /*----------------------------------------------------------------*/
  537.     EntryNewScreen(SCR_ID_PROF_HDLR_EDIT_PROFILE, mmi_ph_exit_edit_selected_profile, NULL, NULL);
  538.     InitializeCategory57Screen();
  539.     gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_EDIT_PROFILE);
  540.     input_buffer_p = GetCurrNInputBuffer(SCR_ID_PROF_HDLR_EDIT_PROFILE, &input_buffer_size);    /* added for inline edit history */
  541.     mmi_ph_selected_profile_fill_inline_struct();
  542.     if (input_buffer_p != NULL)
  543.     {
  544.         SetCategory57Data(wgui_inline_items, MAX_INLINE_ITEM_EDIT_PROFILE_LIST, input_buffer_p);
  545.     }
  546.     if ((GetInlineDoneFlag(gui_buffer_p) == 0) && (g_ph_done_flag == 0x01))
  547.     {
  548.         SetInlineDoneFlag(gui_buffer_p);
  549.     }
  550.     RegisterHighlightHandler(mmi_ph_highlight_inline_item);
  551.     ShowCategory57Screen(
  552.         STR_ID_BRW_EDIT_PROFILE,
  553.         //GetRootTitleIcon(SERVICES_WAP_MENU_ID), /* modified by tk */
  554. GetRootTitleIcon(g_ph_title_img_id),
  555.         STR_GLOBAL_EDIT,
  556.         NULL,
  557.         STR_GLOBAL_BACK,
  558.         IMG_GLOBAL_BACK,
  559.         MAX_INLINE_ITEM_EDIT_PROFILE_LIST,
  560.         EditProfileIconList,
  561.         wgui_inline_items,
  562.         0,
  563.         gui_buffer_p);
  564.     SetCategory57RightSoftkeyFunctions(mmi_ph_save_selected_profile_changes, GoBackHistory);
  565. }
  566. /*****************************************************************************
  567.  * FUNCTION
  568.  *  mmi_ph_exit_edit_selected_profile
  569.  * DESCRIPTION
  570.  *  exit handler for edit profile screen
  571.  * PARAMETERS
  572.  *  void
  573.  * RETURNS
  574.  *  void
  575.  *****************************************************************************/
  576. void mmi_ph_exit_edit_selected_profile(void)
  577. {
  578.     /*----------------------------------------------------------------*/
  579.     /* Local Variables                                                */
  580.     /*----------------------------------------------------------------*/
  581.     history h;
  582.     U16 input_buffer_size;
  583.     S16 nHistory = 0;
  584.     /*----------------------------------------------------------------*/
  585.     /* Code Body                                                      */
  586.     /*----------------------------------------------------------------*/
  587.     h.scrnID = SCR_ID_PROF_HDLR_EDIT_PROFILE;
  588.     CloseCategory57Screen();
  589.     h.entryFuncPtr = mmi_ph_entry_edit_selected_profile;
  590.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  591.     GetCategory57History(h.guiBuffer);
  592.     input_buffer_size = (U16) GetCategory57DataSize();
  593.     GetCategory57Data((U8*) h.inputBuffer);
  594.     AddNHistory(h, input_buffer_size);
  595. }
  596. /*****************************************************************************
  597.  * FUNCTION
  598.  *  mmi_ph_highlight_inline_item
  599.  * DESCRIPTION
  600.  *  exit handler for edit profile screen
  601.  * PARAMETERS
  602.  *  index       [IN]        IN  this is the index of the inline item in edit profile  screen
  603.  * RETURNS
  604.  *  void
  605.  *****************************************************************************/
  606. void mmi_ph_highlight_inline_item(S32 index)
  607. {
  608.     /*----------------------------------------------------------------*/
  609.     /* Local Variables                                                */
  610.     /*----------------------------------------------------------------*/
  611.     /*----------------------------------------------------------------*/
  612.     /* Code Body                                                      */
  613.     /*----------------------------------------------------------------*/
  614.     if ((index == PH_PROFILE_DATA_ACCOUNT))
  615.     {
  616.         ChangeLeftSoftkey(STR_GLOBAL_SELECT, NULL);
  617.         SetLeftSoftkeyFunction(mmi_ph_prof_list_data_acct, KEY_EVENT_UP);
  618.     }
  619.     else if ((index == PH_PROFILE_CONN_TYPE))
  620.     {
  621.         ChangeLeftSoftkey(STR_GLOBAL_SELECT, NULL);
  622.         SetLeftSoftkeyFunction(mmi_ph_show_connection_type_options, KEY_EVENT_UP);
  623.     }
  624. }
  625. /*****************************************************************************
  626.  * FUNCTION
  627.  *  mmi_ph_prof_list_data_acct
  628.  * DESCRIPTION
  629.  *  LSK handler of Data Account item in Profile Setting inline editor screen.
  630.  * PARAMETERS
  631.  *  void
  632.  * RETURNS
  633.  *  void
  634.  *****************************************************************************/
  635. void mmi_ph_prof_list_data_acct(void)
  636. {
  637.     /*----------------------------------------------------------------*/
  638.     /* Local Variables                                                */
  639.     /*----------------------------------------------------------------*/
  640.     /*----------------------------------------------------------------*/
  641.     /* Code Body                                                      */
  642.     /*----------------------------------------------------------------*/
  643.     if ((g_ph_cntx.profile_module == PH_MMS_PROFILE) || (g_ph_cntx.profile_module == PH_MMS_PROV_PROFILE))
  644. {
  645. mmi_dtcnt_select_account(
  646. mmi_ph_prof_callback,
  647. g_ph_title_img_id,
  648. DATA_ACCOUNT_BEARER_GPRS);
  649. }
  650. else
  651. {
  652.     mmi_dtcnt_select_account(
  653.         mmi_ph_prof_callback,
  654. g_ph_title_img_id,
  655.         DATA_ACCOUNT_BEARER_GPRS | DATA_ACCOUNT_BEARER_CSD);
  656. }
  657. }
  658. /*****************************************************************************
  659.  * FUNCTION
  660.  *  mmi_ph_prof_callback
  661.  * DESCRIPTION
  662.  *  
  663.  * PARAMETERS
  664.  *  index       [IN]        
  665.  * RETURNS
  666.  *  void
  667.  *****************************************************************************/
  668. void mmi_ph_prof_callback(U16 index)
  669. {
  670.     /*----------------------------------------------------------------*/
  671.     /* Local Variables                                                */
  672.     /*----------------------------------------------------------------*/
  673.     /*----------------------------------------------------------------*/
  674.     /* Code Body                                                      */
  675.     /*----------------------------------------------------------------*/
  676.     if (g_ph_cntx.profile_display_p == NULL)
  677.     {
  678.         g_ph_cntx.profile_display_p =
  679.             (ph_show_editable_profile_struct*) jdd_MemAlloc(sizeof(ph_show_editable_profile_struct), 1);
  680.     }
  681.     g_ph_cntx.profile_display_p->data_account = (U8) index;
  682.     if ((g_ph_cntx.profile_module == PH_BROWSER_PROV_PROFILE) || (g_ph_cntx.profile_module == PH_MMS_PROV_PROFILE))
  683.     {
  684.         ph_data_account_enum data_account;
  685.         data_account = mmi_ph_check_data_account_type(g_ph_cntx.profile_display_p->data_account);
  686.         if (data_account == PH_DATA_ACCOUNT_CSD)
  687.         {
  688.             mmi_prov_prof_save_csd_data_acct();
  689.         }
  690.         else if (data_account == PH_DATA_ACCOUNT_GPRS)
  691.         {
  692.             mmi_prov_prof_save_gprs_data_acct();
  693.         }
  694.     }
  695.     else
  696.     {
  697.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  698.         {
  699.             g_ph_wap_profile_p->data_account = g_ph_cntx.profile_display_p->data_account;
  700. mmi_dtcnt_get_account_name(
  701. g_ph_cntx.profile_display_p->data_account,
  702. (S8*) g_ph_cntx.profile_display_p->DataAccountName,
  703. MAX_DATA_ACCOUNT_NAME_LEN);
  704. g_ph_done_flag = 0x01;
  705. DeleteNHistory(1);
  706. GoBackHistory();
  707.         }
  708.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  709.         {
  710.             g_ph_mms_profile_p->data_account = g_ph_cntx.profile_display_p->data_account;
  711.         mmi_dtcnt_get_account_name(
  712.             g_ph_cntx.profile_display_p->data_account,
  713.             (S8*) g_ph_cntx.profile_display_p->DataAccountName,
  714.             MAX_DATA_ACCOUNT_NAME_LEN);
  715.         g_ph_done_flag = 0x01;
  716.         GoBackHistory();
  717.     }
  718. /*        mmi_dtcnt_get_account_name(
  719.             g_ph_cntx.profile_display_p->data_account,
  720.             (S8*) g_ph_cntx.profile_display_p->DataAccountName,
  721.             MAX_DATA_ACCOUNT_NAME_LEN);
  722.         g_ph_done_flag = 0x01;
  723.         DeleteNHistory(1);
  724.         GoBackHistory();*/
  725. }
  726. }
  727. /*****************************************************************************
  728.  * FUNCTION
  729.  *  mmi_ph_selected_profile_fill_inline_struct
  730.  * DESCRIPTION
  731.  *  This API handles the inline items in the edit profile screen ,like data account,username ,password,conn type.....
  732.  * PARAMETERS
  733.  *  void
  734.  * RETURNS
  735.  *  void
  736.  *****************************************************************************/
  737. void mmi_ph_selected_profile_fill_inline_struct(void)
  738. {
  739.     /*----------------------------------------------------------------*/
  740.     /* Local Variables                                                */
  741.     /*----------------------------------------------------------------*/
  742.     S32 buffer_size = 0;
  743.     /*----------------------------------------------------------------*/
  744.     /* Code Body                                                      */
  745.     /*----------------------------------------------------------------*/
  746.     if (g_ph_cntx.profile_display_p == NULL)
  747.     {
  748.         g_ph_cntx.profile_display_p =
  749.             (ph_show_editable_profile_struct*) jdd_MemAlloc(sizeof(ph_show_editable_profile_struct), 1);
  750.     }
  751.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_NAME), KEY_LSK, KEY_EVENT_UP);
  752.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_HOMEPAGE), KEY_LSK, KEY_EVENT_UP);
  753.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_DATA_ACCOUNT), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  754.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_CONN_TYPE), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  755.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_USER_NAME), KEY_LSK, KEY_EVENT_UP);
  756.     SetInlineItemActivation((wgui_inline_items + PH_PROFILE_USER_PASSWORD), KEY_LSK, KEY_EVENT_UP);
  757.     SetInlineItemCaption((wgui_inline_items + PH_PROFILE_NAME_STR), (U8*) GetString(STR_ID_PROF_HDLR_RENAME_PROFILE));
  758.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  759.     {
  760.         SetInlineItemCaption(
  761.             (wgui_inline_items + PH_PROFILE_HOMEPAGE_STR),
  762.             (U8*) GetString(STR_ID_PROF_HDLR_HOMEPAGE));
  763.     }
  764.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  765.     {
  766.         SetInlineItemCaption(
  767.             (wgui_inline_items + PH_PROFILE_HOMEPAGE_STR),
  768.             (U8*) GetString(STR_ID_PROF_HDLR_MMSC_URL));
  769.     }
  770.     SetInlineItemCaption(
  771.         (wgui_inline_items + PH_PROFILE_DATA_ACCOUNT_STR),
  772.         (U8*) GetString(STR_ID_PROF_HDLR_DATA_ACCOUNT));
  773.     SetInlineItemCaption((wgui_inline_items + PH_PROFILE_CONN_TYPE_STR), (U8*) GetString(STR_ID_PROF_HDLR_CONN_TYPE));
  774.     SetInlineItemCaption((wgui_inline_items + PH_PROFILE_USER_NAME_STR), (U8*) GetString(STR_ID_PROF_HDLR_USER_NAME));
  775.     SetInlineItemCaption(
  776.         (wgui_inline_items + PH_PROFILE_USER_PASSWORD_STR),
  777.         (U8*) GetString(STR_ID_PROF_HDLR_PASSWORD));
  778.     SetInlineItemDisplayOnly(
  779.         (wgui_inline_items + PH_PROFILE_DATA_ACCOUNT),
  780.         (U8*) g_ph_cntx.profile_display_p->DataAccountName);
  781.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  782.     {
  783.         /* profile connection type */
  784.         if ((g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED)
  785.             || (g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED_SECURE))
  786.         {
  787.             SetInlineItemDisplayOnly(
  788.                 (wgui_inline_items + PH_PROFILE_CONN_TYPE),
  789.                 (U8*) GetString(STR_ID_PROF_HDLR_CONN_TYPE_CONNECTION));
  790.         }
  791.         else if (g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_HTTP)
  792.         {
  793.             SetInlineItemDisplayOnly(
  794.                 (wgui_inline_items + PH_PROFILE_CONN_TYPE),
  795.                 (U8*) GetString(STR_ID_PROF_HDLR_CONN_TYPE_HTTP));
  796.         }
  797.         /* profile name inline item */
  798.         buffer_size = NVRAM_WAP_PROFILE_PROFILE_NAME_LEN;
  799.         if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
  800.         {
  801.         #if 0
  802. /* under construction !*/
  803. /* under construction !*/
  804. /* under construction !*/
  805. /* under construction !*/
  806. /* under construction !*/
  807. /* under construction !*/
  808. /* under construction !*/
  809. /* under construction !*/
  810. /* under construction !*/
  811. /* under construction !*/
  812. /* under construction !*/
  813. /* under construction !*/
  814.         #endif /* 0 */ 
  815.             AnsiiToUnicodeString(
  816.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  817.                 (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name));
  818.         }
  819.         else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
  820.         {
  821.             UCS2Strcpy(
  822.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  823.                 (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].profile_name));
  824.         }
  825.         SetInlineItemFullScreenEdit(
  826.             (wgui_inline_items + PH_PROFILE_NAME),
  827.             STR_ID_PROF_HDLR_RENAME_PROFILE,
  828.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  829. GetRootTitleIcon(g_ph_title_img_id),
  830.             (U8*) g_ph_cntx.profile_display_p->profile_name,
  831.             buffer_size,
  832.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ONE_LESS_CHARACTER);
  833.         SetInlineFullScreenEditCustomFunction(
  834.             wgui_inline_items + PH_PROFILE_NAME,
  835.             mmi_ph_editable_profile_full_screen_edit);
  836.         /* profile homepage url inline item */
  837.         buffer_size = NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN;
  838.         AnsiiToUnicodeString(
  839.             (S8*) g_ph_cntx.profile_display_p->homepage_url,
  840.             (S8*) (g_ph_wap_profile_p->homepage_url));
  841.         SetInlineItemFullScreenEdit(
  842.             (wgui_inline_items + PH_PROFILE_HOMEPAGE),
  843.             STR_ID_PROF_HDLR_HOMEPAGE,
  844.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  845. GetRootTitleIcon(g_ph_title_img_id),
  846.             (U8*) g_ph_cntx.profile_display_p->homepage_url,
  847.             buffer_size,
  848.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  849.         SetInlineFullScreenEditCustomFunction(
  850.             wgui_inline_items + PH_PROFILE_HOMEPAGE,
  851.             mmi_ph_editable_profile_full_screen_edit);
  852.         /* profile username inline item */
  853.         buffer_size = NVRAM_WAP_PROFILE_USERNAME_LEN;
  854.         AnsiiToUnicodeString((S8*) g_ph_cntx.profile_display_p->username, (S8*) (g_ph_wap_profile_p->username));
  855.         SetInlineItemFullScreenEdit(
  856.             (wgui_inline_items + PH_PROFILE_USER_NAME),
  857.             STR_ID_PROF_HDLR_USER_NAME,
  858.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  859. GetRootTitleIcon(g_ph_title_img_id),
  860.             (U8*) (g_ph_cntx.profile_display_p->username),
  861.             buffer_size,
  862.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  863.         SetInlineFullScreenEditCustomFunction(
  864.             wgui_inline_items + PH_PROFILE_USER_NAME,
  865.             mmi_ph_editable_profile_full_screen_edit);
  866.         /* profile password inline item */
  867.         buffer_size = NVRAM_WAP_PROFILE_PASSWORD_LEN;
  868.         AnsiiToUnicodeString((S8*) g_ph_cntx.profile_display_p->password, (S8*) (g_ph_wap_profile_p->password));
  869.         SetInlineItemFullScreenEdit(
  870.             (wgui_inline_items + PH_PROFILE_USER_PASSWORD),
  871.             STR_ID_PROF_HDLR_PASSWORD,
  872.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  873. GetRootTitleIcon(g_ph_title_img_id),
  874.             (U8*) (g_ph_cntx.profile_display_p->password),
  875.             buffer_size,
  876.             INPUT_TYPE_ALPHANUMERIC_PASSWORD | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  877.         SetInlineFullScreenEditCustomFunction(
  878.             wgui_inline_items + PH_PROFILE_USER_PASSWORD,
  879.             mmi_ph_editable_profile_full_screen_edit);
  880.     }
  881.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  882.     {
  883.         /* profile connection type */
  884.         if ((g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED)
  885.             || (g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED_SECURE))
  886.         {
  887.             SetInlineItemDisplayOnly(
  888.                 (wgui_inline_items + PH_PROFILE_CONN_TYPE),
  889.                 (U8*) GetString(STR_ID_PROF_HDLR_CONN_TYPE_CONNECTION));
  890.         }
  891.         else if (g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_HTTP)
  892.         {
  893.             SetInlineItemDisplayOnly(
  894.                 (wgui_inline_items + PH_PROFILE_CONN_TYPE),
  895.                 (U8*) GetString(STR_ID_PROF_HDLR_CONN_TYPE_HTTP));
  896.         }
  897.         /* profile name inline item */
  898.         buffer_size = NVRAM_WAP_PROFILE_PROFILE_NAME_LEN;
  899.         if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_ASCII)
  900.         {
  901.         #if 0
  902. /* under construction !*/
  903. /* under construction !*/
  904. /* under construction !*/
  905. /* under construction !*/
  906. /* under construction !*/
  907. /* under construction !*/
  908. /* under construction !*/
  909. /* under construction !*/
  910. /* under construction !*/
  911. /* under construction !*/
  912. /* under construction !*/
  913. /* under construction !*/
  914.         #endif /* 0 */ 
  915.             AnsiiToUnicodeString(
  916.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  917.                 (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name));
  918.         }
  919.         else if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].dcs == PH_DCS_UCS)
  920.         {
  921.             UCS2Strcpy(
  922.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  923.                 (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[g_ph_cntx.profile_index].profile_name));
  924.         }
  925.         SetInlineItemFullScreenEdit(
  926.             (wgui_inline_items + PH_PROFILE_NAME),
  927.             STR_ID_PROF_HDLR_RENAME_PROFILE,
  928.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  929. GetRootTitleIcon(g_ph_title_img_id),
  930.             (U8*) (g_ph_cntx.profile_display_p->profile_name),
  931.             buffer_size,
  932.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ENCODING_BASED_LENGTH | INPUT_TYPE_ONE_LESS_CHARACTER);
  933.         SetInlineFullScreenEditCustomFunction(
  934.             wgui_inline_items + PH_PROFILE_NAME,
  935.             mmi_ph_editable_profile_full_screen_edit);
  936.         /* profile MMSC url inline item */
  937.         buffer_size = NVRAM_MMS_PROFILE_MMSC_URL_LEN;
  938.         AnsiiToUnicodeString((S8*) g_ph_cntx.profile_display_p->homepage_url, (S8*) (g_ph_mms_profile_p->mmsc_url));
  939.         SetInlineItemFullScreenEdit(
  940.             (wgui_inline_items + PH_PROFILE_HOMEPAGE),
  941.             STR_ID_PROF_HDLR_HOMEPAGE,
  942.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  943. GetRootTitleIcon(g_ph_title_img_id),
  944.             (U8*) (g_ph_cntx.profile_display_p->homepage_url),
  945.             buffer_size,
  946.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  947.         SetInlineFullScreenEditCustomFunction(
  948.             wgui_inline_items + PH_PROFILE_HOMEPAGE,
  949.             mmi_ph_editable_profile_full_screen_edit);
  950.         /* profile username inline item */
  951.         buffer_size = NVRAM_MMS_PROFILE_USERNAME_LEN;
  952.         AnsiiToUnicodeString((S8*) g_ph_cntx.profile_display_p->username, (S8*) (g_ph_mms_profile_p->username));
  953.         SetInlineItemFullScreenEdit(
  954.             (wgui_inline_items + PH_PROFILE_USER_NAME),
  955.             STR_ID_PROF_HDLR_USER_NAME,
  956.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  957. GetRootTitleIcon(g_ph_title_img_id),
  958.             (U8*) (g_ph_cntx.profile_display_p->username),
  959.             buffer_size,
  960.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  961.         SetInlineFullScreenEditCustomFunction(
  962.             wgui_inline_items + PH_PROFILE_USER_NAME,
  963.             mmi_ph_editable_profile_full_screen_edit);
  964.         /* profile password inline item */
  965.         buffer_size = NVRAM_MMS_PROFILE_PASSWORD_LEN;
  966.         AnsiiToUnicodeString((S8*) g_ph_cntx.profile_display_p->password, (S8*) (g_ph_mms_profile_p->password));
  967.         SetInlineItemFullScreenEdit(
  968.             (wgui_inline_items + PH_PROFILE_USER_PASSWORD),
  969.             STR_ID_PROF_HDLR_PASSWORD,
  970.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  971. GetRootTitleIcon(g_ph_title_img_id),
  972.             (U8*) (g_ph_cntx.profile_display_p->password),
  973.             buffer_size,
  974.             INPUT_TYPE_ALPHANUMERIC_PASSWORD | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  975.         SetInlineFullScreenEditCustomFunction(
  976.             wgui_inline_items + PH_PROFILE_USER_PASSWORD,
  977.             mmi_ph_editable_profile_full_screen_edit);
  978.     }
  979. }
  980. /*****************************************************************************
  981.  * FUNCTION
  982.  *  mmi_ph_editable_profile_full_screen_edit
  983.  * DESCRIPTION
  984.  *  It is the inline full screen edit custom function
  985.  * PARAMETERS
  986.  *  void
  987.  * RETURNS
  988.  *  void
  989.  *****************************************************************************/
  990. void mmi_ph_editable_profile_full_screen_edit(void)
  991. {
  992.     /*----------------------------------------------------------------*/
  993.     /* Local Variables                                                */
  994.     /*----------------------------------------------------------------*/
  995.     /*----------------------------------------------------------------*/
  996.     /* Code Body                                                      */
  997.     /*----------------------------------------------------------------*/
  998.     mmi_ph_update_profile_inline_values();
  999.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  1000.     SetInputMethodAndDoneCaptionIcon(GetRootTitleIcon(g_ph_title_img_id)/*GetRootTitleIcon(SERVICES_WAP_MENU_ID)*/);
  1001.     SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
  1002. }
  1003. /*****************************************************************************
  1004.  * FUNCTION
  1005.  *  mmi_ph_update_profile_inline_values
  1006.  * DESCRIPTION
  1007.  *  It fills the global profile structure based on the inline edit displayable data
  1008.  * PARAMETERS
  1009.  *  void
  1010.  * RETURNS
  1011.  *  void
  1012.  *****************************************************************************/
  1013. void mmi_ph_update_profile_inline_values(void)
  1014. {
  1015.     /*----------------------------------------------------------------*/
  1016.     /* Local Variables                                                */
  1017.     /*----------------------------------------------------------------*/
  1018.     /*----------------------------------------------------------------*/
  1019.     /* Code Body                                                      */
  1020.     /*----------------------------------------------------------------*/
  1021.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1022.     {
  1023.         UnicodeToAnsii((S8*) (g_ph_wap_profile_p->password), (S8*) (g_ph_cntx.profile_display_p->password));
  1024.     }
  1025.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1026.     {
  1027.         UnicodeToAnsii((S8*) (g_ph_mms_profile_p->password), (S8*) (g_ph_cntx.profile_display_p->password));
  1028.     }
  1029.     else
  1030.     {
  1031.         ASSERT(0);
  1032.     }
  1033.     /* Other values can be updated later like username */
  1034. }
  1035. /*****************************************************************************
  1036.  * FUNCTION
  1037.  *  mmi_ph_save_selected_profile_changes
  1038.  * DESCRIPTION
  1039.  *  This is the entry function for the save edit profile changes confirmation screen
  1040.  * PARAMETERS
  1041.  *  void
  1042.  * RETURNS
  1043.  *  void
  1044.  *****************************************************************************/
  1045. void mmi_ph_save_selected_profile_changes(void)
  1046. {
  1047.     /*----------------------------------------------------------------*/
  1048.     /* Local Variables                                                */
  1049.     /*----------------------------------------------------------------*/
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Code Body                                                      */
  1052.     /*----------------------------------------------------------------*/
  1053.     DisplayConfirm(
  1054.         STR_GLOBAL_YES,
  1055.         IMG_GLOBAL_YES,
  1056.         STR_GLOBAL_NO,
  1057.         IMG_GLOBAL_NO,
  1058.         get_string(STR_GLOBAL_SAVE),
  1059.         IMG_GLOBAL_QUESTION,
  1060.         WARNING_TONE);
  1061.     SetLeftSoftkeyFunction(mmi_ph_editable_profile_save_changes, KEY_EVENT_UP);
  1062.     SetRightSoftkeyFunction(mmi_ph_editable_profile_reject_changes, KEY_EVENT_UP);
  1063. }
  1064. /*****************************************************************************
  1065.  * FUNCTION
  1066.  *  mmi_ph_editable_profile_reject_changes
  1067.  * DESCRIPTION
  1068.  *  It handles the Press of RSK(NO) on the save changes screen for the editable profile
  1069.  * PARAMETERS
  1070.  *  void
  1071.  * RETURNS
  1072.  *  void
  1073.  *****************************************************************************/
  1074. void mmi_ph_editable_profile_reject_changes(void)
  1075. {
  1076.     /*----------------------------------------------------------------*/
  1077.     /* Local Variables                                                */
  1078.     /*----------------------------------------------------------------*/
  1079.     /*----------------------------------------------------------------*/
  1080.     /* Code Body                                                      */
  1081.     /*----------------------------------------------------------------*/
  1082.     DeleteNHistory(1);
  1083.     GoBackHistory();
  1084. }
  1085. /*****************************************************************************
  1086.  * FUNCTION
  1087.  *  mmi_ph_editable_profile_save_changes
  1088.  * DESCRIPTION
  1089.  *  It invokes the storage into the NVRAM for the changes done in the profile struct (Browser ,MMS)
  1090.  * PARAMETERS
  1091.  *  void
  1092.  * RETURNS
  1093.  *  void
  1094.  *****************************************************************************/
  1095. void mmi_ph_editable_profile_save_changes(void)
  1096. {
  1097.     /*----------------------------------------------------------------*/
  1098.     /* Local Variables                                                */
  1099.     /*----------------------------------------------------------------*/
  1100.     /*----------------------------------------------------------------*/
  1101.     /* Code Body                                                      */
  1102.     /*----------------------------------------------------------------*/
  1103.     MMI_BOOL IsValidURL;
  1104.     IsValidURL = mmi_brw_validate_url((PU8) g_ph_cntx.profile_display_p->homepage_url);
  1105.     if (IsValidURL == MMI_TRUE)
  1106.     {
  1107.         if (g_ph_cntx.profile_index == g_ph_cntx.wap_actived_profile_index)
  1108.         {
  1109.             mmi_brw_set_connection_active_flag(E_FALSE);
  1110.         }
  1111.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1112.         {
  1113.             mmi_ph_update_nvram_wap_profile();
  1114.         }
  1115.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1116.         {
  1117.             mmi_ph_update_nvram_mms_profile();
  1118.         }
  1119.     }
  1120.     else
  1121.     {
  1122.         DisplayPopup((PU8) GetString(STR_ID_BRW_INVALID_URL), IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE);
  1123.     }
  1124. }
  1125. /*****************************************************************************
  1126.  * FUNCTION
  1127.  *  mmi_ph_entry_activate_selected_profile
  1128.  * DESCRIPTION
  1129.  *  It is the entry function for the activate profile confirmation screen
  1130.  * PARAMETERS
  1131.  *  void
  1132.  * RETURNS
  1133.  *  void
  1134.  *****************************************************************************/
  1135. void mmi_ph_entry_activate_selected_profile(void)
  1136. {
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Local Variables                                                */
  1139.     /*----------------------------------------------------------------*/
  1140.     /*----------------------------------------------------------------*/
  1141.     /* Code Body                                                      */
  1142.     /*----------------------------------------------------------------*/
  1143.     DisplayConfirm(
  1144.         STR_GLOBAL_YES,
  1145.         IMG_GLOBAL_YES,
  1146.         STR_GLOBAL_NO,
  1147.         IMG_GLOBAL_NO,
  1148.         get_string(STR_ID_PROF_HDLR_ACTIVATE_PROFILE),
  1149.         IMG_GLOBAL_QUESTION,
  1150.         WARNING_TONE);
  1151.     SetLeftSoftkeyFunction(mmi_ph_activate_selected_profile, KEY_EVENT_UP);
  1152.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1153. }
  1154. /*****************************************************************************
  1155.  * FUNCTION
  1156.  *  mmi_ph_activate_selected_profile
  1157.  * DESCRIPTION
  1158.  *  It updates the current selected profile index as the activated proifle index
  1159.  *  & based on this index updates the activated profile struct.
  1160.  *  Done popup is shown on completion
  1161.  * PARAMETERS
  1162.  *  void
  1163.  * RETURNS
  1164.  *  void
  1165.  *****************************************************************************/
  1166. void mmi_ph_activate_selected_profile(void)
  1167. {
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Local Variables                                                */
  1170.     /*----------------------------------------------------------------*/
  1171.     S16 error;
  1172.     /*----------------------------------------------------------------*/
  1173.     /* Code Body                                                      */
  1174.     /*----------------------------------------------------------------*/
  1175.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1176.     {
  1177.         g_ph_cntx.wap_actived_profile_index = g_ph_cntx.profile_index;
  1178.         WriteValue(NVRAM_PH_ACTIVATED_WAP_PROFILE_INDEX, &g_ph_cntx.wap_actived_profile_index, DS_BYTE, &error);
  1179.         mmi_ph_get_activated_profile_data(PH_BROWSER_PROFILE, g_ph_cntx.profile_index);
  1180.     }
  1181.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1182.     {
  1183.         g_ph_cntx.mms_actived_profile_index = g_ph_cntx.profile_index;
  1184.         WriteValue(NVRAM_PH_ACTIVATED_MMS_PROFILE_INDEX, &g_ph_cntx.mms_actived_profile_index, DS_BYTE, &error);
  1185.         mmi_ph_get_activated_profile_data(PH_MMS_PROFILE, g_ph_cntx.profile_index);
  1186.     }
  1187. #if defined(MMS_SUPPORT)/*dilip*/
  1188.     mmi_jmms_set_profile();
  1189. #endif
  1190.     /* Added by Sandeep for checking data connection active or not */
  1191.     /* If the data profile is chnaged by the user then we have to set this flag as false so that 
  1192.        when a new page is fetched then we have to set the profile again */
  1193.     mmi_brw_set_connection_active_flag(E_FALSE);
  1194.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  1195.     DeleteNHistory(1);
  1196. }
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  mmi_ph_show_connection_type_options
  1200.  * DESCRIPTION
  1201.  *  It shows the various connection type menu item available
  1202.  * PARAMETERS
  1203.  *  void
  1204.  * RETURNS
  1205.  *  void
  1206.  *****************************************************************************/
  1207. void mmi_ph_show_connection_type_options(void)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     U8 *gui_buffer_p;
  1213.     S32 num_of_item = 0;
  1214.     S32 count;
  1215.     U32 conn_type_index;
  1216.     U16 nStrItemList[MAX_CONN_TYPE];
  1217.     /*----------------------------------------------------------------*/
  1218.     /* Code Body                                                      */
  1219.     /*----------------------------------------------------------------*/
  1220.     EntryNewScreen(SCR_ID_PROF_HDLR_CONN_TYPE, NULL, mmi_ph_show_connection_type_options, NULL);
  1221.     gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_CONN_TYPE);
  1222.     num_of_item = GetNumOfChild(MENU_ID_PH_CONNECTION_TYPE);
  1223.     GetSequenceStringIds(MENU_ID_PH_CONNECTION_TYPE, nStrItemList);
  1224.     SetParentHandler(MENU_ID_PH_CONNECTION_TYPE);
  1225.     RegisterHighlightHandler(mmi_ph_conn_type_highlight_hdlr);
  1226.     for (count = 0; count < num_of_item; count++)
  1227.     {
  1228.         memset((S8*) subMenuDataPtrs[count], 0, MAX_SUB_MENU_SIZE);
  1229.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[count], (S8*) GetString(nStrItemList[count]), MAX_SUBMENU_CHARACTERS);
  1230.     }
  1231.     conn_type_index = mmi_ph_get_highlighted_menu_item();
  1232.     ShowCategory36Screen(
  1233.         STR_ID_PROF_HDLR_CONN_TYPE,
  1234.         //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  1235. GetRootTitleIcon(g_ph_title_img_id),
  1236.         STR_GLOBAL_OK,
  1237.         IMG_GLOBAL_OK,
  1238.         STR_GLOBAL_BACK,
  1239.         IMG_GLOBAL_BACK,
  1240.         num_of_item,
  1241.         (U8 **) subMenuDataPtrs,
  1242.         (U16) conn_type_index,
  1243.         gui_buffer_p);
  1244.     SetLeftSoftkeyFunction(mmi_ph_entry_edit_connection_type_details, KEY_EVENT_UP);
  1245.     //NOTE : this will be needed if we want to update the connection type just by selecting the conn type
  1246.     //      SetRightSoftkeyFunction(mmi_ph_update_connection_type,KEY_EVENT_UP);
  1247.     //      SetKeyHandler(mmi_ph_update_connection_type,KEY_LEFT_ARROW,KEY_EVENT_DOWN);
  1248.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1249.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1250. }
  1251. /*****************************************************************************
  1252.  * FUNCTION
  1253.  *  mmi_ph_update_connection_type
  1254.  * DESCRIPTION
  1255.  *  This API updates the connection type in the edit profile screen
  1256.  * PARAMETERS
  1257.  *  void
  1258.  * RETURNS
  1259.  *  void
  1260.  *****************************************************************************/
  1261. void mmi_ph_update_connection_type(void)
  1262. {
  1263.     /*----------------------------------------------------------------*/
  1264.     /* Local Variables                                                */
  1265.     /*----------------------------------------------------------------*/
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Code Body                                                      */
  1268.     /*----------------------------------------------------------------*/
  1269.     mmi_ph_highlight_inline_item_conn_type(g_ph_conn_index);
  1270.     DeleteNHistory(1);
  1271. }
  1272. /*****************************************************************************
  1273.  * FUNCTION
  1274.  *  mmi_ph_get_highlighted_menu_item
  1275.  * DESCRIPTION
  1276.  *  It gives the higlighted connection type menu item
  1277.  * PARAMETERS
  1278.  *  void
  1279.  * RETURNS
  1280.  *  U8 connection type highlighted
  1281.  *****************************************************************************/
  1282. U8 mmi_ph_get_highlighted_menu_item(void)
  1283. {
  1284.     /*----------------------------------------------------------------*/
  1285.     /* Local Variables                                                */
  1286.     /*----------------------------------------------------------------*/
  1287.     /*----------------------------------------------------------------*/
  1288.     /* Code Body                                                      */
  1289.     /*----------------------------------------------------------------*/
  1290.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1291.     {
  1292.         if ((g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED)
  1293.             || (g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED_SECURE))
  1294.         {
  1295.             return (U8) PH_MENU_CONNECTION_OREINTED;
  1296.         }
  1297.         else if (g_ph_wap_profile_p->conn_type == PH_CONN_TYPE_HTTP)
  1298.         {
  1299.             return (U8) PH_MENU_HTTP;
  1300.         }
  1301.     }
  1302.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1303.     {
  1304.         if ((g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED)
  1305.             || (g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED_SECURE))
  1306.         {
  1307.             return (U8) PH_MENU_CONNECTION_OREINTED;
  1308.         }
  1309.         else if (g_ph_mms_profile_p->conn_type == PH_CONN_TYPE_HTTP)
  1310.         {
  1311.             return (U8) PH_MENU_HTTP;
  1312.         }
  1313.     }
  1314.     return (U8) PH_MENU_CONNECTION_OREINTED;
  1315. }
  1316. /*****************************************************************************
  1317.  * FUNCTION
  1318.  *  mmi_ph_conn_type_highlight_hdlr
  1319.  * DESCRIPTION
  1320.  *  This API is to update the global connection type index
  1321.  * PARAMETERS
  1322.  *  index       [IN]        Highlighted index
  1323.  * RETURNS
  1324.  *  void
  1325.  *****************************************************************************/
  1326. void mmi_ph_conn_type_highlight_hdlr(S32 index)
  1327. {
  1328.     /*----------------------------------------------------------------*/
  1329.     /* Local Variables                                                */
  1330.     /*----------------------------------------------------------------*/
  1331.     /*----------------------------------------------------------------*/
  1332.     /* Code Body                                                      */
  1333.     /*----------------------------------------------------------------*/
  1334.     g_ph_conn_index = (U8) index;
  1335. }
  1336. /*****************************************************************************
  1337.  * FUNCTION
  1338.  *  mmi_ph_entry_edit_connection_type_details
  1339.  * DESCRIPTION
  1340.  *  This is the entry fucntion for connection type details inline item screen
  1341.  * PARAMETERS
  1342.  *  void
  1343.  * RETURNS
  1344.  *  void
  1345.  *****************************************************************************/
  1346. void mmi_ph_entry_edit_connection_type_details(void)
  1347. {
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Local Variables                                                */
  1350.     /*----------------------------------------------------------------*/
  1351.     U8 *input_buffer_p; /* added for inline edit history */
  1352.     U8 *gui_buffer_p;   /* Buffer holding history data */
  1353.     U16 input_buffer_size;
  1354. U32 conn_type_index; // Sandeep
  1355.     U16 EditConnTypeIconList[MAX_INLINE_ITEM_EDIT_CONN_TYPE_LIST] = {IMG_GLOBAL_L1, 0, IMG_GLOBAL_L2, 0};
  1356.     /*----------------------------------------------------------------*/
  1357.     /* Code Body                                                      */
  1358.     /*----------------------------------------------------------------*/
  1359.     EntryNewScreen(SCR_ID_PROF_HDLR_EDIT_CONN_TYPE, mmi_ph_exit_edit_connection_type_details, NULL, NULL);
  1360.     InitializeCategory57Screen();
  1361.     gui_buffer_p = GetCurrGuiBuffer(SCR_ID_PROF_HDLR_EDIT_CONN_TYPE);
  1362.     input_buffer_p = GetCurrNInputBuffer(SCR_ID_PROF_HDLR_EDIT_CONN_TYPE, &input_buffer_size);  /* added for inline edit history */
  1363.     mmi_ph_edit_conn_type_fill_inline_struct();
  1364.     if (input_buffer_p != NULL)
  1365.     {
  1366.         if (g_ph_conn_index == PH_MENU_HTTP)
  1367.         {
  1368.             SetCategory57Data(wgui_inline_items, MAX_INLINE_ITEM_EDIT_CONN_TYPE_LIST, input_buffer_p);
  1369.         }
  1370.         else
  1371.         {
  1372.             SetCategory57Data(wgui_inline_items, 2, input_buffer_p);
  1373.         }
  1374.     }
  1375. //Sandeep
  1376. conn_type_index = mmi_ph_get_highlighted_menu_item();
  1377. if ( conn_type_index != g_ph_conn_index )
  1378. {
  1379. SetInlineListMenuChanged();
  1380. }
  1381.     if (g_ph_conn_index == PH_MENU_HTTP)
  1382.     {
  1383.         ShowCategory57Screen(
  1384.             STR_GLOBAL_EDIT,
  1385.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  1386. GetRootTitleIcon(g_ph_title_img_id),
  1387.             STR_GLOBAL_EDIT,
  1388.             NULL,
  1389.             STR_GLOBAL_BACK,
  1390.             IMG_GLOBAL_BACK,
  1391.             MAX_INLINE_ITEM_EDIT_CONN_TYPE_LIST,
  1392.             EditConnTypeIconList,
  1393.             wgui_inline_items,
  1394.             0,
  1395.             gui_buffer_p);
  1396.     }
  1397.     else
  1398.     {
  1399.         ShowCategory57Screen(
  1400.             STR_GLOBAL_EDIT,
  1401.             //GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  1402. GetRootTitleIcon(g_ph_title_img_id),
  1403.             STR_GLOBAL_EDIT,
  1404.             NULL,
  1405.             STR_GLOBAL_BACK,
  1406.             IMG_GLOBAL_BACK,
  1407.             2,
  1408.             EditConnTypeIconList,
  1409.             wgui_inline_items,
  1410.             0,
  1411.             gui_buffer_p);
  1412.     }
  1413.     SetCategory57RightSoftkeyFunctions(mmi_ph_save_connection_type_changes, GoBackHistory);
  1414. }
  1415. /*****************************************************************************
  1416.  * FUNCTION
  1417.  *  mmi_ph_highlight_inline_item_conn_type
  1418.  * DESCRIPTION
  1419.  *  This API updates the Browser & MMS proifle structs based  on the highlighted index
  1420.  * PARAMETERS
  1421.  *  index       [IN]        
  1422.  * RETURNS
  1423.  *  void
  1424.  *****************************************************************************/
  1425. void mmi_ph_highlight_inline_item_conn_type(S32 index)
  1426. {
  1427.     /*----------------------------------------------------------------*/
  1428.     /* Local Variables                                                */
  1429.     /*----------------------------------------------------------------*/
  1430.     /*----------------------------------------------------------------*/
  1431.     /* Code Body                                                      */
  1432.     /*----------------------------------------------------------------*/
  1433.     if (index == PH_MENU_CONNECTION_OREINTED)
  1434.     {
  1435.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1436.         {
  1437.         #if defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT)
  1438.             if (UCS2Strcmp
  1439.                 ((S8*) g_ph_cntx.profile_display_p->security_option[g_ph_cntx.profile_display_p->security_opt_index],
  1440.                  (S8*) GetString(STR_ID_PROF_HDLR_ON)) == 0)
  1441.             {
  1442.                 g_ph_wap_profile_p->conn_type = CONN_TYPE_CONNECTION_OREINTED_SECURE;
  1443.                 g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].conn_type =
  1444.                     CONN_TYPE_CONNECTION_OREINTED_SECURE;
  1445.             }
  1446.             else
  1447.             {
  1448.                 g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  1449.                 g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].conn_type =
  1450.                     PH_CONN_TYPE_CONNECTION_OREINTED;
  1451.             }
  1452.         #else /* defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT) */ 
  1453.             g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  1454.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].conn_type =
  1455.                 PH_CONN_TYPE_CONNECTION_OREINTED;
  1456.         #endif /* defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT) */ 
  1457.         }
  1458.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1459.         {
  1460.         #if defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT)
  1461.             if (UCS2Strcmp
  1462.                 ((S8*) g_ph_cntx.profile_display_p->security_option[g_ph_cntx.profile_display_p->security_opt_index],
  1463.                  (S8*) GetString(STR_ID_PROF_HDLR_ON)) == 0)
  1464.             {
  1465.                 g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED_SECURE;
  1466.             }
  1467.             else
  1468.             {
  1469.                 g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  1470.             }
  1471.         #else /* defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT) */ 
  1472.             g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  1473.         #endif /* defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT) */ 
  1474.         }
  1475.     }
  1476.     else if (index == PH_MENU_HTTP)
  1477.     {
  1478.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1479.         {
  1480.             g_ph_wap_profile_p->conn_type = PH_CONN_TYPE_HTTP;
  1481.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[g_ph_cntx.profile_index].conn_type =
  1482.                 PH_CONN_TYPE_HTTP;
  1483.         }
  1484.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1485.         {
  1486.             g_ph_mms_profile_p->conn_type = PH_CONN_TYPE_HTTP;
  1487.         }
  1488.     }
  1489. }
  1490. /*****************************************************************************
  1491.  * FUNCTION
  1492.  *  mmi_ph_save_connection_type_changes
  1493.  * DESCRIPTION
  1494.  *  This API saves the changes done with the connection type like port & IP
  1495.  * PARAMETERS
  1496.  *  void
  1497.  * RETURNS
  1498.  *  void
  1499.  *****************************************************************************/
  1500. void mmi_ph_save_connection_type_changes(void)
  1501. {
  1502.     /*----------------------------------------------------------------*/
  1503.     /* Local Variables                                                */
  1504.     /*----------------------------------------------------------------*/
  1505.     U8 ip_value[4];
  1506.     U32 ip_sum = 0;
  1507.     /*----------------------------------------------------------------*/
  1508.     /* Code Body                                                      */
  1509.     /*----------------------------------------------------------------*/
  1510. g_ph_done_flag = 0x01;  /* Tk added for Handling the Done RSK label */
  1511.     ip_value[0] = (U8) gui_atoi((UI_string_type) g_ph_cntx.profile_display_p->IP1);
  1512.     ip_value[1] = (U8) gui_atoi((UI_string_type) g_ph_cntx.profile_display_p->IP2);
  1513.     ip_value[2] = (U8) gui_atoi((UI_string_type) g_ph_cntx.profile_display_p->IP3);
  1514.     ip_value[3] = (U8) gui_atoi((UI_string_type) g_ph_cntx.profile_display_p->IP4);
  1515.     ip_sum = ip_value[0] + ip_value[1] + ip_value[2] + ip_value[3];
  1516.     if ((ip_sum == 0x00) && ((g_ph_conn_index == PH_MENU_CONNECTION_OREINTED)))
  1517.     {
  1518.         DisplayPopup(
  1519.             (PU8) GetString(STR_ID_PROF_HDLR_INVALID_IP),
  1520.             IMG_GLOBAL_ERROR,
  1521.             1,
  1522.             UI_POPUP_NOTIFYDURATION_TIME,
  1523.             ERROR_TONE);
  1524.     }
  1525.     else
  1526.     {
  1527.         U32 port = 0;
  1528.         port = (U32) gui_atoi((UI_string_type) g_ph_cntx.profile_display_p->proxy_port);
  1529.         if (!UCS2Strlen((S8*) g_ph_cntx.profile_display_p->proxy_port))
  1530.         {
  1531.             DisplayPopup(
  1532.                 (PU8) GetString(STR_ID_PROF_HDLR_INVALID_INPUT),
  1533.                 IMG_GLOBAL_ERROR,
  1534.                 1,
  1535.                 UI_POPUP_NOTIFYDURATION_TIME,
  1536.                 ERROR_TONE);
  1537.         }
  1538.         else if (port >= PH_USHORT_MAX)
  1539.         {
  1540.             DisplayPopup(
  1541.                 (PU8) GetString(STR_ID_PROF_HDLR_INVALID_INPUT),
  1542.                 IMG_GLOBAL_ERROR,
  1543.                 1,
  1544.                 UI_POPUP_NOTIFYDURATION_TIME,
  1545.                 ERROR_TONE);
  1546.         }
  1547.         else
  1548.         {
  1549.             if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1550.             {
  1551.                 g_ph_wap_profile_p->proxy_ip[0] = ip_value[0];
  1552.                 g_ph_wap_profile_p->proxy_ip[1] = ip_value[1];
  1553.                 g_ph_wap_profile_p->proxy_ip[2] = ip_value[2];
  1554.                 g_ph_wap_profile_p->proxy_ip[3] = ip_value[3];
  1555.                 g_ph_wap_profile_p->proxy_port = (U16) port;
  1556.                 mmi_ph_update_connection_type();
  1557.                 GoBackHistory();
  1558.             }
  1559.             else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1560.             {
  1561.                 g_ph_mms_profile_p->proxy_ip[0] = ip_value[0];
  1562.                 g_ph_mms_profile_p->proxy_ip[1] = ip_value[1];
  1563.                 g_ph_mms_profile_p->proxy_ip[2] = ip_value[2];
  1564.                 g_ph_mms_profile_p->proxy_ip[3] = ip_value[3];
  1565.                 g_ph_mms_profile_p->proxy_port = (U16) port;
  1566.                 mmi_ph_update_connection_type();
  1567.                 GoBackHistory();
  1568.             }
  1569.         }
  1570.     }
  1571. }
  1572. /*****************************************************************************
  1573.  * FUNCTION
  1574.  *  mmi_ph_exit_edit_connection_type_details
  1575.  * DESCRIPTION
  1576.  *  It is te exit handler for the edit connection type screen
  1577.  * PARAMETERS
  1578.  *  void
  1579.  * RETURNS
  1580.  *  void
  1581.  *****************************************************************************/
  1582. void mmi_ph_exit_edit_connection_type_details(void)
  1583. {
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Local Variables                                                */
  1586.     /*----------------------------------------------------------------*/
  1587.     history h;
  1588.     U16 input_buffer_size;
  1589.     S16 nHistory = 0;
  1590.     /*----------------------------------------------------------------*/
  1591.     /* Code Body                                                      */
  1592.     /*----------------------------------------------------------------*/
  1593.     h.scrnID = SCR_ID_PROF_HDLR_EDIT_CONN_TYPE;
  1594.     CloseCategory57Screen();
  1595.     h.entryFuncPtr = mmi_ph_entry_edit_connection_type_details;
  1596.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  1597.     GetCategory57History(h.guiBuffer);
  1598.     input_buffer_size = (U16) GetCategory57DataSize();
  1599.     GetCategory57Data((U8*) h.inputBuffer);
  1600.     AddNHistory(h, input_buffer_size);
  1601. }
  1602. /*****************************************************************************
  1603.  * FUNCTION
  1604.  *  mmi_ph_edit_conn_type_fill_inline_struct
  1605.  * DESCRIPTION
  1606.  *  This API handles the connection type inline edit screen,containing inline items like IP ,proxy port
  1607.  * PARAMETERS
  1608.  *  void
  1609.  * RETURNS
  1610.  *  void
  1611.  *****************************************************************************/
  1612. void mmi_ph_edit_conn_type_fill_inline_struct(void)
  1613. {
  1614.     /*----------------------------------------------------------------*/
  1615.     /* Local Variables                                                */
  1616.     /*----------------------------------------------------------------*/
  1617.     S32 buffer_size = 0;
  1618.     /*----------------------------------------------------------------*/
  1619.     /* Code Body                                                      */
  1620.     /*----------------------------------------------------------------*/
  1621.     if (g_ph_cntx.profile_display_p == NULL)
  1622.     {
  1623.         g_ph_cntx.profile_display_p =
  1624.             (ph_show_editable_profile_struct*) jdd_MemAlloc(sizeof(ph_show_editable_profile_struct), 1);
  1625.     }
  1626.     if (g_ph_conn_index == PH_MENU_HTTP)
  1627.     {
  1628.         SetInlineItemActivation(
  1629.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS),
  1630.             INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
  1631.             0);
  1632.         SetInlineItemCaption(
  1633.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS_STR),
  1634.             (U8*) GetString(STR_ID_PROF_HDLR_PROXY_ADDRESS));
  1635.         SetInlineItemActivation((wgui_inline_items + PH_CONN_TYPE_SECURITY), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1636.         SetInlineItemCaption((wgui_inline_items + PH_CONN_TYPE_SECURITY_STR), (U8*) GetString(STR_ID_PROF_HDLR_PORT));
  1637.         /* dara NOTE ..for http ..its port in place of security */
  1638.         buffer_size = 6;
  1639.         SetInlineItemTextEdit(
  1640.             (wgui_inline_items + PH_CONN_TYPE_SECURITY),
  1641.             (U8*) (g_ph_cntx.profile_display_p->proxy_port),
  1642.             buffer_size,
  1643.             INPUT_TYPE_NUMERIC);
  1644.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1645.         {
  1646.             gui_itoa((S32) g_ph_wap_profile_p->proxy_port, (U16*) g_ph_cntx.profile_display_p->proxy_port, 10);
  1647.         }
  1648.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1649.         {
  1650.             gui_itoa((S32) g_ph_mms_profile_p->proxy_port, (U16*) g_ph_cntx.profile_display_p->proxy_port, 10);
  1651.         }
  1652.     }
  1653.     else
  1654.     {
  1655.         SetInlineItemActivation(
  1656.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS),
  1657.             INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
  1658.             0);
  1659.         SetInlineItemCaption(
  1660.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS_STR),
  1661.             (U8*) GetString(STR_ID_PROF_HDLR_IP_ADDRESS));
  1662.     #if defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT)
  1663.         SetInlineItemActivation((wgui_inline_items + PH_CONN_TYPE_SECURITY), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1664.         SetInlineItemCaption(
  1665.             (wgui_inline_items + PH_CONN_TYPE_SECURITY_STR),
  1666.             (U8*) GetString(STR_ID_PROF_HDLR_SECURITY));
  1667.         g_ph_cntx.profile_display_p->security_option[0] = (U8*) GetString(STR_ID_PROF_HDLR_OFF);
  1668.         g_ph_cntx.profile_display_p->security_option[1] = (U8*) GetString(STR_ID_PROF_HDLR_ON);
  1669.         SetInlineItemSelect(
  1670.             (wgui_inline_items + CONN_TYPE_SECURITY),
  1671.             (S32) 0x02,
  1672.             (U8 **) g_ph_cntx.profile_display_p->security_option,
  1673.             (S32*) (&(g_ph_cntx.profile_display_p->security_opt_index)));
  1674.     #endif /* defined (WAP_SEC_SUPPORT) && defined (JATAAYU_SUPPORT) */ 
  1675.         if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1676.         {
  1677.             gui_itoa((S32) g_ph_wap_profile_p->proxy_port, (U16*) g_ph_cntx.profile_display_p->proxy_port, 10);
  1678.         }
  1679.         else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1680.         {
  1681.             gui_itoa((S32) g_ph_mms_profile_p->proxy_port, (U16*) g_ph_cntx.profile_display_p->proxy_port, 10);
  1682.         }
  1683.     }
  1684.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1685.     {
  1686.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP1, (U8) g_ph_wap_profile_p->proxy_ip[0]);
  1687.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP2, (U8) g_ph_wap_profile_p->proxy_ip[1]);
  1688.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP3, (U8) g_ph_wap_profile_p->proxy_ip[2]);
  1689.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP4, (U8) g_ph_wap_profile_p->proxy_ip[3]);
  1690.         SetInlineItemIP4(
  1691.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS),
  1692.             (U8*) g_ph_cntx.profile_display_p->IP1,
  1693.             (U8*) g_ph_cntx.profile_display_p->IP2,
  1694.             (U8*) g_ph_cntx.profile_display_p->IP3,
  1695.             (U8*) g_ph_cntx.profile_display_p->IP4,
  1696.             PreparedIPAddressString);
  1697.     }
  1698.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1699.     {
  1700.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP1, (U8) g_ph_mms_profile_p->proxy_ip[0]);
  1701.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP2, (U8) g_ph_mms_profile_p->proxy_ip[1]);
  1702.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP3, (U8) g_ph_mms_profile_p->proxy_ip[2]);
  1703.         ReturnThreeDigitString(g_ph_cntx.profile_display_p->IP4, (U8) g_ph_mms_profile_p->proxy_ip[3]);
  1704.         SetInlineItemIP4(
  1705.             (wgui_inline_items + PH_CONN_TYPE_IP_ADDRESS),
  1706.             (U8*) g_ph_cntx.profile_display_p->IP1,
  1707.             (U8*) g_ph_cntx.profile_display_p->IP2,
  1708.             (U8*) g_ph_cntx.profile_display_p->IP3,
  1709.             (U8*) g_ph_cntx.profile_display_p->IP4,
  1710.             PreparedIPAddressString);
  1711.     }
  1712. }
  1713. /*****************************************************************************
  1714.  * FUNCTION
  1715.  *  mmi_ph_get_selected_profile_content_data
  1716.  * DESCRIPTION
  1717.  *  This gets the content data for the profile index selected()
  1718.  *  its general for browser & MMS profiles
  1719.  * PARAMETERS
  1720.  *  profile_index       [IN]        Profile index
  1721.  * RETURNS
  1722.  *  void
  1723.  *****************************************************************************/
  1724. void mmi_ph_get_selected_profile_content_data(U8 profile_index)
  1725. {
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Local Variables                                                */
  1728.     /*----------------------------------------------------------------*/
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Code Body                                                      */
  1731.     /*----------------------------------------------------------------*/
  1732.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  1733.     {
  1734.         if (g_ph_wap_profile_p == NULL)
  1735.         {
  1736.             g_ph_wap_profile_p =
  1737.                 (nvram_wap_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_CONTENT_SIZE, 1);
  1738.         }
  1739.     }
  1740.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  1741.     {
  1742.         if (g_ph_mms_profile_p == NULL)
  1743.         {
  1744.             g_ph_mms_profile_p =
  1745.                 (nvram_mms_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_MMS_PROFILE_CONTENT_SIZE, 1);
  1746.         }
  1747.     }
  1748.     mmi_ph_get_profile_nvram_content_data(profile_index);
  1749. }
  1750. /*****************************************************************************
  1751.  * FUNCTION
  1752.  *  mmi_ph_get_activated_profile_index
  1753.  * DESCRIPTION
  1754.  *  THis API returns the activated profile index
  1755.  * PARAMETERS
  1756.  *  void
  1757.  * RETURNS
  1758.  *  U8    activated profile index
  1759.  *****************************************************************************/
  1760. U8 mmi_ph_get_activated_profile_index(void)
  1761. {
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Local Variables                                                */
  1764.     /*----------------------------------------------------------------*/
  1765.     S16 error;
  1766.     /*----------------------------------------------------------------*/
  1767.     /* Code Body                                                      */
  1768.     /*----------------------------------------------------------------*/
  1769.     if ((g_ph_cntx.profile_module == PH_BROWSER_PROFILE) || (g_ph_cntx.profile_module == PH_BROWSER_PROV_PROFILE))      /* added by tk */
  1770.     {
  1771.         ReadValue(NVRAM_PH_ACTIVATED_WAP_PROFILE_INDEX, &g_ph_cntx.wap_actived_profile_index, DS_BYTE, &error);
  1772.         return g_ph_cntx.wap_actived_profile_index;
  1773.     }
  1774.     else if ((g_ph_cntx.profile_module == PH_MMS_PROFILE) || (g_ph_cntx.profile_module == PH_MMS_PROV_PROFILE)) /* added by tk */
  1775.     {
  1776.         ReadValue(NVRAM_PH_ACTIVATED_MMS_PROFILE_INDEX, &g_ph_cntx.mms_actived_profile_index, DS_BYTE, &error);
  1777.         return g_ph_cntx.mms_actived_profile_index;
  1778.     }
  1779.     return 0;
  1780. }
  1781. /*****************************************************************************
  1782.  * FUNCTION
  1783.  *  mmi_ph_check_data_account_type
  1784.  * DESCRIPTION
  1785.  *  It checks the data account type(CSD or GPRS) for the index passed
  1786.  * PARAMETERS
  1787.  *  account_index       [IN]        Data account index
  1788.  * RETURNS
  1789.  *  void
  1790.  *****************************************************************************/
  1791. ph_data_account_enum mmi_ph_check_data_account_type(U8 account_index)
  1792. {
  1793.     /*----------------------------------------------------------------*/
  1794.     /* Local Variables                                                */
  1795.     /*----------------------------------------------------------------*/
  1796.     /*----------------------------------------------------------------*/
  1797.     /* Code Body                                                      */
  1798.     /*----------------------------------------------------------------*/
  1799.     if (custom_get_csd_profile_num() > account_index)
  1800.     {
  1801.         return PH_DATA_ACCOUNT_CSD;
  1802.     }
  1803.     else if ((custom_get_gprs_profile_num() + custom_get_csd_profile_num()) >= account_index)
  1804.     {
  1805.         return PH_DATA_ACCOUNT_GPRS;
  1806.     }
  1807.     else
  1808.     {
  1809.         return PH_DATA_ACCOUNT_INVALID;
  1810.     }
  1811. }
  1812. /*****************************************************************************
  1813.  * FUNCTION
  1814.  *  mmi_ph_get_csd_account_name_req
  1815.  * DESCRIPTION
  1816.  *  It send PRT_MMI_CC_GET_CSD_PROFILE_REQ to the L4 to get the csd data account for the index
  1817.  * PARAMETERS
  1818.  *  item_num        [IN]        
  1819.  * RETURNS
  1820.  *  void
  1821.  *****************************************************************************/
  1822. void mmi_ph_get_csd_account_name_req(U8 item_num)
  1823. {
  1824.     /*----------------------------------------------------------------*/
  1825.     /* Local Variables                                                */
  1826.     /*----------------------------------------------------------------*/
  1827.     mmi_cc_get_csd_profile_req_struct *my_msg_p;
  1828.     MYQUEUE Message;
  1829.     /*----------------------------------------------------------------*/
  1830.     /* Code Body                                                      */
  1831.     /*----------------------------------------------------------------*/
  1832.     my_msg_p = (mmi_cc_get_csd_profile_req_struct*) OslConstructDataPtr(sizeof(mmi_cc_get_csd_profile_req_struct));
  1833.     my_msg_p->prof_id = item_num;
  1834.     SetProtocolEventHandler(mmi_ph_get_csd_account_name_rsp, PRT_MMI_CC_GET_CSD_PROFILE_RSP);
  1835.     Message.oslSrcId = MOD_MMI;
  1836.     Message.oslDestId = MOD_L4C;
  1837.     Message.oslMsgId = PRT_MMI_CC_GET_CSD_PROFILE_REQ;
  1838.     Message.oslDataPtr = (oslParaType*) my_msg_p;
  1839.     Message.oslPeerBuffPtr = NULL;
  1840.     OslMsgSendExtQueue(&Message);
  1841. }
  1842. /*****************************************************************************
  1843.  * FUNCTION
  1844.  *  mmi_ph_get_csd_account_name_rsp
  1845.  * DESCRIPTION
  1846.  *  It handles the PRT_MMI_CC_GET_CSD_PROFILE_RSP from L4 to extract csd data account info
  1847.  * PARAMETERS
  1848.  *  info        [IN]        Its the pointer to csd data received from L4
  1849.  * RETURNS
  1850.  *  void
  1851.  *****************************************************************************/
  1852. void mmi_ph_get_csd_account_name_rsp(void *info)
  1853. {
  1854.     /*----------------------------------------------------------------*/
  1855.     /* Local Variables                                                */
  1856.     /*----------------------------------------------------------------*/
  1857.     mmi_cc_get_csd_profile_rsp_struct *local_p;
  1858.     U32 i = 0;
  1859.     S8 account_name_str[30 * ENCODING_LENGTH];
  1860.     /*----------------------------------------------------------------*/
  1861.     /* Code Body                                                      */
  1862.     /*----------------------------------------------------------------*/
  1863.     local_p = (mmi_cc_get_csd_profile_rsp_struct*) info;
  1864.     SetDynaDataAccountName(account_name_str, g_ph_cntx.ph_dataaccount_index);
  1865.     if (local_p->name.name_dcs == DATA_ACCOUNT_UCS)
  1866.     {
  1867.         i = 0;
  1868.         if (local_p->name.name_length == 0)
  1869.         {
  1870.             pfnUnicodeStrcpy((PS8) g_ph_cntx.profile_display_p->DataAccountName, (PS8) account_name_str);
  1871.         }
  1872.         else
  1873.         {
  1874.             while (i != local_p->name.name_length)
  1875.             {
  1876.                 g_ph_cntx.profile_display_p->DataAccountName[i] = local_p->name.name[i + 1];
  1877.                 g_ph_cntx.profile_display_p->DataAccountName[i + 1] = local_p->name.name[i];
  1878.                 i += 2;
  1879.             }
  1880.             g_ph_cntx.profile_display_p->DataAccountName[local_p->name.name_length] = 0x00;
  1881.             g_ph_cntx.profile_display_p->DataAccountName[local_p->name.name_length + 1] = 0x00;
  1882.         }
  1883.     }
  1884.     else if (local_p->name.name_dcs == DATA_ACCOUNT_ASCII)
  1885.     {
  1886.         if (local_p->name.name_length == 0)
  1887.         {
  1888.             pfnUnicodeStrcpy((PS8) g_ph_cntx.profile_display_p->DataAccountName, (PS8) account_name_str);
  1889.         }
  1890.         else
  1891.         {
  1892.             AnsiiNToUnicodeString(
  1893.                 (PS8) g_ph_cntx.profile_display_p->DataAccountName,
  1894.                 (PS8) local_p->name.name,
  1895.                 (local_p->name.name_length + 1) * ENCODING_LENGTH);
  1896.         }
  1897.     }
  1898.     mmi_ph_entry_edit_selected_profile();
  1899. }
  1900. /*****************************************************************************
  1901.  * FUNCTION
  1902.  *  mmi_ph_get_gprs_account_name_req
  1903.  * DESCRIPTION
  1904.  *  It send PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_REQ to the L4 to get the csd data account for the index
  1905.  * PARAMETERS
  1906.  *  item_num        [IN]        
  1907.  * RETURNS
  1908.  *  void
  1909.  *****************************************************************************/
  1910. void mmi_ph_get_gprs_account_name_req(U8 item_num)
  1911. {
  1912. #ifdef __GPRS_MODE__
  1913.     /*----------------------------------------------------------------*/
  1914.     /* Local Variables                                                */
  1915.     /*----------------------------------------------------------------*/
  1916.     mmi_ps_get_gprs_data_account_req_struct *my_msg_p;
  1917.     MYQUEUE Message;
  1918.     /*----------------------------------------------------------------*/
  1919.     /* Code Body                                                      */
  1920.     /*----------------------------------------------------------------*/
  1921.     my_msg_p =
  1922.         (mmi_ps_get_gprs_data_account_req_struct*)
  1923.         OslConstructDataPtr(sizeof(mmi_ps_get_gprs_data_account_req_struct));
  1924.     my_msg_p->profile_id = item_num + 1 - MAX_DATA_ACCOUNT_GSM_LIMIT;
  1925.     Message.oslSrcId = MOD_MMI;
  1926.     Message.oslDestId = MOD_L4C;
  1927.     Message.oslMsgId = PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_REQ;
  1928.     Message.oslDataPtr = (oslParaType*) my_msg_p;
  1929.     Message.oslPeerBuffPtr = NULL;
  1930.     SetProtocolEventHandler(mmi_ph_get_gprs_account_name_rsp, PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_RSP);
  1931.     OslMsgSendExtQueue(&Message);
  1932.     PRINT_INFORMATION_2((MMI_TRACE_INFO, "**** JProfileUIHandler.c ******GPRS Data Account request sent to L4 n"));
  1933. #endif /* __GPRS_MODE__ */ 
  1934. }
  1935. /*****************************************************************************
  1936.  * FUNCTION
  1937.  *  mmi_ph_get_gprs_account_name_rsp
  1938.  * DESCRIPTION
  1939.  *  It handles the PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_RSP from L4 to extract GPRS data account info
  1940.  * PARAMETERS
  1941.  *  info        [IN]        Its the pointer to gprs data received from L4
  1942.  * RETURNS
  1943.  *  void
  1944.  *****************************************************************************/
  1945. void mmi_ph_get_gprs_account_name_rsp(void *info)
  1946. {
  1947.     /*----------------------------------------------------------------*/
  1948.     /* Local Variables                                                */
  1949.     /*----------------------------------------------------------------*/
  1950. #ifdef __GPRS_MODE__
  1951.     U32 i = 0;
  1952.     mmi_ps_get_gprs_data_account_rsp_struct *local_p;
  1953.     S8 account_name_str[30 * ENCODING_LENGTH];
  1954.     /*----------------------------------------------------------------*/
  1955.     /* Code Body                                                      */
  1956.     /*----------------------------------------------------------------*/
  1957.     local_p = (mmi_ps_get_gprs_data_account_rsp_struct*) info;
  1958.     SetDynaDataAccountName(account_name_str, g_ph_cntx.ph_dataaccount_index);
  1959.     if (local_p->gprs_account.name_dcs == DATA_ACCOUNT_UCS)
  1960.     {
  1961.         i = 0;
  1962.         if (local_p->gprs_account.name_length == 0)
  1963.         {
  1964.             pfnUnicodeStrcpy((PS8) g_ph_cntx.profile_display_p->DataAccountName, (PS8) account_name_str);
  1965.         }
  1966.         else
  1967.         {
  1968.             while (i != local_p->gprs_account.name_length)
  1969.             {
  1970.                 g_ph_cntx.profile_display_p->DataAccountName[i] = local_p->gprs_account.name[i + 1];
  1971.                 g_ph_cntx.profile_display_p->DataAccountName[i + 1] = local_p->gprs_account.name[i];
  1972.                 i += 2;
  1973.             }
  1974.             g_ph_cntx.profile_display_p->DataAccountName[local_p->gprs_account.name_length] = 0x00;
  1975.             g_ph_cntx.profile_display_p->DataAccountName[local_p->gprs_account.name_length + 1] = 0x00;
  1976.         }
  1977.     }
  1978.     else if (local_p->gprs_account.name_dcs == DATA_ACCOUNT_ASCII)
  1979.     {
  1980.         if (local_p->gprs_account.name_length == 0)
  1981.         {
  1982.             pfnUnicodeStrcpy((PS8) g_ph_cntx.profile_display_p->DataAccountName, (PS8) account_name_str);
  1983.         }
  1984.         else
  1985.         {
  1986.             AnsiiNToUnicodeString(
  1987.                 (PS8) g_ph_cntx.profile_display_p->DataAccountName,
  1988.                 (PS8) local_p->gprs_account.name,
  1989.                 (local_p->gprs_account.name_length + 1) * ENCODING_LENGTH);
  1990.         }
  1991.     }
  1992.     mmi_ph_entry_edit_selected_profile();
  1993. #endif /* __GPRS_MODE__ */ 
  1994. }
  1995. /*****************************************************************************
  1996.  * FUNCTION
  1997.  *  mmi_ph_handle_get_data_account_name
  1998.  * DESCRIPTION
  1999.  *  It API checks for the profile module & then depending upon the
  2000.  *  data account type associated ,send the request to the L4 to get the data account info
  2001.  * PARAMETERS
  2002.  *  void
  2003.  * RETURNS
  2004.  *  void
  2005.  *****************************************************************************/
  2006. void mmi_ph_handle_get_data_account_name(void)
  2007. {
  2008.     /*----------------------------------------------------------------*/
  2009.     /* Local Variables                                                */
  2010.     /*----------------------------------------------------------------*/
  2011.     /*----------------------------------------------------------------*/
  2012.     /* Code Body                                                      */
  2013.     /*----------------------------------------------------------------*/
  2014.     if (g_ph_cntx.profile_display_p == NULL)
  2015.     {
  2016.         g_ph_cntx.profile_display_p =
  2017.             (ph_show_editable_profile_struct*) jdd_MemAlloc(sizeof(ph_show_editable_profile_struct), 1);
  2018.     }
  2019.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  2020.     {
  2021.         mmi_dtcnt_get_account_name(
  2022.             g_ph_wap_profile_p->data_account,
  2023.             (S8*) g_ph_cntx.profile_display_p->DataAccountName,
  2024.             MAX_DATA_ACCOUNT_NAME_LEN);
  2025.     }
  2026.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  2027.     {
  2028.         mmi_dtcnt_get_account_name(
  2029.             g_ph_mms_profile_p->data_account,
  2030.             (S8*) g_ph_cntx.profile_display_p->DataAccountName,
  2031.             MAX_DATA_ACCOUNT_NAME_LEN);
  2032.     }
  2033.     mmi_ph_entry_edit_selected_profile();
  2034. }
  2035. #if 0
  2036. /* under construction !*/
  2037. /* under construction !*/
  2038. /* under construction !*/
  2039. /* under construction !*/
  2040. /* under construction !*/
  2041. /* under construction !*/
  2042. /* under construction !*/
  2043. /* under construction !*/
  2044. /* under construction !*/
  2045. /* under construction !*/
  2046. /* under construction !*/
  2047. /* under construction !*/
  2048. /* under construction !*/
  2049. /* under construction !*/
  2050. /* under construction !*/
  2051. /* under construction !*/
  2052. /* under construction !*/
  2053. /* under construction !*/
  2054. /* under construction !*/
  2055. /* under construction !*/
  2056. /* under construction !*/
  2057. /* under construction !*/
  2058. /* under construction !*/
  2059. /* under construction !*/
  2060. /* under construction !*/
  2061. /* under construction !*/
  2062. /* under construction !*/
  2063. /* under construction !*/
  2064. /* under construction !*/
  2065. /* under construction !*/
  2066. /* under construction !*/
  2067. /* under construction !*/
  2068. /* under construction !*/
  2069. /* under construction !*/
  2070. /* under construction !*/
  2071. /* under construction !*/
  2072. /* under construction !*/
  2073. /* under construction !*/
  2074. /* under construction !*/
  2075. /* under construction !*/
  2076. /* under construction !*/
  2077. /* under construction !*/
  2078. /* under construction !*/
  2079. /* under construction !*/
  2080. /* under construction !*/
  2081. /* under construction !*/
  2082. /* under construction !*/
  2083. /* under construction !*/
  2084. /* under construction !*/
  2085. /* under construction !*/
  2086. /* under construction !*/
  2087. /* under construction !*/
  2088. /* under construction !*/
  2089. /* under construction !*/
  2090. /* under construction !*/
  2091. /* under construction !*/
  2092. /* under construction !*/
  2093. /* under construction !*/
  2094. /* under construction !*/
  2095. /* under construction !*/
  2096. /* under construction !*/
  2097. /* under construction !*/
  2098. /* under construction !*/
  2099. /* under construction !*/
  2100. /* under construction !*/
  2101. #endif /* 0 */ 
  2102. /*****************************************************************************
  2103.  * FUNCTION
  2104.  *  mmi_ph_get_profile_name_list
  2105.  * DESCRIPTION
  2106.  *  This API extracts profile names from the g_ph_wap_prof_name_arr_p,& g_ph_mms_prof_name_arr_p
  2107.  *  into the subMenuData to be displayed
  2108.  * PARAMETERS
  2109.  *  void
  2110.  * RETURNS
  2111.  *  void
  2112.  *****************************************************************************/
  2113. void mmi_ph_get_profile_name_list(void)
  2114. {
  2115.     /*----------------------------------------------------------------*/
  2116.     /* Local Variables                                                */
  2117.     /*----------------------------------------------------------------*/
  2118.     U32 i;
  2119.     /*----------------------------------------------------------------*/
  2120.     /* Code Body                                                      */
  2121.     /*----------------------------------------------------------------*/
  2122.     if ((g_ph_cntx.profile_module == PH_BROWSER_PROFILE) || (g_ph_cntx.profile_module == PH_BROWSER_PROV_PROFILE))
  2123.     {
  2124.         for (i = 0; i < NVRAM_WAP_PROFILE_MAX; i++)
  2125.         {
  2126.             if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].dcs == PH_DCS_UCS)
  2127.             {
  2128.                 UCS2Strcpy(
  2129.                     (S8*) (S8*) subMenuData[i],
  2130.                     (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].profile_name));
  2131.             }
  2132.             else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].dcs == PH_DCS_ASCII)
  2133.             {
  2134.                 AnsiiToUnicodeString(
  2135.                     (S8*) subMenuData[i],
  2136.                     (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].profile_name));
  2137.             }
  2138.         }
  2139.     }
  2140.     else if ((g_ph_cntx.profile_module == PH_MMS_PROFILE) || (g_ph_cntx.profile_module == PH_MMS_PROV_PROFILE))
  2141.     {
  2142.         for (i = 0; i < NVRAM_MMS_PROFILE_MAX; i++)
  2143.         {
  2144.             if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[i].dcs == PH_DCS_UCS)
  2145.             {
  2146.                 UCS2Strcpy(
  2147.                     (S8*) (S8*) subMenuData[i],
  2148.                     (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[i].profile_name));
  2149.             }
  2150.             else if (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[i].dcs == PH_DCS_ASCII)
  2151.             {
  2152.                 AnsiiToUnicodeString(
  2153.                     (S8*) subMenuData[i],
  2154.                     (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[i].profile_name));
  2155.             }
  2156.         }
  2157.     }
  2158. }
  2159. /*****************************************************************************
  2160.  * FUNCTION
  2161.  *  mmi_ph_get_activated_wap_profile
  2162.  * DESCRIPTION
  2163.  *  It returns the pointer to the activated wap profile content struct
  2164.  * PARAMETERS
  2165.  *  void
  2166.  * RETURNS
  2167.  *  g_ph_activated_wap_profile
  2168.  *****************************************************************************/
  2169. nvram_wap_profile_content_struct *mmi_ph_get_activated_wap_profile(void)
  2170. {
  2171.     /*----------------------------------------------------------------*/
  2172.     /* Local Variables                                                */
  2173.     /*----------------------------------------------------------------*/
  2174.     /*----------------------------------------------------------------*/
  2175.     /* Code Body                                                      */
  2176.     /*----------------------------------------------------------------*/
  2177.     return g_ph_activated_wap_profile;
  2178. }
  2179. /*****************************************************************************
  2180.  * FUNCTION
  2181.  *  mmi_ph_get_activated_mms_profile
  2182.  * DESCRIPTION
  2183.  *  It returns the pointer to the activated MMS profile content struct
  2184.  * PARAMETERS
  2185.  *  void
  2186.  * RETURNS
  2187.  *  g_ph_activated_mms_profile
  2188.  *****************************************************************************/
  2189. nvram_mms_profile_content_struct *mmi_ph_get_activated_mms_profile(void)
  2190. {
  2191.     /*----------------------------------------------------------------*/
  2192.     /* Local Variables                                                */
  2193.     /*----------------------------------------------------------------*/
  2194.     /*----------------------------------------------------------------*/
  2195.     /* Code Body                                                      */
  2196.     /*----------------------------------------------------------------*/
  2197.     return g_ph_activated_mms_profile;
  2198. }
  2199. /*****************************************************************************
  2200.  * FUNCTION
  2201.  *  mmi_ph_brw_get_activated_profile_homepage
  2202.  * DESCRIPTION
  2203.  *  It retreives the activated profile data and returns the homepage url of the activated profile
  2204.  * PARAMETERS
  2205.  *  void
  2206.  * RETURNS
  2207.  *  g_ph_activated_wap_profile->homepage_url the homepage url of the activated profile
  2208.  *****************************************************************************/
  2209. U8 *mmi_ph_brw_get_activated_profile_homepage(void)
  2210. {
  2211.     /*----------------------------------------------------------------*/
  2212.     /* Local Variables                                                */
  2213.     /*----------------------------------------------------------------*/
  2214.     /*----------------------------------------------------------------*/
  2215.     /* Code Body                                                      */
  2216.     /*----------------------------------------------------------------*/
  2217.     if (g_ph_activated_wap_profile == NULL)
  2218.     {
  2219.         g_ph_activated_wap_profile =
  2220.             (nvram_wap_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_CONTENT_SIZE, 1);
  2221.         mmi_ph_get_activated_profile_data(PH_BROWSER_PROFILE, g_ph_cntx.wap_actived_profile_index);
  2222.     }
  2223.     return (U8*) (g_ph_activated_wap_profile->homepage_url);
  2224. }
  2225. /*****************************************************************************
  2226.  * FUNCTION
  2227.  *  mmi_ph_brw_set_activated_profile_homepage
  2228.  * DESCRIPTION
  2229.  *  It sets the url passed as the homepage url of the activated WAP profile
  2230.  * PARAMETERS
  2231.  *  homepage_url_p      [?]         
  2232.  *  homepage_url(?)     [IN]        
  2233.  * RETURNS
  2234.  *  void
  2235.  *****************************************************************************/
  2236. void mmi_ph_brw_set_activated_profile_homepage(U8 *homepage_url_p)
  2237. {
  2238.     /*----------------------------------------------------------------*/
  2239.     /* Local Variables                                                */
  2240.     /*----------------------------------------------------------------*/
  2241.     U32 len = 0;
  2242.     /*----------------------------------------------------------------*/
  2243.     /* Code Body                                                      */
  2244.     /*----------------------------------------------------------------*/
  2245.     len = strlen((S8*) homepage_url_p);
  2246.     if (len >= NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN)
  2247.     {
  2248.         len = NVRAM_WAP_PROFILE_HOMEPAGE_URL_LEN - 1;
  2249.     }
  2250.     memcpy(g_ph_activated_wap_profile->homepage_url, homepage_url_p, len);
  2251.     g_ph_activated_wap_profile->homepage_url[len] = '';
  2252.     mmi_ph_update_nvram_activated_wap_profile();
  2253. }
  2254. /*****************************************************************************
  2255.  * FUNCTION
  2256.  *  mmi_ph_mms_get_activated_profile_mmsc_url
  2257.  * DESCRIPTION
  2258.  *  It returns the mmsc url associalted with the activated mms profile
  2259.  * PARAMETERS
  2260.  *  void
  2261.  * RETURNS
  2262.  *  g_ph_activated_mms_profile->mmsc_url   mmsc url of the activated profile
  2263.  *****************************************************************************/
  2264. U8 *mmi_ph_mms_get_activated_profile_mmsc_url(void)
  2265. {
  2266.     /*----------------------------------------------------------------*/
  2267.     /* Local Variables                                                */
  2268.     /*----------------------------------------------------------------*/
  2269.     /*----------------------------------------------------------------*/
  2270.     /* Code Body                                                      */
  2271.     /*----------------------------------------------------------------*/
  2272.     if (g_ph_activated_mms_profile == NULL)
  2273.     {
  2274.         g_ph_activated_mms_profile =
  2275.             (nvram_mms_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_MMS_PROFILE_CONTENT_SIZE, 1);
  2276.         mmi_ph_get_activated_profile_data(PH_MMS_PROFILE, g_ph_cntx.mms_actived_profile_index);
  2277.     }
  2278.     return (U8*) (g_ph_activated_mms_profile->mmsc_url);
  2279. }
  2280. /*****************************************************************************
  2281.  * FUNCTION
  2282.  *  mmi_ph_get_activated_prof_id_req_hdlr
  2283.  * DESCRIPTION
  2284.  *  This is the request handler for MSG_ID_WAP_GET_BRA_PROF_ID_REQ request ID ,it in turns retruns teh activated profile index
  2285.  * PARAMETERS
  2286.  *  void
  2287.  * RETURNS
  2288.  *  void
  2289.  *****************************************************************************/
  2290. void mmi_ph_get_activated_prof_id_req_hdlr(void)
  2291. {
  2292.     /*----------------------------------------------------------------*/
  2293.     /* Local Variables                                                */
  2294.     /*----------------------------------------------------------------*/
  2295.     MYQUEUE Message;
  2296.     wap_get_bra_prof_id_rsp_struct *prof_id_rsp;
  2297.     /*----------------------------------------------------------------*/
  2298.     /* Code Body                                                      */
  2299.     /*----------------------------------------------------------------*/
  2300.     prof_id_rsp = (wap_get_bra_prof_id_rsp_struct*) OslConstructDataPtr(sizeof(wap_get_bra_prof_id_rsp_struct));
  2301.     prof_id_rsp->prof_id = g_ph_cntx.mms_actived_profile_index;
  2302.     prof_id_rsp->net_id = g_ph_activated_wap_profile->data_account;
  2303.     Message.oslSrcId = MOD_WAP;
  2304.     Message.oslDestId = MOD_J2ME;
  2305.     Message.oslMsgId = MSG_ID_WAP_GET_BRA_PROF_ID_RSP;
  2306.     Message.oslDataPtr = (oslParaType*) prof_id_rsp;
  2307.     Message.oslPeerBuffPtr = NULL;
  2308.     OslMsgSendExtQueue(&Message);
  2309. }
  2310. /*****************************************************************************
  2311.  * FUNCTION
  2312.  *  mmi_ph_get_prof_list_req_hdlr
  2313.  * DESCRIPTION
  2314.  *  It is the request handler for the MSG_ID_WAP_GET_PROF_LIST_REQ ,it in turns returns the profiel name list as the response
  2315.  * PARAMETERS
  2316.  *  req_src_id      [IN]        
  2317.  * RETURNS
  2318.  *  void
  2319.  *****************************************************************************/
  2320. void mmi_ph_get_prof_list_req_hdlr(module_type req_src_id)
  2321. {
  2322.     /*----------------------------------------------------------------*/
  2323.     /* Local Variables                                                */
  2324.     /*----------------------------------------------------------------*/
  2325.     wap_get_prof_list_rsp_struct *prof_list_rsp;
  2326.     ilm_struct *ilm_ptr;
  2327.     U32 i;
  2328.     /*----------------------------------------------------------------*/
  2329.     /* Code Body                                                      */
  2330.     /*----------------------------------------------------------------*/
  2331.     prof_list_rsp =
  2332.         (wap_get_prof_list_rsp_struct*) construct_local_para(sizeof(wap_get_prof_list_rsp_struct), TD_CTRL);
  2333.     prof_list_rsp->result = PH_PROFILE_SUCCESS;
  2334.     prof_list_rsp->number = NVRAM_WAP_PROFILE_MAX;
  2335.     prof_list_rsp->prof_list =
  2336.         (wap_prof_entry_struct*) OslMalloc((sizeof(wap_prof_entry_struct)) * NVRAM_WAP_PROFILE_MAX);
  2337.     mmi_ph_get_brw_profile_name_list();
  2338.     for (i = 0; i < NVRAM_WAP_PROFILE_MAX; i++)
  2339.     {
  2340.         U8 *s = g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].profile_name;
  2341.         if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].dcs == PH_DCS_ASCII)
  2342.         {
  2343.             U32 len = strlen((S8*) s);
  2344.             if (len > NVRAM_WAP_PROFILE_NAME_LEN / 2)
  2345.             {
  2346.                 len = NVRAM_WAP_PROFILE_NAME_LEN / 2;
  2347.             }
  2348.             AnsiiNToUnicodeString((S8*) (prof_list_rsp->prof_list[i].name.value), (S8*) s, len);
  2349.             prof_list_rsp->prof_list[i].name.len = (len * ENCODING_LENGTH) + 1;
  2350.         }
  2351.         else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].dcs == PH_DCS_UCS)
  2352.         {
  2353.             U32 len = UCS2Strlen((S8*) s);
  2354.             UCS2Strncpy((S8*) (prof_list_rsp->prof_list[i].name.value), (S8*) s, len);
  2355.             prof_list_rsp->prof_list[i].name.len = (len * ENCODING_LENGTH) + 1;
  2356.         }
  2357.         prof_list_rsp->prof_list[i].id = i;
  2358.         if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].conn_type == PH_CONN_TYPE_HTTP)
  2359.         {
  2360.             prof_list_rsp->prof_list[i].conn_type = PH_CONN_TYPE_HTTP;
  2361.         }
  2362.         else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].conn_type ==
  2363.                  PH_CONN_TYPE_CONNECTION_OREINTED)
  2364.         {
  2365.             prof_list_rsp->prof_list[i].conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  2366.         }
  2367.         else if (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[i].conn_type ==
  2368.                  PH_CONN_TYPE_CONNECTION_OREINTED_SECURE)
  2369.         {
  2370.             prof_list_rsp->prof_list[i].conn_type = PH_CONN_TYPE_CONNECTION_OREINTED_SECURE;
  2371.         }
  2372.     }
  2373.     if (g_ph_wap_prof_name_arr_p != NULL)
  2374.     {
  2375.         jdd_MemFree(g_ph_wap_prof_name_arr_p);
  2376.         g_ph_wap_prof_name_arr_p = NULL;
  2377.     }
  2378.     ilm_ptr = allocate_ilm(MOD_WAP);
  2379.     ilm_ptr->local_para_ptr = (local_para_struct*) prof_list_rsp;
  2380.     ilm_ptr->msg_id = MSG_ID_WAP_GET_PROF_LIST_RSP;
  2381.     ilm_ptr->peer_buff_ptr = NULL;
  2382.     if (req_src_id == MOD_J2ME)
  2383.     {
  2384.         SEND_ILM(MOD_WAP, MOD_J2ME, WAP_J2ME_SAP, ilm_ptr);
  2385.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "Profile Name List Response sent to Java Taskn"));
  2386.     }
  2387.     else if (req_src_id == MOD_MMI)
  2388.     {
  2389.         /* since in jataayu solution MOD_WAP, MOD_MMI are part of MMI task only */
  2390.         ilm_ptr->src_mod_id = MOD_WAP;
  2391.         ilm_ptr->dest_mod_id = MOD_MMI;
  2392.         ilm_ptr->sap_id = WAP_MMI_SAP;
  2393.         msg_send_ext_queue(ilm_ptr);
  2394.     }
  2395. }
  2396. /*****************************************************************************
  2397.  * FUNCTION
  2398.  *  mmi_ph_get_prof_content_req_hdlr
  2399.  * DESCRIPTION
  2400.  *  It is the rquest handler for the MSG_ID_WAP_GET_PROF_CONTENT_REQ request from the java task
  2401.  *  this in turn returns the profiel content data as the response
  2402.  * PARAMETERS
  2403.  *  req_src_id      [IN]        
  2404.  *  msg             [IN]        This is pointer to profile content req struct sent by java task
  2405.  * RETURNS
  2406.  *  void
  2407.  *****************************************************************************/
  2408. void mmi_ph_get_prof_content_req_hdlr(module_type req_src_id, void *msg)
  2409. {
  2410.     /*----------------------------------------------------------------*/
  2411.     /* Local Variables                                                */
  2412.     /*----------------------------------------------------------------*/
  2413.     S16 error;
  2414.     ilm_struct *ilm_ptr;
  2415.     wap_get_prof_content_rsp_struct *prof_cont_rsp;
  2416.     wap_get_prof_content_req_struct *content_req_ptr;
  2417.     nvram_wap_profile_content_struct *prov_wap_profile = NULL;
  2418.     /*----------------------------------------------------------------*/
  2419.     /* Code Body                                                      */
  2420.     /*----------------------------------------------------------------*/
  2421.     content_req_ptr = (wap_get_prof_content_req_struct*) msg;
  2422.     prof_cont_rsp =
  2423.         (wap_get_prof_content_rsp_struct*) construct_local_para(sizeof(wap_get_prof_content_rsp_struct), TD_CTRL);
  2424.     if (prov_wap_profile == NULL)
  2425.     {
  2426.         prov_wap_profile = (nvram_wap_profile_content_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_CONTENT_SIZE, 1);
  2427.     }
  2428.     ReadRecord(
  2429.         NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  2430.         (U16) (content_req_ptr->id + 1),
  2431.         prov_wap_profile,
  2432.         NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  2433.         &error);
  2434.     prof_cont_rsp->result = PH_PROFILE_SUCCESS;
  2435.     if (prov_wap_profile->conn_type == PH_CONN_TYPE_HTTP)
  2436.     {
  2437.         prof_cont_rsp->conn_type = PH_CONN_TYPE_HTTP;
  2438.     }
  2439.     else if (prov_wap_profile->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED)
  2440.     {
  2441.         prof_cont_rsp->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED;
  2442.     }
  2443.     else if (prov_wap_profile->conn_type == PH_CONN_TYPE_CONNECTION_OREINTED_SECURE)
  2444.     {
  2445.         prof_cont_rsp->conn_type = PH_CONN_TYPE_CONNECTION_OREINTED_SECURE;
  2446.     }
  2447.     prof_cont_rsp->net_id = prov_wap_profile->data_account;
  2448.     prof_cont_rsp->id = content_req_ptr->id;
  2449.     memset(prov_wap_profile->password, 0, NVRAM_WAP_PROFILE_PASSWORD_LEN);
  2450.     if (prov_wap_profile->password == NULL)
  2451.     {
  2452.         prof_cont_rsp->password[0] = '';
  2453.     }
  2454.     else if (strlen((S8*) prov_wap_profile->password) >= NVRAM_WAP_PROFILE_PASSWORD_LEN)
  2455.     {
  2456.         strncpy((S8*) prof_cont_rsp->password, (S8*) prov_wap_profile->password, NVRAM_WAP_PROFILE_PASSWORD_LEN - 1);
  2457.         prof_cont_rsp->password[NVRAM_WAP_PROFILE_PASSWORD_LEN - 2] = '';
  2458.     }
  2459.     else
  2460.     {
  2461.         strcpy((S8*) prof_cont_rsp->password, (S8*) prov_wap_profile->password);
  2462.     }
  2463.     memset(prov_wap_profile->username, 0, NVRAM_WAP_PROFILE_USERNAME_LEN);
  2464.     if (prov_wap_profile->username == NULL)
  2465.     {
  2466.         prof_cont_rsp->username[0] = '';
  2467.     }
  2468.     else if (strlen((S8*) prov_wap_profile->username) >= NVRAM_WAP_PROFILE_USERNAME_LEN)
  2469.     {
  2470.         strncpy((S8*) prof_cont_rsp->username, (S8*) prov_wap_profile->username, NVRAM_WAP_PROFILE_USERNAME_LEN - 1);
  2471.         prof_cont_rsp->username[NVRAM_WAP_PROFILE_USERNAME_LEN - 2] = '';
  2472.     }
  2473.     else
  2474.     {
  2475.         strcpy((S8*) prof_cont_rsp->username, (S8*) prov_wap_profile->username);
  2476.     }
  2477.     memset(prof_cont_rsp->prx_ip, 0, 4);
  2478.     memcpy(prof_cont_rsp->prx_ip, prov_wap_profile->proxy_ip, 4);
  2479.     prof_cont_rsp->prx_port = prov_wap_profile->proxy_port;
  2480.     jdd_MemFree(prov_wap_profile);
  2481.     prov_wap_profile = NULL;
  2482.     ilm_ptr = allocate_ilm(MOD_WAP);
  2483.     ilm_ptr->local_para_ptr = (local_para_struct*) prof_cont_rsp;
  2484.     ilm_ptr->msg_id = MSG_ID_WAP_GET_PROF_CONTENT_RSP;
  2485.     ilm_ptr->peer_buff_ptr = NULL;
  2486.     if (req_src_id == MOD_J2ME)
  2487.     {
  2488.         SEND_ILM(MOD_WAP, req_src_id, WAP_J2ME_SAP, ilm_ptr);
  2489.         PRINT_INFORMATION_2((MMI_TRACE_INFO, "Profile Content Response sent to Java Taskn"));
  2490.     }
  2491.     else if (req_src_id == MOD_MMI)
  2492.     {
  2493.         /* since in jataayu solution MOD_WAP, MOD_MMI are part of MMI task only */
  2494.         ilm_ptr->src_mod_id = MOD_WAP;
  2495.         ilm_ptr->dest_mod_id = MOD_MMI;
  2496.         ilm_ptr->sap_id = WAP_MMI_SAP;
  2497.         msg_send_ext_queue(ilm_ptr);
  2498.     }
  2499. }
  2500. #endif /* defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT))) */ 
  2501. #endif /* _JPROFILEUIHANDLER_C */