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

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.  * UserCtrlPlmn.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file is intends for user control PLMN management.
  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.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  *------------------------------------------------------------------------------
  100.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  101.  *============================================================================
  102.  ****************************************************************************/
  103. #include "MMI_features.h"
  104. #include "StdC.h"
  105. #include "L4Dr1.h"
  106. #include "L4Dr.h"
  107. #include "FrameworkStruct.h"
  108. #include "NetworkSetupDefs.h"
  109. #include "NetworkSetupGProt.h"
  110. #include "DebugInitDef.h"
  111. #include "MainMenuDef.h"
  112. #include "ProtocolEvents.h"
  113. #include "SettingProfile.h"
  114. #include "SettingDefs.h"
  115. #include "SettingGprots.h"
  116. #include "PrefNwksGprot.h"
  117. #include "CommonScreens.h"
  118. #include "MessagesExDcl.h"
  119. #include "SimDetectionGprot.h"
  120. #include "SimDetectionGexdcl.h"
  121. #include "MessagesResourceData.h"
  122. #include "PreferredNwksStruct.h"
  123. #include "PrefNwksGprot.h"
  124. #include "CustResDef.h"
  125. #include "Wgui_categories_inputs.h"
  126. #include "NVRAMType.h"
  127. #include "NVRAMProt.h"
  128. #include "NVRAMEnum.h"
  129. #include "IdleAppDef.h"
  130. /**************************************************************************
  131.    Pre-definition
  132. **************************************************************************/
  133. #ifdef __MMI_USER_CTRL_PLMN_SUPPORT__
  134. /**************************************************************************
  135.    Global variables
  136. **************************************************************************/
  137. extern U8 gPLMN[];
  138. UserCtrlPlmnListContext gUserCtrlPlmnList;
  139. /**************************************************************************
  140.    Function Prototypes
  141. **************************************************************************/
  142. extern void mmi_phb_op_email_custom_function(void);
  143. extern void RefreshNwProviderName(U8 *);
  144. void mmi_netset_entry_user_ctrl_plmn_add_data(void);
  145. /*****************************************************************************
  146.  * FUNCTION
  147.  *  mmi_netset_access_user_ctrl_plmn_nvram
  148.  * DESCRIPTION
  149.  *  
  150.  * PARAMETERS
  151.  *  write_flag      [IN]        
  152.  * RETURNS
  153.  *  void
  154.  *****************************************************************************/
  155. void mmi_netset_access_user_ctrl_plmn_nvram(U8 write_flag)
  156. {
  157. #ifdef MMI_ON_HARDWARE_P
  158.     /*----------------------------------------------------------------*/
  159.     /* Local Variables                                                */
  160.     /*----------------------------------------------------------------*/
  161.     S16 error;
  162.     /*----------------------------------------------------------------*/
  163.     /* Code Body                                                      */
  164.     /*----------------------------------------------------------------*/
  165.     if (write_flag)
  166.     {
  167.         WriteRecord(
  168.             NVRAM_EF_USER_CTRL_PLMN_LID,
  169.             1,
  170.             (void*)(&gUserCtrlPlmnList.PrefPLMN[0][0]),
  171.             NVRAM_EF_USER_CTRL_PLMN_SIZE,
  172.             &error);
  173.     }
  174.     else
  175.     {
  176.         ReadRecord(
  177.             NVRAM_EF_USER_CTRL_PLMN_LID,
  178.             1,
  179.             (void*)(&gUserCtrlPlmnList.PrefPLMN[0][0]),
  180.             NVRAM_EF_USER_CTRL_PLMN_SIZE,
  181.             &error);
  182.     }
  183. #endif /* MMI_ON_HARDWARE_P */ 
  184. }
  185. /*****************************************************************************
  186.  * FUNCTION
  187.  *  mmi_netset_get_user_ctrl_plmn_list
  188.  * DESCRIPTION
  189.  *  
  190.  * PARAMETERS
  191.  *  void
  192.  * RETURNS
  193.  *  void
  194.  *****************************************************************************/
  195. void mmi_netset_get_user_ctrl_plmn_list(void)
  196. {
  197.     /*----------------------------------------------------------------*/
  198.     /* Local Variables                                                */
  199.     /*----------------------------------------------------------------*/
  200.     U32 plmn_num;
  201.     U8 i;
  202.     /*----------------------------------------------------------------*/
  203.     /* Code Body                                                      */
  204.     /*----------------------------------------------------------------*/
  205.     mmi_netset_access_user_ctrl_plmn_nvram(0);
  206.     gUserCtrlPlmnList.PlmnListSize = 0;
  207.     for (i = 0; i < MAX_USER_CTRL_PLMN; i++)
  208.     {
  209.         memcpy((char*)(&plmn_num), gUserCtrlPlmnList.PrefPLMN[i], sizeof(U32));
  210.         if (plmn_num != 0)
  211.         {
  212.             gUserCtrlPlmnList.PlmnListSize++;
  213.         }
  214.         else
  215.         {
  216.             break;
  217.         }
  218.     }
  219. }
  220. /*****************************************************************************
  221.  * FUNCTION
  222.  *  mmi_netset_construct_user_ctrl_plmn_hint
  223.  * DESCRIPTION
  224.  *  
  225.  * PARAMETERS
  226.  *  hintArray       [IN]        
  227.  * RETURNS
  228.  *  void
  229.  *****************************************************************************/
  230. void mmi_netset_construct_user_ctrl_plmn_hint(U8 **hintArray)
  231. {
  232.     /*----------------------------------------------------------------*/
  233.     /* Local Variables                                                */
  234.     /*----------------------------------------------------------------*/
  235.     U8 i;
  236.     U32 plmn_num;
  237.     U8 plmn_tmp[MAX_PLMN_LEN + 1];
  238.     /*----------------------------------------------------------------*/
  239.     /* Code Body                                                      */
  240.     /*----------------------------------------------------------------*/
  241.     for (i = 0; i < gUserCtrlPlmnList.PlmnListSize; i++)
  242.     {
  243.         memset((S8*) hintData[i], 0, MAX_SUB_MENU_SIZE);
  244.         memcpy((char*)(&plmn_num), gUserCtrlPlmnList.PrefPLMN[i], sizeof(U32));
  245.         mmi_netset_bcd_short_2_plmn_str(plmn_num, plmn_tmp);
  246.         AnsiiToUnicodeString((S8*) hintData[i], (S8*) plmn_tmp);
  247.         hintArray[i] = hintData[i];
  248.     }
  249. }
  250. /*****************************************************************************
  251.  * FUNCTION
  252.  *  mmi_netset_highlight_user_ctrl_plmn_list_hdlr
  253.  * DESCRIPTION
  254.  *  
  255.  * PARAMETERS
  256.  *  index       [IN]        
  257.  * RETURNS
  258.  *  void
  259.  *****************************************************************************/
  260. void mmi_netset_highlight_user_ctrl_plmn_list_hdlr(S32 index)
  261. {
  262.     /*----------------------------------------------------------------*/
  263.     /* Local Variables                                                */
  264.     /*----------------------------------------------------------------*/
  265.     /*----------------------------------------------------------------*/
  266.     /* Code Body                                                      */
  267.     /*----------------------------------------------------------------*/
  268.     gUserCtrlPlmnList.CurrSelPlmn = (U8) index;
  269. }
  270. /*****************************************************************************
  271.  * FUNCTION
  272.  *  mmi_netset_exec_options_highlight_handler
  273.  * DESCRIPTION
  274.  *  
  275.  * PARAMETERS
  276.  *  index       [IN]
  277.  * RETURNS
  278.  *  void
  279.  *****************************************************************************/
  280. static void mmi_netset_exec_options_highlight_handler(S32 index)
  281. {
  282.     if (gUserCtrlPlmnList.PlmnListSize == MAX_USER_CTRL_PLMN)
  283.     {
  284.         ExecuteCurrHiliteHandler(index + 1);
  285.     }
  286.     else
  287.     {
  288.         ExecuteCurrHiliteHandler(index);
  289.     }
  290. }
  291. /*****************************************************************************
  292.  * FUNCTION
  293.  *  mmi_netset_entry_user_ctrl_plmn_options
  294.  * DESCRIPTION
  295.  *  
  296.  * PARAMETERS
  297.  *  void
  298.  * RETURNS
  299.  *  void
  300.  *****************************************************************************/
  301. void mmi_netset_entry_user_ctrl_plmn_options(void)
  302. {
  303.     /*----------------------------------------------------------------*/
  304.     /* Local Variables                                                */
  305.     /*----------------------------------------------------------------*/
  306.     PU8 guiBuffer;
  307.     U16 nStrItemList[2];    /* Stores the strings id of submenus returned */
  308.     U16 nNumofItem;         /* Stores no of children in the submenu */
  309.     U16 ItemIcons[2];
  310.     /*----------------------------------------------------------------*/
  311.     /* Code Body                                                      */
  312.     /*----------------------------------------------------------------*/
  313.     EntryNewScreen(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS, NULL, mmi_netset_entry_user_ctrl_plmn_options, NULL);
  314.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  315.     nNumofItem = GetNumOfChild(MENU_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  316.     ItemIcons[0] = IMG_GLOBAL_L1;
  317.     ItemIcons[1] = IMG_GLOBAL_L2;
  318.     GetSequenceStringIds(MENU_ID_NETSET_USER_CTRL_PLMN_OPTIONS, nStrItemList);
  319.     SetParentHandler(MENU_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  320.     RegisterHighlightHandler(mmi_netset_exec_options_highlight_handler);
  321.     if (gUserCtrlPlmnList.PlmnListSize == 0)
  322.     {
  323.         nNumofItem = 1;
  324.     }
  325.     else if (gUserCtrlPlmnList.PlmnListSize == MAX_USER_CTRL_PLMN)
  326.     {
  327.         nNumofItem = 1;
  328.         nStrItemList[0] = nStrItemList[1];
  329.     }
  330.     else
  331.     {
  332.         /* keep 2 items */
  333.     }
  334.     ShowCategory15Screen(
  335.         STR_GLOBAL_OPTIONS,
  336.         MAIN_MENU_TITLE_SETTINGS_ICON,
  337.         STR_GLOBAL_OK,
  338.         IMG_GLOBAL_OK,
  339.         STR_GLOBAL_BACK,
  340.         IMG_GLOBAL_BACK,
  341.         nNumofItem,
  342.         nStrItemList,
  343.         ItemIcons,
  344.         LIST_MENU,
  345.         0,
  346.         guiBuffer);
  347.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  348.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  349. }
  350. /*****************************************************************************
  351.  * FUNCTION
  352.  *  mmi_netset_show_user_ctrl_plmn_list
  353.  * DESCRIPTION
  354.  *  
  355.  * PARAMETERS
  356.  *  void
  357.  * RETURNS
  358.  *  void
  359.  *****************************************************************************/
  360. void mmi_netset_show_user_ctrl_plmn_list(void)
  361. {
  362.     /*----------------------------------------------------------------*/
  363.     /* Local Variables                                                */
  364.     /*----------------------------------------------------------------*/
  365.     PU8 guiBuffer;
  366.     U8 *PlmnListHint[MAX_SUB_MENUS];
  367.     PU8 nStrItemList[MAX_USER_CTRL_PLMN];
  368.     U8 i;
  369.     /*----------------------------------------------------------------*/
  370.     /* Code Body                                                      */
  371.     /*----------------------------------------------------------------*/
  372.     EntryNewScreen(SCR_ID_NETSET_USER_CTRL_PLMN_LIST, NULL, mmi_netset_show_user_ctrl_plmn_list, NULL);
  373.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NETSET_USER_CTRL_PLMN_LIST);
  374.     RegisterHighlightHandler(mmi_netset_highlight_user_ctrl_plmn_list_hdlr);
  375.     if (!gUserCtrlPlmnList.PlmnListSize)
  376.     {
  377.         /* no record */
  378.         nStrItemList[0] = (U8*) GetString(STR_GLOBAL_EMPTY_LIST);
  379.         ShowCategory6Screen(
  380.             STR_ID_NETSET_USER_CTRL_PLMN,
  381.             MAIN_MENU_TITLE_SETTINGS_ICON,
  382.             STR_GLOBAL_OPTIONS,
  383.             IMG_GLOBAL_OPTIONS,
  384.             STR_GLOBAL_BACK,
  385.             IMG_GLOBAL_BACK,
  386.             1,
  387.             (U8 **) nStrItemList,
  388.             NULL,
  389.             0,
  390.             guiBuffer);
  391.     }
  392.     else
  393.     {
  394.         for (i = 0; i < MAX_USER_CTRL_PLMN; i++)
  395.         {
  396.             nStrItemList[i] = NULL;
  397.         }
  398.         for (i = 0; i < gUserCtrlPlmnList.PlmnListSize; i++)
  399.         {
  400.             AnsiiToUnicodeString(
  401.                 (S8*) gUserCtrlPlmnList.tmpPlmnListData[i],
  402.                 (S8*) gUserCtrlPlmnList.PrefPLMN[i] + sizeof(U32));
  403.             nStrItemList[i] = gUserCtrlPlmnList.tmpPlmnListData[i];
  404.         }
  405.         mmi_netset_construct_user_ctrl_plmn_hint(PlmnListHint);
  406.         ShowCategory6Screen(
  407.             STR_ID_NETSET_USER_CTRL_PLMN,
  408.             MAIN_MENU_TITLE_SETTINGS_ICON,
  409.             STR_GLOBAL_OPTIONS,
  410.             IMG_GLOBAL_OPTIONS,
  411.             STR_GLOBAL_BACK,
  412.             IMG_GLOBAL_BACK,
  413.             gUserCtrlPlmnList.PlmnListSize,
  414.             (U8 **) nStrItemList,
  415.             PlmnListHint,
  416.             0,
  417.             guiBuffer);
  418.     }
  419.     SetLeftSoftkeyFunction(mmi_netset_entry_user_ctrl_plmn_options, KEY_EVENT_UP);
  420.     SetKeyHandler(mmi_netset_entry_user_ctrl_plmn_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  421.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  422.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  423. }
  424. /*****************************************************************************
  425.  * FUNCTION
  426.  *  mmi_netset_entry_user_ctrl_plmn_add_one
  427.  * DESCRIPTION
  428.  *  
  429.  * PARAMETERS
  430.  *  void
  431.  * RETURNS
  432.  *  void
  433.  *****************************************************************************/
  434. void mmi_netset_entry_user_ctrl_plmn_add_one(void)
  435. {
  436.     /*----------------------------------------------------------------*/
  437.     /* Local Variables                                                */
  438.     /*----------------------------------------------------------------*/
  439.     U8 plmn_ansii[MAX_PLMN_LEN + 1], opname_asnii[MAX_LENGTH_DISPLAY_NAME];
  440.     U32 plmn_usr;
  441.     /*----------------------------------------------------------------*/
  442.     /* Code Body                                                      */
  443.     /*----------------------------------------------------------------*/
  444.     if (pfnUnicodeStrlen((S8*) gUserCtrlPlmnList.PlmnAddNumber) < MAX_PLMN_LEN - 1 ||
  445.         pfnUnicodeStrcmp((S8*) gUserCtrlPlmnList.PlmnAddString, (S8*) L"") == 0)
  446.     {
  447.         DisplayPopup(
  448.             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  449.             IMG_GLOBAL_UNFINISHED,
  450.             1,
  451.             UI_POPUP_NOTIFYDURATION_TIME,
  452.             ERROR_TONE);
  453.         DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  454.         DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_ADD);
  455.         return;
  456.     }
  457.     UnicodeToAnsii((S8*) plmn_ansii, (S8*) gUserCtrlPlmnList.PlmnAddNumber);
  458.     UnicodeToAnsii((S8*) opname_asnii, (S8*) gUserCtrlPlmnList.PlmnAddString);
  459.     CloseCategory57Screen();
  460.     if (mmi_netset_retrieve_opname_from_plmn(plmn_ansii, NULL) >= 0)
  461.     {
  462.         /* duplicated */
  463.         DisplayPopup(
  464.             (PU8) GetString(STR_ID_NETSET_DUPLICATED_PLMN),
  465.             IMG_GLOBAL_UNFINISHED,
  466.             1,
  467.             UI_POPUP_NOTIFYDURATION_TIME,
  468.             ERROR_TONE);
  469.         DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  470.         DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_ADD);
  471.         return;
  472.     }
  473.     DisplayPopup(
  474.         (U8*) GetString(STR_GLOBAL_DONE),
  475.         IMG_GLOBAL_ACTIVATED,
  476.         1,
  477.         UI_POPUP_NOTIFYDURATION_TIME,
  478.         (U8) SUCCESS_TONE);
  479.     DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  480.     DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_ADD);
  481.     /* write data to nvram */
  482.     plmn_usr = mmi_netset_plmn_str_2_bcd_short(plmn_ansii);
  483.     memset(gUserCtrlPlmnList.PrefPLMN[gUserCtrlPlmnList.PlmnListSize], 0, 24);
  484.     memcpy(gUserCtrlPlmnList.PrefPLMN[gUserCtrlPlmnList.PlmnListSize], (char*)(&plmn_usr), sizeof(U32));
  485.     memcpy(
  486.         gUserCtrlPlmnList.PrefPLMN[gUserCtrlPlmnList.PlmnListSize] + sizeof(U32),
  487.         opname_asnii,
  488.         strlen((S8*) opname_asnii));
  489.     gUserCtrlPlmnList.PlmnListSize++;
  490.     mmi_netset_access_user_ctrl_plmn_nvram(1);
  491.     RefreshNwProviderName(gPLMN);
  492. }
  493. /*****************************************************************************
  494.  * FUNCTION
  495.  *  mmi_netset_set_user_ctrl_plmn_add_inline_editor
  496.  * DESCRIPTION
  497.  *  
  498.  * PARAMETERS
  499.  *  void
  500.  * RETURNS
  501.  *  void
  502.  *****************************************************************************/
  503. void mmi_netset_set_user_ctrl_plmn_add_inline_editor(void)
  504. {
  505.     /*----------------------------------------------------------------*/
  506.     /* Local Variables                                                */
  507.     /*----------------------------------------------------------------*/
  508.     /*----------------------------------------------------------------*/
  509.     /* Code Body                                                      */
  510.     /*----------------------------------------------------------------*/
  511.     memset(gUserCtrlPlmnList.PlmnAddNumber, 0, (MAX_PLMN_LEN + 1) * ENCODING_LENGTH);
  512.     memset(gUserCtrlPlmnList.PlmnAddString, 0, MAX_LENGTH_DISPLAY_NAME * ENCODING_LENGTH);
  513.     if (!IsScreenPresent(SCR_ID_NETSET_USER_CTRL_PLMN_LIST))
  514.     {
  515.         AnsiiToUnicodeString((S8*) gUserCtrlPlmnList.PlmnAddNumber, (S8*) gPLMN);
  516.     }
  517.     SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  518.     SetInlineItemCaption(&wgui_inline_items[0], (PU8) GetString(STR_ID_NETSET_PRR_MCC_CAPTION));
  519.     SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  520.     SetInlineItemTextEdit(
  521.         &wgui_inline_items[1],
  522.         (PU8) gUserCtrlPlmnList.PlmnAddNumber,
  523.         MAX_PLMN_LEN + 1,
  524.         INPUT_TYPE_NUMERIC);
  525.     //SetInlineItemFullWidth(&wgui_inline_items[1]);
  526.     EnableInlineItemBoundary(&wgui_inline_items[1]);
  527.     DisableInlineItemHighlight(&wgui_inline_items[1]);
  528.     SetInlineItemActivation(&wgui_inline_items[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  529.     SetInlineItemCaption(&wgui_inline_items[2], (PU8) GetString(STR_ID_NETSET_OP_NAME_CAPTION));
  530.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  531.     SetInlineItemTextEdit(
  532.         &wgui_inline_items[3],
  533.         (PU8) gUserCtrlPlmnList.PlmnAddString,
  534.         MAX_LENGTH_DISPLAY_NAME,
  535.         INPUT_TYPE_ALPHANUMERIC_LOWERCASE | INPUT_TYPE_USE_ONLY_ENGLISH_MODES);
  536. #if defined(__MMI_TOUCH_SCREEN__)
  537.     SetInlineTextEditCustomFunction(&wgui_inline_items[3], mmi_phb_op_email_custom_function);
  538. #endif
  539.     //SetInlineItemFullWidth(&wgui_inline_items[3]);
  540.     EnableInlineItemBoundary(&wgui_inline_items[3]);
  541.     DisableInlineItemHighlight(&wgui_inline_items[3]);
  542. #if 0
  543. /* under construction !*/
  544. /* under construction !*/
  545. /* under construction !*/
  546. /* under construction !*/
  547. /* under construction !*/
  548. /* under construction !*/
  549. /* under construction !*/
  550. /* under construction !*/
  551. /* under construction !*/
  552. /* under construction !*/
  553. #endif
  554. }
  555. /*****************************************************************************
  556.  * FUNCTION
  557.  *  mmi_netset_save_user_ctrl_plmn_cancel
  558.  * DESCRIPTION
  559.  *  Cancellation of save
  560.  * PARAMETERS
  561.  *  void
  562.  * RETURNS
  563.  *  void
  564.  *****************************************************************************/
  565. void mmi_netset_save_user_ctrl_plmn_cancel(void)
  566. {
  567.     /*----------------------------------------------------------------*/
  568.     /* Local Variables                                                */
  569.     /*----------------------------------------------------------------*/
  570.     /*----------------------------------------------------------------*/
  571.     /* Code Body                                                      */
  572.     /*----------------------------------------------------------------*/
  573.     stopRequestedTone(WARNING_TONE);
  574.     DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  575.     DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_ADD);
  576.     GoBackHistory();
  577. }
  578. /*****************************************************************************
  579.  * FUNCTION
  580.  *  mmi_netset_save_user_ctrl_plmn_confirm
  581.  * DESCRIPTION
  582.  *  Confirmation to save
  583.  * PARAMETERS
  584.  *  void
  585.  * RETURNS
  586.  *  void
  587.  *****************************************************************************/
  588. void mmi_netset_save_user_ctrl_plmn_confirm(void)
  589. {
  590.     /*----------------------------------------------------------------*/
  591.     /* Local Variables                                                */
  592.     /*----------------------------------------------------------------*/
  593.     /*----------------------------------------------------------------*/
  594.     /* Code Body                                                      */
  595.     /*----------------------------------------------------------------*/
  596.     DisplayConfirm(
  597.         STR_GLOBAL_YES,
  598.         IMG_GLOBAL_YES,
  599.         STR_GLOBAL_NO,
  600.         IMG_GLOBAL_NO,
  601.         get_string(STR_GLOBAL_SAVE),
  602.         IMG_GLOBAL_QUESTION,
  603.         WARNING_TONE);
  604.     SetRightSoftkeyFunction(mmi_netset_save_user_ctrl_plmn_cancel, KEY_EVENT_UP);
  605.     SetLeftSoftkeyFunction(mmi_netset_entry_user_ctrl_plmn_add_one, KEY_EVENT_UP);
  606. }
  607. /*****************************************************************************
  608.  * FUNCTION
  609.  *  mmi_netset_exit_user_ctrl_plmn_add_data
  610.  * DESCRIPTION
  611.  *  
  612.  * PARAMETERS
  613.  *  void
  614.  * RETURNS
  615.  *  void
  616.  *****************************************************************************/
  617. void mmi_netset_exit_user_ctrl_plmn_add_data(void)
  618. {
  619.     /*----------------------------------------------------------------*/
  620.     /* Local Variables                                                */
  621.     /*----------------------------------------------------------------*/
  622.     history Scr;            /* Variable to hold the history data */
  623.     S16 nHistory = 0;
  624.     U16 inputBufferSize;    /* added for inline edit history */
  625.     /*----------------------------------------------------------------*/
  626.     /* Code Body                                                      */
  627.     /*----------------------------------------------------------------*/
  628.     CloseCategory57Screen();
  629.     Scr.scrnID = SCR_ID_NETSET_USER_CTRL_PLMN_ADD;
  630.     Scr.entryFuncPtr = mmi_netset_entry_user_ctrl_plmn_add_data;
  631.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  632.     inputBufferSize = (S16) GetCategory57DataSize();    /* added for inline edit history */
  633.     GetCategory57Data((U8*) Scr.inputBuffer);           /* added for inline edit history */
  634.     GetCategory57History(Scr.guiBuffer);
  635.     AddNHistory(Scr, inputBufferSize);
  636. }
  637. /*****************************************************************************
  638.  * FUNCTION
  639.  *  mmi_netset_entry_user_ctrl_plmn_add_data
  640.  * DESCRIPTION
  641.  *  
  642.  * PARAMETERS
  643.  *  void
  644.  * RETURNS
  645.  *  void
  646.  *****************************************************************************/
  647. void mmi_netset_entry_user_ctrl_plmn_add_data(void)
  648. {
  649.     /*----------------------------------------------------------------*/
  650.     /* Local Variables                                                */
  651.     /*----------------------------------------------------------------*/
  652.     U8 *guiBuffer;          /* Buffer holding history data */
  653.     U8 *inputBuffer;        /* added for inline edit history */
  654.     U16 inputBufferSize;    /* added for inline edit history */
  655.     U16 IconList[] = {IMG_GLOBAL_L1, 0, IMG_GLOBAL_L2, 0};
  656.     /*----------------------------------------------------------------*/
  657.     /* Code Body                                                      */
  658.     /*----------------------------------------------------------------*/
  659.     EntryNewScreen(SCR_ID_NETSET_USER_CTRL_PLMN_ADD, mmi_netset_exit_user_ctrl_plmn_add_data, NULL, NULL);
  660.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NETSET_USER_CTRL_PLMN_ADD);
  661.     inputBuffer = GetCurrNInputBuffer(SCR_ID_NETSET_USER_CTRL_PLMN_ADD, &inputBufferSize);      /* added for inline edit history */
  662.     InitializeCategory57Screen();
  663.     mmi_netset_set_user_ctrl_plmn_add_inline_editor();
  664.     if (inputBuffer != NULL)
  665.     {
  666.         SetCategory57Data(wgui_inline_items, 4, inputBuffer);
  667.     }
  668.     ClearHighlightHandler();
  669.     if (IsScreenPresent(SCR_ID_NETSET_USER_CTRL_PLMN_LIST))
  670.     {
  671.         ShowCategory57Screen(
  672.             STR_GLOBAL_ADD,
  673.             MAIN_MENU_TITLE_SETTINGS_ICON,
  674.             STR_GLOBAL_OK,
  675.             IMG_GLOBAL_OK,
  676.             STR_GLOBAL_BACK,
  677.             IMG_GLOBAL_BACK,
  678.             4,
  679.             IconList,
  680.             wgui_inline_items,
  681.             1,
  682.             guiBuffer);
  683.     }
  684.     else
  685.     {
  686.         ShowCategory57Screen(
  687.             STR_GLOBAL_ADD,
  688.             MAIN_MENU_TITLE_SETTINGS_ICON,
  689.             STR_GLOBAL_OK,
  690.             IMG_GLOBAL_OK,
  691.             STR_GLOBAL_BACK,
  692.             IMG_GLOBAL_BACK,
  693.             4,
  694.             IconList,
  695.             wgui_inline_items,
  696.             3,
  697.             guiBuffer);
  698.     }
  699.     SetCategory57RightSoftkeyFunctions(mmi_netset_save_user_ctrl_plmn_confirm, GoBackHistory);
  700.     DeleteScreenIfPresent(SCR_ID_NETSET_UNKNOWN_PLMN_MSG);
  701. }
  702. /*****************************************************************************
  703.  * FUNCTION
  704.  *  mmi_netset_entry_user_ctrl_plmn_del_one
  705.  * DESCRIPTION
  706.  *  
  707.  * PARAMETERS
  708.  *  void
  709.  * RETURNS
  710.  *  void
  711.  *****************************************************************************/
  712. void mmi_netset_entry_user_ctrl_plmn_del_one(void)
  713. {
  714.     /*----------------------------------------------------------------*/
  715.     /* Local Variables                                                */
  716.     /*----------------------------------------------------------------*/
  717.     U8 i;
  718.     /*----------------------------------------------------------------*/
  719.     /* Code Body                                                      */
  720.     /*----------------------------------------------------------------*/
  721.     DisplayPopup(
  722.         (U8*) GetString(STR_GLOBAL_DONE),
  723.         IMG_GLOBAL_ACTIVATED,
  724.         1,
  725.         UI_POPUP_NOTIFYDURATION_TIME,
  726.         (U8) SUCCESS_TONE);
  727.     DeleteScreenIfPresent(SCR_ID_NETSET_USER_CTRL_PLMN_OPTIONS);
  728.     /* write data to nvram */
  729.     for (i = gUserCtrlPlmnList.CurrSelPlmn + 1; i < gUserCtrlPlmnList.PlmnListSize; i++)
  730.     {
  731.         memcpy(gUserCtrlPlmnList.PrefPLMN[i - 1], gUserCtrlPlmnList.PrefPLMN[i], 24);
  732.     }
  733.     memset(gUserCtrlPlmnList.PrefPLMN[gUserCtrlPlmnList.PlmnListSize - 1], 0, 24);
  734.     gUserCtrlPlmnList.PlmnListSize--;
  735.     mmi_netset_access_user_ctrl_plmn_nvram(1);
  736.     RefreshNwProviderName(gPLMN);
  737. }
  738. /*****************************************************************************
  739.  * FUNCTION
  740.  *  mmi_netset_confirm_user_ctrl_plmn_del
  741.  * DESCRIPTION
  742.  *  
  743.  * PARAMETERS
  744.  *  void
  745.  * RETURNS
  746.  *  void
  747.  *****************************************************************************/
  748. void mmi_netset_confirm_user_ctrl_plmn_del(void)
  749. {
  750.     /*----------------------------------------------------------------*/
  751.     /* Local Variables                                                */
  752.     /*----------------------------------------------------------------*/
  753.     /*----------------------------------------------------------------*/
  754.     /* Code Body                                                      */
  755.     /*----------------------------------------------------------------*/
  756.     DisplayConfirm(
  757.         STR_GLOBAL_YES,
  758.         IMG_GLOBAL_YES,
  759.         STR_GLOBAL_NO,
  760.         IMG_GLOBAL_NO,
  761.         get_string(STR_GLOBAL_DELETE),
  762.         IMG_GLOBAL_QUESTION,
  763.         WARNING_TONE);
  764.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  765.     SetLeftSoftkeyFunction(mmi_netset_entry_user_ctrl_plmn_del_one, KEY_EVENT_UP);
  766. }
  767. /*****************************************************************************
  768.  * FUNCTION
  769.  *  mmi_netset_highlight_user_ctrl_plmn_add
  770.  * DESCRIPTION
  771.  *  
  772.  * PARAMETERS
  773.  *  void
  774.  * RETURNS
  775.  *  void
  776.  *****************************************************************************/
  777. void mmi_netset_highlight_user_ctrl_plmn_add(void)
  778. {
  779.     /*----------------------------------------------------------------*/
  780.     /* Local Variables                                                */
  781.     /*----------------------------------------------------------------*/
  782.     /*----------------------------------------------------------------*/
  783.     /* Code Body                                                      */
  784.     /*----------------------------------------------------------------*/
  785.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  786.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  787.     SetLeftSoftkeyFunction(mmi_netset_entry_user_ctrl_plmn_add_data, KEY_EVENT_UP);
  788.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  789.     SetKeyHandler(mmi_netset_entry_user_ctrl_plmn_add_data, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  790.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  791. }
  792. /*****************************************************************************
  793.  * FUNCTION
  794.  *  mmi_netset_highlight_user_ctrl_plmn_del
  795.  * DESCRIPTION
  796.  *  
  797.  * PARAMETERS
  798.  *  void
  799.  * RETURNS
  800.  *  void
  801.  *****************************************************************************/
  802. void mmi_netset_highlight_user_ctrl_plmn_del(void)
  803. {
  804.     /*----------------------------------------------------------------*/
  805.     /* Local Variables                                                */
  806.     /*----------------------------------------------------------------*/
  807.     /*----------------------------------------------------------------*/
  808.     /* Code Body                                                      */
  809.     /*----------------------------------------------------------------*/
  810.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  811.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  812.     SetLeftSoftkeyFunction(mmi_netset_confirm_user_ctrl_plmn_del, KEY_EVENT_UP);
  813.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  814.     SetKeyHandler(mmi_netset_confirm_user_ctrl_plmn_del, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  815.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  816. }
  817. /*****************************************************************************
  818.  * FUNCTION
  819.  *  mmi_netset_init_user_ctrl_plmn
  820.  * DESCRIPTION
  821.  *  
  822.  * PARAMETERS
  823.  *  void
  824.  * RETURNS
  825.  *  void
  826.  *****************************************************************************/
  827. void mmi_netset_init_user_ctrl_plmn(void)
  828. {
  829.     /*----------------------------------------------------------------*/
  830.     /* Local Variables                                                */
  831.     /*----------------------------------------------------------------*/
  832.     /*----------------------------------------------------------------*/
  833.     /* Code Body                                                      */
  834.     /*----------------------------------------------------------------*/
  835.     SetHiliteHandler(MENU_ID_NETSET_USER_CTRL_PLMN_ADD, mmi_netset_highlight_user_ctrl_plmn_add);
  836.     SetHiliteHandler(MENU_ID_NETSET_USER_CTRL_PLMN_DEL, mmi_netset_highlight_user_ctrl_plmn_del);
  837.     gUserCtrlPlmnList.UnknownOpCheck = MMI_TRUE;
  838. #ifndef MMI_ON_HARDWARE_P
  839.     memset((void*)(&gUserCtrlPlmnList.PrefPLMN[0][0]), 0, MAX_USER_CTRL_PLMN * 24);
  840. #endif 
  841.     mmi_netset_get_user_ctrl_plmn_list();
  842. }
  843. /*****************************************************************************
  844.  * FUNCTION
  845.  *  mmi_netset_highlight_user_ctrl_plmn
  846.  * DESCRIPTION
  847.  *  
  848.  * PARAMETERS
  849.  *  void
  850.  * RETURNS
  851.  *  void
  852.  *****************************************************************************/
  853. void mmi_netset_highlight_user_ctrl_plmn(void)
  854. {
  855.     /*----------------------------------------------------------------*/
  856.     /* Local Variables                                                */
  857.     /*----------------------------------------------------------------*/
  858.     /*----------------------------------------------------------------*/
  859.     /* Code Body                                                      */
  860.     /*----------------------------------------------------------------*/
  861.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  862.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  863.     SetLeftSoftkeyFunction(mmi_netset_show_user_ctrl_plmn_list, KEY_EVENT_UP);
  864.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  865.     SetKeyHandler(mmi_netset_show_user_ctrl_plmn_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  866.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  867. }
  868. /*****************************************************************************
  869.  * FUNCTION
  870.  *  mmi_netset_unknown_operator_check
  871.  * DESCRIPTION
  872.  *  
  873.  * PARAMETERS
  874.  *  void
  875.  * RETURNS
  876.  *  
  877.  *****************************************************************************/
  878. U8 mmi_netset_unknown_operator_check(void)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     /*----------------------------------------------------------------*/
  884.     /* Code Body                                                      */
  885.     /*----------------------------------------------------------------*/
  886.     if (gUserCtrlPlmnList.UnknownOpCheck == MMI_FALSE || g_pwr_context.CurrentServiceType != FULL_SERVICE)
  887.     {
  888.         return 0;
  889.     }
  890.     if (mmi_bootup_is_roaming())
  891.     {
  892.         if (gUserCtrlPlmnList.UnknownOpCheck == MMI_TRUE &&
  893.             gUserCtrlPlmnList.PlmnListSize < MAX_USER_CTRL_PLMN &&
  894.             mmi_netset_retrieve_opname_from_plmn(gPLMN, NULL) == -1)
  895.         {
  896.             return 1;
  897.         }
  898.         else
  899.         {
  900.             return 0;
  901.         }
  902.     }
  903.     else
  904.     {
  905.         if (gUserCtrlPlmnList.UnknownOpCheck == MMI_TRUE &&
  906.             gUserCtrlPlmnList.PlmnListSize < MAX_USER_CTRL_PLMN &&
  907.             gOpNameValid == MMI_FALSE && mmi_netset_retrieve_opname_from_plmn(gPLMN, NULL) == -1)
  908.         {
  909.             return 1;
  910.         }
  911.         else
  912.         {
  913.             return 0;
  914.         }
  915.     }
  916. }
  917. /*****************************************************************************
  918.  * FUNCTION
  919.  *  mmi_netset_unknown_operator_query
  920.  * DESCRIPTION
  921.  *  
  922.  * PARAMETERS
  923.  *  void
  924.  * RETURNS
  925.  *  void
  926.  *****************************************************************************/
  927. void mmi_netset_unknown_operator_query(void)
  928. {
  929.     /*----------------------------------------------------------------*/
  930.     /* Local Variables                                                */
  931.     /*----------------------------------------------------------------*/
  932.     /*----------------------------------------------------------------*/
  933.     /* Code Body                                                      */
  934.     /*----------------------------------------------------------------*/
  935.     EntryNewScreen(SCR_ID_NETSET_UNKNOWN_PLMN_MSG, NULL, mmi_netset_unknown_operator_query, NULL);
  936.     if (g_keylock_context.gKeyPadLockFlag == 0)
  937.     {
  938.         ShowCategory2Screen(
  939.             STR_ID_NETSET_USER_CTRL_PLMN,
  940.             MAIN_MENU_TITLE_SETTINGS_ICON,
  941.             STR_GLOBAL_YES,
  942.             IMG_GLOBAL_YES,
  943.             STR_GLOBAL_NO,
  944.             IMG_GLOBAL_NO,
  945.             STR_ID_NETSET_UNKNOWN_PLMN_MSG,
  946.             NULL);
  947.         gUserCtrlPlmnList.UnknownOpCheck = MMI_FALSE;
  948.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  949.         SetLeftSoftkeyFunction(mmi_netset_entry_user_ctrl_plmn_add_data, KEY_EVENT_UP);
  950.     }
  951.     else
  952.     {    
  953.         ShowCategory2Screen(
  954.             STR_ID_NETSET_USER_CTRL_PLMN,
  955.             MAIN_MENU_TITLE_SETTINGS_ICON,
  956.             g_keylock_context.KeyLockLSKStringID,
  957.             g_keylock_context.KeyLockLSKIconID,
  958.             g_keylock_context.KeyLockRSKStringID,
  959.             g_keylock_context.KeyLockRSKIconID,
  960.             STR_ID_NETSET_UNKNOWN_PLMN_MSG,
  961.             NULL);
  962.     }
  963. }
  964. /**************************************************************************
  965.    Pre-definition
  966. **************************************************************************/
  967. #endif /* __MMI_USER_CTRL_PLMN_SUPPORT__ */