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

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.  *  PhoneSetup.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  This file is intends for phone setup application
  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.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  *
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  * removed!
  248.  * removed!
  249.  * removed!
  250.  *
  251.  * removed!
  252.  * removed!
  253.  * removed!
  254.  *
  255.  * removed!
  256.  * removed!
  257.  * removed!
  258.  *
  259.  * removed!
  260.  * removed!
  261.  * removed!
  262.  *
  263.  * removed!
  264.  * removed!
  265.  * removed!
  266.  *
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  *
  271.  * removed!
  272.  * removed!
  273.  * removed!
  274.  *
  275.  * removed!
  276.  * removed!
  277.  * removed!
  278.  *
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  *
  283.  * removed!
  284.  * removed!
  285.  * removed!
  286.  *
  287.  * removed!
  288.  * removed!
  289.  * removed!
  290.  * removed!
  291.  *
  292.  * removed!
  293.  * removed!
  294.  * removed!
  295.  *
  296.  * removed!
  297.  * removed!
  298.  * removed!
  299.  *
  300.  * removed!
  301.  * removed!
  302.  * removed!
  303.  *
  304.  * removed!
  305.  * removed!
  306.  * removed!
  307.  *
  308.  * removed!
  309.  * removed!
  310.  * removed!
  311.  *
  312.  * removed!
  313.  * removed!
  314.  * removed!
  315.  *
  316.  * removed!
  317.  * removed!
  318.  * removed!
  319.  *
  320.  * removed!
  321.  * removed!
  322.  * removed!
  323.  *
  324.  * removed!
  325.  * removed!
  326.  * removed!
  327.  *
  328.  * removed!
  329.  * removed!
  330.  * removed!
  331.  *
  332.  * removed!
  333.  * removed!
  334.  * removed!
  335.  *
  336.  * removed!
  337.  * removed!
  338.  * removed!
  339.  *
  340.  * removed!
  341.  * removed!
  342.  * removed!
  343.  *
  344.  * removed!
  345.  * removed!
  346.  * removed!
  347.  *
  348.  * removed!
  349.  * removed!
  350.  * removed!
  351.  *
  352.  * removed!
  353.  * removed!
  354.  * removed!
  355.  *
  356.  * removed!
  357.  * removed!
  358.  * removed!
  359.  *
  360.  * removed!
  361.  * removed!
  362.  * removed!
  363.  *
  364.  * removed!
  365.  * removed!
  366.  * removed!
  367.  *
  368.  * removed!
  369.  * removed!
  370.  * removed!
  371.  *
  372.  * removed!
  373.  * removed!
  374.  * removed!
  375.  *
  376.  * removed!
  377.  * removed!
  378.  * removed!
  379.  *
  380.  * removed!
  381.  * removed!
  382.  * removed!
  383.  *
  384.  * removed!
  385.  * removed!
  386.  * removed!
  387.  *
  388.  * removed!
  389.  * removed!
  390.  * removed!
  391.  *
  392.  * removed!
  393.  * removed!
  394.  * removed!
  395.  *
  396.  * removed!
  397.  * removed!
  398.  * removed!
  399.  *
  400.  * removed!
  401.  * removed!
  402.  * removed!
  403.  *
  404.  * removed!
  405.  * removed!
  406.  * removed!
  407.  *
  408.  * removed!
  409.  * removed!
  410.  * removed!
  411.  *
  412.  * removed!
  413.  * removed!
  414.  * removed!
  415.  *
  416.  * removed!
  417.  * removed!
  418.  * removed!
  419.  *
  420.  * removed!
  421.  * removed!
  422.  * removed!
  423.  *
  424.  *------------------------------------------------------------------------------
  425.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  426.  *============================================================================
  427.  ****************************************************************************/
  428. /***************************************************************************** 
  429. * Include
  430. *****************************************************************************/
  431. /*  Include: MMI header file */
  432. #include "MMI_features.h"
  433. #include "stdC.h"
  434. #include "L4Dr1.h"
  435. #include "PixtelDataTypes.h"
  436. #include "wgui_categories.h"
  437. #include "wgui_categories_inputs.h"
  438. #include "wgui_categories_popup.h"
  439. #include "CustDataRes.h"
  440. #include "CustMenuRes.h"
  441. #include "EventsGProt.h"
  442. #include "DebugInitDef.h"
  443. #include "HistoryGprot.h"
  444. #include "ProtocolEvents.h"
  445. #include "CommonScreens.h"
  446. #include "Globaldefs.h"
  447. #include "Unicodexdcl.h"
  448. #include "NVRAMType.h"
  449. #include "NVRAMProt.h"
  450. #include "NVRAMEnum.h"
  451. #include "SettingsGexdcl.h"
  452. #include "settingGprots.h"
  453. #include "SettingDefs.h"
  454. #include "PhnsetProt.h"
  455. #include "WPSSProtos.h"
  456. #include "ATHandlerProt.h"      /* SendATSetGreeting() */
  457. #include "MainMenuDef.h"        /* MAIN_MENU_TITLE_SETTINGS_ICON */
  458. #include "QueueGProt.h" /* Osl Send Message */
  459. #include "settingprot.h"        /* PhoneSetup Prototype */
  460. #include "CSP.h"        /* CSP_VALUE_ADDED_SERVICES_SERVICE_GROUP, CSP_Language */
  461. #include "SettingProfile.h"     /* WARNING_TONE */
  462. #include "ProfileGprots.h"      /* playRequestedTone() */
  463. #include "MessagesExDcl.h"      /* GetChildMenuIDIndexByParentMenuID()  */
  464. #include "ScheduledPowerOnOffGProt.h"
  465. #include "ScreenSaverDefs.h"
  466. #include "WallpaperDefs.h"
  467. #include "DownloadDefs.h"
  468. #include "PhoneSetup.h"
  469. #include "PhoneSetupGprots.h"
  470. #include "Conversions.h"
  471. #include "GpioInc.h"    /* Backlight */
  472. #include "SimDetectionDef.h"    /* for g_pwr_context */
  473. #include "SimDetectionGprot.h"
  474. //KP Jerry add on 2007-3-28 start
  475. #ifdef __DUAL_SIM_SUPPORT__
  476. #include "gpio_hw.h"
  477. #include "CallSetUp.h"
  478. #include "CallmanagementIdDef.h"
  479. #include "CallSetUpEnum.h"
  480. #include "CallForwarding.h"
  481. #include "AlarmFrameworkProt.h"
  482. #endif
  483. //KP Jerry add on 2007-3-28 end
  484. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  485. #include "TouchScreenGprot.h"
  486. #ifdef __MTK_TARGET__
  487. #include "Touch_Panel.h"
  488. #endif 
  489. #ifdef __MMI_HANDWRITING_PAD__
  490. #include "touch_panel_custom.h"
  491. #endif 
  492. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  493. #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  494. #include "wgui_datetime.h"
  495. #endif 
  496. #ifdef __MMI_AUTO_LANG_EN__
  497. #include "CustResDef.h"
  498. #include "SSCStringHandle.h"
  499. #endif /* __MMI_AUTO_LANG_EN__ */ 
  500. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  501. #include "ShortcutsProts.h"
  502. #endif 
  503. #ifdef __MMI_PREFER_INPUT_METHOD__
  504. #include "PreferedInputMethodProt.h"    /* GetInputMethodIndex(),  InitPreferedInputMethod() */
  505. #endif 
  506. /*  Include: PS header file */
  507. #ifdef MMI_ON_HARDWARE_P
  508. #include "L4Dr.h"
  509. #include "lcd_if.h"
  510. #include "lcd_sw.h"
  511. #include "lcd_sw_inc.h"
  512. #include "sublcd.h"
  513. #endif /* MMI_ON_HARDWARE_P */ 
  514. #ifdef __MMI_TVOUT__
  515. #include "med_api.h"    /* media task */
  516. #include "mdi_tv.h"
  517. #endif /* __MMI_TVOUT__ */ 
  518. extern S16 MMI_current_input_ext_type;       //KP Jerry add for can use "MMI_current_input_ext_type" on 2007-4-3
  519. /***************************************************************************** 
  520. * Define
  521. *****************************************************************************/
  522. #ifdef __MMI_AUTO_LANG_EN__
  523. #define MMI_NUM_OF_AUTOLANG_ELEM   (sizeof(auto_lang_struct) / sizeof(auto_lang_struct[0]))
  524. #endif 
  525. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  526. /* Handwriting setting */
  527. #define MAX_PEN_SPEED 3
  528. #define MAX_PEN_COLORS 8
  529. #define DEFAULT_PEN_SPEED 1
  530. #define DEFAULT_PEN_COLOR 1
  531. /* Calibration */
  532. #define NUM_CALIBRATION_POINTS 3
  533. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  534. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  535. #define phone_setup_language GetChildMenuIDIndexByParentMenuID(MENU9102_INITIAL_SETUP,MENU_SETTING_LANGUAGE)
  536. #define phone_setup_preferred_input_method GetChildMenuIDIndexByParentMenuID(MENU9102_INITIAL_SETUP,MENU_SETTING_PREFERED_INPUT_METHOD)
  537. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  538. #define phone_setup_encoding_type GetChildMenuIDIndexByParentMenuID(MENU9102_INITIAL_SETUP,MENU_SETTING_DEF_ENCODING_TYPE)
  539. #define encoding_type_big2 GetChildMenuIDIndexByParentMenuID(MENU_SETTING_DEF_ENCODING_TYPE,MENU_SETTING_DEF_ENCODING_BIG2)
  540. #define encoding_type_gb2312 GetChildMenuIDIndexByParentMenuID(MENU_SETTING_DEF_ENCODING_TYPE,MENU_SETTING_DEF_ENCODING_GB2312)
  541. #define encoding_type_ucs2 GetChildMenuIDIndexByParentMenuID(MENU_SETTING_DEF_ENCODING_TYPE,MENU_SETTING_DEF_ENCODING_UCS2)
  542. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  543. #endif /* __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__ */ 
  544. /***************************************************************************** 
  545. * Typedef
  546. *****************************************************************************/
  547. typedef struct _AutoLang
  548. {
  549.     l4c_cbs_language_enum LanType;
  550.     S8 *LanSSC;
  551. } StructAutoLang;
  552. /***************************************************************************** 
  553. * Local Variable
  554. *****************************************************************************/
  555. static U8 *greet_text_on_off[2];
  556. #ifdef __MMI_AUTO_LANG_EN__
  557. static StructAutoLang auto_lang_struct[] = 
  558. {
  559.     /* ISO 639 2-alphabet Language Codes */
  560.     {CBS2_ZH, SSC_SCHINESE},
  561.     {CBS2_TW, SSC_TCHINESE},
  562.     {CBS0_ENGLISH, SSC_ENGLISH},
  563.     {CBS0_SPANISH, SSC_SPANISH},
  564.     {CBS2_TH, SSC_THAI},
  565.     {CBS0_FRENCH, SSC_FRENCH},
  566.     {CBS0_GERMAN, SSC_GERMAN},
  567.     {CBS0_ITALIAN, SSC_ITALIAN},
  568.     {CBS0_PORTUGUESE, SSC_PORTUGUESE},
  569.     {CBS1_RUSSIAN, SSC_RUSSIAN},
  570.     {CBS2_BG, SSC_BULGARIAN},
  571.     {CBS0_TURKISH, SSC_TURKISH},
  572.     {CBS2_VI, SSC_VIETNAMESE},
  573.     {CBS2_ID, SSC_INDONESIAN},
  574.     {CBS2_MS, SSC_MALAY},
  575.     {CBS1_ARABIC, SSC_ARABIC},
  576.     {CBS2_FA, SSC_PERSIAN},
  577.     {CBS2_SK, SSC_SLOVAK},
  578.     {CBS2_NL, SSC_DUTCH},
  579.     {CBS1_FINNISH, SSC_FINNISH},
  580.     {CBS2_SV, SSC_SWEDISH},
  581.     {CBS2_HR, SSC_CROATIAN},
  582.     {CBS2_RO, SSC_ROMANIAN},
  583.     {CBS2_SL, SSC_SLOVENIAN},
  584.     {CBS2_EL, SSC_GREEK},
  585.     {CBS2_CS, SSC_CZECH},
  586.     {CBS0_LANG_UNSPECIFIED, NULL /* Language UnSpecificed */ },
  587.     {CBS_INVALID, NULL /* Language UnSpecificed */ }
  588. };
  589. #endif /* __MMI_AUTO_LANG_EN__ */ 
  590. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  591. /* Handwriting setting */
  592. static S32 gInlinePenSpeed;
  593. static S32 gInlinePenColorIndex;
  594. static U8 *g_pen_speed_str_list[MAX_PEN_SPEED];
  595. static const color g_pen_color_list[MAX_PEN_COLORS] = 
  596. {
  597.     {0, 255, 255},
  598.     {255, 0, 0},
  599.     {0, 255, 0},
  600.     {255, 255, 0},
  601.     {255, 0, 255},
  602.     {255, 128, 0},
  603.     {0, 0, 128},
  604.     {0, 0, 0}
  605. };
  606. /* Current state of calibration screen */
  607. typedef struct
  608. {
  609.     /* Calibration point */
  610.     mmi_pen_point_struct points[NUM_CALIBRATION_POINTS];
  611.     /* Flag to check whether calibration has finished or not */
  612.     BOOL finished;
  613.     /* Sasve to factory default or user calibration data */
  614.     BOOL save_to_factory_default;
  615.     /* Original calibration setting before entring Calibration Application */
  616.     mmi_pen_calibration_struct backup_data;
  617.     /* Finish callback */
  618.     void (*finish_callback) (void);
  619. } mmi_phnset_calibration_struct;
  620. static PHNSET_CALIBRATION_STATE_ENUM g_phnset_calibration_screen_state = CALIBRATION_NULL_STATE;
  621. static mmi_phnset_calibration_struct *g_phnset_calibration_cntx_p;
  622. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  623. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  624. static S32 languages_default_item;
  625. static S32 is_inline_menu_exist = 0;
  626. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  627. static S32 default_encoding_type;
  628. #endif 
  629. #endif /* __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__ */ 
  630. /***************************************************************************** 
  631. * Global Variable
  632. *****************************************************************************/
  633. PHNSET_CNTX g_phnset_cntx;
  634. PHNSET_CNTX *g_phnset_cntx_p = &g_phnset_cntx;
  635. extern U8 g_dst;
  636. //KP Jerry add on 2007-3-30 start
  637. #ifdef __DUAL_SIM_SUPPORT__
  638. S8 unicode_buf1[SIM_NUM_LENGTH*ENCODING_LENGTH];
  639. S8 unicode_buf2[SIM_NUM_LENGTH*ENCODING_LENGTH];
  640. S8  unreachable_num[45*ENCODING_LENGTH];
  641. S8 unreachablestates;
  642. S8 isSearchFinished;
  643. #endif
  644. //KP Jerry add on 2007-3-30 end
  645. /***************************************************************************** 
  646. * External Variable
  647. *****************************************************************************/
  648. /* Lagnuage */
  649. extern sLanguageDetails *gLanguageArray;
  650. extern U16 gCurrLangIndex;
  651. extern U8 *ItemType[8];
  652. extern U8 gPLMN[];
  653. extern PU8 subMenuDataPtrs[MAX_SUB_MENUS];
  654. #ifdef __MMI_PREFER_INPUT_METHOD__
  655. extern U8 *inputMethodList[9];
  656. extern U16 currInputMethodIndex;
  657. #endif /* __MMI_PREFER_INPUT_METHOD__ */ 
  658. /***************************************************************************** 
  659. * Global Function
  660. *****************************************************************************/
  661. #ifdef __MMI_TVOUT__
  662. void mmi_phnset_tvout_event_hdlr(MDI_RESULT result);
  663. #endif 
  664. /***************************************************************************** 
  665. * External Function
  666. *****************************************************************************/
  667. extern void SetProfileSettingCustomFuns(void);
  668. extern void RefreshNwProviderName(U8 *UpdatePlmn);
  669. #ifdef __MMI_PREFER_INPUT_METHOD__
  670. extern U16 GetInputMethodIndex(U16 inputType);
  671. #endif 
  672. /*****************************************************************************
  673. * Local Function 
  674. *****************************************************************************/
  675. #ifdef __MMI_TVOUT__
  676. static void mmi_phnset_highlight_tvout(void);
  677. static void mmi_phnset_entry_tvout_screen(void);
  678. static void mmi_phnset_highlight_tvout_setting(void);
  679. static void mmi_phnset_highlight_tvout_adjust(void);
  680. static void mmi_phnset_tvout_set_adjust(void);
  681. static void mmi_phnset_tvout_cancel_adjust(void);
  682. static void mmi_phnset_entry_tvout_setting_screen(void);
  683. static void mmi_phnset_exit_tvout_setting_screen(void);
  684. static void mmi_phnset_entry_tvout_adjust_screen(void);
  685. static void mmi_phnset_tvout_adjust_y_gamma_callback(S32 value);
  686. static void mmi_phnset_tvout_adjust_u_callback(S32 value);
  687. static void mmi_phnset_tvout_adjust_v_callback(S32 value);
  688. #endif /* __MMI_TVOUT__ */ 
  689. /*****************************************************************************
  690.  * FUNCTION
  691.  *  InitPhoneSetupCntx
  692.  * DESCRIPTION
  693.  *  This function is to initialize phone setup context
  694.  * PARAMETERS
  695.  *  void
  696.  *  a(?)        [IN/OUT]        
  697.  *  b(?)        [IN]            
  698.  * RETURNS
  699.  *  void
  700.  *****************************************************************************/
  701. void InitPhoneSetupCntx(void)
  702. {
  703.     /*----------------------------------------------------------------*/
  704.     /* Local Variables                                                */
  705.     /*----------------------------------------------------------------*/
  706.     S16 Err = 0;
  707.     /*----------------------------------------------------------------*/
  708.     /* Code Body                                                      */
  709.     /*----------------------------------------------------------------*/
  710.     /* Common */
  711.     g_phnset_cntx_p->curHightlightItem = 0;
  712.     g_phnset_cntx_p->ScrAnchor = IDLE_SCREEN_ID;
  713.     /* Set Time and Date */
  714.     g_phnset_cntx_p->currentCity = 0;
  715.     g_phnset_cntx_p->CurHomeCityStrID = 0;
  716.     g_phnset_cntx_p->CurHomeCityStrPtr = 0;
  717.     g_phnset_cntx_p->CurTimeFmt = 0;
  718.     g_phnset_cntx_p->CurDateFmt = 0;
  719.     g_phnset_cntx_p->AM_PM_flag = NULL;
  720.     ReadValue(NVRAM_SETTING_DT_DST, &(g_phnset_cntx_p->currentDST), DS_BYTE, &Err);
  721.     if (g_phnset_cntx_p->currentDST == 0xff)
  722.     {
  723.         g_phnset_cntx_p->currentDST = 0;
  724.         WriteValue(NVRAM_SETTING_DT_DST, &g_phnset_cntx_p->currentDST, DS_BYTE, &Err);
  725. g_dst = g_phnset_cntx_p->currentDST;
  726.     }
  727.     memset(&(g_phnset_cntx_p->settime), 0, sizeof(PHNSET_DATETIME_STRUCT));
  728.     /* NITZ */
  729.     g_phnset_cntx_p->NITZDirtyFlag = MMI_FALSE;
  730.     g_phnset_cntx_p->curNITZStatus = 0;
  731.     /* Phone Setup */
  732.     g_phnset_cntx_p->ShowOwnNumDirtyFlag = MMI_FALSE;
  733.     g_phnset_cntx_p->ShowDtDirtyFlag = MMI_FALSE;
  734.     g_phnset_cntx_p->curShowDtStatus = 0;
  735.     g_phnset_cntx_p->curShowOwnNumStatus = 0;
  736.     /* Lisen 0921-1 */
  737. #if defined(__MMI_OPERATOR_NAME_MENU__)
  738.     g_phnset_cntx_p->curShowOPNStatus = 0;
  739. #endif 
  740. #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  741.     g_phnset_cntx_p->MenuStyle = 0;
  742. #endif 
  743.     /* Language */
  744.     g_phnset_cntx_p->ppLang = NULL;
  745.     g_phnset_cntx_p->UsrLangIdx = 0;
  746.     g_phnset_cntx_p->LP = CBS0_LANG_UNSPECIFIED;
  747.     /* Wallpaper & Screen Saver */
  748.     g_phnset_cntx_p->curtWpID = 0;
  749. #ifdef __MMI_SUB_WALLPAPER__
  750.     g_phnset_cntx_p->curtSubWpID = 0;
  751. #endif 
  752.     g_phnset_cntx_p->WPSSPreviewScrFlag = 1;
  753.     g_phnset_cntx_p->WPFctyImgNum = 0;
  754.     g_phnset_cntx_p->SSFctyImgNum = 0;
  755.     g_phnset_cntx_p->WPDwnlImgNum = 0;
  756.     g_phnset_cntx_p->SSDwnlImgNum = 0;
  757.     g_phnset_cntx_p->curSSStatus = 0;
  758.     g_phnset_cntx_p->curSSWaitTime = 0;
  759.     g_phnset_cntx_p->SSStatusInlineHilite = 0;
  760.     g_phnset_cntx_p->SSWaitStatusInlineHilite = 2;
  761.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  762.     memset(g_phnset_cntx_p->SysWPSSList, 0, sizeof(g_phnset_cntx_p->SysWPSSList));
  763.     memset(g_phnset_cntx_p->DwnlWPSSList, 0, sizeof(g_phnset_cntx_p->DwnlWPSSList));
  764. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  765.     SetHiliteHandler(MENU_SETTING_DEF_ENCODING_TYPE, HighlightPhnsetDefEncoding);
  766.     SetHintHandler(MENU_SETTING_DEF_ENCODING_TYPE, HintPhnsetDefEncoding);
  767.     ReadValue(NVRAM_SETTING_DEF_ENCODING, &(g_phnset_cntx_p->EncodingType), DS_BYTE, &Err);
  768.     if (g_phnset_cntx_p->EncodingType == 0xFF || Err != NVRAM_READ_SUCCESS)
  769.     {
  770. //KP Jerry modify on 2006-12-6 start 
  771. #if (defined(__MMI_CHSET_BIG5__) && !defined(__MMI_CHSET_GB2312__))
  772. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_BIG5;
  773. #elif (defined(__MMI_CHSET_GB2312__) && !defined(__MMI_CHSET_BIG5__))
  774. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_GB2312;
  775. #elif (defined(__MMI_CHSET_GB2312__) && defined(__MMI_CHSET_BIG5__))
  776.   #if defined __MMI_DEFAULT_LANG_TR_CHINESE__
  777. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_BIG5;
  778.   #elif defined __MMI_DEFAULT_LANG_SM_CHINESE__
  779. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_GB2312;
  780.   #else
  781. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_BIG5;
  782.   #endif
  783. #else
  784. g_phnset_cntx_p->EncodingType = PHNSET_ENCOD_UCS2;
  785. #endif
  786. //KP Jerry modify on 2006-12-6 end 
  787.     }
  788.     switch (g_phnset_cntx_p->EncodingType)
  789.     {
  790.         case PHNSET_ENCOD_BIG5:
  791.     #ifdef __MMI_CHSET_BIG5__
  792.             g_chset_text_encoding = MMI_CHSET_BIG5;
  793.     #else 
  794.             ASSERT(0);  /* Encoding type not support */
  795.     #endif 
  796.             break;
  797.         case PHNSET_ENCOD_GB2312:
  798.     #ifdef __MMI_CHSET_GB2312__
  799.             g_chset_text_encoding = MMI_CHSET_GB2312;
  800.     #else 
  801.             ASSERT(0);  /* Encoding type not support */
  802.     #endif 
  803.             break;
  804.     }
  805. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  806. #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  807.     ReadValue(NVRAM_SET_MAINMENU_STYLE, &(g_phnset_cntx_p->MenuStyle), DS_BYTE, &Err);
  808.     if (g_phnset_cntx_p->MenuStyle == 0xFF || g_phnset_cntx_p->MenuStyle >= PHNSET_MAINMENU_STYLE_MAX)
  809.     {
  810.         g_phnset_cntx_p->MenuStyle = 0;
  811.     }
  812. #endif /* __MMI_MAINMENU_STYLE_CHANGE_EN__ */ 
  813. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  814.     ReadValue(NVRAM_PEN_SPEED, &(g_phnset_cntx_p->pen_speed), DS_BYTE, &Err);
  815.     if (g_phnset_cntx_p->pen_speed == 0xFF || Err != NVRAM_READ_SUCCESS || g_phnset_cntx_p->pen_speed >= MAX_PEN_SPEED)
  816.     {
  817.         g_phnset_cntx_p->pen_speed = DEFAULT_PEN_SPEED;
  818.     }
  819.     ReadValue(NVRAM_PEN_COLOR, &(g_phnset_cntx_p->pen_color), DS_BYTE, &Err);
  820.     if (g_phnset_cntx_p->pen_color == 0xFF || Err != NVRAM_READ_SUCCESS || g_phnset_cntx_p->pen_color >= MAX_PEN_COLORS)
  821.     {
  822.         g_phnset_cntx_p->pen_color = DEFAULT_PEN_COLOR;
  823.     }
  824. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  825. }
  826. /*****************************************************************************
  827.  * FUNCTION
  828.  *  InitPhoneSetupApp
  829.  * DESCRIPTION
  830.  *  This function is to register highlight handler for Phonesetup
  831.  * PARAMETERS
  832.  *  void
  833.  *  a(?)        [IN/OUT]        
  834.  *  b(?)        [IN]            
  835.  * RETURNS
  836.  *  void
  837.  *****************************************************************************/
  838. void InitPhoneSetupApp(void)
  839. {
  840.     /*----------------------------------------------------------------*/
  841.     /* Local Variables                                                */
  842.     /*----------------------------------------------------------------*/
  843.     /*----------------------------------------------------------------*/
  844.     /* Code Body                                                      */
  845.     /*----------------------------------------------------------------*/
  846.     PRINT_INFORMATION(("File: [%s]  Line: [%d] <<InitNetworkSetupApp.>n", __FILE__, __LINE__));
  847.     /* Robin 0603: G12C request -- Add Display Setup menu */
  848. #ifdef __MMI_DISP_SETUP_LEVEL_UP__
  849.     SetHiliteHandler(MENU_DISP_SETUP, HighlightDispSetup);
  850. #endif 
  851.     // SetHiliteHandler(MENU_SETTING_SPEED_DIAL,  HighlightPhbSpeedDial);  /* Move to SpeedDial.c */
  852. #if !defined(__MMI_NO_CONTRAST_LEVEL__)
  853.     SetHiliteHandler(MENU_SETTING_CONTRAST_LEVEL, HighlightPhnsetContrastLevel);
  854. #endif 
  855.     SetHiliteHandler(MENU_SETTING_SCHEDULE_POWER, HighlightSPOF);
  856.     SetHiliteHandler(MENU_IDLE_SCR_DISP, HighlightPhnsetIdleScrDisp);
  857.     SetHiliteHandler(MENU_SETTING_SHOW_OWN_NUMBER, HighlightPhnsetShowOwnNo);
  858.     /* Lisen 0921-1 */
  859. #if defined(__MMI_OPERATOR_NAME_MENU__)
  860.     SetHiliteHandler(MENU_SETTING_SHOW_OPN, HighlightPhnsetShowOPN);
  861. #endif 
  862.     SetHiliteHandler(MENU_SETTING_SHOW_DT_TIME, HighlightPhnsetShowDtTime);
  863.     //SetHiliteHandler(MITEM113_PBOOK_SPEED_DIAL,HighlightPhbSpeedDialSetNum); /* Move to SpeedDial.c */
  864.     //SetHiliteHandler(MENU_SETTING_SPEED_STATUS,HighlightPhbSpeedDialStatus); /* Move to SpeedDial.c */
  865.     SetHiliteHandler(MENU_SETTING_LANGUAGE, HighlightPhnsetLang);
  866.     SetHiliteHandler(MENU9146_WELCOME_TEXT, HighlightPhnsetWelcomeText);
  867.     SetHiliteHandler(MENU_SETTING_SCR_SVR, HighlightPhnsetScreenSaver);
  868.     SetHiliteHandler(MENU_SETTING_WALLPAPER, HighlightPhnsetMainWallpaper);
  869. #ifdef __MMI_SUB_WALLPAPER__
  870.     SetHiliteHandler(MENU_SETTING_WALLPAPER_SUB, HighlightPhnsetSubWallpaper);
  871. #endif 
  872. #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  873.     SetHintHandler(MENU_SETTING_MAINMENU_STYLE, HintPhnsetMainMenuStyle);
  874.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE, HighlightPhnsetMainMenuStyle);
  875.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE_MATRIX, HighlightPhnsetMainMenuStyleSelect);
  876.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE_PAGE, HighlightPhnsetMainMenuStyleSelect);
  877.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE_CIRCULAR, HighlightPhnsetMainMenuStyleSelect);
  878.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE_ROTATE, HighlightPhnsetMainMenuStyleSelect);   /* PDG1   Manish */
  879.     SetHiliteHandler(MENU_SETTING_MAINMENU_STYLE_LIST, HighlightPhnsetMainMenuStyleSelect);
  880. #endif /* __MMI_MAINMENU_STYLE_CHANGE_EN__ */ 
  881. #if defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  882.     SetHintHandler(MENU_SETTING_IDLE_CLOCK_TYPE, HintPhnsetIdleClockType);
  883.     SetHiliteHandler(MENU_SETTING_IDLE_CLOCK_TYPE, HighlightPhnsetIdleClockType);
  884. #endif /* defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__) */ 
  885. #ifndef __MMI_HIDE_HOMECITY__
  886.     SetHiliteHandler(MENU9142_SETHOMECITY, HighlightPhnsetSetHomeCity);
  887. #endif 
  888. #ifndef __MMI_SEPARATE_DT_SETTING__
  889.     SetHiliteHandler(MENU9143_SETTIMEANDDATE, HighlightPhnsetSetDT);
  890.     SetHiliteHandler(MENU9144_SETTIMEANDDATEFORMAT, HighlightPhnsetSetFormat);
  891. #else /* __MMI_SEPARATE_DT_SETTING__ */ 
  892.     SetHiliteHandler(MENU_ID_SETTING_DATEANDFORMAT, HighlightPhnsetSetDateAndFormat);
  893.     SetHiliteHandler(MENU_ID_SETTING_TIMEANDFORMAT, HighlightPhnsetSetTimeAndFormat);
  894. #endif /* __MMI_SEPARATE_DT_SETTING__ */ 
  895.     /* diamond, 2005/07/05 Flight mode */
  896. #ifdef __FLIGHT_MODE_SUPPORT__
  897.     SetHiliteHandler(MENU_SETTING_FLIGHT_MODE, HighlightPhnsetFlightMode);
  898. #endif 
  899.     /* end, diamond */
  900. #ifndef __MMI_HIDE_HOMECITY__
  901.     SetHintHandler((U16) MENU9142_SETHOMECITY, HintPhnsetTimeAndDate);
  902. #endif 
  903.     SetHintHandler(MENU9146_WELCOME_TEXT, HintPhnsetWelcomeText);
  904.     SetHintHandler(MENU_SETTING_LANGUAGE, HintPhnsetLanguage);
  905.     SetHintHandler(MENU_SETTING_SHOW_OWN_NUMBER, HintPhnsetOwnerNum);
  906.     /* Lisen 0921-1 */
  907. #if defined(__MMI_OPERATOR_NAME_MENU__)
  908.     SetHintHandler(MENU_SETTING_SHOW_OPN, HintPhnsetOPN);
  909. #endif 
  910.     SetHintHandler(MENU_SETTING_SHOW_DT_TIME, HintPhnsetShowDateTime);
  911.     SetHintHandler(MENU_SETTING_WALLPAPER, HintPhnsetWallpaper);
  912. #ifdef __MMI_SUB_WALLPAPER__
  913.     SetHintHandler(MENU_SETTING_WALLPAPER_SUB, HintPhnsetSubWallpaper);
  914. #endif 
  915.     SetHintHandler(MENU_SETTING_SCR_SVR, HintPhnsetScreenSaver);
  916. #ifdef __DAILY_WALLPAPER__
  917.     SetHiliteHandler(MENU_SETTING_WALLPAPER_FIX, HighlightPhnsetWallpaperFix);
  918.     SetHintHandler(MENU_SETTING_WALLPAPER_ROTATE, HintPhnsetWallpaperRotate);
  919. #endif /* __DAILY_WALLPAPER__ */ 
  920. #ifdef __MMI_NITZ__
  921. #ifdef __MMI_AUTOTIMEZONE_IN_DATEANDTIME__
  922.     SetHintHandler(MENU9145_SETTIMEANDDATENITZ, HintPhnsetNITZ);
  923.     SetHiliteHandler(MENU9145_SETTIMEANDDATENITZ, HighlightPhnsetNITZ);
  924. #else /* __MMI_AUTOTIMEZONE_IN_DATEANDTIME__ */ 
  925.     SetHintHandler(MENU_SETTING_MENU_TREE, HintPhnsetNITZ);
  926.     SetHiliteHandler(MENU_SETTING_MENU_TREE, HighlightPhnsetNITZ);
  927. #endif /* __MMI_AUTOTIMEZONE_IN_DATEANDTIME__ */ 
  928. #endif /* __MMI_NITZ__ */ 
  929. #ifdef __MMI_PREFER_INPUT_METHOD__
  930.     SetHintHandler(MENU_SETTING_PREFERED_INPUT_METHOD, HintPhnsetPreferedInputMethod);
  931. #endif 
  932. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__) && !defined(__DISABLE_SHORTCUTS_IMPL__)
  933.     SetHiliteHandler(MENU_SETTING_DEDICATED_KEYS, HighlightDedicatedKeys);
  934. #endif 
  935. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  936.     SetHiliteHandler(MENU_SETTING_HANDWRITING, HighlightHandwritingSetting);
  937.     SetHiliteHandler(MENU_SETTING_CALIBRATION, HighlightCalibrationSetting);
  938. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  939. #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  940.     SetHiliteHandler(MENU_SETTING_POWER_ON_DISPLAY, HighlightPhnsetPowerOn);
  941.     SetHintHandler(MENU_SETTING_POWER_ON_DISPLAY, HintPhnsetPwrOnDisplay);
  942.     SetHiliteHandler(MENU_SETTING_POWER_OFF_DISPLAY, HighlightPhnsetPowerOff);
  943.     SetHintHandler(MENU_SETTING_POWER_OFF_DISPLAY, HintPhnsetPwrOffDisplay);
  944. #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  945.     /* Cylen 2005/08/23 GPIO Setting */
  946. #ifdef __MMI_CHANGABLE_FONT__
  947.     SetHiliteHandler(MENU_ID_PHNSET_FONT_SIZE, HighlightPhnsetFontSize);
  948.     SetHintHandler(MENU_ID_PHNSET_FONT_SIZE, HintPhnsetFontSize);
  949.     PhnsetReadFontSize();   /* __USB_IN_NORMAL_MODE__ */
  950. #endif /* __MMI_CHANGABLE_FONT__ */ 
  951.     SetHiliteHandler(MENU_ID_PHNSET_GPIO_SETTING, HighlightPhnsetGPIOSetting);
  952.     SetHiliteHandler(MENU_ID_PHNSET_GPIO_LED, HighlightPhnsetGPIOLED);
  953.     SetHiliteHandler(MENU_ID_PHNSET_GPIO_BACKLITE, HighlightPhnsetGPIOBackLite);
  954. //KP Jerry add on 2007-2-15 start
  955. #ifdef __DUAL_SIM_SUPPORT__
  956. SetHiliteHandler(MENU_SIM_SWCH, HighlightSIMSwitch);
  957. SetHiliteHandler(MENU_SIM_SWCH_NUM_EDTT, HighlightSIMNumEdit);
  958. SetHiliteHandler(MENU_SIM_SWCH_UNREACHABLE_AUTO_ON_OFF, HighlightAutoUnReachableForward);
  959. SetHiliteHandler(MENU_SIM_SWCH_ON_OFF, HighlightSIMCardSwitch);
  960. #ifdef __DUAL_SIM_QUICK_SWITCH__
  961. SetHiliteHandler(MENU_SIM_SWCH_QUICK_ON_OFF, HighlightSIMCardQuickSwitch);
  962. #endif
  963. #endif
  964. //KP Jerry add on 2007-2-15 end
  965. #ifdef __MMI_COVER_SETTING__
  966.     SetHiliteHandler(MENU_ID_PHNSET_GPIO_COVER_CLOSE, HighlightPhnsetGPIOCover);
  967. #endif 
  968.     SetHintHandler(MENU_ID_PHNSET_GPIO_LED, HintPhnsetGPIOLED);
  969. //KP Jerry add on 2007-2-15 start
  970. #ifdef __DUAL_SIM_SUPPORT__
  971. SetHintHandler(MENU_SIM_SWCH, HintSIMSwitch);
  972. SetHintHandler(MENU_SIM_SWCH_ON_OFF, HintSwitching);
  973. #ifdef __DUAL_SIM_QUICK_SWITCH__
  974. SetHintHandler(MENU_SIM_SWCH_QUICK_ON_OFF, HintSwitching);
  975. #endif
  976. SetHintHandler(MENU_SIM_SWCH_UNREACHABLE_AUTO_ON_OFF, HintUnReachable);
  977. #endif
  978. //KP Jerry add on 2007-2-15 end
  979.     /* diamond, 2005/07/05 Flight mode */
  980. #ifdef __FLIGHT_MODE_SUPPORT__
  981.     SetHintHandler(MENU_SETTING_FLIGHT_MODE, HintPhnsetFlightMode);
  982. #endif 
  983.     /* end, diamond */
  984. #ifdef __MMI_TVOUT__
  985.     SetHiliteHandler(MENU_ID_SETTING_TVOUT, mmi_phnset_highlight_tvout);
  986.     SetHiliteHandler(MENU_ID_SETTING_TVOUT_SETTING, mmi_phnset_highlight_tvout_setting);
  987.     SetHiliteHandler(MENU_ID_SETTING_TVOUT_ADJUST, mmi_phnset_highlight_tvout_adjust);
  988. #endif /* __MMI_TVOUT__ */ 
  989. }
  990. //KP Jerry add on 2007-3-23 start
  991. #ifdef __DUAL_SIM_SUPPORT__
  992. void GoBackSIMSwitchScreen(void)
  993. {
  994. GoBackToHistory(SCR_ID_PHNSET_SIM_SWITCH);
  995. }
  996. void MakeSIMSwitch(void)
  997. {
  998. isSearchFinished = SEARCH_SUCCESS;
  999. // Switching SIM Card
  1000. SIMSwitchAndResetRequest();
  1001. }
  1002. void MakeSetTimerSIMSwitch(void)
  1003. {
  1004. StopTimer(POPUP_TIMER);
  1005. StartTimer(POPUP_TIMER, UI_POPUP_NOTIFYDURATION_TIME*2, MakeSIMSwitch);
  1006. }
  1007. void MakeOnUnReachableSuccess(void)
  1008. {
  1009. DisplayPopup(
  1010.             (PU8) (g_callset_context.SSDisplayBuffer),
  1011.             IMG_GLOBAL_ACTIVATED,
  1012.             MMI_TRUE,
  1013.             UI_POPUP_NOTIFYDURATION_TIME,
  1014.             WARNING_TONE);
  1015. ClearAllKeyHandler();
  1016. MakeSetTimerSIMSwitch();
  1017. }
  1018. void MakeOffUnReachableSuccess(void)
  1019. {
  1020. DisplayPopup(
  1021.             (PU8) (g_callset_context.SSDisplayBuffer),
  1022.             IMG_GLOBAL_ACTIVATED,
  1023.             MMI_TRUE,
  1024.             UI_POPUP_NOTIFYDURATION_TIME,
  1025.             WARNING_TONE);
  1026. ClearAllKeyHandler();
  1027. MakeSetTimerSIMSwitch();
  1028. }
  1029. void NetWorkNotProviedServiceLeftKeyProcess(void)
  1030. {
  1031. S16 error;
  1032. if (g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_ON)
  1033. {
  1034. g_phnset_cntx.AutoUnReachableStates = AUTO_UNREACHABLE_OFF;
  1035. WriteValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  1036. DisplayPopup(
  1037.             (PU8) GetString(STR_GLOBAL_DETACTIVATE),
  1038.             IMG_GLOBAL_ACTIVATED,
  1039.             MMI_TRUE,
  1040.             UI_POPUP_NOTIFYDURATION_TIME,
  1041.             WARNING_TONE);
  1042. ClearAllKeyHandler();
  1043. }
  1044. MakeSetTimerSIMSwitch();
  1045. }
  1046. void NetWorkNotProviedServiceRightKeyProcess(void)
  1047. {
  1048. MakeSIMSwitch();
  1049. }
  1050. void MakeNetWorkNotProviedService(void)
  1051. {
  1052. /*----------------------------------------------------------------*/
  1053. /* Local Variables                                                */
  1054. /*----------------------------------------------------------------*/
  1055. S16 error;
  1056. S8 short_string[2];
  1057. S8 TempShortString[2];
  1058. S8 *TempBuff1;
  1059. /*----------------------------------------------------------------*/
  1060. /* Code Body                                                      */
  1061. /*----------------------------------------------------------------*/
  1062. ReadValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  1063. TempBuff1 = (S8*) OslMalloc(MAX_DISP_UCS2);
  1064. memset(TempBuff1, 0, MAX_DISP_UCS2); 
  1065. memset(short_string, 0, 2); 
  1066. memset(TempShortString, 0, 2); 
  1067. pfnUnicodeStrcpy((PS8) TempBuff1, (PS8) (g_callset_context.SSDisplayBuffer));
  1068. if (g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_ON)
  1069. {
  1070. sprintf(short_string, "n");
  1071. AnsiiToUnicodeString((PS8) TempShortString, (PS8) short_string);
  1072. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) GetString(STR_SIM_SWITCH_UNREACHABLE_AUTO_ON_OFF));
  1073. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) TempShortString); 
  1074. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) GetString(STR_SIM_SWITCH_SHUT_DOWN));
  1075. }
  1076. DisplayConfirm(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1077.     STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1078.     (PU16) TempBuff1,IMG_GLOBAL_QUESTION, WARNING_TONE);
  1079. SetLeftSoftkeyFunction(NetWorkNotProviedServiceLeftKeyProcess,KEY_EVENT_UP);
  1080. SetRightSoftkeyFunction(NetWorkNotProviedServiceRightKeyProcess,KEY_EVENT_UP);
  1081. OslMfree(TempBuff1);
  1082. }
  1083. void EntrySIMSwitchProcessResut(void)
  1084. {
  1085. /*----------------------------------------------------------------*/
  1086. /* Local Variables                                                */
  1087. /*----------------------------------------------------------------*/
  1088. S8   FindSubStr;
  1089. S8  len_unreachable, len_sim_num;
  1090. S16 Error;
  1091. S8  unreachable_ansii_num[45];
  1092. U8  SIM1Num[SIM_NUM_LENGTH];
  1093. U8  SIM2Num[SIM_NUM_LENGTH];
  1094. U8  AutoUnReachableStates; // Auto on-off
  1095. /*----------------------------------------------------------------*/
  1096. /* Code Body                                                      */
  1097. /*----------------------------------------------------------------*/
  1098. memset(unicode_buf1, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1099. memset(unicode_buf2, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1100. memset(SIM1Num, 0, SIM_NUM_LENGTH);
  1101. memset(SIM2Num, 0, SIM_NUM_LENGTH);
  1102. memset(unreachable_ansii_num, 0, 45);
  1103. // Read NVRAM SIM1 and SIM2 Number.
  1104. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1105. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1106. AnsiiToUnicodeString((S8*)unicode_buf1, (S8*)SIM1Num);
  1107. AnsiiToUnicodeString((S8*)unicode_buf2, (S8*)SIM2Num);
  1108. UnicodeToAnsii((S8*)unreachable_ansii_num, (S8*)unreachable_num);
  1109. ReadValue(NVRAM_SIM_SWITCH_ID, &AutoUnReachableStates, DS_BYTE, &Error);
  1110. if (AutoUnReachableStates == AUTO_UNREACHABLE_ON) /* The Auto UnReachable Service is Already On. */
  1111. {
  1112. if (unreachablestates == UNREACHABLE_ON) /* The UnReachable Service is Already On. */
  1113. {
  1114. ReadValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &Error);
  1115. if(g_phnset_cntx.SIMID == SIM1)
  1116. {
  1117. len_unreachable = strlen((char *)unreachable_ansii_num);
  1118. len_sim_num = strlen((char *)SIM2Num);
  1119. if (len_unreachable < 7)
  1120. {
  1121. if (len_unreachable >= len_sim_num)
  1122. {
  1123. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM2Num);
  1124. }
  1125. else
  1126. FindSubStr = 1;
  1127. }
  1128. else
  1129. {
  1130. if (len_sim_num < 7)
  1131. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM2Num);
  1132. else
  1133. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - 7), (const char *)(SIM2Num + len_sim_num - 7));
  1134. }
  1135. if (FindSubStr != 0)  
  1136. {
  1137. // The UnReachable Service of Current SIM Card is Cancel.
  1138. g_callset_context.SSCFType = FORWARD_CANCEL_ALL;
  1139. EnterPhnSetUnReachableOffReq();
  1140. }
  1141. else
  1142. {
  1143. // Hint User UnReachable Service is Already On
  1144. MakeOnUnReachableSuccess();
  1145. }
  1146. }
  1147. else if (g_phnset_cntx.SIMID == SIM2)
  1148. {
  1149. len_unreachable = strlen((char *)unreachable_ansii_num);
  1150. len_sim_num = strlen((char *)SIM1Num);
  1151. if (len_unreachable < 7)
  1152. {
  1153. if (len_unreachable >= len_sim_num)
  1154. {
  1155. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM1Num);
  1156. }
  1157. else
  1158. FindSubStr = 1;
  1159. }
  1160. else
  1161. {
  1162. if (len_sim_num < 7)
  1163. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM1Num);
  1164. else
  1165. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - 7), (const char *)(SIM1Num + len_sim_num - 7));
  1166. }
  1167. if (FindSubStr != 0)  
  1168. {
  1169. // The UnReachable Service of Current SIM Card is Cancel.
  1170. g_callset_context.SSCFType = FORWARD_CANCEL_ALL;
  1171. EnterPhnSetUnReachableOffReq();
  1172. }
  1173. else
  1174. {
  1175. // Hint User UnReachable Service is Already On
  1176. MakeOnUnReachableSuccess();
  1177. }
  1178. }
  1179. }
  1180. else if (unreachablestates == UNREACHABLE_OFF) /* The UnReachable Service is Already Off */
  1181. {
  1182. EnterPhnSetUnReachableOnReq();
  1183. }
  1184. else if (unreachablestates == UNREACHABLE_NOT_PROVIDED)
  1185. {
  1186. MakeNetWorkNotProviedService();
  1187. }
  1188. }
  1189. else /* The Auto UnReachable Service is Already Off. */
  1190. {
  1191. if (unreachablestates == UNREACHABLE_ON) /* The UnReachable Service is Already On. */
  1192.   {
  1193.   ReadValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &Error);
  1194. if(g_phnset_cntx.SIMID == SIM1)
  1195. {
  1196. len_unreachable = strlen((char *)unreachable_ansii_num);
  1197. len_sim_num = strlen((char *)SIM2Num);
  1198. if (len_unreachable < 7)
  1199. {
  1200. if (len_unreachable >= len_sim_num)
  1201. {
  1202. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM2Num);
  1203. }
  1204. else
  1205. FindSubStr = 1;
  1206. }
  1207. else
  1208. {
  1209. if (len_sim_num < 7)
  1210. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM2Num);
  1211. else
  1212. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - 7), (const char *)(SIM2Num + len_sim_num - 7));
  1213. }
  1214. if (FindSubStr != 0)   
  1215. {
  1216. // Hint User UnReachable Service of Current SIM Card  is Already On, But isn't setting number.
  1217. mmi_phbset_sim_switch_off_confirm();
  1218. }
  1219. else
  1220. {
  1221. g_callset_context.SSCFType = FORWARD_CANCEL_ALL;
  1222. EnterPhnSetUnReachableOffReq();
  1223. }
  1224. }
  1225. else if (g_phnset_cntx.SIMID == SIM2)
  1226. {
  1227. len_unreachable = strlen((char *)unreachable_ansii_num);
  1228. len_sim_num = strlen((char *)SIM1Num);
  1229. if (len_unreachable < 7)
  1230. {
  1231. if (len_unreachable >= len_sim_num)
  1232. {
  1233. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM1Num);
  1234. }
  1235. else
  1236. FindSubStr = 1;
  1237. }
  1238. else
  1239. {
  1240. if (len_sim_num < 7)
  1241. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - len_sim_num), (const char *) SIM1Num);
  1242. else
  1243. FindSubStr = strcmp((const char *)(unreachable_ansii_num + len_unreachable - 7), (const char *)(SIM1Num + len_sim_num - 7));
  1244. }
  1245. if (FindSubStr != 0)   
  1246. {
  1247. // Hint User UnReachable Service of Current SIM Card  is Already On, But isn't setting number.
  1248. mmi_phbset_sim_switch_off_confirm();
  1249. }
  1250. else
  1251. {
  1252. g_callset_context.SSCFType = FORWARD_CANCEL_ALL;
  1253. EnterPhnSetUnReachableOffReq();
  1254. }
  1255. }
  1256.   }
  1257. else if (unreachablestates == UNREACHABLE_OFF)
  1258.   {
  1259.   // Hint User Current SIM Card UnReachable Service is Already off.
  1260. MakeOffUnReachableSuccess();
  1261.   }
  1262. else if (unreachablestates == UNREACHABLE_NOT_PROVIDED)
  1263. {
  1264. MakeNetWorkNotProviedService();
  1265. }
  1266. }
  1267. }
  1268. void EntrySIMSwitchProcess(void)
  1269. {
  1270.     /*----------------------------------------------------------------*/
  1271.     /* Local Variables                                                */
  1272.     /*----------------------------------------------------------------*/
  1273.     /*----------------------------------------------------------------*/
  1274.     /* Code Body                                                      */
  1275.     /*----------------------------------------------------------------*/
  1276.     if ((!isIncomingCall()) || (GetActiveScreenId() == SCR_CM_REQUESTINGUSSD))
  1277.     {
  1278.         RemoveSSReqScr();
  1279.         EntrySIMSwitchProcessResut();
  1280.     }
  1281.     else
  1282.     {
  1283.         HistoryReplace(SCR_CM_REQUESTINGUSSD, SCR_ID_CALLSET_GENERAL_SS_RESULT, EntrySIMSwitchProcessResut);
  1284.     }
  1285. }
  1286. void SIMSwitchForwardRsp(void *info)
  1287. {
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Local Variables                                                */
  1290.     /*----------------------------------------------------------------*/
  1291.     S8 short_string[45];
  1292.     U8 bs_index;
  1293.     S8 TempShortString[90];
  1294.     S8 TempBuff[250];
  1295.     S8 *TempBuff1;
  1296.     mmi_ss_call_forward_rsp_struct *pMsgFwdQueryrsp = (mmi_ss_call_forward_rsp_struct*) info;
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Code Body                                                      */
  1299.     /*----------------------------------------------------------------*/
  1300.     TempBuff1 = (S8*) OslMalloc(MAX_DISP_UCS2);
  1301.     memset(TempBuff1, 0, MAX_DISP_UCS2);                    
  1302.     DeleteScreenIfPresent(SCR_ID_CALLSET_FORWARD_OPTIONS);
  1303.     DeleteScreenIfPresent(SCR_ID_CALLSET_FORWARD_NUMBER);
  1304.     DeleteScreenIfPresent(SCR_ID_CALLSET_FORWARD_NO_ANS_TIME);
  1305.     if (pMsgFwdQueryrsp->result.flag == L4C_OK)
  1306.     {  
  1307.         pfnUnicodeStrcpy((PS8) TempBuff1, (PS8) GetString(STR_L4_CFNRC));
  1308.         if (pMsgFwdQueryrsp->count == 0)
  1309.         {
  1310.  unreachablestates = UNREACHABLE_OFF;
  1311.  pfnUnicodeStrcat((PS8) TempBuff1, (PS8) GetString(STR_DEACTIVATED));
  1312.         }
  1313.         for (bs_index = 0; bs_index < pMsgFwdQueryrsp->count; bs_index++)
  1314.         {
  1315.             memset(TempBuff, 0, sizeof(TempBuff));
  1316.             if (pMsgFwdQueryrsp->list[bs_index].ss_status & SS_ABIT)
  1317.             {
  1318.   unreachablestates = UNREACHABLE_ON;
  1319.   pfnUnicodeStrcat((PS8) TempBuff, (PS8) GetString(STR_ACTIVATED));
  1320.             }
  1321.             else if (pMsgFwdQueryrsp->opcode == SS_OP_INTERROGATESS)
  1322.             {
  1323.                 if (pMsgFwdQueryrsp->list[bs_index].ss_status & SS_PBIT)
  1324.                 {
  1325.  unreachablestates = UNREACHABLE_OFF;
  1326.  pfnUnicodeStrcat((PS8) TempBuff1, (PS8) GetString(STR_DEACTIVATED));
  1327.                 }
  1328.                 else
  1329.                 {
  1330.  unreachablestates = UNREACHABLE_NOT_PROVIDED;
  1331.  pfnUnicodeStrcat((PS8) TempBuff, (PS8) GetString(STR_NOT_PROVIDED));
  1332.                 }
  1333.             }
  1334.             else
  1335.             {
  1336. unreachablestates = UNREACHABLE_OFF;
  1337. pfnUnicodeStrcat((PS8) TempBuff1, (PS8) GetString(STR_DEACTIVATED));
  1338.             }
  1339. if (pMsgFwdQueryrsp->list[bs_index].no_reply_timer != 0)
  1340.              {
  1341.                 sprintf(short_string, "%d ", (U8) pMsgFwdQueryrsp->list[bs_index].no_reply_timer);
  1342.                 AnsiiToUnicodeString((PS8) TempShortString, (PS8) short_string);
  1343.                 pfnUnicodeStrcat((S8*) TempBuff, (S8*) TempShortString);
  1344.                 pfnUnicodeStrcat((PS8) TempBuff, (PS8) GetString(STR_SECONDS));
  1345.              }
  1346. AppendBScodeString(pMsgFwdQueryrsp->list[bs_index].bs_code, TempBuff);
  1347. memset(unreachable_num, 0, sizeof(unreachable_num));
  1348.             if (strlen(pMsgFwdQueryrsp->list[bs_index].address) != 0)
  1349.             {
  1350. memset(short_string, 0, sizeof(short_string));
  1351.                 memset(TempShortString, 0, sizeof(TempShortString));
  1352. strncpy((PS8) short_string, (PS8) pMsgFwdQueryrsp->list[bs_index].address, sizeof(short_string) - 5);
  1353. AnsiiToUnicodeString((PS8) unreachable_num, (PS8) short_string);
  1354. strcat((PS8) short_string, " ");
  1355.                    AnsiiToUnicodeString((PS8) TempShortString, (PS8) short_string);
  1356.                    pfnUnicodeStrcat((S8*) TempBuff, (S8*) TempShortString);
  1357.             }
  1358. if ((pfnUnicodeStrlen((PS8) TempBuff) + pfnUnicodeStrlen((PS8) TempBuff1))
  1359.                 < MAX_DISP_UCS2 / ENCODING_LENGTH)
  1360.             {
  1361.                 pfnUnicodeStrcat((S8*) TempBuff1, (S8*) TempBuff);
  1362.             }
  1363.         }
  1364. sprintf(short_string, "n");
  1365. AnsiiToUnicodeString((PS8) TempShortString, (PS8) short_string);
  1366. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) TempShortString); 
  1367. if (isSearchFinished == SEARCH_FAIL)
  1368. {
  1369.         switch (g_callset_context.SSCFCondQueryStage)
  1370.         {
  1371.             case CF_COND_STAGE_NONE:
  1372.    pfnUnicodeStrcpy((S8*) g_callset_context.SSDisplayBuffer, (S8*) TempBuff1);
  1373.                 DeleteScreenIfPresent(SCR_ID_CALLSET_GENERAL_SS_RESULT);
  1374.                 EntrySIMSwitchProcess();
  1375.                 break;
  1376.             case CF_COND_STAGE_UNREACH:
  1377.    pfnUnicodeStrcpy((S8*) g_callset_context.SSDisplayBuffer, (S8*) TempBuff1);
  1378.                 g_callset_context.SSCFType = FORWARD_ALLCOND;
  1379.                 EnterPhnSetUnReachableQueryReq();
  1380.                 break;
  1381.             default:
  1382.                 ASSERT(0);
  1383.                 break;
  1384.         }
  1385. }
  1386. if (TempBuff1 != NULL)
  1387. OslMfree(TempBuff1);
  1388. TempBuff1 = NULL;
  1389.     }
  1390.     else
  1391.     {
  1392.         ResetCFCondStage();
  1393.     #ifdef __MMI_SS_SHOW_CAUSE__
  1394.         ShowCauseString(pMsgFwdQueryrsp->result.cause, g_callset_context.SSDisplayBuffer);
  1395.         DeleteScreenIfPresent(SCR_ID_CALLSET_GENERAL_SS_RESULT);
  1396.         EntrySIMSwitchProcess();
  1397.     #else /* __MMI_SS_SHOW_CAUSE__ */ 
  1398.         DisplayPopup((PU8) GetString(STR_GLOBAL_NOT_DONE), IMG_GLOBAL_UNFINISHED, 0, CS_NOTIFYDURATION, ERROR_TONE);
  1399.         RemoveSSReqScr();
  1400. if (TempBuff1 != NULL)
  1401. OslMfree(TempBuff1);
  1402. TempBuff1 = NULL;
  1403. MakeSetTimerSIMSwitch();
  1404.     #endif /* __MMI_SS_SHOW_CAUSE__ */ 
  1405.     }
  1406. }
  1407. void EnterPhnSetUnReachableOnReq(void)
  1408. {
  1409. /*----------------------------------------------------------------*/
  1410. /* Local Variables                                                */
  1411. /*----------------------------------------------------------------*/
  1412. S8 input_string[MAX_DIGITS_USSD * ENCODING_LENGTH];
  1413. S8 string_code[50];
  1414. PS8 hash_string = NULL;
  1415. U8 i;
  1416. S16 Error;
  1417. U8  SIM1Num[SIM_NUM_LENGTH];
  1418. U8  SIM2Num[SIM_NUM_LENGTH];
  1419. /*----------------------------------------------------------------*/
  1420. /* Code Body                                                      */
  1421. /*----------------------------------------------------------------*/
  1422. // Read NVRAM SIM1 and SIM2 Number
  1423. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1424. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1425. AnsiiToUnicodeString((S8*)unicode_buf1, (S8*)SIM1Num);
  1426. AnsiiToUnicodeString((S8*)unicode_buf2, (S8*)SIM2Num);
  1427. memset(g_callset_context.SSCFNum, 0, (MAX_CC_ADDR_LEN *ENCODING_LENGTH) + 2);
  1428. if(g_phnset_cntx.SIMID == SIM1)
  1429. {
  1430. pfnUnicodeStrcpy((S8*)(g_callset_context.SSCFNum), (S8*)unicode_buf2);
  1431. }
  1432. else if (g_phnset_cntx.SIMID == SIM2)
  1433. {
  1434. pfnUnicodeStrcpy((S8*)(g_callset_context.SSCFNum), (S8*)unicode_buf1);
  1435. }
  1436.     for (i = 0; i < pfnUnicodeStrlen((S8*) g_callset_context.SSCFNum); i++)
  1437.     {
  1438.         if ((g_callset_context.SSCFNum[i * 2] == 'p') || (g_callset_context.SSCFNum[i * 2] == 'w'))
  1439.         {
  1440. DisplayPopup((PU8) GetString(STR_GLOBAL_NOT_DONE), IMG_GLOBAL_UNFINISHED, 0, CS_NOTIFYDURATION, ERROR_TONE);
  1441. return;
  1442.         }
  1443.     }
  1444.     /* format the string for the ss string handling */
  1445.     memset(input_string, 0, (MAX_DIGITS_USSD * ENCODING_LENGTH));
  1446.     memset(string_code, 0, 50);
  1447.     hash_string = (PS8) GetString(STR_SIM_SWITCH_HASH_VALUE);
  1448.     strcpy((S8*) string_code, "**62*");
  1449.     AnsiiToUnicodeString((PS8) input_string, (PS8) string_code);
  1450.     pfnUnicodeStrcat((PS8) input_string, (PS8) g_callset_context.SSCFNum);
  1451.     pfnUnicodeStrcat((PS8) input_string, (PS8) hash_string);
  1452.     /* set protocol event handler for the call fwd response */
  1453.     SetProtocolEventHandler(SIMSwitchForwardRsp, PRT_MMI_SS_CALL_FORWARD_RSP);
  1454.     /* make a corresponding ss string for call fwd option */
  1455.     MakeCall((PS8) input_string);
  1456.     return;
  1457. }
  1458. void EnterPhnSetUnReachableOffReq(void)
  1459. {
  1460.     /*----------------------------------------------------------------*/
  1461.     /* Local Variables                                                */
  1462.     /*----------------------------------------------------------------*/
  1463.     S8 input_string[MAX_DIGITS_USSD * ENCODING_LENGTH];
  1464.     S8 string_out[20];
  1465.     /*----------------------------------------------------------------*/
  1466.     /* Code Body                                                      */
  1467.     /*----------------------------------------------------------------*/
  1468.     //micha1229
  1469.     //      PS8 hash_string = NULL ;
  1470.     /* format the string for the ss string handling */
  1471.     memset(input_string, 0, (MAX_DIGITS_USSD * ENCODING_LENGTH));
  1472.     memset(string_out, 0, 20);
  1473.     /* hash_string = (PS8) GetString(STR_HASH_VALUE); */
  1474.     strcpy((S8*) string_out, "##62#");
  1475.     AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1476.     /* set protocol event handler for the call fwd response */
  1477.     SetProtocolEventHandler(SIMSwitchForwardRsp, PRT_MMI_SS_CALL_FORWARD_RSP);
  1478.     /* make a corresponding ss string for call fwd option */
  1479.     MakeCall((PS8) input_string);
  1480.     return;
  1481. }
  1482. void EnterPhnSetUnReachableQueryReq(void)
  1483. {
  1484.     /*----------------------------------------------------------------*/
  1485.     /* Local Variables                                                */
  1486.     /*----------------------------------------------------------------*/
  1487.     S8 input_string[MAX_DIGITS_USSD * ENCODING_LENGTH];
  1488.     S8 string_out[20];
  1489.     /*----------------------------------------------------------------*/
  1490.     /* Code Body                                                      */
  1491.     /*----------------------------------------------------------------*/
  1492.     //micha1229
  1493.     //      PS8 hash_string = NULL ;
  1494.     /* format the string for the ss string handling */
  1495.     memset(input_string, 0, (MAX_DIGITS_USSD * ENCODING_LENGTH));
  1496.     memset(string_out, 0, 20);
  1497.     /* hash_string = (PS8) GetString(STR_HASH_VALUE); */
  1498.     switch (g_callset_context.SSCFType)
  1499.     {
  1500.             /* if the menu item is selected is voice call fwd when un reachable */
  1501.         case FORWARD_UNREACHABLE:
  1502.             strcpy((S8*) string_out, "*#62#");
  1503.             AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1504.             break;
  1505.             /* if the menu item is selected is voice call fwd when no answer */
  1506.         case FORWARD_NOANSWER:
  1507.             strcpy((S8*) string_out, "*#61#");
  1508.             AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1509.             break;
  1510.             /* if the menu item is selected is voice call fwd when all conditional */
  1511.         case FORWARD_BUSY:
  1512.             strcpy((S8*) string_out, "*#67#");
  1513.             AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1514.             break;
  1515.             /* if the menu item is selected all voice call fwd */
  1516.         case FORWARD_ALLCOND:
  1517.             switch (g_callset_context.SSCFCondQueryStage)
  1518.             {
  1519.                 case CF_COND_STAGE_NONE:
  1520.                     g_callset_context.SSCFCondQueryStage = CF_COND_STAGE_UNREACH;            
  1521.                     strcpy((S8*) string_out, "*#62#");
  1522.                     AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1523.                     break;
  1524.                 case CF_COND_STAGE_UNREACH:
  1525.                     g_callset_context.SSCFCondQueryStage = CF_COND_STAGE_NOANS;            
  1526.                     strcpy((S8*) string_out, "*#61#");
  1527.                     AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1528.                     break;
  1529.                 case CF_COND_STAGE_NOANS:
  1530.                     g_callset_context.SSCFCondQueryStage = CF_COND_STAGE_BUSY;            
  1531.                     strcpy((S8*) string_out, "*#67#");
  1532.                     AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1533.                     break;
  1534.                 default:
  1535.                     ASSERT(0);
  1536.                     break;
  1537.             }
  1538.             break;
  1539.             /* if the menu item is selected is voice call fwd when busy */
  1540.         case FORWARD_ALLVOICE:
  1541.             strcpy((S8*) string_out, "*#21**11#");
  1542.             AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1543.             break;
  1544.             /* if the menu item is selected is data call fwd */
  1545.         case FORWARD_DATA:
  1546.             strcpy((S8*) string_out, "*#21**20#");
  1547.             AnsiiToUnicodeString((PS8) input_string, (PS8) string_out);
  1548.             break;
  1549.     }
  1550.     /* set protocol event handler for the call fwd response */
  1551.     SetProtocolEventHandler(SIMSwitchForwardRsp, PRT_MMI_SS_CALL_FORWARD_RSP);
  1552.     /* make a corresponding ss string for call fwd option */
  1553.     MakeCall((PS8) input_string);
  1554.     return;
  1555. }
  1556. void MakeSIMSwitchConfirmOff(void)
  1557. {
  1558. /*----------------------------------------------------------------*/
  1559. /* Local Variables                                                */
  1560. /*----------------------------------------------------------------*/
  1561. /*----------------------------------------------------------------*/
  1562. /* Code Body                                                      */
  1563. /*----------------------------------------------------------------*/
  1564. EnterPhnSetUnReachableOffReq();
  1565. MakeSetTimerSIMSwitch();
  1566. }
  1567. /**************************************************************
  1568. FUNCTION NAME : MakeAutoUnReachableSel(void)
  1569.    PURPOSE : Handler Select Auto UnReachable ON/OFF.
  1570. INPUT PARAMETERS : nil
  1571. OUTPUT PARAMETERS : nil
  1572. RETURNS : void
  1573. REMARKS : NA
  1574. **************************************************************/
  1575. void MakeAutoUnReachableSel(void)
  1576. {
  1577. /*----------------------------------------------------------------*/
  1578. /* Local Variables                                                */
  1579. /*----------------------------------------------------------------*/
  1580. S16 error;
  1581. /*----------------------------------------------------------------*/
  1582. /* Code Body                                                      */
  1583. /*----------------------------------------------------------------*/
  1584. if (g_phnset_cntx.AutoUnReachableStates > AUTO_UNREACHABLE_ON ||  g_phnset_cntx.AutoUnReachableStates < AUTO_UNREACHABLE_OFF)
  1585. {
  1586. ReadValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  1587. }
  1588. if (g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_OFF)
  1589. {
  1590. g_phnset_cntx.AutoUnReachableStates = AUTO_UNREACHABLE_ON;
  1591. WriteValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  1592. pfnUnicodeStrcpy((S8*)hintData[1],(PS8)GetString(STR_GLOBAL_ON));
  1593. Category52ChangeItemDescription(1, (U8*) GetString(STR_GLOBAL_ON));
  1594.       ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  1595. }
  1596. else if (g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_ON)
  1597. {
  1598. g_phnset_cntx.AutoUnReachableStates = AUTO_UNREACHABLE_OFF;
  1599. WriteValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  1600. pfnUnicodeStrcpy((S8*)hintData[1],(PS8)GetString(STR_GLOBAL_OFF));
  1601. Category52ChangeItemDescription(1, (U8*) GetString(STR_GLOBAL_OFF));
  1602. ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  1603. }
  1604. RedrawCategoryFunction();
  1605. }
  1606. /**************************************************************
  1607. FUNCTION NAME : MakeSIMSwitchSel(void)
  1608.    PURPOSE : Handler SIM Switch.
  1609. INPUT PARAMETERS : nil
  1610. OUTPUT PARAMETERS : nil
  1611. RETURNS : void
  1612. REMARKS : NA
  1613. **************************************************************/
  1614. void MakeSIMSwitchSel(void )
  1615. {
  1616. /*----------------------------------------------------------------*/
  1617. /* Local Variables                                                */
  1618. /*----------------------------------------------------------------*/
  1619. S16 Error;
  1620. S16 SIM1Num[SIM_NUM_LENGTH];
  1621. S16 SIM2Num[SIM_NUM_LENGTH];
  1622. /*----------------------------------------------------------------*/
  1623. /* Code Body                                                      */
  1624. /*----------------------------------------------------------------*/
  1625. memset(unicode_buf1, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1626. memset(unicode_buf2, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1627. memset(SIM1Num, 0, SIM_NUM_LENGTH);
  1628. memset(SIM2Num, 0, SIM_NUM_LENGTH);
  1629. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1630. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1631. AnsiiToUnicodeString((S8*)unicode_buf1, (S8*)SIM1Num);
  1632. AnsiiToUnicodeString((S8*)unicode_buf2, (S8*)SIM2Num);
  1633. if (!pfnUnicodeStrlen((const S8*)unicode_buf1) ||  !pfnUnicodeStrlen((const S8*)unicode_buf2))
  1634. {
  1635. // Hint User input all data
  1636. StopTimer(POPUP_TIMER);
  1637. DisplayPopup((PU8)GetString(STR_SIM_SWITCH_SETTING_SIM_NUM), IMG_GLOBAL_WARNING, MMI_TRUE, UI_POPUP_NOTIFYDURATION_TIME, WARNING_TONE);
  1638. ClearAllKeyHandler();
  1639. StartTimer(POPUP_TIMER, UI_POPUP_NOTIFYDURATION_TIME, mmi_phnset_entry_sim_num_edit);
  1640. return;
  1641. }
  1642. else if (!pfnUnicodeStrcmp((const S8*)unicode_buf1,(const S8*)unicode_buf2))
  1643. {
  1644. // SIM1 And SIM2 number can not equal
  1645. StopTimer(POPUP_TIMER);
  1646. DisplayPopup((PU8)GetString(STR_SIM_SWITCH_ERROR_SAME_NUM), IMG_GLOBAL_WARNING, MMI_TRUE, UI_POPUP_NOTIFYDURATION_TIME, WARNING_TONE);
  1647. ClearAllKeyHandler();
  1648. StartTimer(POPUP_TIMER, UI_POPUP_NOTIFYDURATION_TIME, mmi_phnset_entry_sim_num_edit);
  1649. return;
  1650. }
  1651. isSearchFinished = SEARCH_FAIL;
  1652. g_callset_context.SSCFType = FORWARD_UNREACHABLE;
  1653. EnterPhnSetUnReachableQueryReq();
  1654. }
  1655. void SIMSwitchAndResetRequest(void)
  1656. {
  1657. #if !defined(__MTK_TARGET__)
  1658. S8 str_buf[] = "Press Yes to restore and shutdown";
  1659. UI_string_type unicode_buf[sizeof(str_buf)];
  1660. AnsiiToUnicodeString((PS8)unicode_buf, (PS8)str_buf);
  1661. DisplayConfirm(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1662.     STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1663.     (PU16)unicode_buf,IMG_GLOBAL_QUESTION, WARNING_TONE);
  1664. #else
  1665. DisplayConfirm(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1666.     STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1667.     (PU16)GetString(STR_SETTING_SIM_SWITCH_CONFIRM),IMG_GLOBAL_QUESTION, WARNING_TONE);
  1668. #endif
  1669. /* Register function with left/right softkey */
  1670. SetRightSoftkeyFunction(GoBackSIMSwitchScreen,KEY_EVENT_UP);
  1671. SetLeftSoftkeyFunction(SIMSwitchAndReset,KEY_EVENT_UP);
  1672. }
  1673. static void SIMSwitchRequestRacDetach()
  1674. {
  1675. #ifdef MMI_ON_HARDWARE_P
  1676.     /*----------------------------------------------------------------*/
  1677.     /* Local Variables                                                */
  1678.     /*----------------------------------------------------------------*/
  1679.     MYQUEUE Message;
  1680.     /*----------------------------------------------------------------*/
  1681.     /* Code Body                                                      */
  1682.     /*----------------------------------------------------------------*/
  1683.     Message.oslSrcId = MOD_MMI;
  1684.     Message.oslDestId = MOD_L4C;
  1685.     Message.oslMsgId = MSG_ID_MMI_NW_PWROFF_DETACH_REQ;
  1686.     Message.oslDataPtr = (oslParaType*) NULL;
  1687.     Message.oslPeerBuffPtr = NULL;
  1688.     OslMsgSendExtQueue(&Message);
  1689. #endif /* MMI_ON_HARDWARE_P */ 
  1690. }
  1691. void SIMSwitchAndReset(void)
  1692. {
  1693. S16 error;
  1694. if(g_phnset_cntx.SIMID == 0)
  1695. {
  1696. g_phnset_cntx.SIMID = 1;
  1697. }
  1698. else
  1699. {
  1700. g_phnset_cntx.SIMID = 0;
  1701. }
  1702. WriteValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &error);
  1703. SIMSwitchRequestRacDetach();
  1704. kal_sleep_task(200);     /*  sleep for 200 ticks, about 1s */
  1705. AlmATPowerReset(MMI_FALSE, 10); // shutdown system and reboot in 10 seconds.
  1706. }
  1707. void LoadandSetSIMID(void)
  1708. {
  1709.   #ifdef MMI_ON_HARDWARE_P
  1710. S16 error;
  1711. ReadValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &error);
  1712. if(g_phnset_cntx.SIMID<0 || g_phnset_cntx.SIMID>1)
  1713. {
  1714. g_phnset_cntx.SIMID = 0;
  1715. WriteValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &error);
  1716. }
  1717.    
  1718. if(g_phnset_cntx.SIMID == 0)
  1719. {
  1720. GPIO_InitIO(1, SIM_SWITCH_PIN);
  1721. GPIO_ModeSetup(SIM_SWITCH_PIN, 0);
  1722. GPIO_WriteIO(1, SIM_SWITCH_PIN);
  1723. }
  1724. else
  1725. {
  1726. GPIO_InitIO(1, SIM_SWITCH_PIN);
  1727. GPIO_ModeSetup(SIM_SWITCH_PIN, 0);
  1728. GPIO_WriteIO(0, SIM_SWITCH_PIN);
  1729. }
  1730. #endif/*MMI_ON_HARDWARE_P*/
  1731. }
  1732. /**************************************************************
  1733. FUNCTION NAME : LoadSIMSwitchAllData(void)
  1734.    PURPOSE : Init data.
  1735. INPUT PARAMETERS : nil
  1736. OUTPUT PARAMETERS : nil
  1737. RETURNS : void
  1738. REMARKS : NA
  1739. **************************************************************/
  1740. void LoadSIMSwitchAllData(void)
  1741. {
  1742. /*----------------------------------------------------------------*/
  1743. /* Local Variables                                                */
  1744. /*----------------------------------------------------------------*/
  1745. S16 Error;
  1746. S16 SIM1Num[SIM_NUM_LENGTH];
  1747. S16 SIM2Num[SIM_NUM_LENGTH];
  1748. /*----------------------------------------------------------------*/
  1749. /* Code Body                                                      */
  1750. /*----------------------------------------------------------------*/
  1751. memset(SIM1Num, 0, SIM_NUM_LENGTH);
  1752. memset(SIM2Num, 0, SIM_NUM_LENGTH);
  1753. LoadandSetSIMID();
  1754. ReadValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &Error);
  1755. if (g_phnset_cntx.AutoUnReachableStates < AUTO_UNREACHABLE_OFF || g_phnset_cntx.AutoUnReachableStates > AUTO_UNREACHABLE_ON)
  1756. {
  1757. g_phnset_cntx.AutoUnReachableStates = AUTO_UNREACHABLE_ON;
  1758. WriteValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &Error);
  1759. WriteRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1760. WriteRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1761. }
  1762. }
  1763. /**************************************************************
  1764. FUNCTION NAME : mmi_phnset_entry_sim_switch(void)
  1765.    PURPOSE : handler Entry SIM Switch Edit Screen.
  1766. INPUT PARAMETERS : nil
  1767. OUTPUT PARAMETERS : nil
  1768. RETURNS : void
  1769. REMARKS : NA
  1770. **************************************************************/
  1771. void mmi_phnset_entry_sim_switch(void)
  1772. {
  1773.     /*----------------------------------------------------------------*/
  1774.     /* Local Variables                                                */
  1775.     /*----------------------------------------------------------------*/
  1776.     U16 nStrItemList[3];    /* Stores the strings id of submenus returned */
  1777.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  1778.     U8 *guiBuffer;  /* Buffer holding history data */
  1779.     U8 index;
  1780.     U8 *popUpList[MAX_SUB_MENUS];
  1781.     /*----------------------------------------------------------------*/
  1782.     /* Code Body                                                      */
  1783.     /*----------------------------------------------------------------*/
  1784.     EntryNewScreen(SCR_ID_PHNSET_SIM_SWITCH, NULL, mmi_phnset_entry_sim_switch, NULL);
  1785.     guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_SIM_SWITCH);
  1786.     nNumofItem = GetNumOfChild(MENU_SIM_SWCH);
  1787.     GetSequenceStringIds(MENU_SIM_SWCH, nStrItemList);
  1788.     SetParentHandler(MENU_SIM_SWCH);
  1789.     ConstructHintsList(MENU_SIM_SWCH, popUpList);
  1790.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1791.     ShowCategory52Screen(
  1792.         STR_SIM_SWITCH,
  1793.         MAIN_MENU_TITLE_SETTINGS_ICON,
  1794.         STR_GLOBAL_OK,
  1795.         IMG_GLOBAL_OK,
  1796.         STR_GLOBAL_BACK,
  1797.         IMG_GLOBAL_BACK,
  1798.         nNumofItem,
  1799.         nStrItemList,
  1800.         (U16*) gIndexIconsImageList,
  1801.         (U8 **) popUpList,
  1802.         LIST_MENU,
  1803.         0,
  1804.         guiBuffer);
  1805.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1806. }
  1807. /**************************************************************
  1808. FUNCTION NAME : mmi_phnset_sim_switch_write_to_nvram(void)
  1809.    PURPOSE : handler Save Number of SIM1 and SIM2 Card to NVRAM.
  1810. INPUT PARAMETERS : nil
  1811. OUTPUT PARAMETERS : nil
  1812. RETURNS : void
  1813. REMARKS : NA
  1814. **************************************************************/
  1815. void mmi_phnset_sim_switch_save_to_nvram(void)
  1816. {
  1817. /*----------------------------------------------------------------*/
  1818. /* Local Variables                                                */
  1819. /*----------------------------------------------------------------*/
  1820. S8   i;
  1821. S16 Error;
  1822. S16 SIM1Num[SIM_NUM_LENGTH];
  1823. S16 SIM2Num[SIM_NUM_LENGTH];
  1824. /*----------------------------------------------------------------*/
  1825. /* Code Body                                                      */
  1826. /*----------------------------------------------------------------*/
  1827. memset(SIM1Num, 0, SIM_NUM_LENGTH);
  1828. memset(SIM2Num, 0, SIM_NUM_LENGTH);
  1829. UnicodeToAnsii((S8*)SIM1Num, (S8*)unicode_buf1);
  1830.      UnicodeToAnsii((S8*)SIM2Num, (S8*)unicode_buf2);
  1831. for (i = 0; i < pfnUnicodeStrlen((const S8*) unicode_buf1); i++)
  1832. {
  1833. if ((unicode_buf1[i * 2] == 'p') || (unicode_buf1[i * 2] == 'w'))
  1834. {
  1835. ClearAllKeyHandler();
  1836. DisplayPopup((PU8) GetString(STR_SIM_SWITCH_ERROR_CHAR), IMG_GLOBAL_ERROR, MMI_TRUE, CS_NOTIFYDURATION, ERROR_TONE);
  1837. return;
  1838. }
  1839. }
  1840. for (i = 0; i < pfnUnicodeStrlen((const S8*) unicode_buf2); i++)
  1841. {
  1842. if ((unicode_buf2[i * 2] == 'p') || (unicode_buf2[i * 2] == 'w'))
  1843. {
  1844. ClearAllKeyHandler();
  1845. DisplayPopup((PU8) GetString(STR_SIM_SWITCH_ERROR_CHAR), IMG_GLOBAL_ERROR, MMI_TRUE, CS_NOTIFYDURATION, ERROR_TONE);
  1846. return;
  1847. }
  1848. }
  1849. WriteRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1850. WriteRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1851. GoBackSIMSwitchScreen();
  1852. }
  1853. /**************************************************************
  1854. FUNCTION NAME : mmi_phnset_sim_switch_write_to_nvram(void)
  1855.    PURPOSE : handler Judged is or not Save Number of SIM1 and SIM2 Card to NVRAM.
  1856. INPUT PARAMETERS : nil
  1857. OUTPUT PARAMETERS : nil
  1858. RETURNS : void
  1859. REMARKS : NA
  1860. **************************************************************/
  1861. void mmi_phnset_sim_switch_write_to_nvram(void)
  1862. {
  1863. /*----------------------------------------------------------------*/
  1864. /* Local Variables                                                */
  1865. /*----------------------------------------------------------------*/
  1866. /*----------------------------------------------------------------*/
  1867. /* Code Body                                                      */
  1868. /*----------------------------------------------------------------*/
  1869. DisplayConfirm(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1870.     STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1871.     (PU16)GetString(STR_GLOBAL_SAVE),IMG_GLOBAL_QUESTION, WARNING_TONE);
  1872. SetLeftSoftkeyFunction(mmi_phnset_sim_switch_save_to_nvram,KEY_EVENT_UP);
  1873. SetRightSoftkeyFunction(GoBackSIMSwitchScreen,KEY_EVENT_UP);
  1874. }
  1875. void mmi_phbset_sim_switch_off_confirm(void)
  1876. {
  1877. /*----------------------------------------------------------------*/
  1878. /* Local Variables                                                */
  1879. /*----------------------------------------------------------------*/
  1880. S8 *TempBuff1;
  1881. S8 short_string[2];
  1882. S8 TempShortString[2];
  1883. /*----------------------------------------------------------------*/
  1884. /* Code Body                                                      */
  1885. /*----------------------------------------------------------------*/
  1886. TempBuff1 = (S8*) OslMalloc(MAX_DISP_UCS2);
  1887. memset(TempBuff1, 0, MAX_DISP_UCS2); 
  1888. memset(short_string, 0, 2); 
  1889. memset(TempShortString, 0, 2); 
  1890. pfnUnicodeStrcpy((PS8) TempBuff1, (PS8) GetString(STR_L4_CFNRC));
  1891. sprintf(short_string, "n");
  1892. AnsiiToUnicodeString((PS8) TempShortString, (PS8) short_string);
  1893. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) TempShortString); 
  1894. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) unreachable_num);
  1895. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) TempShortString); 
  1896. pfnUnicodeStrcat((S8*) TempBuff1, (S8*) GetString(STR_SIM_SWITCH_SHUT_DOWN));
  1897. DisplayConfirm(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1898.     STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1899.     (PU16) TempBuff1,IMG_GLOBAL_QUESTION, WARNING_TONE);
  1900. OslMfree(TempBuff1);
  1901. /* Register function with left/right softkey */
  1902. SetLeftSoftkeyFunction(MakeSIMSwitchConfirmOff,KEY_EVENT_UP);
  1903. SetRightSoftkeyFunction(MakeSIMSwitch,KEY_EVENT_UP);
  1904. }
  1905. void ExitSIMNumEditScreen(void)
  1906. {
  1907.     /*----------------------------------------------------------------*/
  1908.     /* Local Variables                                                */
  1909.     /*----------------------------------------------------------------*/
  1910.     /*----------------------------------------------------------------*/
  1911.     /* Code Body                                                      */
  1912.     /*----------------------------------------------------------------*/
  1913.     MMI_current_input_ext_type &= ~INPUT_TYPE_EXT_SIM_NUMERIC;          //KP Jerry add for enable "p, w" button when exit from current screen on 2007-4-3
  1914.     CloseCategory57Screen();
  1915. }
  1916. void mmi_phnset_sim_num_edit_highlighthandler(S32 index)
  1917. {
  1918. switch(index)
  1919. {
  1920. case 0:
  1921. ChangeTitle(0, (PU8) GetString(STR_SIM_SWITCH_SIM1_NUM));
  1922. break;
  1923. case 1:
  1924. ChangeTitle(0, (PU8) GetString(STR_SIM_SWITCH_SIM2_NUM));
  1925. break;
  1926. default:
  1927. break;
  1928. }
  1929. draw_title();
  1930. }
  1931. /**************************************************************
  1932. FUNCTION NAME : mmi_phnset_entry_sim_num_edit(void)
  1933.    PURPOSE : handler Edit for Number of SIM1 and SIM2 Card 
  1934. INPUT PARAMETERS : nil
  1935. OUTPUT PARAMETERS : nil
  1936. RETURNS : void
  1937. REMARKS : NA
  1938. **************************************************************/
  1939. extern void StarKeyHandler (void);     //KP Jerry add for modify '*' multitap candidate to '+' only on 2007-4-3
  1940. void HashKeyHandler(void)
  1941. {
  1942. }
  1943. void mmi_phnset_entry_sim_num_edit(void)
  1944. {
  1945. /*----------------------------------------------------------------*/
  1946. /* Local Variables                                                */
  1947. /*----------------------------------------------------------------*/
  1948. U8 *guiBuffer;  /* Buffer holding history data */
  1949. U16 ImageList[2];
  1950. S16 Error;
  1951. S16 SIM1Num[SIM_NUM_LENGTH];
  1952. S16 SIM2Num[SIM_NUM_LENGTH];
  1953. /*----------------------------------------------------------------*/
  1954. /* Code Body                                                      */
  1955. /*----------------------------------------------------------------*/
  1956. EntryNewScreen(SCR_ID_PHNSET_SIM_NUM_EDIT, ExitSIMNumEditScreen, mmi_phnset_entry_sim_num_edit, NULL);
  1957. InitializeCategory57Screen();
  1958. #ifdef MMI_ON_HARDWARE_P
  1959. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1960. EnableInlineItemDefaultText();
  1961. #endif
  1962. #endif 
  1963. RegisterHighlightHandler(mmi_phnset_sim_num_edit_highlighthandler);
  1964. guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_SIM_NUM_EDIT);
  1965. memset(unicode_buf1, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1966. memset(unicode_buf2, 0, SIM_NUM_LENGTH*ENCODING_LENGTH);
  1967. memset(SIM1Num, 0, SIM_NUM_LENGTH);
  1968. memset(SIM2Num, 0, SIM_NUM_LENGTH);
  1969. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 1, SIM1Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1970. ReadRecord(NVRAM_EF_SIM_SWITCH_LID, 2, SIM2Num, NVRAM_EF_SIM_SWITCH_SIZE, &Error);
  1971. AnsiiToUnicodeString((S8*)unicode_buf1, (S8*)SIM1Num);
  1972. AnsiiToUnicodeString((S8*)unicode_buf2, (S8*)SIM2Num);
  1973. MMI_current_input_ext_type |= INPUT_TYPE_EXT_SIM_NUMERIC;     //KP Jerry add for disable "p, w" button on 2007-4-3
  1974.        
  1975. SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1976. SetInlineItemTextEdit(&wgui_inline_items[0], (PU8)unicode_buf1, SIM_NUM_LENGTH, INPUT_TYPE_PHONE_NUMBER);
  1977. ImageList[0] = IMG_GLOBAL_L1;
  1978. SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1979. SetInlineItemTextEdit(&wgui_inline_items[1], (PU8)unicode_buf2, SIM_NUM_LENGTH, INPUT_TYPE_PHONE_NUMBER);
  1980. ImageList[1] = IMG_GLOBAL_L2;
  1981. /*
  1982. #ifdef MMI_ON_HARDWARE_P
  1983. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1984. SetInlineItemTextEditDefaultItemNameIfEmpty(&wgui_inline_items[0], (U16)STR_SSW_SIM1);
  1985. SetInlineItemTextEditDefaultItemNameIfEmpty(&wgui_inline_items[1], (U16)STR_SSW_SIM2);
  1986. #endif 
  1987. #endif
  1988. */
  1989. DisableCategory57ScreenDone();
  1990. ShowCategory57Screen(STR_SIM_SWITCH, 0, 
  1991.                      STR_GLOBAL_OK, 
  1992.                      IMG_GLOBAL_OK, 
  1993.                      STR_GLOBAL_BACK, 
  1994.                      IMG_GLOBAL_BACK,
  1995.                      2, ImageList, wgui_inline_items, 0, guiBuffer);
  1996. SetCategory57RightSoftkeyFunctions( mmi_phnset_sim_switch_write_to_nvram, GoBackHistory );
  1997. }
  1998. void HintSwitching(U16 index)
  1999. {
  2000. S16 error;
  2001. memset((S8 *)hintData[(index)],0,MAX_SUB_MENU_SIZE);
  2002. if(g_phnset_cntx.SIMID<0 || g_phnset_cntx.SIMID>1)
  2003. {
  2004. ReadValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &error);
  2005. }
  2006. if(g_phnset_cntx.SIMID == SIM1)
  2007. {
  2008. pfnUnicodeStrcpy((S8*)g_phnset_cntx.SIMInfo, ( S8*)GetString(STR_SSW_SIM1));
  2009. }
  2010. else if(g_phnset_cntx.SIMID == SIM2)
  2011. {
  2012. pfnUnicodeStrcpy((S8*)g_phnset_cntx.SIMInfo, ( S8*)GetString(STR_SSW_SIM2));
  2013. }
  2014. pfnUnicodeStrcpy((S8*)hintData[index],(PS8)g_phnset_cntx.SIMInfo);
  2015. }
  2016. void HintSIMSwitch(U16 index)
  2017. {
  2018. S16 error;
  2019. memset((S8 *)hintData[(index)],0,MAX_SUB_MENU_SIZE);
  2020. if(g_phnset_cntx.SIMID<0 || g_phnset_cntx.SIMID>1)
  2021. {
  2022. ReadValue( NVRAM_SIM_ID, &(g_phnset_cntx.SIMID), DS_BYTE , &error);
  2023. }
  2024. if(g_phnset_cntx.SIMID == SIM1)
  2025. {
  2026. pfnUnicodeStrcpy((S8*)g_phnset_cntx.SIMInfo, ( S8*)GetString(STR_SSW_SIM1));
  2027. }
  2028. else if(g_phnset_cntx.SIMID == SIM2)
  2029. {
  2030. pfnUnicodeStrcpy((S8*)g_phnset_cntx.SIMInfo, ( S8*)GetString(STR_SSW_SIM2));
  2031. }
  2032. pfnUnicodeStrcpy((S8*)hintData[index],(PS8)g_phnset_cntx.SIMInfo);
  2033. }
  2034. void HintUnReachable(U16 index)
  2035. {
  2036. S16 error;
  2037. memset((S8 *)hintData[(index)],0,MAX_SUB_MENU_SIZE);
  2038. if (g_phnset_cntx.AutoUnReachableStates > AUTO_UNREACHABLE_ON ||  g_phnset_cntx.AutoUnReachableStates < AUTO_UNREACHABLE_OFF)
  2039. {
  2040. ReadValue(NVRAM_SIM_SWITCH_ID, &(g_phnset_cntx.AutoUnReachableStates), DS_BYTE, &error);
  2041. }
  2042. if(g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_OFF)
  2043. {
  2044. pfnUnicodeStrcpy((S8*)hintData[index],(PS8)GetString(STR_GLOBAL_OFF));
  2045. }
  2046. else if(g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_ON)
  2047. {
  2048. pfnUnicodeStrcpy((S8*)hintData[index],(PS8)GetString(STR_GLOBAL_ON));
  2049. }
  2050. }
  2051. /**************************************************************
  2052. FUNCTION NAME : HighlightSIMNumEdit(void)
  2053.    PURPOSE : hilite handler Edit for Number of SIM1 and SIM2 Card 
  2054. INPUT PARAMETERS : nil
  2055. OUTPUT PARAMETERS : nil
  2056. RETURNS : void
  2057. REMARKS : NA
  2058. **************************************************************/
  2059. void HighlightSIMNumEdit(void)
  2060. {
  2061. ChangeLeftSoftkey(STR_GLOBAL_EDIT, 0);
  2062. SetLeftSoftkeyFunction(mmi_phnset_entry_sim_num_edit,KEY_EVENT_UP);
  2063. SetKeyHandler(mmi_phnset_entry_sim_num_edit, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2064. SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
  2065. /* set the left/right arrow key function handlers */
  2066. SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2067. return;
  2068. }
  2069. /**************************************************************
  2070. FUNCTION NAME : HighlightAutoUnReachableForward(void)
  2071.    PURPOSE : hilite handler for Auto UnReachable Forward On/Off
  2072. INPUT PARAMETERS : nil
  2073. OUTPUT PARAMETERS : nil
  2074. RETURNS : void
  2075. REMARKS : NA
  2076. **************************************************************/
  2077. void HighlightAutoUnReachableForward(void)
  2078. {
  2079. if(g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_OFF)
  2080. {
  2081. ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  2082. }
  2083. else if(g_phnset_cntx.AutoUnReachableStates == AUTO_UNREACHABLE_ON)
  2084. {
  2085. ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  2086. }
  2087. SetLeftSoftkeyFunction(MakeAutoUnReachableSel, KEY_EVENT_UP);
  2088. SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2089. }
  2090. /**************************************************************
  2091. FUNCTION NAME : HighlightSIMCardSwitch(void)
  2092.    PURPOSE : hilite handler for SIM Switch
  2093. INPUT PARAMETERS : nil
  2094. OUTPUT PARAMETERS : nil
  2095. RETURNS : void
  2096. REMARKS : NA
  2097. **************************************************************/
  2098. void HighlightSIMCardSwitch(void)
  2099. {
  2100. ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  2101. SetLeftSoftkeyFunction(MakeSIMSwitchSel, KEY_EVENT_UP);
  2102. SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2103. }
  2104. #ifdef __DUAL_SIM_QUICK_SWITCH__
  2105. /**************************************************************
  2106. FUNCTION NAME : HighlightSIMCardQuickSwitch(void)
  2107.    PURPOSE : hilite handler for SIM Switch
  2108. INPUT PARAMETERS : nil
  2109. OUTPUT PARAMETERS : nil
  2110. RETURNS : void
  2111. REMARKS : NA
  2112. **************************************************************/
  2113. void HighlightSIMCardQuickSwitch(void)
  2114. {
  2115. ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  2116. SetLeftSoftkeyFunction(SIMSwitchAndResetRequest, KEY_EVENT_UP);
  2117. SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2118. }
  2119. #endif
  2120. /**************************************************************
  2121. FUNCTION NAME : HighlightSIMSwitch(void)
  2122.    PURPOSE : hilite handler for SIM Switch Main Menu
  2123. INPUT PARAMETERS : nil
  2124. OUTPUT PARAMETERS : nil
  2125. RETURNS : void
  2126. REMARKS : NA
  2127. **************************************************************/
  2128. void HighlightSIMSwitch(void)
  2129. {
  2130. SetLeftSoftkeyFunction(mmi_phnset_entry_sim_switch,KEY_EVENT_UP);
  2131. SetKeyHandler(mmi_phnset_entry_sim_switch, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2132. SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
  2133. /* set the left/right arrow key function handlers */
  2134. SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2135. return;
  2136. }
  2137. #endif
  2138. //KP Jerry add on 2007-3-23 end
  2139. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  2140. /*****************************************************************************
  2141.  * FUNCTION
  2142.  *  mmi_phnset_2line_is_exist
  2143.  * DESCRIPTION
  2144.  *  To check the the existence of two line display
  2145.  * PARAMETERS
  2146.  *  void
  2147.  * RETURNS
  2148.  *  void
  2149.  *****************************************************************************/
  2150. S32 mmi_phnset_2line_is_exist(void)
  2151. {
  2152.     /*----------------------------------------------------------------*/
  2153.     /* Local Variables                                                */
  2154.     /*----------------------------------------------------------------*/
  2155.     /*----------------------------------------------------------------*/
  2156.     /* Code Body                                                      */
  2157.     /*----------------------------------------------------------------*/
  2158.     return is_inline_menu_exist;
  2159. }
  2160. /*****************************************************************************
  2161.  * FUNCTION
  2162.  *  mmi_phnset_2line_lang_get_data
  2163.  * DESCRIPTION
  2164.  *  This function is to get the language data for the two line item
  2165.  * PARAMETERS
  2166.  *  inline_item_index       [IN]        Index of the inline item to be shown
  2167.  *  str_buff                [IN]        Language to be shown
  2168.  *  img_buff_p              [?]         Image to be shown with the inline item
  2169.  * RETURNS
  2170.  *  void
  2171.  *****************************************************************************/
  2172. static void mmi_phnset_2line_lang_get_data(S32 inline_item_index, UI_string_type str_buff, PU8 *img_buff_p)
  2173. {
  2174. #ifdef __MMI_AUTO_LANG_EN__
  2175.     /*----------------------------------------------------------------*/
  2176.     /* Local Variables                                                */
  2177.     /*----------------------------------------------------------------*/
  2178.     /*----------------------------------------------------------------*/
  2179.     /* Code Body                                                      */
  2180.     /*----------------------------------------------------------------*/
  2181.     if (index == 0)
  2182.     {
  2183.         pfnUnicodeStrcpy((PS8) str_buff, (PS8) GetString(STR_LANGUAGESCR_AUTO));
  2184.     }
  2185.     else
  2186.     {
  2187.         pfnUnicodeStrcpy((PS8) str_buff, (PS8) g_phnset_cntx_p->ppLang[inline_item_index - 1]);
  2188.     }
  2189. #else /* __MMI_AUTO_LANG_EN__ */ 
  2190.     pfnUnicodeStrcpy((PS8) str_buff, (PS8) g_phnset_cntx_p->ppLang[inline_item_index]);
  2191. #endif /* __MMI_AUTO_LANG_EN__ */ 
  2192.     if (inline_item_index < IMG_GLOBAL_LEND - IMG_GLOBAL_LSTART - 1)
  2193.     {
  2194.         *img_buff_p = get_image((U16) (IMG_GLOBAL_LSTART + inline_item_index + 1));
  2195.     }
  2196.     else
  2197.     {
  2198.         *img_buff_p = NULL;
  2199.     }
  2200.     g_phnset_cntx_p->curHightlightItem = inline_item_index;
  2201.     languages_default_item = inline_item_index;
  2202. }
  2203. /*****************************************************************************
  2204.  * FUNCTION
  2205.  *  mmi_phnset_2line_encod_get_data
  2206.  * DESCRIPTION
  2207.  *  This function is to get the encoding type for the two line item
  2208.  * PARAMETERS
  2209.  *  inline_item_index       [IN]        Index of the inline item to be shown
  2210.  *  str_buff                [IN]        Encoding type string to be shown
  2211.  *  img_buff_p              [?]         Image to be shown with the inline item
  2212.  * RETURNS
  2213.  *  void
  2214.  *****************************************************************************/
  2215. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2216. static void mmi_phnset_2line_encod_get_data(S32 inline_item_index, UI_string_type str_buff, PU8 *img_buff_p)
  2217. {
  2218.     /*----------------------------------------------------------------*/
  2219.     /* Local Variables                                                */
  2220.     /*----------------------------------------------------------------*/
  2221.     /*----------------------------------------------------------------*/
  2222.     /* Code Body                                                      */
  2223.     /*----------------------------------------------------------------*/
  2224.     if (inline_item_index == encoding_type_big2)
  2225.     {
  2226.         pfnUnicodeStrcpy((PS8) str_buff, (PS8) GetString(STR_DEF_ENCODING_TYPE_BIG5));
  2227.     }
  2228.     else if (inline_item_index == encoding_type_gb2312)
  2229.     {
  2230.         pfnUnicodeStrcpy((PS8) str_buff, (PS8) GetString(STR_DEF_ENCODING_TYPE_GB2312));
  2231.     }
  2232.     else if (inline_item_index == encoding_type_ucs2)
  2233.     {
  2234.         pfnUnicodeStrcpy((PS8) str_buff, (PS8) GetString(STR_DEF_ENCODING_TYPE_UCS2));
  2235.     }
  2236.     if (inline_item_index < IMG_GLOBAL_LEND - IMG_GLOBAL_LSTART - 1)
  2237.     {
  2238.         *img_buff_p = get_image((U16) (IMG_GLOBAL_LSTART + inline_item_index + 1));
  2239.     }
  2240.     else
  2241.     {
  2242.         *img_buff_p = NULL;
  2243.     }
  2244.     g_phnset_cntx_p->curHightlightItem = inline_item_index;
  2245.     default_encoding_type = inline_item_index;
  2246. }
  2247. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  mmi_phnset_2line_read_setting
  2251.  * DESCRIPTION
  2252.  *  This function is to set the current values of the inline items
  2253.  * PARAMETERS
  2254.  *  void
  2255.  *  Input: None(?)
  2256.  * RETURNS
  2257.  *  void
  2258.  *****************************************************************************/
  2259. static void mmi_phnset_2line_read_setting()
  2260. {
  2261.     /*----------------------------------------------------------------*/
  2262.     /* Local Variables                                                */
  2263.     /*----------------------------------------------------------------*/
  2264.     /*----------------------------------------------------------------*/
  2265.     /* Code Body                                                      */
  2266.     /*----------------------------------------------------------------*/
  2267.     languages_default_item = gCurrLangIndex;
  2268. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2269.     default_encoding_type = g_phnset_cntx_p->EncodingType;
  2270. #endif 
  2271.     mmi_phnset_2line_prfr_input_set_default();
  2272. }
  2273. /*****************************************************************************
  2274.  * FUNCTION
  2275.  *  mmi_phnset_2line_lang_complete_callback
  2276.  * DESCRIPTION
  2277.  *  This function is called when language menu item is unhighlighted
  2278.  * PARAMETERS
  2279.  *  menuitem_index      [IN]        Menuitem index
  2280.  *  selected_index      [IN]        Inline item index
  2281.  * RETURNS
  2282.  *  void
  2283.  *****************************************************************************/
  2284. static void mmi_phnset_2line_lang_complete_callback(S32 menuitem_index, S32 selected_index)
  2285. {
  2286.     /*----------------------------------------------------------------*/
  2287.     /* Local Variables                                                */
  2288.     /*----------------------------------------------------------------*/
  2289.     /*----------------------------------------------------------------*/
  2290.     /* Code Body                                                      */
  2291.     /*----------------------------------------------------------------*/
  2292.     g_phnset_cntx_p->curHightlightItem = gCurrLangIndex;
  2293.     languages_default_item = gCurrLangIndex;
  2294. }
  2295. /*****************************************************************************
  2296.  * FUNCTION
  2297.  *  mmi_phnset_2line_encod_complete_callback
  2298.  * DESCRIPTION
  2299.  *  This function is called when encoding type menu item is unhighlighted
  2300.  * PARAMETERS
  2301.  *  menuitem_index      [IN]        Menuitem index
  2302.  *  selected_index      [IN]        Inline item index
  2303.  * RETURNS
  2304.  *  void
  2305.  *****************************************************************************/
  2306. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2307. static void mmi_phnset_2line_encod_complete_callback(S32 menuitem_index, S32 selected_index)
  2308. {
  2309.     /*----------------------------------------------------------------*/
  2310.     /* Local Variables                                                */
  2311.     /*----------------------------------------------------------------*/
  2312.     /*----------------------------------------------------------------*/
  2313.     /* Code Body                                                      */
  2314.     /*----------------------------------------------------------------*/
  2315.     default_encoding_type = g_phnset_cntx_p->EncodingType;
  2316. }
  2317. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  2318. /*****************************************************************************
  2319.  * FUNCTION
  2320.  *  mmi_phnset_2line_get_current
  2321.  * DESCRIPTION
  2322.  *  This function returns the default value to be shown with the two line menu item for phone setup
  2323.  * PARAMETERS
  2324.  *  item_index      [IN]        Menuitem index
  2325.  * RETURNS
  2326.  *  S32
  2327.  *****************************************************************************/
  2328. static S32 mmi_phnset_2line_get_current(S32 item_index)
  2329. {
  2330.     /*----------------------------------------------------------------*/
  2331.     /* Local Variables                                                */
  2332.     /*----------------------------------------------------------------*/
  2333.     S32 current_value = 0;
  2334.     /*----------------------------------------------------------------*/
  2335.     /* Code Body                                                      */
  2336.     /*----------------------------------------------------------------*/
  2337.     if (item_index == phone_setup_language)
  2338.     {
  2339.         current_value = (S32) gCurrLangIndex;
  2340.     }
  2341.     else if (item_index == phone_setup_preferred_input_method)
  2342.     {
  2343.         current_value = mmi_phnset_get_current_preferr_input();
  2344.     }
  2345. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2346.     else if (item_index == phone_setup_encoding_type)
  2347.     {
  2348.         current_value = (S32) g_phnset_cntx_p->EncodingType;
  2349.     }
  2350. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  2351.     else
  2352.     {
  2353.         return 0;
  2354.     }
  2355.     return current_value;
  2356. }
  2357. /*****************************************************************************
  2358.  * FUNCTION
  2359.  *  mmi_phnset_2line_select_data
  2360.  * DESCRIPTION
  2361.  *  This function used to get the two line menu item data for phone setup
  2362.  * PARAMETERS
  2363.  *  item_index              [IN]        Menuitem index
  2364.  *  inline_item_index       [IN]        Inline item index
  2365.  *  str_buff                [IN]        Inline Item String to be shown
  2366.  *  img_buff_p              [?]         Image to be shown with the inline item
  2367.  *  thumbnail               [?]         Thumbnail picture to be shown with the inline item
  2368.  * RETURNS
  2369.  *  pBOOL
  2370.  *****************************************************************************/
  2371. static pBOOL mmi_phnset_2line_select_data(
  2372.                 S32 item_index,
  2373.                 S32 inline_item_index,
  2374.                 UI_string_type str_buff,
  2375.                 PU8 *img_buff_p,
  2376.                 wgui_thumbnail_image_union *thumbnail)
  2377. {
  2378.     /*----------------------------------------------------------------*/
  2379.     /* Local Variables                                                */
  2380.     /*----------------------------------------------------------------*/
  2381.     /*----------------------------------------------------------------*/
  2382.     /* Code Body                                                      */
  2383.     /*----------------------------------------------------------------*/
  2384.     if (item_index == phone_setup_language)
  2385.     {
  2386.         mmi_phnset_2line_lang_get_data(inline_item_index, str_buff, img_buff_p);
  2387.     }
  2388.     else if (item_index == phone_setup_preferred_input_method)
  2389.     {
  2390.         mmi_phnset_2line_prfr_input_get_data(inline_item_index, str_buff, img_buff_p);
  2391.     }
  2392. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2393.     else if (item_index == phone_setup_encoding_type)
  2394.     {
  2395.         mmi_phnset_2line_encod_get_data(inline_item_index, str_buff, img_buff_p);
  2396.     }
  2397. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  2398.     else
  2399.     {
  2400.         return FALSE;
  2401.     }
  2402.     return TRUE;
  2403. }
  2404. /*****************************************************************************
  2405.  * FUNCTION
  2406.  *  mmi_phnset_2line_get_display_style
  2407.  * DESCRIPTION
  2408.  *  This function used to get the two line menu item display style
  2409.  *  whether TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT or TWO_LINE_MENUITEM_STYLE_DISPLAY_LEVEL_SELECT
  2410.  * PARAMETERS
  2411.  *  index       [IN]        Menuitem index
  2412.  * RETURNS
  2413.  *  U8
  2414.  *****************************************************************************/
  2415. U8 mmi_phnset_2line_get_display_style(S32 index)
  2416. {
  2417.     /*----------------------------------------------------------------*/
  2418.     /* Local Variables                                                */
  2419.     /*----------------------------------------------------------------*/
  2420.     /*----------------------------------------------------------------*/
  2421.     /* Code Body                                                      */
  2422.     /*----------------------------------------------------------------*/
  2423.     if (index == phone_setup_language || index == phone_setup_preferred_input_method
  2424. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2425.         || index == phone_setup_encoding_type
  2426. #endif 
  2427.         )
  2428.         return TWO_LINE_MENUITEM_STYLE_DISPLAY_HORIZONTAL_SELECT;
  2429.     else
  2430.     {
  2431.         return 0;   /* TWO_LINE_MENUITEM_STYLE_DISPLAY_LEVEL_SELECT? */
  2432.     }
  2433. }
  2434. /*****************************************************************************
  2435.  * FUNCTION
  2436.  *  mmi_phnset_2line_get_menuitem_properties
  2437.  * DESCRIPTION
  2438.  *  This function is used to get the properties of the selected menu item
  2439.  * PARAMETERS
  2440.  *  index                           [IN]        Menu item index
  2441.  *  current_menuitem_properties     [?]         Structure to be filled for menuitem properties
  2442.  * RETURNS
  2443.  *  U8(?)
  2444.  *****************************************************************************/
  2445. static void mmi_phnset_2line_get_menuitem_properties(
  2446.                 int index,
  2447.                 wgui_two_line_menuitem_struct *current_menuitem_properties)
  2448. {
  2449.     /*----------------------------------------------------------------*/
  2450.     /* Local Variables                                                */
  2451.     /*----------------------------------------------------------------*/
  2452.     /*----------------------------------------------------------------*/
  2453.     /* Code Body                                                      */
  2454.     /*----------------------------------------------------------------*/
  2455.     if (index == phone_setup_language)
  2456.     {
  2457.         current_menuitem_properties->num_of_items = (S32) GetLanguages(&(g_phnset_cntx_p->ppLang));
  2458.         current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
  2459.         current_menuitem_properties->defualt_value_callback = mmi_phnset_2line_get_current;
  2460.         current_menuitem_properties->complete_callback = mmi_phnset_2line_lang_complete_callback;
  2461.         current_menuitem_properties->two_line_data_callback.get_data_for_horizontal_select =
  2462.             mmi_phnset_2line_select_data;
  2463.     }
  2464.     else if (index == phone_setup_preferred_input_method)
  2465.     {
  2466.         current_menuitem_properties->num_of_items = mmi_phnset_2line_prfr_input_get_total_items(index);
  2467.         current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
  2468.         current_menuitem_properties->defualt_value_callback = mmi_phnset_2line_prfr_input_get_default;
  2469.         current_menuitem_properties->complete_callback = mmi_phnset_2line_prfr_input_complete_callback;
  2470.         current_menuitem_properties->two_line_data_callback.get_data_for_horizontal_select =
  2471.             mmi_phnset_2line_select_data;
  2472.     }
  2473. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  2474.     else if (index == phone_setup_encoding_type)
  2475.     {
  2476.         current_menuitem_properties->num_of_items = (S32) GetNumOfChild(MENU_SETTING_DEF_ENCODING_TYPE);
  2477.         current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
  2478.         current_menuitem_properties->defualt_value_callback = mmi_phnset_2line_get_current;
  2479.         current_menuitem_properties->complete_callback = mmi_phnset_2line_encod_complete_callback;
  2480.         current_menuitem_properties->two_line_data_callback.get_data_for_horizontal_select =
  2481.             mmi_phnset_2line_select_data;
  2482.     }
  2483. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  2484. }
  2485. #endif /* __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__ */ 
  2486. /*****************************************************************************
  2487.  * FUNCTION
  2488.  *  EntryPhnsetScr
  2489.  * DESCRIPTION
  2490.  *  This function is Entry function for Phonesetup
  2491.  *  Following functions: HintPhnsetTimeAndDate
  2492.  *  HighlighPhnsettSPOF
  2493.  *  HighlightPhnsetLang
  2494.  *  HintPhnsetPreferedInputMethod
  2495.  *  HighlightPhnsetContrastLevel
  2496.  *  HighlightPhnsetWelcomeText
  2497.  *  HighlightPhbSpeedDial
  2498.  *  HighlightPhnsetNITZ
  2499.  * PARAMETERS
  2500.  *  void
  2501.  *  a(?)        [IN/OUT]        
  2502.  *  b(?)        [IN]            
  2503.  * RETURNS
  2504.  *  void
  2505.  *****************************************************************************/
  2506. void EntryPhnsetScr(void)
  2507. {
  2508.     /*----------------------------------------------------------------*/
  2509.     /* Local Variables                                                */
  2510.     /*----------------------------------------------------------------*/
  2511.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  2512.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  2513.     U16 nDispAttribute;                 /* Stores display attribue */
  2514.     U8 *guiBuffer;                      /* Buffer holding history data */
  2515.     U8 *ItemType[MAX_SUB_MENUS];
  2516.     /*----------------------------------------------------------------*/
  2517.     /* Code Body                                                      */
  2518.     /*----------------------------------------------------------------*/
  2519.     /* U32 maskingByte=-1;