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

MTK

开发平台:

C/C++

  1.  *  HintPhnsetWelcomeText
  2.  * DESCRIPTION
  3.  *  This function is hint handling function
  4.  *  for Phonesetup -> Greeting Text
  5.  *  Functionality:
  6.  * PARAMETERS
  7.  *  index       [IN]            
  8.  *  a(?)        [IN/OUT]        
  9.  *  b(?)        [IN]            
  10.  * RETURNS
  11.  *  void
  12.  *****************************************************************************/
  13. void HintPhnsetWelcomeText(U16 index)
  14. {
  15.     /*----------------------------------------------------------------*/
  16.     /* Local Variables                                                */
  17.     /*----------------------------------------------------------------*/
  18.     /*----------------------------------------------------------------*/
  19.     /* Code Body                                                      */
  20.     /*----------------------------------------------------------------*/
  21.     if (IsShowWelcomeScr1())
  22.     {
  23.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  24.     }
  25.     else
  26.     {
  27.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  28.     }
  29. }
  30. /*****************************************************************************
  31.  * FUNCTION
  32.  *  HintPhnsetOwnerNum
  33.  * DESCRIPTION
  34.  *  This function is hint handling function
  35.  *  for Phonesetup -> Language
  36.  *  Functionality:
  37.  * PARAMETERS
  38.  *  index       [IN]            
  39.  *  a(?)        [IN/OUT]        
  40.  *  b(?)        [IN]            
  41.  * RETURNS
  42.  *  void
  43.  *****************************************************************************/
  44. void HintPhnsetOwnerNum(U16 index)
  45. {
  46.     /*----------------------------------------------------------------*/
  47.     /* Local Variables                                                */
  48.     /*----------------------------------------------------------------*/
  49.     /*----------------------------------------------------------------*/
  50.     /* Code Body                                                      */
  51.     /*----------------------------------------------------------------*/
  52.     if (PhnsetGetShowOwnerNumStatus())
  53.     {
  54.         g_phnset_cntx_p->curShowOwnNumStatus = 1;
  55.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  56.     }
  57.     else
  58.     {
  59.         g_phnset_cntx_p->curShowOwnNumStatus = 0;
  60.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  61.     }
  62. }
  63. /* Lisen 0921-1 */
  64. #if defined(__MMI_OPERATOR_NAME_MENU__)
  65. /*****************************************************************************
  66.  * FUNCTION
  67.  *  HintPhnsetOPN
  68.  * DESCRIPTION
  69.  *  This function is hint handling function
  70.  *  for Phonesetup -> Language
  71.  *  Functionality:
  72.  * PARAMETERS
  73.  *  index       [IN]            
  74.  *  a(?)        [IN/OUT]        
  75.  *  b(?)        [IN]            
  76.  * RETURNS
  77.  *  void
  78.  *****************************************************************************/
  79. void HintPhnsetOPN(U16 index)
  80. {
  81.     /*----------------------------------------------------------------*/
  82.     /* Local Variables                                                */
  83.     /*----------------------------------------------------------------*/
  84.     /*----------------------------------------------------------------*/
  85.     /* Code Body                                                      */
  86.     /*----------------------------------------------------------------*/
  87.     if (PhnsetGetShowOPNStatus())
  88.     {
  89.         g_phnset_cntx_p->curShowOPNStatus = 1;
  90.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  91.     }
  92.     else
  93.     {
  94.         g_phnset_cntx_p->curShowOPNStatus = 0;
  95.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  96.     }
  97. }
  98. #endif /* defined(__MMI_OPERATOR_NAME_MENU__) */ 
  99. /*****************************************************************************
  100.  * FUNCTION
  101.  *  HintPhnsetShowDateTime
  102.  * DESCRIPTION
  103.  *  This function is hint handling function
  104.  *  for Phonesetup -> Language
  105.  *  Functionality:
  106.  * PARAMETERS
  107.  *  index       [IN]            
  108.  *  a(?)        [IN/OUT]        
  109.  *  b(?)        [IN]            
  110.  * RETURNS
  111.  *  void
  112.  *****************************************************************************/
  113. void HintPhnsetShowDateTime(U16 index)
  114. {
  115.     /*----------------------------------------------------------------*/
  116.     /* Local Variables                                                */
  117.     /*----------------------------------------------------------------*/
  118.     /*----------------------------------------------------------------*/
  119.     /* Code Body                                                      */
  120.     /*----------------------------------------------------------------*/
  121.     if (PhnsetGetShowDateTimeStatus())
  122.     {
  123.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  124.     }
  125.     else
  126.     {
  127.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  128.     }
  129. }
  130. /*****************************************************************************
  131.  * FUNCTION
  132.  *  HintPhnsetWallpaper
  133.  * DESCRIPTION
  134.  *  This function is hint handling function
  135.  *  for Phonesetup -> Display Character -> Wallpaper
  136.  *  Functionality:
  137.  * PARAMETERS
  138.  *  index       [IN]            
  139.  *  a(?)        [IN/OUT]        
  140.  *  b(?)        [IN]            
  141.  * RETURNS
  142.  *  void
  143.  *****************************************************************************/
  144. void HintPhnsetWallpaper(U16 index)
  145. {
  146.     /*----------------------------------------------------------------*/
  147.     /* Local Variables                                                */
  148.     /*----------------------------------------------------------------*/
  149.     PS8 p;
  150.     /*----------------------------------------------------------------*/
  151.     /* Code Body                                                      */
  152.     /*----------------------------------------------------------------*/
  153.     p = PhnsetGetCurWallpaperName();
  154.     if (p)
  155.     {
  156.         pfnUnicodeStrcpy((PS8) hintData[index], p);
  157.     }
  158. }
  159. #ifdef __MMI_SUB_WALLPAPER__
  160. /*****************************************************************************
  161.  * FUNCTION
  162.  *  HintPhnsetSubWallpaper
  163.  * DESCRIPTION
  164.  *  This function is hint handling function
  165.  *  for Phonesetup -> Display Character -> Wallpaper
  166.  *  Functionality:
  167.  * PARAMETERS
  168.  *  index       [IN]            
  169.  *  a(?)        [IN/OUT]        
  170.  *  b(?)        [IN]            
  171.  * RETURNS
  172.  *  void
  173.  *****************************************************************************/
  174. void HintPhnsetSubWallpaper(U16 index)
  175. {
  176.     /*----------------------------------------------------------------*/
  177.     /* Local Variables                                                */
  178.     /*----------------------------------------------------------------*/
  179.     PS8 name;
  180.     /*----------------------------------------------------------------*/
  181.     /* Code Body                                                      */
  182.     /*----------------------------------------------------------------*/
  183.     name = PhnsetGetCurSubWallpaperName();
  184.     if (name)
  185.     {
  186.         pfnUnicodeStrcpy((PS8) hintData[index], name);
  187.     }
  188. }
  189. #endif /* __MMI_SUB_WALLPAPER__ */ 
  190. #if defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  191. /*****************************************************************************
  192.  * FUNCTION
  193.  *  PhnsetReadIdleClockType
  194.  * DESCRIPTION
  195.  *  
  196.  * PARAMETERS
  197.  *  void
  198.  * RETURNS
  199.  *  void
  200.  *****************************************************************************/
  201. void PhnsetReadIdleClockType(void)
  202. {
  203.     /*----------------------------------------------------------------*/
  204.     /* Local Variables                                                */
  205.     /*----------------------------------------------------------------*/
  206.     S16 error;
  207.     /*----------------------------------------------------------------*/
  208.     /* Code Body                                                      */
  209.     /*----------------------------------------------------------------*/
  210.     ReadValue(NVRAM_PHNSET_IDLE_CLOCK_TYPE, &(g_phnset_cntx_p->curtCLKType), DS_BYTE, &error);
  211.     if (g_phnset_cntx_p->curtCLKType > 1)
  212.     {
  213.         g_phnset_cntx_p->curtCLKType = 1;     //Old:0;     //KP Jerry modify for setting clock-type default value to DIGITAL on 2007-3-29
  214.         WriteValue(NVRAM_PHNSET_IDLE_CLOCK_TYPE, &(g_phnset_cntx_p->curtCLKType), DS_BYTE, &error);
  215.     }
  216.     wgui_set_clock_type((U8) g_phnset_cntx_p->curtCLKType);
  217. }
  218. /*****************************************************************************
  219.  * FUNCTION
  220.  *  HintPhnsetIdleClockType
  221.  * DESCRIPTION
  222.  *  
  223.  * PARAMETERS
  224.  *  index       [IN]        
  225.  * RETURNS
  226.  *  void
  227.  *****************************************************************************/
  228. void HintPhnsetIdleClockType(U16 index)
  229. {
  230.     /*----------------------------------------------------------------*/
  231.     /* Local Variables                                                */
  232.     /*----------------------------------------------------------------*/
  233.     /*----------------------------------------------------------------*/
  234.     /* Code Body                                                      */
  235.     /*----------------------------------------------------------------*/
  236.     switch (g_phnset_cntx_p->curtCLKType)
  237.     {
  238.             /* 
  239.              * case MMI_PHNSET_IDLECLKTYPE_NONE:
  240.              * pfnUnicodeStrcpy((PS8)hintData[index],(PS8)GetString(STR_GLOBAL_NONE));
  241.              * break;            
  242.              */
  243.         case MMI_PHNSET_IDLECLKTYPE_DIGITAL:
  244.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_PHNSET_DISPCHAR_DIGITAL));
  245.             break;
  246.         case MMI_PHNSET_IDLECLKTYPE_ANALOG:
  247.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_PHNSET_DISPCHAR_ANALOG));
  248.             break;
  249.         default:
  250.             MMI_ASSERT(0);
  251.     }
  252. }
  253. /*****************************************************************************
  254.  * FUNCTION
  255.  *  PhnsetIdleClockTypeHiliteHandler
  256.  * DESCRIPTION
  257.  *  
  258.  * PARAMETERS
  259.  *  index       [IN]        
  260.  * RETURNS
  261.  *  void
  262.  *****************************************************************************/
  263. void PhnsetIdleClockTypeHiliteHandler(S32 index)
  264. {
  265.     /*----------------------------------------------------------------*/
  266.     /* Local Variables                                                */
  267.     /*----------------------------------------------------------------*/
  268.     /*----------------------------------------------------------------*/
  269.     /* Code Body                                                      */
  270.     /*----------------------------------------------------------------*/
  271.     g_phnset_cntx_p->curHightlightItem = (U32) index;
  272. }
  273. /*****************************************************************************
  274.  * FUNCTION
  275.  *  PhnsetIdleClockType
  276.  * DESCRIPTION
  277.  *  
  278.  * PARAMETERS
  279.  *  void
  280.  * RETURNS
  281.  *  void
  282.  *****************************************************************************/
  283. void PhnsetIdleClockType(void)
  284. {
  285.     /*----------------------------------------------------------------*/
  286.     /* Local Variables                                                */
  287.     /*----------------------------------------------------------------*/
  288.     S16 error;
  289.     /*----------------------------------------------------------------*/
  290.     /* Code Body                                                      */
  291.     /*----------------------------------------------------------------*/
  292.     g_phnset_cntx_p->curtCLKType = g_phnset_cntx_p->curHightlightItem;
  293.     WriteValue(NVRAM_PHNSET_IDLE_CLOCK_TYPE, &(g_phnset_cntx_p->curtCLKType), DS_BYTE, &error);
  294.     wgui_set_clock_type((U8) g_phnset_cntx_p->curtCLKType);
  295.     g_phnset_cntx_p->isCorrectSet = 1;
  296.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  297. }
  298. /*****************************************************************************
  299.  * FUNCTION
  300.  *  ExitPhnsetIdleClockType
  301.  * DESCRIPTION
  302.  *  
  303.  * PARAMETERS
  304.  *  void
  305.  * RETURNS
  306.  *  void
  307.  *****************************************************************************/
  308. void ExitPhnsetIdleClockType(void)
  309. {
  310.     /*----------------------------------------------------------------*/
  311.     /* Local Variables                                                */
  312.     /*----------------------------------------------------------------*/
  313.     /*----------------------------------------------------------------*/
  314.     /* Code Body                                                      */
  315.     /*----------------------------------------------------------------*/
  316.     if (g_phnset_cntx_p->isCorrectSet)
  317.     {
  318.         DeleteUptoScrID(SCR_IDLE_SCR_DISP);
  319.     }
  320. }
  321. /*****************************************************************************
  322.  * FUNCTION
  323.  *  EntryPhnsetIdleClockType
  324.  * DESCRIPTION
  325.  *  
  326.  * PARAMETERS
  327.  *  void
  328.  * RETURNS
  329.  *  void
  330.  *****************************************************************************/
  331. void EntryPhnsetIdleClockType(void)
  332. {
  333.     /*----------------------------------------------------------------*/
  334.     /* Local Variables                                                */
  335.     /*----------------------------------------------------------------*/
  336.     U8 *pGuiBuffer;
  337.     /*----------------------------------------------------------------*/
  338.     /* Code Body                                                      */
  339.     /*----------------------------------------------------------------*/
  340.     EntryNewScreen(SCR_ID_PHNSET_IDLE_CLOCK_TYPE, ExitPhnsetIdleClockType, EntryPhnsetIdleClockType, NULL);
  341.     g_phnset_cntx_p->isCorrectSet = 0;
  342.     pGuiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_IDLE_CLOCK_TYPE);
  343.     /*
  344.      * subMenuDataPtrs[MMI_PHNSET_IDLECLKTYPE_NONE] = (PU8)GetString( STR_GLOBAL_NONE );;
  345.      */
  346.     subMenuDataPtrs[MMI_PHNSET_IDLECLKTYPE_ANALOG] = (PU8) GetString(STR_ID_PHNSET_DISPCHAR_ANALOG);
  347.     subMenuDataPtrs[MMI_PHNSET_IDLECLKTYPE_DIGITAL] = (PU8) GetString(STR_ID_PHNSET_DISPCHAR_DIGITAL);
  348.     if (g_phnset_cntx_p->curtCLKType > 1)
  349.     {
  350.         PhnsetReadIdleClockType();  /* __USB_IN_NORMAL_MODE__ */
  351.     }
  352.     RegisterHighlightHandler(PhnsetIdleClockTypeHiliteHandler);
  353.     ShowCategory36Screen(
  354.         STR_ID_IDLE_CLOCK_TYPE,
  355.         MAIN_MENU_TITLE_SETTINGS_ICON,
  356.         STR_GLOBAL_OK,
  357.         IMG_GLOBAL_OK,
  358.         STR_GLOBAL_BACK,
  359.         IMG_GLOBAL_BACK,
  360.         MMI_PHNSET_IDLECLKTYPE_MAX,
  361.         (U8 **) subMenuDataPtrs,
  362.         g_phnset_cntx_p->curtCLKType,
  363.         pGuiBuffer);
  364.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  365.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  366.     SetLeftSoftkeyFunction(PhnsetIdleClockType, KEY_EVENT_UP);
  367.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  368. }
  369. /*****************************************************************************
  370.  * FUNCTION
  371.  *  HighlightPhnsetIdleClockType
  372.  * DESCRIPTION
  373.  *  
  374.  * PARAMETERS
  375.  *  void
  376.  * RETURNS
  377.  *  void
  378.  *****************************************************************************/
  379. void HighlightPhnsetIdleClockType(void)
  380. {
  381.     /*----------------------------------------------------------------*/
  382.     /* Local Variables                                                */
  383.     /*----------------------------------------------------------------*/
  384.     /*----------------------------------------------------------------*/
  385.     /* Code Body                                                      */
  386.     /*----------------------------------------------------------------*/
  387.     /* 1 Change left soft key icon and label */
  388.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  389.     /* 2 Change right soft key icon and label */
  390.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  391.     SetLeftSoftkeyFunction(EntryPhnsetIdleClockType, KEY_EVENT_UP);
  392.     SetKeyHandler(EntryPhnsetIdleClockType, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  393.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  394.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  395. }
  396. #endif /* defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__) */ 
  397. /*****************************************************************************
  398.  * FUNCTION
  399.  *  HintPhnsetScreenSaver
  400.  * DESCRIPTION
  401.  *  This function is hint handling function
  402.  *  for Phonesetup -> Display Character -> Screen Saver
  403.  *  Functionality:
  404.  * PARAMETERS
  405.  *  index       [IN]            
  406.  *  a(?)        [IN/OUT]        
  407.  *  b(?)        [IN]            
  408.  * RETURNS
  409.  *  void
  410.  *****************************************************************************/
  411. void HintPhnsetScreenSaver(U16 index)
  412. {
  413.     /*----------------------------------------------------------------*/
  414.     /* Local Variables                                                */
  415.     /*----------------------------------------------------------------*/
  416.     /*----------------------------------------------------------------*/
  417.     /* Code Body                                                      */
  418.     /*----------------------------------------------------------------*/
  419.     switch (PhnsetGetCurScrSvrStatus())
  420.     {
  421.         case SET_SS_STATUS_ON:
  422.         {
  423.             PS8 p = PhnsetGetCurScrSvrName();
  424.             if (p)
  425.             {
  426.                 pfnUnicodeStrcpy((PS8) hintData[index], p);
  427.             }
  428.             else
  429.             {
  430.                 pfnUnicodeStrcpy((PS8) hintData[index], "");
  431.             }
  432.         }
  433.             break;
  434.     #ifdef __MMI_LCD_PARTIAL_ON__
  435.         case SET_SS_STATUS_POWERSAVING:
  436.             pfnUnicodeStrcpy((PS8) hintData[index], (const S8*)GetString(STR_SCREENSAVER_DISPLAY_TIME));
  437.             break;
  438.     #endif /* __MMI_LCD_PARTIAL_ON__ */ 
  439.         default:
  440.             pfnUnicodeStrcpy((PS8) hintData[index], "");
  441.             /* memset(hintData[index],0,MAX_SUB_MENU_HINT_SIZE); */
  442.     }
  443. }
  444. /*****************************************************************************
  445.  * FUNCTION
  446.  *  SettingInlineCustomFunction
  447.  * DESCRIPTION
  448.  *  This function is to be register as the inline editor full screen editor LSK handler
  449.  *  for Phonesetup-> Greeting Text -> Greeting Text
  450.  * PARAMETERS
  451.  *  void
  452.  *  a(?)        [IN/OUT]        
  453.  *  b(?)        [IN]            
  454.  * RETURNS
  455.  *  void
  456.  *****************************************************************************/
  457. void SettingInlineCustomFunction(void)
  458. {
  459.     /*----------------------------------------------------------------*/
  460.     /* Local Variables                                                */
  461.     /*----------------------------------------------------------------*/
  462.     /*----------------------------------------------------------------*/
  463.     /* Code Body                                                      */
  464.     /*----------------------------------------------------------------*/
  465.     PRINT_INFORMATION(("*-------[SmsSettingsGuiInterface.c] SetProfileSettingCustomFuns -------*n"));
  466.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
  467.     SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
  468.     SetInputMethodAndDoneCaptionIcon(MAIN_MENU_TITLE_SETTINGS_ICON);
  469. }
  470. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  471. /*****************************************************************************
  472.  * FUNCTION
  473.  *  HighlightPhnsetDefEncoding
  474.  * DESCRIPTION
  475.  *  This function is Highlight handler for Phonesetup-> Default Encoding Type
  476.  *  Follow functions: EntryPhnsetLang
  477.  * PARAMETERS
  478.  *  void
  479.  *  a(?)        [IN/OUT]        
  480.  *  b(?)        [IN]            
  481.  * RETURNS
  482.  *  void
  483.  *****************************************************************************/
  484. void HighlightPhnsetDefEncoding(void)
  485. {
  486.     /*----------------------------------------------------------------*/
  487.     /* Local Variables                                                */
  488.     /*----------------------------------------------------------------*/
  489.     /*----------------------------------------------------------------*/
  490.     /* Code Body                                                      */
  491.     /*----------------------------------------------------------------*/
  492.     /* Change softkey label */
  493.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  494.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  495.     SetLeftSoftkeyFunction(EntryPhnsetDefEncoding, KEY_EVENT_UP);
  496.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  497. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  498.     if (!is_inline_menu_exist)
  499. #endif 
  500.     {
  501.         SetKeyHandler(EntryPhnsetDefEncoding, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  502.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  503.     }
  504. }
  505. /*****************************************************************************
  506.  * FUNCTION
  507.  *  HintPhnsetDefEncoding
  508.  * DESCRIPTION
  509.  *  This function is Hint handler for Phonesetup-> Default Encoding Type
  510.  *  Follow functions:
  511.  * PARAMETERS
  512.  *  index       [IN]            
  513.  *  a(?)        [IN/OUT]        
  514.  *  b(?)        [IN]            
  515.  * RETURNS
  516.  *  void
  517.  *****************************************************************************/
  518. void HintPhnsetDefEncoding(U16 index)
  519. {
  520.     /*----------------------------------------------------------------*/
  521.     /* Local Variables                                                */
  522.     /*----------------------------------------------------------------*/
  523.     PS8 hintStr = NULL;
  524.     /*----------------------------------------------------------------*/
  525.     /* Code Body                                                      */
  526.     /*----------------------------------------------------------------*/
  527.     switch (g_phnset_cntx_p->EncodingType)
  528.     {
  529.         case 0:
  530.             hintStr = (PS8) GetString(STR_DEF_ENCODING_TYPE_BIG5);
  531.             break;
  532.         case 1:
  533.             hintStr = (PS8) GetString(STR_DEF_ENCODING_TYPE_GB2312);
  534.             break;
  535.         case 2:
  536.             hintStr = (PS8) GetString(STR_DEF_ENCODING_TYPE_UCS2);
  537.             break;
  538.         default:
  539.             hintStr = (PS8) GetString(STR_DEF_ENCODING_TYPE_BIG5);
  540.             break;
  541.     }
  542.     pfnUnicodeStrcpy((PS8) hintData[index], hintStr);
  543. }
  544. /*****************************************************************************
  545.  * FUNCTION
  546.  *  PhnsetDefEncodingHiliteHandler
  547.  * DESCRIPTION
  548.  *  This function is Highlight handler for Phonesetup->Default Encoding Type
  549.  *  Follow functions:
  550.  * PARAMETERS
  551.  *  index       [IN]            
  552.  *  a(?)        [IN/OUT]        
  553.  *  b(?)        [IN]            
  554.  * RETURNS
  555.  *  void
  556.  *****************************************************************************/
  557. void PhnsetDefEncodingHiliteHandler(S32 index)
  558. {
  559.     /*----------------------------------------------------------------*/
  560.     /* Local Variables                                                */
  561.     /*----------------------------------------------------------------*/
  562.     /*----------------------------------------------------------------*/
  563.     /* Code Body                                                      */
  564.     /*----------------------------------------------------------------*/
  565.     g_phnset_cntx_p->curHightlightItem = (U32) index;
  566. }
  567. /*****************************************************************************
  568.  * FUNCTION
  569.  *  PhnsetDefEncodingSelectHandler
  570.  * DESCRIPTION
  571.  *  This function is LSK handler for Phonesetup->Default Encoding Type -> X
  572.  *  Follow functions:
  573.  * PARAMETERS
  574.  *  void
  575.  *  a(?)        [IN/OUT]        
  576.  *  b(?)        [IN]            
  577.  * RETURNS
  578.  *  void
  579.  *****************************************************************************/
  580. void PhnsetDefEncodingSelectHandler(void)
  581. {
  582.     /*----------------------------------------------------------------*/
  583.     /* Local Variables                                                */
  584.     /*----------------------------------------------------------------*/
  585.     S16 error;
  586.     BOOL is_suc = MMI_TRUE;
  587.     /*----------------------------------------------------------------*/
  588.     /* Code Body                                                      */
  589.     /*----------------------------------------------------------------*/
  590.     if (g_phnset_cntx_p->EncodingType != g_phnset_cntx_p->curHightlightItem)
  591.     {
  592.     #ifdef MMI_ON_HARDWARE_P
  593.         switch (g_phnset_cntx_p->curHightlightItem)
  594.         {
  595.             case PHNSET_ENCOD_BIG5:
  596.         #ifdef __MMI_CHSET_BIG5__
  597.                 g_chset_text_encoding = MMI_CHSET_BIG5;
  598.         #else /* __MMI_CHSET_BIG5__ */ 
  599.                 /* g_chset_text_encoding =MMI_CHSET_BASE; */
  600.                 is_suc = MMI_FALSE;
  601.         #endif /* __MMI_CHSET_BIG5__ */ 
  602.                 break;
  603.             case PHNSET_ENCOD_GB2312:
  604.         #ifdef __MMI_CHSET_GB2312__
  605.                 g_chset_text_encoding = MMI_CHSET_GB2312;
  606.         #else /* __MMI_CHSET_GB2312__ */ 
  607.                 /* g_chset_text_encoding = MMI_CHSET_BASE; */
  608.                 is_suc = MMI_FALSE;
  609.         #endif /* __MMI_CHSET_GB2312__ */ 
  610.                 break;
  611.             default:
  612.                 /* g_chset_text_encoding =MMI_CHSET_BASE; */
  613.                 is_suc = MMI_FALSE;
  614.                 break;
  615.         }
  616.     #endif /* MMI_ON_HARDWARE_P */ 
  617.         g_phnset_cntx_p->EncodingType = (U8) (g_phnset_cntx_p->curHightlightItem);
  618.         WriteValue(NVRAM_SETTING_DEF_ENCODING, &(g_phnset_cntx_p->curHightlightItem), DS_BYTE, &error);
  619.     }
  620.     if (MMI_TRUE == is_suc)
  621.     {
  622.         DisplayPopup(
  623.             (U8*) GetString(STR_GLOBAL_DONE),
  624.             IMG_GLOBAL_ACTIVATED,
  625.             MMI_FALSE,
  626.             UI_POPUP_NOTIFYDURATION_TIME,
  627.             (U8) SUCCESS_TONE);
  628.     }
  629.     else
  630.     {
  631.         DisplayPopup(
  632.             (U8*) GetString(STR_GLOBAL_ERROR),
  633.             IMG_GLOBAL_ERROR,
  634.             MMI_FALSE,
  635.             UI_POPUP_NOTIFYDURATION_TIME,
  636.             (U8) WARNING_TONE);
  637.     }
  638.     DeleteScreenIfPresent(SCR_DEF_ENCODING_TYPE);
  639. }
  640. /*****************************************************************************
  641.  * FUNCTION
  642.  *  EntryPhnsetDefEncoding
  643.  * DESCRIPTION
  644.  *  This function is Entry function for Phonesetup-> Default encoding type
  645.  *  Following functions:
  646.  * PARAMETERS
  647.  *  void
  648.  *  a(?)        [IN/OUT]        
  649.  *  b(?)        [IN]            
  650.  * RETURNS
  651.  *  void
  652.  *****************************************************************************/
  653. void EntryPhnsetDefEncoding(void)
  654. {
  655.     /*----------------------------------------------------------------*/
  656.     /* Local Variables                                                */
  657.     /*----------------------------------------------------------------*/
  658.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  659.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  660.     U16 nDispAttribute;                 /* Stores display attribue */
  661.     U8 *guiBuffer;                      /* Buffer holding history data */
  662.     /*----------------------------------------------------------------*/
  663.     /* Code Body                                                      */
  664.     /*----------------------------------------------------------------*/
  665.     /* U8 *HintList[MAX_SUB_MENUS]; */
  666.     /* 1 Call Exit Handler */
  667.     EntryNewScreen(SCR_DEF_ENCODING_TYPE, NULL, EntryPhnsetDefEncoding, NULL);
  668.     /* 2 Get current screen to gui buffer  for history purposes */
  669.     guiBuffer = GetCurrGuiBuffer(SCR_DEF_ENCODING_TYPE);
  670.     /* 3. Retrieve no of child of menu item to be displayed */
  671.     nNumofItem = GetNumOfChild(MENU_SETTING_DEF_ENCODING_TYPE);
  672.     /* 4. Get attribute of menu to be displayed */
  673.     nDispAttribute = GetDispAttributeOfItem(MENU_SETTING_DEF_ENCODING_TYPE);
  674.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  675.     GetSequenceStringIds(MENU_SETTING_DEF_ENCODING_TYPE, nStrItemList);
  676.     /* 6 Set current parent id */
  677.     SetParentHandler(MENU_SETTING_DEF_ENCODING_TYPE);
  678.     /* 7 Register highlight handler to be called in menu screen */
  679.     RegisterHighlightHandler(PhnsetDefEncodingHiliteHandler);
  680.     /* 8 Construct the Hints List */
  681.     /* ConstructHintsList(MENU_SETTING_DEF_ENCODING_TYPE, HintList); */
  682.     /* 9. Display Category screen */
  683.     ShowCategory11Screen(STR_DEF_ENCODING_TYPE_TITLE,
  684.                          MAIN_MENU_TITLE_SETTINGS_ICON,
  685.                          STR_GLOBAL_OK, IMG_GLOBAL_OK, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, nNumofItem, nStrItemList,
  686. #if defined(__MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__)
  687.                          g_phnset_cntx_p->curHightlightItem,
  688. #else 
  689.                          g_phnset_cntx_p->EncodingType,
  690. #endif 
  691.                          guiBuffer);
  692.     /* 10.Register function with softkey */
  693.     SetLeftSoftkeyFunction(PhnsetDefEncodingSelectHandler, KEY_EVENT_UP);
  694.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  695.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  696.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  697. }
  698. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  699. /*****************************************************************************
  700.  * FUNCTION
  701.  *  PhnsetGetDefEncodingType
  702.  * DESCRIPTION
  703.  *  This function is export function for applications to query the current encoding type setting
  704.  *  Follow functions:
  705.  * PARAMETERS
  706.  *  void
  707.  *  a(?)        [IN/OUT]        
  708.  *  b(?)        [IN]            
  709.  * RETURNS
  710.  *  void
  711.  *****************************************************************************/
  712. U8 PhnsetGetDefEncodingType(void)
  713. {
  714. #ifdef __MMI_SET_DEF_ENCODING_TYPE__
  715.     /*----------------------------------------------------------------*/
  716.     /* Local Variables                                                */
  717.     /*----------------------------------------------------------------*/
  718.     /*----------------------------------------------------------------*/
  719.     /* Code Body                                                      */
  720.     /*----------------------------------------------------------------*/
  721.     return g_chset_text_encoding;
  722. #else /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  723.     return g_chset_text_encoding;     //Old:MMI_CHSET_BIG5;     //KP Jerry modify because of we modify g_chset_text_encoding initial value according to system-default-language on 2007-4-5
  724. #endif /* __MMI_SET_DEF_ENCODING_TYPE__ */ 
  725. }
  726. /*
  727.  * Language Setting
  728.  */
  729. /*****************************************************************************
  730.  * FUNCTION
  731.  *  HighlightPhnsetLang
  732.  * DESCRIPTION
  733.  *  This function is Highlight handler for Phonesetup->Language
  734.  *  Follow functions: EntryPhnsetLang
  735.  * PARAMETERS
  736.  *  void
  737.  *  a(?)        [IN/OUT]        
  738.  *  b(?)        [IN]            
  739.  * RETURNS
  740.  *  void
  741.  *****************************************************************************/
  742. void HighlightPhnsetLang(void)
  743. {
  744.     /*----------------------------------------------------------------*/
  745.     /* Local Variables                                                */
  746.     /*----------------------------------------------------------------*/
  747.     /*----------------------------------------------------------------*/
  748.     /* Code Body                                                      */
  749.     /*----------------------------------------------------------------*/
  750.     /* 1 Change left soft key icon and label */
  751.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  752.     /* 2 Change right soft key icon and label */
  753.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  754.     SetLeftSoftkeyFunction(EntryPhnsetLang, KEY_EVENT_UP);
  755.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  756. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  757.     if (!is_inline_menu_exist)
  758. #endif 
  759.     {
  760.         SetKeyHandler(EntryPhnsetLang, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  761.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  762.     }
  763. }
  764. /*****************************************************************************
  765.  * FUNCTION
  766.  *  EntryPhnsetLang
  767.  * DESCRIPTION
  768.  *  This function is Entry function for Phonesetup->IdleScreenDisplay
  769.  *  Following functions:
  770.  * PARAMETERS
  771.  *  void
  772.  *  a(?)        [IN/OUT]        
  773.  *  b(?)        [IN]            
  774.  * RETURNS
  775.  *  void
  776.  *****************************************************************************/
  777. void EntryPhnsetLang(void)
  778. {
  779.     /*----------------------------------------------------------------*/
  780.     /* Local Variables                                                */
  781.     /*----------------------------------------------------------------*/
  782.     U8 *pGuiBuffer;
  783.     S32 totalLang;
  784. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  785.     U16 hiliteItem = g_phnset_cntx_p->curHightlightItem;
  786. #else 
  787.     U16 hiliteItem = gCurrLangIndex;
  788. #endif 
  789.     U8 i;
  790.     /*----------------------------------------------------------------*/
  791.     /* Code Body                                                      */
  792.     /*----------------------------------------------------------------*/
  793.     EntryNewScreen(SCR_LANGUAGE_SELECTION, NULL, EntryPhnsetLang, NULL);
  794.     totalLang = (S32) GetLanguages(&(g_phnset_cntx_p->ppLang));
  795. #ifdef __MMI_AUTO_LANG_EN__
  796.     {
  797.         S16 error;
  798.         U8 data = 0;
  799.         ReadValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  800.         if (data == 0xFF)   /* Auto Language set */
  801.         {
  802.             hiliteItem = 0;
  803.         }
  804.         else
  805.         {
  806.             hiliteItem += 1;
  807.         }
  808.     }
  809.     subMenuDataPtrs[0] = (PU8) GetString(STR_LANGUAGESCR_AUTO);
  810.     for (i = 0; i < totalLang; i++)
  811.     {
  812.         subMenuDataPtrs[i + 1] = g_phnset_cntx_p->ppLang[i];
  813.     }
  814.     totalLang += 1;
  815. #else /* __MMI_AUTO_LANG_EN__ */ 
  816.     for (i = 0; i < totalLang; i++)
  817.     {
  818.         subMenuDataPtrs[i] = g_phnset_cntx_p->ppLang[i];
  819.     }
  820. #endif /* __MMI_AUTO_LANG_EN__ */ 
  821.     pGuiBuffer = GetCurrGuiBuffer(SCR_LANGUAGE_SELECTION);
  822.     RegisterHighlightHandler(PhnsetLangHiliteHandler);
  823.     ShowCategory36Screen(
  824.         STR_MENU_LANGUAGE,
  825.         MAIN_MENU_TITLE_SETTINGS_ICON,
  826.         STR_GLOBAL_OK,
  827.         IMG_GLOBAL_OK,
  828.         STR_GLOBAL_BACK,
  829.         IMG_GLOBAL_BACK,
  830.         totalLang,
  831.         (U8 **) subMenuDataPtrs,
  832.         hiliteItem,
  833.         pGuiBuffer);
  834.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  835.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  836.     SetLeftSoftkeyFunction(PhnsetLangLSKHandler, KEY_EVENT_UP);
  837.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  838. }
  839. /*****************************************************************************
  840.  * FUNCTION
  841.  *  PhnsetLangHiliteHandler
  842.  * DESCRIPTION
  843.  *  This function is Highlight handler for Phonesetup->Language
  844.  *  Follow functions:
  845.  * PARAMETERS
  846.  *  index       [IN]            
  847.  *  a(?)        [IN/OUT]        
  848.  *  b(?)        [IN]            
  849.  * RETURNS
  850.  *  void
  851.  *****************************************************************************/
  852. void PhnsetLangHiliteHandler(S32 index)
  853. {
  854.     /*----------------------------------------------------------------*/
  855.     /* Local Variables                                                */
  856.     /*----------------------------------------------------------------*/
  857.     /*----------------------------------------------------------------*/
  858.     /* Code Body                                                      */
  859.     /*----------------------------------------------------------------*/
  860.     g_phnset_cntx_p->curHightlightItem = (U32) index;
  861. }
  862. /*****************************************************************************
  863.  * FUNCTION
  864.  *  PhnsetLangLSKHandler
  865.  * DESCRIPTION
  866.  *  This function is left softkey handling function
  867.  *  for Phonesetup->Language
  868.  *  Functionality: Save the setting menu style
  869.  * PARAMETERS
  870.  *  void
  871.  *  a(?)        [IN/OUT]        
  872.  *  b(?)        [IN]            
  873.  * RETURNS
  874.  *  void
  875.  *****************************************************************************/
  876. void PhnsetLangLSKHandler(void)
  877. {
  878.     /*----------------------------------------------------------------*/
  879.     /* Local Variables                                                */
  880.     /*----------------------------------------------------------------*/
  881.     U8 data;
  882.     S16 error;
  883.     U16 index;
  884.     S32 LangIdx = g_phnset_cntx_p->curHightlightItem;
  885.     BOOL isAutoLangSet = MMI_FALSE;
  886.     /*----------------------------------------------------------------*/
  887.     /* Code Body                                                      */
  888.     /*----------------------------------------------------------------*/
  889. #ifdef __MMI_AUTO_LANG_EN__
  890.     if (g_phnset_cntx_p->curHightlightItem == 0)    /* Auto Language selected */
  891.     {
  892.         LangIdx = 0;
  893.         isAutoLangSet = MMI_TRUE;
  894.     }
  895.     else
  896.     {
  897.         LangIdx -= 1;
  898.     }
  899. #endif /* __MMI_AUTO_LANG_EN__ */ 
  900.     ReadValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  901.    /************************************************************************/
  902.     /* Robin 1129, Add auto language selection                        */
  903.    /************************************************************************/
  904.     /* if( (LangIdx != (S32) gCurrLangIndex) *** Different Language        */
  905.     /*   || (data != 0xFF && isAutoLangSet == MMI_TRUE)  *** Auto Lang Set  */
  906.     /*   || (data == 0xFF && isAutoLangSet == MMI_FALSE) *** Auto Lang UnSet */
  907.     /*   )                                                   */
  908.    /************************************************************************/
  909.     if ((LangIdx != (S32) gCurrLangIndex)
  910.         || (data != 0xFF && isAutoLangSet == MMI_TRUE) || (data == 0xFF && isAutoLangSet == MMI_FALSE))
  911.     {
  912.         index = GetCurrHiliteID();
  913.         if (isAutoLangSet == MMI_TRUE)
  914.         {
  915.         #ifdef __MMI_AUTO_LANG_EN__
  916.             /* only when __MMI_AUTO_LANG_EN__ compile option turn on, the isAutoLangSet is possible to be TRUE  */
  917.             U16 autoLangIdx = PhnsetGetAutoLangIdx();
  918.             data = 0xFF;
  919.             SetCurrentLanguage((S8) autoLangIdx);
  920.             WriteValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  921.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_LANGUAGESCR_AUTO));
  922.    /********************************************************/
  923.             /* Robin 0602, Remove set AT command profile functions  */
  924.             /* AT command will query MMI when needed                */
  925.             /* Send to PS for AT+CLAE                               */
  926.    /********************************************************/
  927.             SendLangChange2AT((U8) autoLangIdx);
  928.         #endif /* __MMI_AUTO_LANG_EN__ */ 
  929.         }
  930.         else
  931.         {
  932.             data = (U8) LangIdx;
  933.             SetCurrentLanguage((S8) data);
  934.             WriteValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  935.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) g_phnset_cntx_p->ppLang[(U8) LangIdx]);
  936.       /********************************************************/
  937.             /* Robin 0602, Remove set AT command profile functions  */
  938.             /* AT command will query MMI when needed                */
  939.             /* Send to PS for AT+CLAE                               */
  940.       /********************************************************/
  941.             SendLangChange2AT((U8) LangIdx);
  942.         }
  943.         Category52ChangeItemDescription(2, hintData[index]);
  944.     #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  945.         if (!is_inline_menu_exist)
  946.     #endif 
  947.         RefreshNwProviderName(gPLMN);
  948.     #ifdef __MMI_WORLD_CLOCK_SUBLCD_SETTING__
  949.         if (gIsSubLcdOnIdleScreen == 1)
  950.         {
  951.             ShowIdleAppSubLcd();
  952.         }
  953.     #endif /* __MMI_WORLD_CLOCK_SUBLCD_SETTING__ */ 
  954.     }
  955.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  956. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  957.     if (!is_inline_menu_exist)
  958. #endif 
  959.         DeleteNHistory(1);
  960. }
  961. #ifdef __MMI_AUTO_LANG_EN__
  962. /*****************************************************************************
  963.  * FUNCTION
  964.  *  PhnsetGetAutoLangIdx
  965.  * DESCRIPTION
  966.  *  This function is to read language setting from nvram and set
  967.  *  Functionality:
  968.  * PARAMETERS
  969.  *  void
  970.  *  a(?)        [IN/OUT]        
  971.  *  b(?)        [IN]            
  972.  * RETURNS
  973.  *  void
  974.  *****************************************************************************/
  975. U16 PhnsetGetAutoLangIdx(void)
  976. {
  977.     /*----------------------------------------------------------------*/
  978.     /* Local Variables                                                */
  979.     /*----------------------------------------------------------------*/
  980.     U8 lang_idx;
  981.     /*----------------------------------------------------------------*/
  982.     /* Code Body                                                      */
  983.     /*----------------------------------------------------------------*/
  984.     if (g_phnset_cntx_p->LP != CBS_INVALID && g_phnset_cntx_p->LP != CBS0_LANG_UNSPECIFIED)
  985.     {
  986.         for (lang_idx = 0; lang_idx < MMI_NUM_OF_AUTOLANG_ELEM; lang_idx++)
  987.         {
  988.             if (g_phnset_cntx_p->LP == auto_lang_struct[lang_idx].LanType)
  989.             {
  990.                 if (auto_lang_struct[lang_idx].LanSSC)
  991.                 {
  992.                     return GetLanguageIndex((S8*) auto_lang_struct[lang_idx].LanSSC);
  993.                 }
  994.                 else
  995.                 {
  996.                     return 0;
  997.                 }
  998.             }
  999.         }
  1000.         if (lang_idx == MMI_NUM_OF_AUTOLANG_ELEM)   /* Not found! LP Not support */
  1001.         {
  1002.         #ifdef MMI_ON_HARDWARE_P
  1003.             return (U16) GetLanguageIndex((S8*) MMI_DEFLANGSSC_FOR_AUTO);
  1004.         #else 
  1005.             return 0;
  1006.         #endif 
  1007.         }
  1008.     }
  1009.     else
  1010.     {
  1011.     #ifdef MMI_ON_HARDWARE_P
  1012.         return (U16) GetLanguageIndex((S8*) MMI_DEFLANGSSC_FOR_AUTO);
  1013.     #else 
  1014.         return 0;
  1015.     #endif 
  1016.     }
  1017. }
  1018. /*****************************************************************************
  1019.  * FUNCTION
  1020.  *  PhnsetPLPInd
  1021.  * DESCRIPTION
  1022.  *  Process and store LP in phonesetup context
  1023.  *  Functionality:
  1024.  * PARAMETERS
  1025.  *  LPArr       [?]             
  1026.  *  a(?)        [IN/OUT]        
  1027.  *  b(?)        [IN]            
  1028.  * RETURNS
  1029.  *  void
  1030.  *****************************************************************************/
  1031. #define MMI_MAX_LP 5
  1032. void PhnsetPLPInd(U8 *LPArr)
  1033. {
  1034.     /*----------------------------------------------------------------*/
  1035.     /* Local Variables                                                */
  1036.     /*----------------------------------------------------------------*/
  1037.     U8 i = 0, j = 0;
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Code Body                                                      */
  1040.     /*----------------------------------------------------------------*/
  1041.     for (i = 0; i < MMI_MAX_LP; i++)
  1042.     {
  1043.         /* found LP from language_type/SSC mapping table --> auto_lang_struct[]  */
  1044.         for (j = 0; j < MMI_NUM_OF_AUTOLANG_ELEM; j++)
  1045.         {
  1046.             if (LPArr[i] == auto_lang_struct[j].LanType)
  1047.             {
  1048.                 break;
  1049.             }
  1050.         }
  1051.         /* Find language array (gLanguageArray) using found SSC */
  1052.         if (j != MMI_NUM_OF_AUTOLANG_ELEM)
  1053.         {
  1054.             if (auto_lang_struct[j].LanSSC)
  1055.                 if (GetLanguageIndex((S8*) auto_lang_struct[j].LanSSC) != 0xFFFF)
  1056.                 {
  1057.                     PhnsetSetLP(LPArr[i]);
  1058.                     break;
  1059.                 }
  1060.         }
  1061.     }
  1062. }
  1063. /*****************************************************************************
  1064.  * FUNCTION
  1065.  *  PhnsetSetLP
  1066.  * DESCRIPTION
  1067.  *  This function is for SIM info indication to set LP
  1068.  *  Functionality:
  1069.  * PARAMETERS
  1070.  *  LP          [IN]            
  1071.  *  a(?)        [IN/OUT]        
  1072.  *  b(?)        [IN]            
  1073.  * RETURNS
  1074.  *  void
  1075.  *****************************************************************************/
  1076. void PhnsetSetLP(U8 LP)
  1077. {
  1078.     /*----------------------------------------------------------------*/
  1079.     /* Local Variables                                                */
  1080.     /*----------------------------------------------------------------*/
  1081.     /*----------------------------------------------------------------*/
  1082.     /* Code Body                                                      */
  1083.     /*----------------------------------------------------------------*/
  1084.     g_phnset_cntx_p->LP = LP;
  1085. }
  1086. /*****************************************************************************
  1087.  * FUNCTION
  1088.  *  PhnsetGetLang
  1089.  * DESCRIPTION
  1090.  *  This function is to get user set language
  1091.  *  Functionality:
  1092.  * PARAMETERS
  1093.  *  void
  1094.  *  a(?)        [IN/OUT]        
  1095.  *  b(?)        [IN]            
  1096.  * RETURNS
  1097.  *  void
  1098.  *****************************************************************************/
  1099. U8 PhnsetGetLang(void)
  1100. {
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Local Variables                                                */
  1103.     /*----------------------------------------------------------------*/
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Code Body                                                      */
  1106.     /*----------------------------------------------------------------*/
  1107.     return g_phnset_cntx_p->UsrLangIdx;
  1108. }
  1109. #endif /* __MMI_AUTO_LANG_EN__ */ 
  1110. /*****************************************************************************
  1111.  * FUNCTION
  1112.  *  PhnsetSetLangByNvramValue
  1113.  * DESCRIPTION
  1114.  *  This function is to read language setting from nvram and set
  1115.  *  Functionality:
  1116.  * PARAMETERS
  1117.  *  void
  1118.  *  a(?)        [IN/OUT]        
  1119.  *  b(?)        [IN]            
  1120.  * RETURNS
  1121.  *  void
  1122.  *****************************************************************************/
  1123. MMI_BOOL PhnsetSetLangByNvramValue(void)
  1124. {
  1125.     /*----------------------------------------------------------------*/
  1126.     /* Local Variables                                                */
  1127.     /*----------------------------------------------------------------*/
  1128.     S16 error;
  1129.     U8 data = 0;
  1130.     /*----------------------------------------------------------------*/
  1131.     /* Code Body                                                      */
  1132.     /*----------------------------------------------------------------*/
  1133.     ReadValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  1134.     g_phnset_cntx_p->UsrLangIdx = data;
  1135.     if (data == 0xFF)
  1136.     {
  1137.     #ifdef __MMI_AUTO_LANG_EN__
  1138.         /* If read nvram before SIM LP comming, treat as unspecified language */
  1139.         /* PhonsetGetAugoLanIdx will return default language index */
  1140.         data = PhnsetGetAutoLangIdx();
  1141.     #else /* __MMI_AUTO_LANG_EN__ */ 
  1142.         data = 0;
  1143.         WriteValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  1144.     #endif /* __MMI_AUTO_LANG_EN__ */ 
  1145.     }
  1146.     SetCurrentLanguage(data);   /* Func in ReadRes.c */
  1147.     return MMI_TRUE;
  1148. }
  1149. /*****************************************************************************
  1150.  * FUNCTION
  1151.  *  PhnsetReinitHomeCityIdx
  1152.  * DESCRIPTION
  1153.  *  This function is to rearrange home city global array and set home city highlight item
  1154.  *  Functionality:
  1155.  * PARAMETERS
  1156.  *  void
  1157.  *  a(?)        [IN/OUT]        
  1158.  *  b(?)        [IN]            
  1159.  * RETURNS
  1160.  *  void
  1161.  *****************************************************************************/
  1162. void PhnsetReinitHomeCityIdx(void)
  1163. {
  1164.     /*----------------------------------------------------------------*/
  1165.     /* Local Variables                                                */
  1166.     /*----------------------------------------------------------------*/
  1167.     /*----------------------------------------------------------------*/
  1168.     /* Code Body                                                      */
  1169.     /*----------------------------------------------------------------*/
  1170.      /**
  1171.         * This Is Needed As Set Home City NVRAM Index Doesnt Change On Language Change
  1172.       * As The Global City Array Is Chnaged. 
  1173.       **/
  1174.      /**************************************************************/
  1175.     /*  Dont Chnage Order Of These Function Calls --Start-- Gurinder   ***** */
  1176.     PhnsetReadNvmHomeCityIdxNStoreCityName();
  1177.     PhnsetReinitHomeCity();
  1178.     /*  Dont Chnage Order Of These Function Calls --End-- Gurinder     ***** */
  1179.      /**************************************************************/
  1180. }
  1181. /*****************************************************************************
  1182.  * FUNCTION
  1183.  *  PhnsetSetHomeCityPtr
  1184.  * DESCRIPTION
  1185.  *  This function is to set current homecity string ptr
  1186.  *  Functionality:
  1187.  * PARAMETERS
  1188.  *  str         [?]             
  1189.  *  a(?)        [IN/OUT]        
  1190.  *  b(?)        [IN]            
  1191.  * RETURNS
  1192.  *  void
  1193.  *****************************************************************************/
  1194. void PhnsetSetHomeCityPtr(U8 *str)
  1195. {
  1196.     /*----------------------------------------------------------------*/
  1197.     /* Local Variables                                                */
  1198.     /*----------------------------------------------------------------*/
  1199.     /*----------------------------------------------------------------*/
  1200.     /* Code Body                                                      */
  1201.     /*----------------------------------------------------------------*/
  1202.     g_phnset_cntx_p->CurHomeCityStrPtr = str;
  1203. }
  1204. #if (defined(__MMI_NITZ__) && !defined(__MMI_AUTOTIMEZONE_IN_DATEANDTIME__))
  1205. /*****************************************************************************
  1206.  * FUNCTION
  1207.  *  HighlightPhnsetNITZ
  1208.  * DESCRIPTION
  1209.  *  This function is highlight handler for Phonesetup-> Auto Update Date and Time
  1210.  *  Follow functions:tEntryAutoUpdateDtTime
  1211.  * PARAMETERS
  1212.  *  void
  1213.  *  a(?)        [IN/OUT]        
  1214.  *  b(?)        [IN]            
  1215.  * RETURNS
  1216.  *  void
  1217.  *****************************************************************************/
  1218. void HighlightPhnsetNITZ(void)
  1219. {
  1220.     /*----------------------------------------------------------------*/
  1221.     /* Local Variables                                                */
  1222.     /*----------------------------------------------------------------*/
  1223.     U16 index;
  1224.     /*----------------------------------------------------------------*/
  1225.     /* Code Body                                                      */
  1226.     /*----------------------------------------------------------------*/
  1227.     index = GetCurrHiliteID();
  1228.     /* Set the LSK to Off when Auto Update is ON */
  1229.     if (g_phnset_cntx_p->curNITZStatus == 1)
  1230.     {
  1231.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  1232.     }
  1233.     else
  1234.     {
  1235.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  1236.     }
  1237.     /* Change right soft key icon and label */
  1238.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1239.     /* Change left soft key icon and label */
  1240.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1241.     /* Register function for left soft key */
  1242.     SetLeftSoftkeyFunction(EntryPhnsetNITZ, KEY_EVENT_UP);
  1243.     /* Register function for right soft key */
  1244.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1245.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1246. }
  1247. /*****************************************************************************
  1248.  * FUNCTION
  1249.  *  EntryPhnsetNITZ
  1250.  * DESCRIPTION
  1251.  *  This function is Left softkey handler for Phonesetup-> Auto Update Date and Time
  1252.  *  Functionality: Toggle status only
  1253.  * PARAMETERS
  1254.  *  void
  1255.  *  a(?)        [IN/OUT]        
  1256.  *  b(?)        [IN]            
  1257.  * RETURNS
  1258.  *  void
  1259.  *****************************************************************************/
  1260. void EntryPhnsetNITZ(void)
  1261. {
  1262.     /*----------------------------------------------------------------*/
  1263.     /* Local Variables                                                */
  1264.     /*----------------------------------------------------------------*/
  1265.     U16 index;
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Code Body                                                      */
  1268.     /*----------------------------------------------------------------*/
  1269.     index = GetCurrHiliteID();
  1270.     /* Toggle Auto Update of Date And Time */
  1271.     if (g_phnset_cntx_p->curNITZStatus == 0)
  1272.     {
  1273.         g_phnset_cntx_p->curNITZStatus = 1;
  1274.     }
  1275.     else
  1276.     {
  1277.         g_phnset_cntx_p->curNITZStatus = 0;
  1278.     }
  1279.     /* Store the updated Value */
  1280.     g_phnset_cntx_p->NITZDirtyFlag = TRUE;
  1281.     if (g_phnset_cntx_p->curNITZStatus)
  1282.     {
  1283.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  1284.         Category52ChangeItemDescription(index, hintData[index]);
  1285.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  1286.     }
  1287.     else
  1288.     {
  1289.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  1290.         Category52ChangeItemDescription(index, hintData[index]);
  1291.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  1292.     }
  1293.     RedrawCategoryFunction();
  1294.     HighlightPhnsetNITZ();
  1295. }
  1296. /*****************************************************************************
  1297.  * FUNCTION
  1298.  *  HintPhnsetNITZ
  1299.  * DESCRIPTION
  1300.  *  This function is hint handling function
  1301.  *  for Phonesetup -> Auto Update of Date and Time
  1302.  *  Functionality:
  1303.  * PARAMETERS
  1304.  *  index       [IN]            
  1305.  *  a(?)        [IN/OUT]        
  1306.  *  b(?)        [IN]            
  1307.  * RETURNS
  1308.  *  void
  1309.  *****************************************************************************/
  1310. void HintPhnsetNITZ(U16 index)
  1311. {
  1312.     /*----------------------------------------------------------------*/
  1313.     /* Local Variables                                                */
  1314.     /*----------------------------------------------------------------*/
  1315.     /*----------------------------------------------------------------*/
  1316.     /* Code Body                                                      */
  1317.     /*----------------------------------------------------------------*/
  1318.     if (PhnsetGetNITZFuncStatus())
  1319.     {
  1320.         g_phnset_cntx_p->curNITZStatus = 1; /* Robin 1115, initial globol variable */
  1321.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  1322.     }
  1323.     else
  1324.     {
  1325.         g_phnset_cntx_p->curNITZStatus = 0; /* Robin 1115, initial globol variable */
  1326.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  1327.     }
  1328. }
  1329. /*****************************************************************************
  1330.  * FUNCTION
  1331.  *  PhnsetGetNITZFuncStatus
  1332.  * DESCRIPTION
  1333.  *  This function is to get NITZ function on/off status
  1334.  *  Functionality: Only exist when (__MMI_NITZ__) and (!__MMI_AUTOTIMEZONE_IN_DATEANDTIME__)
  1335.  * PARAMETERS
  1336.  *  void
  1337.  *  a(?)        [IN/OUT]        
  1338.  *  b(?)        [IN]            
  1339.  * RETURNS
  1340.  *  void
  1341.  *****************************************************************************/
  1342. MMI_BOOL PhnsetGetNITZFuncStatus(void)
  1343. {
  1344.     /*----------------------------------------------------------------*/
  1345.     /* Local Variables                                                */
  1346.     /*----------------------------------------------------------------*/
  1347.     U8 data = 0;
  1348.     S16 error;
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Code Body                                                      */
  1351.     /*----------------------------------------------------------------*/
  1352.     ReadValue(NVRAM_SETTING_AUTOUPDATE_DT_TIME, &data, DS_BYTE, &error);
  1353.     if (data == 1)
  1354.     {
  1355.         return MMI_TRUE;
  1356.     }
  1357.     else if (data == 0xff)
  1358.     {
  1359.         data = RstGetNITZStatusDefault();
  1360.         WriteValue(NVRAM_SETTING_AUTOUPDATE_DT_TIME, &data, DS_BYTE, &error);
  1361.         return MMI_FALSE;
  1362.     }
  1363.     else
  1364.     {
  1365.         return MMI_FALSE;
  1366.     }
  1367. }
  1368. #endif /* (defined(__MMI_NITZ__) && !defined(__MMI_AUTOTIMEZONE_IN_DATEANDTIME__)) */ 
  1369. /*****************************************************************************
  1370. *
  1371. *  TV Out 
  1372. *
  1373. *****************************************************************************/
  1374. /*****************************************************************************
  1375.  * FUNCTION
  1376.  *  mmi_phnset_highlight_tvout
  1377.  * DESCRIPTION
  1378.  *  highlight tvout item
  1379.  * PARAMETERS
  1380.  *  void
  1381.  * RETURNS
  1382.  *  void
  1383.  *****************************************************************************/
  1384. #ifdef __MMI_TVOUT__
  1385. static void mmi_phnset_highlight_tvout(void)
  1386. {
  1387.     /*----------------------------------------------------------------*/
  1388.     /* Local Variables                                                */
  1389.     /*----------------------------------------------------------------*/
  1390.     /*----------------------------------------------------------------*/
  1391.     /* Code Body                                                      */
  1392.     /*----------------------------------------------------------------*/
  1393.     SetLeftSoftkeyFunction(mmi_phnset_entry_tvout_screen, KEY_EVENT_UP);
  1394.     SetKeyHandler(mmi_phnset_entry_tvout_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1395.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1396.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1397. }
  1398. #endif /* __MMI_TVOUT__ */ 
  1399. /*****************************************************************************
  1400.  * FUNCTION
  1401.  *  mmi_phnset_entry_tvout_screen
  1402.  * DESCRIPTION
  1403.  *  entry phone setup tv out screen
  1404.  * PARAMETERS
  1405.  *  void
  1406.  * RETURNS
  1407.  *  void
  1408.  *****************************************************************************/
  1409. #ifdef __MMI_TVOUT__
  1410. static void mmi_phnset_entry_tvout_screen(void)
  1411. {
  1412.     /*----------------------------------------------------------------*/
  1413.     /* Local Variables                                                */
  1414.     /*----------------------------------------------------------------*/
  1415.     U16 item_list[32];
  1416.     U16 item_icons[32];
  1417.     U16 num_of_items;
  1418.     U8 *gui_buffer;
  1419.     U8 *popup_list[16];
  1420.     S32 i;
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Code Body                                                      */
  1423.     /*----------------------------------------------------------------*/
  1424.     EntryNewScreen(SCR_ID_SETTING_TVOUT, NULL, mmi_phnset_entry_tvout_screen, NULL);
  1425.     gui_buffer = GetCurrGuiBuffer(SCR_ID_SETTING_TVOUT);
  1426.     num_of_items = GetNumOfChild(MENU_ID_SETTING_TVOUT);
  1427.     GetSequenceStringIds(MENU_ID_SETTING_TVOUT, item_list);
  1428.     GetSequenceImageIds(MENU_ID_SETTING_TVOUT, item_icons);
  1429.     SetParentHandler(MENU_ID_SETTING_TVOUT);
  1430.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1431.     for (i = 0; i < num_of_items; i++)
  1432.     {
  1433.         item_icons[i] = (U16) (IMG_GLOBAL_L1 + i);
  1434.     }
  1435.     for (i = 0; i < num_of_items; i++)
  1436.     {
  1437.         popup_list[i] = NULL;
  1438.     }
  1439.     ConstructHintsList(MENU_ID_SETTING_TVOUT, popup_list);
  1440.     ShowCategory52Screen(
  1441.         STR_ID_SETTING_TVOUT,
  1442.         MAIN_MENU_TITLE_SETTINGS_ICON,
  1443.         STR_GLOBAL_OK,
  1444.         IMG_GLOBAL_OK,
  1445.         STR_GLOBAL_BACK,
  1446.         IMG_GLOBAL_BACK,
  1447.         num_of_items,
  1448.         item_list,
  1449.         item_icons,
  1450.         (U8 **) popup_list,
  1451.         0,
  1452.         0,
  1453.         gui_buffer);
  1454.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1455.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1456. }
  1457. #endif /* __MMI_TVOUT__ */ 
  1458. /*****************************************************************************
  1459.  * FUNCTION
  1460.  *  mmi_phnset_highlight_tvout_setting
  1461.  * DESCRIPTION
  1462.  *  highlight tvout setting item
  1463.  * PARAMETERS
  1464.  *  void
  1465.  * RETURNS
  1466.  *  void
  1467.  *****************************************************************************/
  1468. #ifdef __MMI_TVOUT__
  1469. static void mmi_phnset_highlight_tvout_setting(void)
  1470. {
  1471.     /*----------------------------------------------------------------*/
  1472.     /* Local Variables                                                */
  1473.     /*----------------------------------------------------------------*/
  1474.     /*----------------------------------------------------------------*/
  1475.     /* Code Body                                                      */
  1476.     /*----------------------------------------------------------------*/
  1477.     SetLeftSoftkeyFunction(mmi_phnset_entry_tvout_setting_screen, KEY_EVENT_UP);
  1478.     SetKeyHandler(mmi_phnset_entry_tvout_setting_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1479.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1480.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1481. }
  1482. #endif /* __MMI_TVOUT__ */ 
  1483. /*****************************************************************************
  1484.  * FUNCTION
  1485.  *  mmi_phnset_highlight_tvout_adjust
  1486.  * DESCRIPTION
  1487.  *  highlight tvout adjust item
  1488.  * PARAMETERS
  1489.  *  void
  1490.  * RETURNS
  1491.  *  void
  1492.  *****************************************************************************/
  1493. #ifdef __MMI_TVOUT__
  1494. static void mmi_phnset_highlight_tvout_adjust(void)
  1495. {
  1496.     /*----------------------------------------------------------------*/
  1497.     /* Local Variables                                                */
  1498.     /*----------------------------------------------------------------*/
  1499.     /*----------------------------------------------------------------*/
  1500.     /* Code Body                                                      */
  1501.     /*----------------------------------------------------------------*/
  1502.     SetLeftSoftkeyFunction(mmi_phnset_entry_tvout_adjust_screen, KEY_EVENT_UP);
  1503.     SetKeyHandler(mmi_phnset_entry_tvout_adjust_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1504.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1505.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1506. }
  1507. #endif /* __MMI_TVOUT__ */ 
  1508. /*****************************************************************************
  1509.  * FUNCTION
  1510.  *  mmi_phnset_tvout_set_adjust
  1511.  * DESCRIPTION
  1512.  *  set tv out style
  1513.  * PARAMETERS
  1514.  *  void
  1515.  * RETURNS
  1516.  *  void
  1517.  *****************************************************************************/
  1518. #ifdef __MMI_TVOUT__
  1519. static void mmi_phnset_tvout_set_adjust(void)
  1520. {
  1521.     /*----------------------------------------------------------------*/
  1522.     /* Local Variables                                                */
  1523.     /*----------------------------------------------------------------*/
  1524.     S16 error;
  1525.     U16 y_gamma;
  1526.     U16 u;
  1527.     U16 v;
  1528.     /*----------------------------------------------------------------*/
  1529.     /* Code Body                                                      */
  1530.     /*----------------------------------------------------------------*/
  1531.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1532.     DeleteNHistory(1);
  1533.     g_phnset_cntx_p->tvout_y_gamma = g_phnset_cntx_p->tvout_tmp_y_gamma;
  1534.     g_phnset_cntx_p->tvout_u = g_phnset_cntx_p->tvout_tmp_u;
  1535.     g_phnset_cntx_p->tvout_v = g_phnset_cntx_p->tvout_tmp_v;
  1536.     /* write Y/U/V setting */
  1537.     y_gamma = g_phnset_cntx_p->tvout_y_gamma;
  1538.     u = g_phnset_cntx_p->tvout_u;
  1539.     v = g_phnset_cntx_p->tvout_v;
  1540.     WriteValue(NVRAM_SETTING_TVOUT_Y_GAMMA, &y_gamma, DS_SHORT, &error);
  1541.     WriteValue(NVRAM_SETTING_TVOUT_U, &u, DS_SHORT, &error);
  1542.     WriteValue(NVRAM_SETTING_TVOUT_V, &v, DS_SHORT, &error);
  1543. }
  1544. #endif /* __MMI_TVOUT__ */ 
  1545. /*****************************************************************************
  1546.  * FUNCTION
  1547.  *  mmi_phnset_tvout_cancel_adjust
  1548.  * DESCRIPTION
  1549.  *  cancel tv out adjust
  1550.  * PARAMETERS
  1551.  *  void
  1552.  * RETURNS
  1553.  *  void
  1554.  *****************************************************************************/
  1555. #ifdef __MMI_TVOUT__
  1556. static void mmi_phnset_tvout_cancel_adjust(void)
  1557. {
  1558.     /*----------------------------------------------------------------*/
  1559.     /* Local Variables                                                */
  1560.     /*----------------------------------------------------------------*/
  1561.     /*----------------------------------------------------------------*/
  1562.     /* Code Body                                                      */
  1563.     /*----------------------------------------------------------------*/
  1564.     /* restore default */
  1565.     mdi_tvout_adjust_y_gamma((U16) g_phnset_cntx.tvout_y_gamma);
  1566.     mdi_tvout_adjust_u((U16) g_phnset_cntx.tvout_u);
  1567.     mdi_tvout_adjust_v((U16) g_phnset_cntx.tvout_v);
  1568.     GoBackHistory();
  1569. }
  1570. #endif /* __MMI_TVOUT__ */ 
  1571. /*****************************************************************************
  1572.  * FUNCTION
  1573.  *  mmi_phnset_tvout_setting_set_value
  1574.  * DESCRIPTION
  1575.  *  set tv out format
  1576.  * PARAMETERS
  1577.  *  void
  1578.  * RETURNS
  1579.  *  void
  1580.  *****************************************************************************/
  1581. #ifdef __MMI_TVOUT__
  1582. static void mmi_phnset_tvout_setting_set_value(void)
  1583. {
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Local Variables                                                */
  1586.     /*----------------------------------------------------------------*/
  1587.     S16 error;
  1588.     /*----------------------------------------------------------------*/
  1589.     /* Code Body                                                      */
  1590.     /*----------------------------------------------------------------*/
  1591.     g_phnset_cntx_p->tvout_format = g_phnset_cntx_p->tvout_inline_format;
  1592.     g_phnset_cntx_p->tvout_aud_path = g_phnset_cntx_p->tvout_inline_aud_path;
  1593.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1594.     DeleteNHistory(1);
  1595.     /* write back to NVRAM */
  1596.     WriteValue(NVRAM_SETTING_TVOUT_FORMAT, &g_phnset_cntx_p->tvout_format, DS_SHORT, &error);
  1597.     WriteValue(NVRAM_SETTING_TVOUT_AUD_PATH, &g_phnset_cntx_p->tvout_aud_path, DS_SHORT, &error);
  1598.     /* set format to driver */
  1599.     if (g_phnset_cntx_p->tvout_format == MMI_SETTING_TVOUT_FORMAT_NTSC)
  1600.     {
  1601.         mdi_tvout_set_format(MDI_TV_OUTPUT_FORMAT_NTSC);
  1602.     }
  1603.     else if (g_phnset_cntx_p->tvout_format == MMI_SETTING_TVOUT_FORMAT_PAL)
  1604.     {
  1605.         mdi_tvout_set_format(MDI_TV_OUTPUT_FORMAT_PAL);
  1606.     }
  1607.     else
  1608.     {
  1609.         MMI_ASSERT(0);
  1610.     }
  1611.     /* set audio path to driver */
  1612.     if (g_phnset_cntx_p->tvout_aud_path == MMI_SETTING_TVOUT_AUD_PATH_BOTH)
  1613.     {
  1614.         mdi_tvout_set_aud_path(MDI_TV_AUD_PATH_BOTH);
  1615.     }
  1616.     else if (g_phnset_cntx_p->tvout_aud_path == MMI_SETTING_TVOUT_AUD_PATH_TV)
  1617.     {
  1618.         mdi_tvout_set_aud_path(MDI_TV_AUD_PATH_TV);
  1619.     }
  1620.     else
  1621.     {
  1622.         MMI_ASSERT(0);
  1623.     }
  1624. }
  1625. #endif /* __MMI_TVOUT__ */ 
  1626. /*****************************************************************************
  1627.  * FUNCTION
  1628.  *  mmi_phnset_exit_tvout_setting_screen
  1629.  * DESCRIPTION
  1630.  *  exit phone setup tv out setting screen
  1631.  * PARAMETERS
  1632.  *  void
  1633.  * RETURNS
  1634.  *  void
  1635.  *****************************************************************************/
  1636. #ifdef __MMI_TVOUT__
  1637. void mmi_phnset_exit_tvout_setting_screen(void)
  1638. {
  1639.     /*----------------------------------------------------------------*/
  1640.     /* Local Variables                                                */
  1641.     /*----------------------------------------------------------------*/
  1642.     history h;
  1643.     U16 input_buffer_size;
  1644.     /*----------------------------------------------------------------*/
  1645.     /* Code Body                                                      */
  1646.     /*----------------------------------------------------------------*/
  1647.     CloseCategory57Screen();
  1648.     h.scrnID = SCR_ID_SETTING_TVOUT_SETTING;
  1649.     h.entryFuncPtr = mmi_phnset_entry_tvout_setting_screen;
  1650.     GetCategoryHistory(h.guiBuffer);
  1651.     input_buffer_size = (U16) GetCategory57DataSize();
  1652.     GetCategory57Data((U8*) h.inputBuffer);
  1653.     AddNHistory(h, input_buffer_size);
  1654. }
  1655. #endif /* __MMI_TVOUT__ */ 
  1656. /*****************************************************************************
  1657.  * FUNCTION
  1658.  *  mmi_phnset_tvout_setting_inline_highlight_hdlr
  1659.  * DESCRIPTION
  1660.  *  tvout settint inline hilight handler
  1661.  * PARAMETERS
  1662.  *  index       [IN]        Index
  1663.  * RETURNS
  1664.  *  void
  1665.  *****************************************************************************/
  1666. #ifdef __MMI_TVOUT__
  1667. static void mmi_phnset_tvout_setting_inline_highlight_hdlr(S32 index)
  1668. {
  1669.     /*----------------------------------------------------------------*/
  1670.     /* Local Variables                                                */
  1671.     /*----------------------------------------------------------------*/
  1672.     /*----------------------------------------------------------------*/
  1673.     /* Code Body                                                      */
  1674.     /*----------------------------------------------------------------*/
  1675.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1676.     SetCategory57LeftSoftkeyFunction(mmi_phnset_tvout_setting_set_value);
  1677. }
  1678. #endif /* __MMI_TVOUT__ */ 
  1679. /*****************************************************************************
  1680.  * FUNCTION
  1681.  *  mmi_phnset_entry_tvout_setting_screen
  1682.  * DESCRIPTION
  1683.  *  entry phone setup tv out setting screen
  1684.  * PARAMETERS
  1685.  *  void
  1686.  * RETURNS
  1687.  *  void
  1688.  *****************************************************************************/
  1689. #ifdef __MMI_TVOUT__
  1690. static void mmi_phnset_entry_tvout_setting_screen(void)
  1691. {
  1692.     /*----------------------------------------------------------------*/
  1693.     /* Local Variables                                                */
  1694.     /*----------------------------------------------------------------*/
  1695.     U8 *gui_buffer;
  1696.     U8 *input_buffer;
  1697.     U16 input_buffer_size;
  1698.     S32 item_offset = 0;
  1699.     U16 list_of_icons[4];
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Code Body                                                      */
  1702.     /*----------------------------------------------------------------*/
  1703.     EntryNewScreen(SCR_ID_SETTING_TVOUT_SETTING, mmi_phnset_exit_tvout_setting_screen, NULL, NULL);
  1704.     gui_buffer = GetCurrGuiBuffer(SCR_ID_SETTING_TVOUT_SETTING);
  1705.     input_buffer = GetCurrNInputBuffer(SCR_ID_SETTING_TVOUT_SETTING, &input_buffer_size);
  1706.     /* start of Category 57 */
  1707.     InitializeCategory57Screen();
  1708.     /* Format */
  1709.     g_phnset_cntx_p->tvout_format_str_list[0] = GetString((U16) (STR_ID_SETTING_TVOUT_FORMAT_PAL));
  1710.     g_phnset_cntx_p->tvout_format_str_list[1] = GetString((U16) (STR_ID_SETTING_TVOUT_FORMAT_NTSC));
  1711.     g_phnset_cntx_p->tvout_inline_format = g_phnset_cntx_p->tvout_format;
  1712.     SetInlineItemCaption(&wgui_inline_items[item_offset++], (PU8) GetString(STR_ID_SETTING_TVOUT_FORMAT));
  1713.     SetInlineItemActivation(&wgui_inline_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1714.     SetInlineItemSelect(
  1715.         &wgui_inline_items[item_offset++],
  1716.         2,
  1717.         (PU8*) g_phnset_cntx_p->tvout_format_str_list,
  1718.         &g_phnset_cntx_p->tvout_inline_format);
  1719.     /* Audio Path */
  1720.     g_phnset_cntx_p->tvout_aud_path_str_list[0] = GetString((U16) (STR_ID_SETTING_TVOUT_AUD_PATH_BOTH));
  1721.     g_phnset_cntx_p->tvout_aud_path_str_list[1] = GetString((U16) (STR_ID_SETTING_TVOUT_AUD_PATH_TV));
  1722.     g_phnset_cntx_p->tvout_inline_aud_path = g_phnset_cntx_p->tvout_aud_path;
  1723.     SetInlineItemCaption(&wgui_inline_items[item_offset++], (PU8) GetString(STR_ID_SETTING_TVOUT_AUD_PATH));
  1724.     SetInlineItemActivation(&wgui_inline_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1725.     SetInlineItemSelect(
  1726.         &wgui_inline_items[item_offset++],
  1727.         2,
  1728.         (PU8*) g_phnset_cntx_p->tvout_aud_path_str_list,
  1729.         &g_phnset_cntx_p->tvout_inline_aud_path);
  1730.     if (input_buffer != NULL)
  1731.     {
  1732.         SetCategory57Data(wgui_inline_items, item_offset, input_buffer);
  1733.     }
  1734.     list_of_icons[0] = IMG_GLOBAL_L1;
  1735.     list_of_icons[1] = 0;
  1736.     list_of_icons[2] = IMG_GLOBAL_L2;
  1737.     list_of_icons[3] = 0;
  1738.     RegisterHighlightHandler(mmi_phnset_tvout_setting_inline_highlight_hdlr);
  1739.     ShowCategory57Screen(
  1740.         STR_ID_SETTING_TVOUT_SETTING,
  1741.         MAIN_MENU_TITLE_SETTINGS_ICON,
  1742.         STR_GLOBAL_OK,
  1743.         IMG_GLOBAL_OK,
  1744.         STR_GLOBAL_BACK,
  1745.         IMG_GLOBAL_BACK,
  1746.         item_offset,
  1747.         list_of_icons,
  1748.         wgui_inline_items,
  1749.         0,
  1750.         gui_buffer);
  1751.     /* LSK */
  1752.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1753.     SetCategory57LeftSoftkeyFunction(mmi_phnset_tvout_setting_set_value);
  1754.     /* RSK */
  1755.     DisableCategory57ScreenDone();
  1756.     SetCategory57RightSoftkeyFunctions(GoBackHistory, GoBackHistory);
  1757. }
  1758. #endif /* __MMI_TVOUT__ */ 
  1759. /*****************************************************************************
  1760.  * FUNCTION
  1761.  *  mmi_phnset_entry_tvout_adjust_screen
  1762.  * DESCRIPTION
  1763.  *  entry phone setup tv out adjust screen
  1764.  * PARAMETERS
  1765.  *  void
  1766.  * RETURNS
  1767.  *  void
  1768.  *****************************************************************************/
  1769. #ifdef __MMI_TVOUT__
  1770. static void mmi_phnset_entry_tvout_adjust_screen(void)
  1771. {
  1772.     /*----------------------------------------------------------------*/
  1773.     /* Local Variables                                                */
  1774.     /*----------------------------------------------------------------*/
  1775.     U8 *str_list[3];
  1776.     S32 l_limit[3], u_limit[3];
  1777.     S32 *curr_value[3];
  1778.     void (*cb_func[3]) (S32 value);
  1779.     /*----------------------------------------------------------------*/
  1780.     /* Code Body                                                      */
  1781.     /*----------------------------------------------------------------*/
  1782.     EntryNewScreen(SCR_ID_SETTING_TVOUT_ADJUST, NULL, mmi_phnset_entry_tvout_adjust_screen, NULL);
  1783.     g_phnset_cntx_p->tvout_tmp_y_gamma = g_phnset_cntx_p->tvout_y_gamma;
  1784.     g_phnset_cntx_p->tvout_tmp_u = g_phnset_cntx_p->tvout_u;
  1785.     g_phnset_cntx_p->tvout_tmp_v = g_phnset_cntx_p->tvout_v;
  1786.     /* Y */
  1787.     str_list[0] = (U8*) get_string(STR_ID_SETTING_TVOUT_ADJUST_Y_GAMMA);
  1788.     l_limit[0] = MDI_TV_OUTPUT_GAMMA_1;
  1789.     u_limit[0] = MDI_TV_OUTPUT_GAMMA_5;
  1790.     curr_value[0] = (S32*) (&g_phnset_cntx_p->tvout_tmp_y_gamma);
  1791.     cb_func[0] = mmi_phnset_tvout_adjust_y_gamma_callback;
  1792.     /* U */
  1793.     str_list[1] = (U8*) get_string(STR_ID_SETTING_TVOUT_ADJUST_U);
  1794.     l_limit[1] = 0;
  1795.     u_limit[1] = 255;
  1796.     curr_value[1] = (S32*) (&g_phnset_cntx_p->tvout_tmp_u);
  1797.     cb_func[1] = mmi_phnset_tvout_adjust_u_callback;
  1798.     /* V */
  1799.     str_list[2] = (U8*) get_string(STR_ID_SETTING_TVOUT_ADJUST_V);
  1800.     l_limit[2] = 0;
  1801.     u_limit[2] = 255;
  1802.     curr_value[2] = (S32*) (&g_phnset_cntx_p->tvout_tmp_v);
  1803.     cb_func[2] = mmi_phnset_tvout_adjust_v_callback;
  1804.     ShowCategory88Screen(
  1805.         STR_ID_SETTING_TVOUT_ADJUST,
  1806.         MAIN_MENU_TITLE_SETTINGS_ICON,
  1807.         STR_GLOBAL_OK,
  1808.         IMG_GLOBAL_OK,
  1809.         STR_GLOBAL_BACK,
  1810.         IMG_GLOBAL_BACK,
  1811.         0,
  1812.         3,
  1813.         str_list,
  1814.         l_limit,
  1815.         u_limit,
  1816.         curr_value,
  1817.         cb_func,
  1818.         NULL);
  1819.     SetRightSoftkeyFunction(mmi_phnset_tvout_cancel_adjust, KEY_EVENT_UP);
  1820.     SetLeftSoftkeyFunction(mmi_phnset_tvout_set_adjust, KEY_EVENT_UP);
  1821. }
  1822. #endif /* __MMI_TVOUT__ */ 
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  mmi_phnset_tvout_adjust_y_gamma_callback
  1826.  * DESCRIPTION
  1827.  *  adjust y gamma callback
  1828.  * PARAMETERS
  1829.  *  value       [IN]        Adjusted value
  1830.  * RETURNS
  1831.  *  void
  1832.  *****************************************************************************/
  1833. #ifdef __MMI_TVOUT__
  1834. static void mmi_phnset_tvout_adjust_y_gamma_callback(S32 value)
  1835. {
  1836.     /*----------------------------------------------------------------*/
  1837.     /* Local Variables                                                */
  1838.     /*----------------------------------------------------------------*/
  1839.     /*----------------------------------------------------------------*/
  1840.     /* Code Body                                                      */
  1841.     /*----------------------------------------------------------------*/
  1842.     mdi_tvout_adjust_y_gamma((U16) value);
  1843.     g_phnset_cntx_p->tvout_tmp_y_gamma = value;
  1844. }
  1845. #endif /* __MMI_TVOUT__ */ 
  1846. /*****************************************************************************
  1847.  * FUNCTION
  1848.  *  mmi_phnset_tvout_adjust_u_callback
  1849.  * DESCRIPTION
  1850.  *  adjust u callback
  1851.  * PARAMETERS
  1852.  *  value       [IN]        Adjusted value
  1853.  * RETURNS
  1854.  *  void
  1855.  *****************************************************************************/
  1856. #ifdef __MMI_TVOUT__
  1857. static void mmi_phnset_tvout_adjust_u_callback(S32 value)
  1858. {
  1859.     /*----------------------------------------------------------------*/
  1860.     /* Local Variables                                                */
  1861.     /*----------------------------------------------------------------*/
  1862.     /*----------------------------------------------------------------*/
  1863.     /* Code Body                                                      */
  1864.     /*----------------------------------------------------------------*/
  1865.     mdi_tvout_adjust_u((U16) value);
  1866.     g_phnset_cntx_p->tvout_tmp_u = value;
  1867. }
  1868. #endif /* __MMI_TVOUT__ */ 
  1869. /*****************************************************************************
  1870.  * FUNCTION
  1871.  *  mmi_phnset_tvout_adjust_v_callback
  1872.  * DESCRIPTION
  1873.  *  adjust u callback
  1874.  * PARAMETERS
  1875.  *  value       [IN]        Adjusted value
  1876.  * RETURNS
  1877.  *  void
  1878.  *****************************************************************************/
  1879. #ifdef __MMI_TVOUT__
  1880. static void mmi_phnset_tvout_adjust_v_callback(S32 value)
  1881. {
  1882.     /*----------------------------------------------------------------*/
  1883.     /* Local Variables                                                */
  1884.     /*----------------------------------------------------------------*/
  1885.     /*----------------------------------------------------------------*/
  1886.     /* Code Body                                                      */
  1887.     /*----------------------------------------------------------------*/
  1888.     mdi_tvout_adjust_v((U16) value);
  1889.     g_phnset_cntx_p->tvout_tmp_v = value;
  1890. }
  1891. #endif /* __MMI_TVOUT__ */ 
  1892. /*****************************************************************************
  1893.  * FUNCTION
  1894.  *  mmi_phnset_tvout_init_setting
  1895.  * DESCRIPTION
  1896.  *  init tvout
  1897.  * PARAMETERS
  1898.  *  void
  1899.  * RETURNS
  1900.  *  void
  1901.  *****************************************************************************/
  1902. #ifdef __MMI_TVOUT__
  1903. void mmi_phnset_tvout_init_setting(void)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     S16 error;
  1909.     U16 y_gamma;
  1910.     U16 u;
  1911.     U16 v;
  1912.     /*----------------------------------------------------------------*/
  1913.     /* Code Body                                                      */
  1914.     /*----------------------------------------------------------------*/
  1915.     if (g_phnset_cntx_p->is_tvout_init)
  1916.     {
  1917.         /* if already init, return */
  1918.         return;
  1919.     }
  1920.     
  1921.     /* load format setting */
  1922.     ReadValue(NVRAM_SETTING_TVOUT_FORMAT, &g_phnset_cntx_p->tvout_format, DS_SHORT, &error);
  1923.     /* not init */
  1924.     if (g_phnset_cntx_p->tvout_format == 0xffff)
  1925.     {
  1926.         g_phnset_cntx_p->tvout_format = MMI_SETTING_TVOUT_FORMAT_NTSC;
  1927.         WriteValue(NVRAM_SETTING_TVOUT_FORMAT, &g_phnset_cntx_p->tvout_format, DS_SHORT, &error);
  1928.     }
  1929.     /* set to mdi tvout */
  1930.     if (g_phnset_cntx_p->tvout_format == MMI_SETTING_TVOUT_FORMAT_NTSC)
  1931.     {
  1932.         mdi_tvout_set_format(MDI_TV_OUTPUT_FORMAT_NTSC);
  1933.     }
  1934.     else if (g_phnset_cntx_p->tvout_format == MMI_SETTING_TVOUT_FORMAT_PAL)
  1935.     {
  1936.         mdi_tvout_set_format(MDI_TV_OUTPUT_FORMAT_PAL);
  1937.     }
  1938.     else
  1939.     {
  1940.         MMI_ASSERT(0);
  1941.     }
  1942.     /* audio path */
  1943.     ReadValue(NVRAM_SETTING_TVOUT_AUD_PATH, &g_phnset_cntx_p->tvout_aud_path, DS_SHORT, &error);
  1944.     /* not init */
  1945.     if (g_phnset_cntx_p->tvout_aud_path == 0xffff)
  1946.     {
  1947.         g_phnset_cntx_p->tvout_aud_path = MMI_SETTING_TVOUT_AUD_PATH_TV;
  1948.         WriteValue(NVRAM_SETTING_TVOUT_AUD_PATH, &g_phnset_cntx_p->tvout_aud_path, DS_SHORT, &error);
  1949.     }
  1950.     if (g_phnset_cntx_p->tvout_aud_path == MMI_SETTING_TVOUT_AUD_PATH_BOTH)
  1951.     {
  1952.         mdi_tvout_set_aud_path(MDI_TV_AUD_PATH_BOTH);
  1953.     }
  1954.     else if (g_phnset_cntx_p->tvout_aud_path == MMI_SETTING_TVOUT_AUD_PATH_TV)
  1955.     {
  1956.         mdi_tvout_set_aud_path(MDI_TV_AUD_PATH_TV);
  1957.     }
  1958.     else
  1959.     {
  1960.         MMI_ASSERT(0);
  1961.     }
  1962.     /* load Y/U/V setting */
  1963.     ReadValue(NVRAM_SETTING_TVOUT_Y_GAMMA, &y_gamma, DS_SHORT, &error);
  1964.     ReadValue(NVRAM_SETTING_TVOUT_U, &u, DS_SHORT, &error);
  1965.     ReadValue(NVRAM_SETTING_TVOUT_V, &v, DS_SHORT, &error);
  1966.     /* not init */
  1967.     if (y_gamma == 0xffff)
  1968.     {
  1969.         g_phnset_cntx_p->tvout_y_gamma = MDI_TV_OUTPUT_GAMMA_3;
  1970.         /* recommanded value from driver */
  1971.         g_phnset_cntx_p->tvout_u = 0x77;    /* range 0-255 */
  1972.         g_phnset_cntx_p->tvout_v = 0x90;    /* range 0-255 */
  1973.     }
  1974.     else
  1975.     {
  1976.         g_phnset_cntx_p->tvout_y_gamma = y_gamma;
  1977.         g_phnset_cntx_p->tvout_u = u;   /* range 0-255 */
  1978.         g_phnset_cntx_p->tvout_v = v;   /* range 0-255 */
  1979.     }
  1980.     g_phnset_cntx_p->is_tvout_connected = FALSE;
  1981.     g_phnset_cntx_p->is_tvout_enable_sleep_in = TRUE;   /* default allow tv out to sleep in */
  1982.     g_phnset_cntx_p->is_tvout_sleep_in = FALSE;
  1983.     /* init done */
  1984.     g_phnset_cntx_p->is_tvout_init = TRUE;  
  1985.    
  1986. }
  1987. #endif /* __MMI_TVOUT__ */
  1988. /*****************************************************************************
  1989.  * FUNCTION
  1990.  *  mmi_phnset_tvout_event_hdlr_before_pwron
  1991.  * DESCRIPTION
  1992.  *  event handler before pwron
  1993.  * PARAMETERS
  1994.  *  result  [IN]  connect result 
  1995.  * RETURNS
  1996.  *  void
  1997.  *****************************************************************************/
  1998. #ifdef __MMI_TVOUT__
  1999. static void mmi_phnset_tvout_event_hdlr_before_pwron(MDI_RESULT result)
  2000. {
  2001.     /*----------------------------------------------------------------*/
  2002.     /* Local Variables                                                */
  2003.     /*----------------------------------------------------------------*/
  2004.   
  2005.     /*----------------------------------------------------------------*/
  2006.     /* Code Body                                                      */
  2007.     /*----------------------------------------------------------------*/
  2008.     /* init setting values */
  2009.     mmi_phnset_tvout_init_setting();
  2010.     if (result == MDI_RES_TV_ENABLE)
  2011.     {
  2012.         g_phnset_cntx_p->is_tvout_connected = TRUE;
  2013.     }
  2014.     else if (result == MDI_RES_TV_DISABLE)
  2015.     {
  2016.         g_phnset_cntx_p->is_tvout_connected = FALSE;      
  2017.     }
  2018.     else
  2019.     {
  2020.         MMI_ASSERT(0);      
  2021.     }
  2022.    
  2023. }
  2024. #endif /* __MMI_TVOUT__ */
  2025. /*****************************************************************************
  2026.  * FUNCTION
  2027.  *  mmi_phnset_early_init_tvout_before_pwron
  2028.  * DESCRIPTION
  2029.  *  init tvout before poweron indication
  2030.  * PARAMETERS
  2031.  *  void
  2032.  * RETURNS
  2033.  *  void
  2034.  *****************************************************************************/
  2035. #ifdef __MMI_TVOUT__
  2036. void mmi_phnset_early_init_tvout_before_pwron()
  2037. {
  2038.     /*----------------------------------------------------------------*/
  2039.     /* Local Variables                                                */
  2040.     /*----------------------------------------------------------------*/
  2041.   
  2042.     /*----------------------------------------------------------------*/
  2043.     /* Code Body                                                      */
  2044.     /*----------------------------------------------------------------*/
  2045.     mdi_tvout_early_init_before_pwoeron(mmi_phnset_tvout_event_hdlr_before_pwron);
  2046. }
  2047. #endif /* __MMI_TVOUT__ */
  2048. /*****************************************************************************
  2049.  * FUNCTION
  2050.  *  mmi_phnset_init_tvout
  2051.  * DESCRIPTION
  2052.  *  init tvout
  2053.  * PARAMETERS
  2054.  *  void
  2055.  * RETURNS
  2056.  *  void
  2057.  *****************************************************************************/
  2058. #ifdef __MMI_TVOUT__
  2059. void mmi_phnset_init_tvout(void)
  2060. {
  2061.     /*----------------------------------------------------------------*/
  2062.     /* Local Variables                                                */
  2063.     /*----------------------------------------------------------------*/
  2064.     /*----------------------------------------------------------------*/
  2065.     /* Code Body                                                      */
  2066.     /*----------------------------------------------------------------*/
  2067.     /* always need to init mdi to register callback/message handler */
  2068.     mdi_tvout_init(mmi_phnset_tvout_event_hdlr);
  2069.     mmi_phnset_tvout_init_setting();
  2070. }
  2071. #endif /* __MMI_TVOUT__ */ 
  2072. /*****************************************************************************
  2073.  * FUNCTION
  2074.  *  mmi_phnset_tvout_event_hdlr
  2075.  * DESCRIPTION
  2076.  *  init tvout
  2077.  * PARAMETERS
  2078.  *  result      [IN]        Event result
  2079.  * RETURNS
  2080.  *  void
  2081.  *****************************************************************************/
  2082. #ifdef __MMI_TVOUT__
  2083. void mmi_phnset_tvout_event_hdlr(MDI_RESULT result)
  2084. {
  2085.     /*----------------------------------------------------------------*/
  2086.     /* Local Variables                                                */
  2087.     /*----------------------------------------------------------------*/
  2088.     MDI_RESULT ret;
  2089.     /*----------------------------------------------------------------*/
  2090.     /* Code Body                                                      */
  2091.     /*----------------------------------------------------------------*/
  2092.     if (result == MDI_RES_TV_ENABLE)
  2093.     {
  2094.         if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
  2095.         {
  2096.             DisplayPopup(
  2097.                 (PU8) GetString(STR_ID_SETTING_TVOUT_PLUG_IN),
  2098.                 IMG_ID_POPUP_TVOUT,
  2099.                 1,
  2100.                 ST_NOTIFYDURATION,
  2101.                 SUCCESS_TONE);
  2102.         }
  2103.         /* set adjustment */
  2104.         mdi_tvout_adjust_y_gamma((U16) g_phnset_cntx.tvout_y_gamma);
  2105.         mdi_tvout_adjust_u((U16) g_phnset_cntx.tvout_u);
  2106.         mdi_tvout_adjust_v((U16) g_phnset_cntx.tvout_v);
  2107.         /* start mode1 */
  2108.         mdi_tvout_set_mode(
  2109.             MDI_TV_MODE_LCD_SCR,
  2110.             0,  /* layer_width */
  2111.             0); /* layer_height */
  2112.         ret = mdi_tvout_start();
  2113.         if (ret < 0)
  2114.         {
  2115.             if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
  2116.             {
  2117.                 DisplayPopup(
  2118.                     (PU8) GetString(STR_ID_SETTING_TVOUT_NOT_READY),
  2119.                     IMG_GLOBAL_ERROR,
  2120.                     1,
  2121.                     ST_NOTIFYDURATION,
  2122.                     WARNING_TONE);
  2123.             }
  2124.             return;
  2125.         }
  2126.         else
  2127.         {
  2128.             /* if in poweron period and playing video, need stop and start again */
  2129.             if (mmi_bootup_is_playing_power_on_animation())
  2130.             {
  2131.             #if defined(__MMI_VIDEO_PLAYER__)
  2132.                 mmi_pwron_pause_video();
  2133.                 mmi_pwron_resume_video();
  2134.             #endif /* defined(__MMI_VIDEO_PLAYER__) */
  2135.             }
  2136.         }
  2137.         g_phnset_cntx_p->is_tvout_connected = TRUE;
  2138.     }
  2139.     else if (result == MDI_RES_TV_DISABLE)
  2140.     {
  2141.         if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
  2142.         {
  2143.             DisplayPopup(
  2144.                 (PU8) GetString(STR_ID_SETTING_TVOUT_PLUG_OUT),
  2145.                 IMG_ID_POPUP_TVOUT,
  2146.                 1,
  2147.                 ST_NOTIFYDURATION,
  2148.                 SUCCESS_TONE);
  2149.         }
  2150.         /* if in poweron period and playing video, need stop and start again */
  2151.         if (mmi_bootup_is_playing_power_on_animation())
  2152.         {
  2153.         #if defined(__MMI_VIDEO_PLAYER__)            
  2154.             mmi_pwron_pause_video();
  2155.         #endif /* defined(__MMI_VIDEO_PLAYER__) */            
  2156.         }
  2157.         mdi_tvout_stop();
  2158.         /* if in poweron period and playing video, need stop and start again */
  2159.         if (mmi_bootup_is_playing_power_on_animation())
  2160.         {
  2161.         #if defined(__MMI_VIDEO_PLAYER__)                        
  2162.             mmi_pwron_resume_video();
  2163.         #endif /* defined(__MMI_VIDEO_PLAYER__) */                        
  2164.         }
  2165.         g_phnset_cntx_p->is_tvout_connected = FALSE;
  2166.     }
  2167.     else
  2168.     {
  2169.         MMI_ASSERT(0);
  2170.     }
  2171. }
  2172. #endif /* __MMI_TVOUT__ */ 
  2173. /*****************************************************************************
  2174.  * FUNCTION
  2175.  *  mmi_phnset_tvout_check_pwron_start
  2176.  * DESCRIPTION
  2177.  *  check need start tvout when power on
  2178.  * PARAMETERS
  2179.  *  void
  2180.  * RETURNS
  2181.  *  void
  2182.  *****************************************************************************/
  2183. #ifdef __MMI_TVOUT__
  2184. void mmi_phnset_tvout_check_pwron_start(void)
  2185. {
  2186.     /*----------------------------------------------------------------*/
  2187.     /* Local Variables                                                */
  2188.     /*----------------------------------------------------------------*/
  2189.     /*----------------------------------------------------------------*/
  2190.     /* Code Body                                                      */
  2191.     /*----------------------------------------------------------------*/
  2192.     if (g_phnset_cntx_p->is_tvout_connected && FALSE == mdi_tvout_is_enable())
  2193.     {  
  2194.         /* is connected */
  2195.         mmi_phnset_tvout_event_hdlr(MDI_RES_TV_ENABLE);   
  2196.     }
  2197. }
  2198. #endif /* __MMI_TVOUT__ */ 
  2199. /*****************************************************************************
  2200.  * FUNCTION
  2201.  *  mmi_phnset_tvout_lcd_sleepin_handler
  2202.  * DESCRIPTION
  2203.  *  lcd sleep in handler
  2204.  * PARAMETERS
  2205.  *  void
  2206.  * RETURNS
  2207.  *  void
  2208.  *****************************************************************************/
  2209. #ifdef __MMI_TVOUT__
  2210. void mmi_phnset_tvout_lcd_sleepin_handler(void)
  2211. {
  2212.     /*----------------------------------------------------------------*/
  2213.     /* Local Variables                                                */
  2214.     /*----------------------------------------------------------------*/
  2215.     /*----------------------------------------------------------------*/
  2216.     /* Code Body                                                      */
  2217.     /*----------------------------------------------------------------*/
  2218.     if (g_phnset_cntx_p->is_tvout_connected && g_phnset_cntx_p->is_tvout_enable_sleep_in)
  2219.     {
  2220.         g_phnset_cntx_p->is_tvout_sleep_in = TRUE;
  2221.         mdi_tvout_sleep_in();
  2222.     }
  2223. }
  2224. #endif /* __MMI_TVOUT__ */ 
  2225. /*****************************************************************************
  2226.  * FUNCTION
  2227.  *  mmi_phnset_tvout_lcd_sleepout_handler
  2228.  * DESCRIPTION
  2229.  *  lcd sleep out handler
  2230.  * PARAMETERS
  2231.  *  void
  2232.  * RETURNS
  2233.  *  void
  2234.  *****************************************************************************/
  2235. #ifdef __MMI_TVOUT__
  2236. void mmi_phnset_tvout_lcd_sleepout_handler(void)
  2237. {
  2238.     /*----------------------------------------------------------------*/
  2239.     /* Local Variables                                                */
  2240.     /*----------------------------------------------------------------*/
  2241.     /*----------------------------------------------------------------*/
  2242.     /* Code Body                                                      */
  2243.     /*----------------------------------------------------------------*/
  2244.     if (g_phnset_cntx_p->is_tvout_connected && g_phnset_cntx_p->is_tvout_sleep_in)
  2245.     {
  2246.         g_phnset_cntx_p->is_tvout_sleep_in = FALSE;
  2247.         mdi_tvout_sleep_out();
  2248.     }
  2249. }
  2250. #endif /* __MMI_TVOUT__ */ 
  2251. /*****************************************************************************
  2252.  * FUNCTION
  2253.  *  mmi_phnset_tvout_enable_tv_sleep_in
  2254.  * DESCRIPTION
  2255.  *  allow tv to sleep in
  2256.  * PARAMETERS
  2257.  *  void
  2258.  * RETURNS
  2259.  *  void
  2260.  *****************************************************************************/
  2261. #ifdef __MMI_TVOUT__
  2262. void mmi_phnset_tvout_enable_tv_sleep_in(void)
  2263. {
  2264.     /*----------------------------------------------------------------*/
  2265.     /* Local Variables                                                */
  2266.     /*----------------------------------------------------------------*/
  2267.     /*----------------------------------------------------------------*/
  2268.     /* Code Body                                                      */
  2269.     /*----------------------------------------------------------------*/
  2270.     g_phnset_cntx_p->is_tvout_enable_sleep_in = TRUE;
  2271. }
  2272. #endif /* __MMI_TVOUT__ */ 
  2273. /*****************************************************************************
  2274.  * FUNCTION
  2275.  *  mmi_phnset_tvout_disable_tv_sleep_in
  2276.  * DESCRIPTION
  2277.  *  do not allow tv to sleep in
  2278.  * PARAMETERS
  2279.  *  void
  2280.  * RETURNS
  2281.  *  void
  2282.  *****************************************************************************/
  2283. #ifdef __MMI_TVOUT__
  2284. void mmi_phnset_tvout_disable_tv_sleep_in(void)
  2285. {
  2286.     /*----------------------------------------------------------------*/
  2287.     /* Local Variables                                                */
  2288.     /*----------------------------------------------------------------*/
  2289.     /*----------------------------------------------------------------*/
  2290.     /* Code Body                                                      */
  2291.     /*----------------------------------------------------------------*/
  2292.     g_phnset_cntx_p->is_tvout_enable_sleep_in = FALSE;
  2293. }
  2294. #endif /* __MMI_TVOUT__ */ 
  2295. /*****************************************************************************
  2296.  * FUNCTION
  2297.  *  PhnsetGetFontSize
  2298.  * DESCRIPTION
  2299.  *  ...
  2300.  * PARAMETERS
  2301.  *  void
  2302.  * RETURNS
  2303.  *  void
  2304.  *****************************************************************************/
  2305. U8 PhnsetGetFontSize(void)
  2306. {
  2307.     /*----------------------------------------------------------------*/
  2308.     /* Local Variables                                                */
  2309.     /*----------------------------------------------------------------*/
  2310.     /*----------------------------------------------------------------*/
  2311.     /* Code Body                                                      */
  2312.     /*----------------------------------------------------------------*/
  2313.     return g_phnset_cntx_p->font_size;
  2314. }
  2315. /*****************************************************************************
  2316.  * FUNCTION
  2317.  *  PhnsetReadFontSize
  2318.  * DESCRIPTION
  2319.  *  ...
  2320.  * PARAMETERS
  2321.  *  void
  2322.  * RETURNS
  2323.  *  void
  2324.  *****************************************************************************/
  2325. void PhnsetReadFontSize(void)   /* __USB_IN_NORMAL_MODE__ */
  2326. {
  2327.     /*----------------------------------------------------------------*/
  2328.     /* Local Variables                                                */
  2329.     /*----------------------------------------------------------------*/
  2330.     S16 error;
  2331.     /*----------------------------------------------------------------*/
  2332.     /* Code Body                                                      */
  2333.     /*----------------------------------------------------------------*/
  2334.     ReadValue(NVRAM_BYTE_FONT_SIZE, &(g_phnset_cntx_p->font_size), DS_BYTE, &error);
  2335.     if (g_phnset_cntx_p->font_size > LARGE)
  2336.     {
  2337.         g_phnset_cntx_p->font_size = THEME_DEFAULT;
  2338.     }
  2339. }
  2340. #ifdef __MMI_CHANGABLE_FONT__
  2341. /*****************************************************************************
  2342.  * FUNCTION
  2343.  *  PhnsetSetFontSize
  2344.  * DESCRIPTION
  2345.  *  Setting Font Size Enum
  2346.  * PARAMETERS
  2347.  *  void
  2348.  * RETURNS
  2349.  *  void
  2350.  *****************************************************************************/
  2351. void PhnsetSetFontSize(void)
  2352. {
  2353.     /*----------------------------------------------------------------*/
  2354.     /* Local Variables                                                */
  2355.     /*----------------------------------------------------------------*/
  2356.     S16 error = 0;
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Code Body                                                      */
  2359.     /*----------------------------------------------------------------*/
  2360.     g_phnset_cntx_p->font_size = (U16) GetCurrHiliteID();
  2361.     WriteValue(NVRAM_BYTE_FONT_SIZE, &(g_phnset_cntx_p->font_size), DS_BYTE, &error);
  2362.     change_font_Theme();
  2363.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2364.     DeleteScreenIfPresent(SCR_ID_PHNSET_FONT_SIZE);
  2365. }
  2366. /*****************************************************************************
  2367.  * FUNCTION
  2368.  *  EntryPhnsetFontSize
  2369.  * DESCRIPTION
  2370.  *  
  2371.  * PARAMETERS
  2372.  *  void
  2373.  * RETURNS
  2374.  *  void
  2375.  *****************************************************************************/
  2376. void EntryPhnsetFontSize(void)
  2377. {
  2378.     /*----------------------------------------------------------------*/
  2379.     /* Local Variables                                                */
  2380.     /*----------------------------------------------------------------*/
  2381.     U8 *guiBuffer;
  2382. #ifndef __MMI_DIALLING_FONT__
  2383.     U8 nNumofItem = 4;
  2384.     U16 nStrItemList[4] = 
  2385.     {
  2386.         STR_ID_PHNSET_FONT_SIZE_THEME_DEFAULT, STR_ID_PHNSET_FONT_SIZE_SMALL, STR_ID_PHNSET_FONT_SIZE_MEDIUM,
  2387.         STR_ID_PHNSET_FONT_SIZE_LARGE
  2388.     };
  2389. #else /* __MMI_DIALLING_FONT__ */ 
  2390.     U8 nNumofItem = 3;
  2391.     U16 nStrItemList[3] = 
  2392.     {
  2393.         STR_ID_PHNSET_FONT_SIZE_THEME_DEFAULT, STR_ID_PHNSET_FONT_SIZE_SMALL, STR_ID_PHNSET_FONT_SIZE_MEDIUM
  2394.     };
  2395. #endif /* __MMI_DIALLING_FONT__ */ 
  2396.     /*----------------------------------------------------------------*/
  2397.     /* Code Body                                                      */
  2398.     /*----------------------------------------------------------------*/
  2399.     EntryNewScreen(SCR_ID_PHNSET_FONT_SIZE, NULL, EntryPhnsetFontSize, NULL);
  2400.     guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_FONT_SIZE);
  2401.     SetParentHandler(MENU_ID_PHNSET_FONT_SIZE);
  2402.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2403.     ShowCategory11Screen(
  2404.         STR_ID_PHNSET_FONT_SIZE,
  2405.         MAIN_MENU_TITLE_SETTINGS_ICON,
  2406.         STR_GLOBAL_OK,
  2407.         IMG_GLOBAL_OK,
  2408.         STR_GLOBAL_BACK,
  2409.         IMG_GLOBAL_BACK,
  2410.         nNumofItem,
  2411.         nStrItemList,
  2412.         g_phnset_cntx_p->font_size,
  2413.         guiBuffer);
  2414.     SetLeftSoftkeyFunction(PhnsetSetFontSize, KEY_EVENT_UP);
  2415.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2416.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2417.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2418.     return;
  2419. }
  2420. /*****************************************************************************
  2421.  * FUNCTION
  2422.  *  HintPhnsetFontSize
  2423.  * DESCRIPTION
  2424.  *  Hint handlers for Font Size
  2425.  * PARAMETERS
  2426.  *  index       [IN]        
  2427.  * RETURNS
  2428.  *  void
  2429.  *****************************************************************************/
  2430. void HintPhnsetFontSize(U16 index)
  2431. {
  2432.     /*----------------------------------------------------------------*/
  2433.     /* Local Variables                                                */
  2434.     /*----------------------------------------------------------------*/
  2435.     /*----------------------------------------------------------------*/
  2436.     /* Code Body                                                      */
  2437.     /*----------------------------------------------------------------*/
  2438.     memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
  2439.     switch (g_phnset_cntx_p->font_size)
  2440.     {
  2441.         case THEME_DEFAULT:
  2442.             pfnUnicodeStrncpy(
  2443.                 (PS8) hintData[(index)],
  2444.                 GetString(STR_ID_PHNSET_FONT_SIZE_THEME_DEFAULT),
  2445.                 MAX_SUBMENU_CHARACTERS);
  2446.             break;
  2447.         case SMALL:
  2448.             pfnUnicodeStrncpy(
  2449.                 (PS8) hintData[(index)],
  2450.                 GetString(STR_ID_PHNSET_FONT_SIZE_SMALL),
  2451.                 MAX_SUBMENU_CHARACTERS);
  2452.             break;
  2453.         case MEDIUM:
  2454.             pfnUnicodeStrncpy(
  2455.                 (PS8) hintData[(index)],
  2456.                 GetString(STR_ID_PHNSET_FONT_SIZE_MEDIUM),
  2457.                 MAX_SUBMENU_CHARACTERS);
  2458.             break;
  2459.         case LARGE:
  2460.             pfnUnicodeStrncpy(
  2461.                 (PS8) hintData[(index)],
  2462.                 GetString(STR_ID_PHNSET_FONT_SIZE_LARGE),
  2463.                 MAX_SUBMENU_CHARACTERS);
  2464.             break;
  2465.     }
  2466. }
  2467. /*****************************************************************************
  2468.  * FUNCTION
  2469.  *  HighlightPhnsetFontSize
  2470.  * DESCRIPTION
  2471.  *  
  2472.  * PARAMETERS
  2473.  *  void
  2474.  * RETURNS
  2475.  *  void
  2476.  *****************************************************************************/
  2477. void HighlightPhnsetFontSize(void)
  2478. {
  2479.     /*----------------------------------------------------------------*/
  2480.     /* Local Variables                                                */
  2481.     /*----------------------------------------------------------------*/
  2482.     /*----------------------------------------------------------------*/
  2483.     /* Code Body                                                      */
  2484.     /*----------------------------------------------------------------*/
  2485.     /* 1 Change left soft key icon and label */
  2486.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  2487.     /* 2 Change right soft key icon and label */
  2488.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  2489.     /* 3 Register function for left soft key */
  2490.     SetLeftSoftkeyFunction(EntryPhnsetFontSize, KEY_EVENT_UP);
  2491.     /* 4 Register function for right soft key */
  2492.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2493.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2494.     SetKeyHandler(EntryPhnsetFontSize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2495. }
  2496. #endif /* __MMI_CHANGABLE_FONT__ */