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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * SettingScreenProf.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for Screens for Profiles application
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  *
  206.  *
  207.  * removed!
  208.  * removed!
  209.  *
  210.  *
  211.  * removed!
  212.  * removed!
  213.  *
  214.  *
  215.  *------------------------------------------------------------------------------
  216.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  217.  *============================================================================
  218.  ****************************************************************************/
  219. /**
  220.  * Copyright Notice
  221.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  222.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  223.  *  (It is illegal to remove this copyright notice from this software or any
  224.  *  portion of it)
  225.  */
  226. /***************** Settings Application implementation *********************/
  227. /**************************************************************
  228.    FILENAME : SettingScreenProf.c
  229.    PURPOSE     : Screens for Profiles application
  230.    REMARKS     : nil
  231.    AUTHOR      : Ashima Bajaj,Deepali Gupta
  232.    DATE     : 5/5/2003
  233. **************************************************************/
  234. #include "MMI_features.h"
  235. #include "StdC.h"
  236. #include "L4Dr1.h"
  237. #include "PixtelDataTypes.h"
  238. #include "MainMenuDef.h"
  239. #include "settingdefs.h"
  240. #include "settingprot.h"
  241. #include "Profiles_prot.h"
  242. #include "CustDataRes.h"
  243. #include "EventsGprot.h"
  244. #include "historyGprot.h"
  245. #include "CustMenuRes.h"
  246. #include "wgui_categories.h"
  247. #include "wgui_categories_popup.h"
  248. #include "HardwareEvents.h"
  249. #include "Thrdosinterface.h"
  250. #include "OSThreadInterfaceGprot.h"
  251. #include "settinggprots.h"
  252. #include "QueueGprot.h"
  253. #include "ProtocolEvents.h"
  254. #include "Unicodexdcl.h"
  255. #include "SettingProfile.h"
  256. #include "ProfilesEnum.h"
  257. #include "Globaldefs.h"
  258. #include "ProfilesGdcl.h"
  259. #include "ProfileGprots.h"
  260. #include "GpioInc.h"
  261. #include "NVRAMEnum.h"
  262. #include "NVRAMProt.h"
  263. #include "NVRAMType.h"
  264. #include "DebugInitDef.h"
  265. #include "VolumeHandler.h"
  266. #include "wgui_status_icons.h"
  267. #include "DownloadProtos.h"
  268. #include "CommonScreens.h"
  269. #include "IdleAppProt.h"
  270. #include "KeyBrd.h"
  271. #include "IdleAppDef.h"
  272. #include "ATHandlerProt.h"
  273. /* Leo add for DLT */
  274. #include "FileSystemDef.h"      /* Ritesh */
  275. /* Leo end */
  276. #include "FrameworkStruct.h"
  277. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  278. #include "FileMgr.h"
  279. #include "Conversions.h"
  280. #include "ProfilesDefs.h"
  281. #include "ProfileMgr.h" /* Profile Magager General Include file */
  282. #include "ProfileMgrGProt.h"    /* Profile Magager Extern Include file */
  283. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  284. #include "phonebookdef.h"
  285. #include "mdi_datatype.h"
  286. #include "mdi_audio.h"
  287. #include "CallManagementGprot.h"
  288. #ifdef __DRM_SUPPORT__
  289. #ifdef MMI_ON_HARDWARE_P
  290. #include "FileMgr.h"
  291. #include "Fs_errcode.h"
  292. #include "Drm_gprot.h"
  293. #endif /* MMI_ON_HARDWARE_P */ 
  294. #endif /* __DRM_SUPPORT__ */ 
  295. //KP Jerry add on 2007-4-1 for can use "g_phnset_gpio_cntx_p" start
  296. #ifdef __MMI_PROFILE_POWER_SAVING__
  297. #include "PhnsetGPIO.h"
  298. #endif
  299. //KP Jerry add on 2007-4-1 for can use "g_phnset_gpio_cntx_p" end
  300. /* Leo add for DLT */
  301. #include "MMIThemes.h"  /* ritesh */
  302. /* Leo end */
  303. /* PMT SUKRIT START 20051226 */
  304. #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
  305. #include "MessagesExDcl.h"
  306. S32 default_value_ring_volume;
  307. S32 default_value_keypad_volume;
  308. S32 is_level_select_menuitem_displayed_in_volume_screen = 1;
  309. S32 default_value_ring_volume;
  310. S32 default_value_keypad_volume;
  311. S32 ring_volume_index = -1;
  312. S32 keypad_volume_index = -1;
  313. #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */ 
  314. /* PMT SUKRIT END 20051226 */
  315. void (*gfnprofilelsk) (void);
  316. void (*gfnprofilersk) (void);
  317. extern void EntryScrSetKeyPadVolumeLevel(void);
  318. extern void GetRingToneRange(U8 *startId, U8 *totalId);
  319. extern void GetMidiRange(U8 *startId, U8 *totalId);
  320. extern void GetToneRange(U8 *startId, U8 *totalId);
  321. extern S32 volume_level_UI;
  322. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  323. static PRFSET_MELODY_CONF_TYPE prfset_conf_type = 0;
  324. static U8 g_ext_melody_idx = 0;
  325. static U8 extMldHlitItem = 0;
  326. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  327. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  328. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  329. static U8 g_ms_ext_melody_idx = 0;
  330. static U8 ms_extMldHlitItem = 0;
  331. static U8 g_pon_off_ext_melody_idx = 0;
  332. static U8 pon_off_extMldHlitItem = 0;
  333. #endif
  334. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  335. #if defined(__MMI_PHB_CALLER_RES_SETTING__)
  336. extern void mmi_phb_caller_ring_forward_to_entry(U16 ringToneId);
  337. #endif 
  338. #ifdef __MMI_BT_PROFILE__
  339. void mmi_profiles_bt_open_stream_callback(U8 profile, mdi_result result);
  340. void mmi_profiles_bt_close_stream_callback(U8 profile, mdi_result result);
  341. #endif /* __MMI_BT_PROFILE__*/
  342. static BOOL ring_tone_playing = FALSE;
  343. static mmi_frm_kbd_tone_state_enum key_tone_state;
  344. /*****************************************************************************
  345.  * FUNCTION
  346.  *  mmi_profiles_set_ring_tone_playing
  347.  * DESCRIPTION
  348.  *  set ring tone playing flag
  349.  *  
  350.  *  used for AudioPlayToneWithCallBackVolPath
  351.  * PARAMETERS
  352.  *  is_playing      [IN]        
  353.  * RETURNS
  354.  *  void
  355.  *****************************************************************************/
  356. void mmi_profiles_set_ring_tone_playing(BOOL is_playing)
  357. {
  358.     /*----------------------------------------------------------------*/
  359.     /* Local Variables                                                */
  360.     /*----------------------------------------------------------------*/
  361.     /*----------------------------------------------------------------*/
  362.     /* Code Body                                                      */
  363.     /*----------------------------------------------------------------*/
  364.     ring_tone_playing = is_playing;
  365. }
  366. /*****************************************************************************
  367.  * FUNCTION
  368.  *  mmi_profiles_is_ring_tone_playing
  369.  * DESCRIPTION
  370.  *  check does ring tone is playing
  371.  *  
  372.  *  used for AudioPlayToneWithCallBackVolPath
  373.  * PARAMETERS
  374.  *  void
  375.  * RETURNS
  376.  * BOOL
  377.  *****************************************************************************/
  378. BOOL mmi_profiles_is_ring_tone_playing(void)
  379. {
  380.     /*----------------------------------------------------------------*/
  381.     /* Local Variables                                                */
  382.     /*----------------------------------------------------------------*/
  383.     /*----------------------------------------------------------------*/
  384.     /* Code Body                                                      */
  385.     /*----------------------------------------------------------------*/
  386.     return ring_tone_playing;
  387. }
  388. #if defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P)
  389. /*****************************************************************************
  390.  * FUNCTION
  391.  *  mmi_profiles_check_DRM_content_forwardable
  392.  * DESCRIPTION
  393.  *  check does the file is DRM prohibted to forward
  394.  * PARAMETERS
  395.  *  filename        [IN]        
  396.  * RETURNS
  397.  * BOOL
  398.  *****************************************************************************/
  399. BOOL mmi_profiles_check_DRM_content_forwardable(UI_string_type filename)
  400. {
  401.     /*----------------------------------------------------------------*/
  402.     /* Local Variables                                                */
  403.     /*----------------------------------------------------------------*/
  404.     FS_HANDLE handle;
  405.     DRM_RIGHTS_STRUCT *rights;
  406.     U8 fwd_flag = FMGR_DRM_FWD_APP_FWD_OUT;
  407.     /*----------------------------------------------------------------*/
  408.     /* Code Body                                                      */
  409.     /*----------------------------------------------------------------*/
  410.     if ((handle = DRM_open_file(filename, FS_READ_ONLY, DRM_PERMISSION_NONE)) > FS_NO_ERROR)
  411.     {
  412.         if ((rights = DRM_get_rights(handle)) != NULL)
  413.         {
  414.             DRM_CONSTRAINT_STRUCT *cons;
  415.             U8 permission = DRM_PERMISSION_NONE;
  416.             cons = &rights->play;
  417.             permission |= DRM_PERMISSION_PLAY;
  418.             if (rights->method & DRM_METHOD_SEPARATE_DELIVERY)
  419.             {
  420.                 if (!(rights->status == DRM_STATUS_RIGHTS_PRESENT && (rights->permission & permission) &&
  421.                       cons != NULL && cons->type == DRM_CONSTRAINT_NONE))
  422.                 {
  423.                     if (rights->method & DRM_METHOD_FORWARD_LOCK)
  424.                     {
  425.                         fwd_flag = FMGR_DRM_NO_FWD_APP_NO_FWD_OUT;      /* can't forward, can't set as ringtine wallpaper */
  426.                     }
  427.                     else
  428.                     {
  429.                         fwd_flag = FMGR_DRM_NO_FWD_APP_FWD_OUT; /* can forward, can't set as ringtone wallpaper */
  430.                     }
  431.                 }
  432.             }
  433.             else if (rights->method & DRM_METHOD_COMBINED_DELIVERY)
  434.             {
  435.                 if ((rights->permission & permission) && cons != NULL && cons->type == DRM_CONSTRAINT_NONE)
  436.                 {
  437.                     fwd_flag = FMGR_DRM_FWD_APP_NO_FWD_OUT; /* can't forward, can set as ringtone wallpaper */
  438.                 }
  439.                 else
  440.                 {
  441.                     fwd_flag = FMGR_DRM_NO_FWD_APP_NO_FWD_OUT;  /* can't forward, can't set as ringtine wallpaper */
  442.                 }
  443.             }
  444.             else
  445.             {
  446.                 fwd_flag = FMGR_DRM_FWD_APP_NO_FWD_OUT; /* can't forward, can set as ringtone wallpaper */
  447.             }
  448.         }
  449.         DRM_close_file(handle);
  450.     }
  451.     else
  452.     {
  453.         fwd_flag = FMGR_DRM_NO_FWD_APP_NO_FWD_OUT;
  454.     }
  455.     if (fwd_flag == FMGR_DRM_NO_FWD_APP_NO_FWD_OUT || fwd_flag == FMGR_DRM_NO_FWD_APP_FWD_OUT)
  456.     {
  457.         return FALSE;
  458.     }
  459.     else
  460.     {
  461.         return TRUE;
  462.     }
  463. }
  464. #endif /* defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P) */ 
  465. /*****************************************************************************
  466.  * FUNCTION
  467.  *  mmi_profiles_is_device_profile
  468.  * DESCRIPTION
  469.  *  check does the selected or activated profile a device profile which can't be activated manually
  470.  * PARAMETERS
  471.  *  void
  472.  *  BOOL(?)     [OUT]       
  473.  * RETURNS
  474.  *  void
  475.  *****************************************************************************/
  476. BOOL mmi_profiles_is_device_profile(void)
  477. {
  478.     /*----------------------------------------------------------------*/
  479.     /* Local Variables                                                */
  480.     /*----------------------------------------------------------------*/
  481.     /*----------------------------------------------------------------*/
  482.     /* Code Body                                                      */
  483.     /*----------------------------------------------------------------*/
  484. //KP Jerry add on 2007-4-3 start
  485. #ifdef __MMI_PROFILE_POWER_SAVING__
  486. #ifdef __MMI_BT_PROFILE__
  487.     if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1) || (gprofileId == MMI_PROFILE_BT) ||
  488.         (gactivatedprofile == MMI_PROFILE_BT) || (gprofileId == MMI_PROFILE_POWER_SAVING))
  489.     {
  490.         return TRUE;
  491.     }
  492. #else /* __MMI_BT_PROFILE__ */ 
  493.     if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1) || (gprofileId == MMI_PROFILE_POWER_SAVING))
  494.     {
  495.         return TRUE;
  496.     }
  497. #endif /* __MMI_BT_PROFILE__ */ 
  498. #else/*!__MMI_PROFILE_POWER_SAVING__*/
  499. #ifdef __MMI_BT_PROFILE__
  500.     if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1) || (gprofileId == MMI_PROFILE_BT) ||
  501.         (gactivatedprofile == MMI_PROFILE_BT))
  502.     {
  503.         return TRUE;
  504.     }
  505. #else /* __MMI_BT_PROFILE__ */ 
  506.     if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1))
  507.     {
  508.         return TRUE;
  509.     }
  510. #endif /* __MMI_BT_PROFILE__ */ 
  511. #endif/*__MMI_PROFILE_POWER_SAVING__*/
  512. //KP Jerry add on 2007-4-3 end
  513.     return FALSE;
  514. }
  515. /*****************************************************************************
  516.  * FUNCTION
  517.  *  InitProfileApp
  518.  * DESCRIPTION
  519.  *  Initialize Profile Application
  520.  * PARAMETERS
  521.  *  void
  522.  *  S16(?)      [OUT]       
  523.  * RETURNS
  524.  *  void
  525.  *****************************************************************************/
  526. S16 InitProfileApp(void)
  527. {
  528.     /*----------------------------------------------------------------*/
  529.     /* Local Variables                                                */
  530.     /*----------------------------------------------------------------*/
  531.     /*----------------------------------------------------------------*/
  532.     /* Code Body                                                      */
  533.     /*----------------------------------------------------------------*/
  534.     if (gprofilenvram == 0)
  535.     {
  536.         initializeProfiles();
  537.         ActivatefirstProfile();
  538.     }
  539.     SetHiliteHandler(MAIN_MENU_PROFILES_GENERAL, HighlightGeneralProfile);
  540.     SetHiliteHandler(MAIN_MENU_PROFILES_MEETING, HighlightMeetingProfile);
  541.     SetHiliteHandler(MAIN_MENU_PROFILES_OUTDOOR, HighlightOutdoorProfile);
  542.     SetHiliteHandler(MAIN_MENU_PROFILES_INDOOR, HighlightIndoorProfile);
  543.     SetHiliteHandler(MAIN_MENU_PROFILES_HEADSET, HighlightHeadsetProfile);
  544. #ifdef __MMI_BT_PROFILE__
  545.     SetHiliteHandler(MAIN_MENU_PROFILES_BT, mmi_profiles_bt_profile_highlight_hdlr);
  546. #endif 
  547. #ifndef __MMI_PROF_MENU_ACTIVE_SHRINK__
  548.     SetHiliteHandler(MENU_PROFILES_OPTIONS, HighlightProfilesOptions);
  549.     SetHiliteHandler(MENU_PROFILES_CUSTOMIZE, HighlightProfilesCustomize);
  550. #endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */ 
  551.     SetHiliteHandler(MENU_PROFILES_ACTIVATE, HighlightProfileActivateOptions);
  552.     SetHiliteHandler(MENU_VOLUME_LEVEL, HighlightProfilesVolumeLevel);
  553.     SetHiliteHandler(MENU_MT_CALL_ALERT_TYPE, HighlightProfilesCallAlert);
  554.     SetHiliteHandler(MENU_RING_TYPE, HighlightProfilesRingType);
  555.     SetHiliteHandler(MENU_ANSEWRING_MODE, HighlightProfilesAnsweringMode);
  556. #ifdef __MMI_STATUS_LED__
  557.     SetHiliteHandler(MENU_LIGHT_STATUS, HighlightProfilesStatus);
  558. #endif 
  559. //KP Jerry add on 2007-03-31 start
  560. #ifdef __MMI_PROFILE_POWER_SAVING__
  561.    SetHiliteHandler(MAIN_MENU_PROFILES_POWER_SAVING, HighlightPowerSavingProfile);
  562.    SetHiliteHandler(MENU_LCDBL, HighlightProfilesLCDBL);
  563.    SetHiliteHandler(MENU_KEYBL, HighlightProfilesKEYBL);
  564.    SetHintHandler(MENU_KEYBL, HintProfilesKEYBL);
  565. #endif
  566. //KP Jerry add on 2007-03-31 end
  567.     SetHiliteHandler(MENU_TONE_SETUP, HighlightProfilesToneSetup);
  568.     SetHiliteHandler(MENU_TONE_SETUP_RING_TONE, HighlightProfilesRingToneSetup);
  569.     SetHiliteHandler(MENU_TONE_SETUP_POWERON_TONE, HighlightProfilesPoweronToneSetup);
  570.     SetHiliteHandler(MENU_TONE_SETUP_POWEROFF_TONE, HighlightProfilesPoweroffToneSetup);
  571.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  572. #ifdef __MMI_CLAMSHELL__
  573.     SetHiliteHandler(MENU_TONE_SETUP_COVEROPEN_TONE, HighlightProfilesCoverOpenToneSetup);
  574.     SetHiliteHandler(MENU_TONE_SETUP_COVERCLOSE_TONE, HighlightProfilesCoverCloseToneSetup);
  575. #endif /* __MMI_CLAMSHELL__ */ 
  576.     /* MTK end */
  577.     SetHiliteHandler(MENU_TONE_SETUP_MESSAGE_TONE, HighlightProfilesMessageToneSetup);
  578.     SetHiliteHandler(MENU_TONE_SETUP_KEYPAD_TONE, HighlightProfilesKeypadToneSetup);
  579. #ifndef __MMI_ALM_CUSTOMIZE_TONE__
  580.     SetHiliteHandler(MENU_TONE_SETUP_ALARM_TONE, HighlightAlarmToneSetup);
  581. #endif 
  582.     SetHiliteHandler(MENU_EXTRA_TONE, HighlightExtraToneSetup);
  583.     SetHiliteHandler(MENU_RING_VOLUME_LEVEL, HighlightRingToneVolume);
  584.     SetHiliteHandler(MENU_KEYPAD_VOLUME_LEVEL, HighlightKeyToneVolume);
  585.     SetHiliteHandler(MENU_RING, HighlightCallAlertRing);
  586.     SetHiliteHandler(MENU_VIBRATION_ONLY, HighlightCalAlertVibrationOnly);
  587.     SetHiliteHandler(MENU_VIBRATION_AND_RING, HighlightCallAlertVibrationAndRing);
  588.     SetHiliteHandler(MENU_VIBRATION_THEN_RING, HighlightCallAlertVibrationThenRing);
  589.     SetHiliteHandler(MENU_SILENT, HighlightCallAlertSilent);
  590.     SetHiliteHandler(MENU_RING_TYPE_SINGLE, HighlightRingTypeSingle);
  591.     SetHiliteHandler(MENU_RING_TYPE_REPEAT, HighlightRingTypeRepeat);
  592.     SetHiliteHandler(MENU_RING_TYPE_ASCENDING, HighlightRingTypeAscending);
  593. #ifdef __MMI_CONNECT_NOTICE__
  594.     SetHiliteHandler(MENU_CONNECT_NOTICE, HighlightProfilesConnectNotice);
  595.     SetHiliteHandler(MENU_NOTICE_NONE, HighlightConnectNoticeNone);
  596.     SetHiliteHandler(MENU_NOTICE_TONE_ONLY, HighlightConnectNoticeToneOnly);
  597.     SetHiliteHandler(MENU_NOTICE_VIB_ONLY, HighlightConnectNoticeVibOnly);
  598.     SetHiliteHandler(MENU_NOTICE_TONE_AND_VIB, HighlightConnectNoticeToneAndVib);
  599. #endif /* __MMI_CONNECT_NOTICE__ */ 
  600.     SetHiliteHandler(MENU_KEYPAD_TONE_SILENT, HighlightKeyPadToneSilent);
  601.     SetHiliteHandler(MENU_KEYPAD_TONE_CLICK, HighlightKeyPadToneClick);
  602.     SetHiliteHandler(MENU_KEYPAD_TONE_TONE, HighlightKeyPadToneTone);
  603. #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
  604.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_1, HighlightKeyPadToneHumanVoice1);
  605.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_2, HighlightKeyPadToneHumanVoice2);
  606.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_3, HighlightKeyPadToneHumanVoice3);
  607.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_4, HighlightKeyPadToneHumanVoice4);
  608.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_5, HighlightKeyPadToneHumanVoice5);
  609.     SetHiliteHandler(MENU_KEYPAD_TONE_HUMAN_VOICE_6, HighlightKeyPadToneHumanVoice6);
  610. #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */ 
  611. #if defined(__MMI_CUST_KEYPAD_TONE__)
  612.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_1, HighlightKeyPadToneCust1);
  613.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_2, HighlightKeyPadToneCust2);
  614.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_3, HighlightKeyPadToneCust3);
  615.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_4, HighlightKeyPadToneCust4);
  616.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_5, HighlightKeyPadToneCust5);
  617.     SetHiliteHandler(MENU_KEYPAD_TONE_CUST_6, HighlightKeyPadToneCust6);
  618. #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */ 
  619. #if defined(__MMI_INTELLIGENT_CALL_ALERT__)
  620.     SetHiliteHandler(MENU_INTELLIGENT_CALL_ALERT, HighlightHandlerIntelligentCallAlert);
  621.     SetHintHandler(MENU_INTELLIGENT_CALL_ALERT, HintIntelligentCallAlert);
  622.     SetHiliteHandler(MENU_INTELLIGENT_CALL_ALERT_ON, HighlightHandlerIntelligentCallAlertOn);
  623.     SetHiliteHandler(MENU_INTELLIGENT_CALL_ALERT_OFF, HighlightHandlerIntelligentCallAlertOff);
  624. #endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */ 
  625.     SetHintHandler(MENU_TONE_SETUP_RING_TONE, HintHandlerIncomingCall);
  626. #ifndef __MMI_ALM_CUSTOMIZE_TONE__
  627.     SetHintHandler(MENU_TONE_SETUP_ALARM_TONE, HintHandlerAlarmTone);
  628. #endif 
  629.     SetHintHandler(MENU_TONE_SETUP_POWERON_TONE, HintHandlerPowerOnTone);
  630.     SetHintHandler(MENU_TONE_SETUP_POWEROFF_TONE, HintHandlerPowerOffTone);
  631.     SetHintHandler(MENU_TONE_SETUP_MESSAGE_TONE, HintHandlerMessgaeTone);
  632.     SetHintHandler(MENU_TONE_SETUP_KEYPAD_TONE, HintHandlerKeypadTone);
  633.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  634. #ifdef __MMI_CLAMSHELL__
  635.     SetHintHandler(MENU_TONE_SETUP_COVEROPEN_TONE, HintHandlerCoverOpenTone);
  636.     SetHintHandler(MENU_TONE_SETUP_COVERCLOSE_TONE, HintHandlerCoverCloseTone);
  637. #endif /* __MMI_CLAMSHELL__ */ 
  638.     /* MTK end */
  639.     SetHintHandler(MENU_MT_CALL_ALERT_TYPE, HintHandlerAlertType);
  640.     SetHintHandler(MENU_RING_TYPE, HintHandlerRingType);
  641. #ifdef __MMI_CONNECT_NOTICE__
  642.     SetHintHandler(MENU_CONNECT_NOTICE, HintHandlerConnectNotice);
  643. #endif 
  644.     SetHintHandler(MENU_RING_VOLUME_LEVEL, HintHandlerRingVolume);
  645.     SetHintHandler(MENU_KEYPAD_VOLUME_LEVEL, HintHandlerKeyVolume);
  646. #ifdef __MMI_STATUS_LED__
  647.     SetHintHandler(MENU_LIGHT_STATUS, HintHandlerStatusLED);
  648. #endif 
  649. #ifdef __MMI_BT_PROFILE__
  650. #ifdef __MMI_HFP_SUPPORT__
  651.         mdi_audio_bt_init(BT_HFP, mmi_profiles_bt_open_stream_callback, mmi_profiles_bt_close_stream_callback);
  652. #endif 
  653. #if defined(__MMI_BT_BCHS_SUPPORT__) && defined(__MMI_A2DP_SUPPORT__)
  654.         mdi_audio_bt_init(BT_A2DP, mmi_profiles_bt_open_stream_callback, mmi_profiles_bt_close_stream_callback);
  655. #endif 
  656. #endif /* __MMI_BT_PROFILE__ */ 
  657.     return 0;
  658. }
  659. /*****************************************************************************
  660.  * FUNCTION
  661.  *  initnvramprofapp
  662.  * DESCRIPTION
  663.  *  Initialize NVRAM for Profile
  664.  * PARAMETERS
  665.  *  void
  666.  *  S16(?)      [OUT]       
  667.  * RETURNS
  668.  *  void
  669.  *****************************************************************************/
  670. void initnvramprofapp(void)
  671. {
  672. #ifdef USE_NVRAM_FOR_PROFILES
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     S16 error;
  677.     U16 j;
  678.     /*----------------------------------------------------------------*/
  679.     /* Code Body                                                      */
  680.     /*----------------------------------------------------------------*/
  681.     gprofilenvram = 1;
  682.     j = 1;
  683.     ReadRecord(
  684.         NVRAM_EF_PROFILES_LID,
  685.         j,
  686.         &gprofiles[0],
  687.         MAX_ELEMENTS * sizeof(PROFILE) /* NVRAM_PROFILES_RECORD_SIZE */ ,
  688.         &error);
  689. #ifdef MMI_ON_WIN32
  690.     if (gprofiles[1].toneSetup.ringTone == 65535)
  691.     {
  692.         initializeProfiles();
  693.         glastactivatedprofile = MMI_PROFILE_GENERAL;
  694.         WriteValue(NVRAM_PROFILES_LASTACTIVATED, &glastactivatedprofile, DS_BYTE, &error);
  695.         gactivatedprofile = 0;
  696.         WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  697.         j = 1;
  698.         if (WriteRecord(
  699.                 NVRAM_EF_PROFILES_LID,
  700.                 j,
  701.                 &gprofiles[0],
  702.                 NVRAM_PROFILES_RECORD_SIZE,
  703.                 &error) < NVRAM_PROFILES_RECORD_SIZE)
  704.         {
  705.             PRINT_INFORMATION(("## ERROR: InitProfiles: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  706.         }
  707.     }
  708. #endif /* MMI_ON_WIN32 */ 
  709.     ReadValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  710.     ReadValue(NVRAM_PROFILES_LASTACTIVATED, &glastactivatedprofile, DS_BYTE, &error);
  711. #endif /* USE_NVRAM_FOR_PROFILES */
  712.     if( mmi_gpio_is_earphone_plug_in() )
  713.         mmi_profiles_headset_activate_profile();
  714.     else
  715.     {
  716.         ActivateProfile();
  717.         showAlertStatusIcons(); /* function to show status icon on ilde screen */
  718.     }
  719. }
  720. /*****************************************************************************
  721.  * FUNCTION
  722.  *  EntryScrProfiles
  723.  * DESCRIPTION
  724.  *  Entry fn for main profile screen
  725.  * PARAMETERS
  726.  *  void
  727.  * RETURNS
  728.  *  void
  729.  *****************************************************************************/
  730. void EntryScrProfiles(void)
  731. {
  732.     /*----------------------------------------------------------------*/
  733.     /* Local Variables                                                */
  734.     /*----------------------------------------------------------------*/
  735.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  736.     U8 *guiBuffer;                      /* Buffer holding history data */
  737.     U16 gimagearray2[MAX_SUB_MENUS];    /* array for profilenames */
  738.     U16 nDispAttribute;                 /* Stores display attribue */
  739.     U8 i = 0, data = 0;
  740.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  741.     U16 ItemIcons[MAX_SUB_MENUS];
  742.     static U8 prev_data = 0;
  743.     U16 menu_id = 0;
  744.     /*----------------------------------------------------------------*/
  745.     /* Code Body                                                      */
  746.     /*----------------------------------------------------------------*/
  747.     PRINT_INFORMATION(("<<------- profile list ------->>"));
  748.     /* 1 Call Exit Handler */
  749.     EntryNewScreen(SCR_PROFILES, ExitScrProfiles, EntryScrProfiles, NULL);
  750.     /* 2 Get current screen to gui buffer  for history purposes */
  751.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES);
  752.     /* 3. Retrieve no of child of menu item to be displayed */
  753.     nNumofItem = GetNumOfChild(MAIN_MENU_PROFILES_MENUID);
  754.     /* 5. Get attribute of menu to be displayed */
  755.     nDispAttribute = GetDispAttributeOfItem(MAIN_MENU_PROFILES_MENUID);
  756.     /* 6. Retrieve string ids in sequence of given menu item to be displayed */
  757.     GetSequenceStringIds(MAIN_MENU_PROFILES_MENUID, nStrItemList);
  758.     GetSequenceImageIds(MAIN_MENU_PROFILES_MENUID, ItemIcons);
  759.     SetParentHandler(MAIN_MENU_PROFILES_MENUID);
  760.     for (i = 0; i < nNumofItem; i++)
  761.     {
  762.         gimagearray2[i] = IMG_PROFILES_NO_IMAGE;
  763.     }
  764.     for (i = 0; i < nNumofItem; i++)
  765.     {
  766.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  767.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[i], GetString(nStrItemList[i]), MAX_SUBMENU_CHARACTERS);
  768.     }
  769. /****** Get the index of activated profile menu ID*****/
  770.     switch (gactivatedprofile)
  771.     {
  772.         case MMI_PROFILE_GENERAL:
  773.             menu_id = MAIN_MENU_PROFILES_GENERAL;
  774.             break;
  775.         case MMI_PROFILE_MEETING:
  776.             menu_id = MAIN_MENU_PROFILES_MEETING;
  777.             break;
  778.         case MMI_PROFILE_OUTDOOR:
  779.             menu_id = MAIN_MENU_PROFILES_OUTDOOR;
  780.             break;
  781.         case MMI_PROFILE_INDOOR:
  782.             menu_id = MAIN_MENU_PROFILES_INDOOR;
  783.             break;
  784.         case MMI_PROFILE_HEADSET:
  785.             menu_id = MAIN_MENU_PROFILES_HEADSET;
  786.             break;
  787. //KP Jerry add on 2007-03-31 start
  788. #ifdef __MMI_PROFILE_POWER_SAVING__
  789.         case MMI_PROFILE_POWER_SAVING:
  790.             menu_id = MAIN_MENU_PROFILES_POWER_SAVING;
  791.             break;
  792. #endif
  793. //KP Jerry add on 2007-03-31 end
  794.         case MMI_PROFILE_SILENT:
  795.             data = 0;
  796.             break;
  797.     #ifdef __MMI_BT_PROFILE__
  798.         case MMI_PROFILE_BT:
  799.             menu_id = MAIN_MENU_PROFILES_BT;
  800.             break;
  801.     #endif /* __MMI_BT_PROFILE__ */ 
  802.         default:
  803.             ASSERT(0);
  804.     }
  805.     /* If activated profile is silent then no profile should be seen as activated */
  806.     if (gactivatedprofile != MMI_PROFILE_SILENT)
  807.     {
  808.         data = GetIndexOfStringId(MAIN_MENU_PROFILES_MENUID, menu_id);
  809.         gimagearray2[data] = IMG_PROFILES_ACTIVATED;
  810.     }
  811.     /* ingore guiBuffer when previous activated profile is different thant current profile after back history */
  812.     if (guiBuffer != NULL && prev_data != data)
  813.     {
  814.         guiBuffer = NULL;
  815.     }
  816.     prev_data = data;
  817.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  818.     /* MTK Leo add, mini_tab_bar */
  819. #ifdef __MMI_WGUI_MINI_TAB_BAR__
  820.     wgui_enable_mini_tab_bar(MAIN_MENU_PROFILES_MENUID);
  821. #endif 
  822.     /* MTK Leo end */
  823.     ShowCategory73Screen(
  824.         STR_PROFILE_CAPTION,
  825.         IMG_PROFILES_TITLEE,
  826.         STR_GLOBAL_OPTIONS,
  827.         0,
  828.         STR_GLOBAL_BACK,
  829.         0,
  830.         nNumofItem,
  831.         (U8 **) subMenuDataPtrs,
  832.         (U16*) gimagearray2,
  833.         ItemIcons,
  834.         (U16) data,
  835.         guiBuffer,
  836.         1);
  837.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  838.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  839. }
  840. /*****************************************************************************
  841.  * FUNCTION
  842.  *  ExitScrProfiles
  843.  * DESCRIPTION
  844.  *  Exit profile screen
  845.  * PARAMETERS
  846.  *  void
  847.  * RETURNS
  848.  *  void
  849.  *****************************************************************************/
  850. void ExitScrProfiles(void)
  851. {
  852.     /*----------------------------------------------------------------*/
  853.     /* Local Variables                                                */
  854.     /*----------------------------------------------------------------*/
  855.     /*----------------------------------------------------------------*/
  856.     /* Code Body                                                      */
  857.     /*----------------------------------------------------------------*/
  858.     gprofileId = (U8) gcurrHiliteIndexOne;
  859.     /* MTK Leo add, mini_tab_Bar */
  860. #ifdef __MMI_WGUI_MINI_TAB_BAR__
  861.     wgui_disable_mini_tab_bar();
  862. #endif 
  863.     /* MTK Leo end */
  864. }
  865. /*****************************************************************************
  866.  * FUNCTION
  867.  *  EntryScrProfilesOptions
  868.  * DESCRIPTION
  869.  *  Entry Function of Profiles Options
  870.  * PARAMETERS
  871.  *  void
  872.  * RETURNS
  873.  *  void
  874.  *****************************************************************************/
  875. void EntryScrProfilesOptions(void)
  876. {
  877.     /*----------------------------------------------------------------*/
  878.     /* Local Variables                                                */
  879.     /*----------------------------------------------------------------*/
  880.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  881.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  882.     U16 nDispAttribute;                 /* Stores display attribue */
  883.     U8 *guiBuffer;                      /* Buffer holding history data */
  884.     U8 *PopUpList[MAX_SUB_MENUS];
  885.     S8 i = 0;
  886.     U16 ParentId;
  887.     /*----------------------------------------------------------------*/
  888.     /* Code Body                                                      */
  889.     /*----------------------------------------------------------------*/
  890.     /* 1 Call Exit Handler */
  891.     EntryNewScreen(SCR_PROFILES_OPTIONS, NULL, EntryScrProfilesOptions, NULL);
  892. /****If headset is connected then options menu should show Customize only*******/
  893.     if (mmi_profiles_is_device_profile())
  894.     {
  895.         ParentId = MENU_PROFILES_OPTIONS_CUSTOMIZE;
  896.     }
  897.     else
  898.     {
  899.         ParentId = MENU_PROFILES_OPTIONS;
  900.     }
  901.     /* 1 Set parent handler */
  902.     SetParentHandler(ParentId);
  903.     /* 2 Get current screen to gui buffer  for history purposes */
  904.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_OPTIONS);
  905.     /* 3. Retrieve no of child of menu item to be displayed */
  906.     nNumofItem = GetNumOfChild(ParentId);
  907.     /* 4. Get attribute of menu to be displayed */
  908.     nDispAttribute = GetDispAttributeOfItem(ParentId);
  909.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  910.     GetSequenceStringIds(ParentId, nStrItemList);
  911.     for (i = 0; i < nNumofItem; i++)
  912.     {
  913.         PopUpList[i] = NULL;
  914.     }
  915.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  916.     /* 8 Display Category Screen */
  917.     ShowCategory52Screen(
  918.         STR_PROFILE_OPTION_CAPTION,
  919.         IMG_PROFILES_TITLEE,
  920.         STR_GLOBAL_OK,
  921.         IMG_GLOBAL_OK,
  922.         STR_GLOBAL_BACK,
  923.         IMG_GLOBAL_BACK,
  924.         nNumofItem,
  925.         nStrItemList,
  926.         (PU16) gIndexIconsImageList,
  927.         PopUpList,
  928.         0,
  929.         0,
  930.         guiBuffer);
  931.     /* 9.Register function with right softkey */
  932.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  933.     /* 10. Register Exit handler */
  934.     /* SetExitHandler(SCR_PROFILES_OPTIONS, ExitScrProfilesOptions); */
  935. }
  936. /*****************************************************************************
  937.  * FUNCTION
  938.  *  EntryScrProfilesActivate
  939.  * DESCRIPTION
  940.  *  Activates the Highlighted profile
  941.  * PARAMETERS
  942.  *  void
  943.  * RETURNS
  944.  *  void
  945.  *****************************************************************************/
  946. void EntryScrProfilesActivate(void)
  947. {
  948.     /*----------------------------------------------------------------*/
  949.     /* Local Variables                                                */
  950.     /*----------------------------------------------------------------*/
  951.     S16 error = 0;
  952.     /*----------------------------------------------------------------*/
  953.     /* Code Body                                                      */
  954.     /*----------------------------------------------------------------*/
  955.     /* SetParentHandler(MENU_PROFILES_ACTIVATE); */
  956.     gactivatedprofile = gprofileId;
  957.     DisplayPopup(
  958.         (PU8) GetString(STR_GENERAL_ACTIVATE_MESSAGE),
  959.         IMG_GLOBAL_ACTIVATED,
  960.         1,
  961.         UI_POPUP_NOTIFYDURATION_TIME,
  962.         SUCCESS_TONE);
  963.     DeleteNHistory(1);
  964.     WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  965.     ActivateProfile();
  966. }
  967. /*****************************************************************************
  968.  * FUNCTION
  969.  *  EntryScrProfilesActivateById
  970.  * DESCRIPTION
  971.  *  Activates the profileId
  972.  * PARAMETERS
  973.  *  profileId       [IN]        
  974.  * RETURNS
  975.  *  void
  976.  *****************************************************************************/
  977. void EntryScrProfilesActivateById(U8 profileId)
  978. {
  979.     /*----------------------------------------------------------------*/
  980.     /* Local Variables                                                */
  981.     /*----------------------------------------------------------------*/
  982.     S8 str_activate[100];
  983.     U16 msg_id = 0;
  984.     S16 error = 0;
  985.     /*----------------------------------------------------------------*/
  986.     /* Code Body                                                      */
  987.     /*----------------------------------------------------------------*/
  988.     switch (profileId)
  989.     {
  990.         case MMI_PROFILE_GENERAL:
  991.             msg_id = STR_PROFILES_GENERAL;
  992.             break;
  993.         case MMI_PROFILE_MEETING:
  994.             msg_id = STR_PROFILES_MEETING;
  995.             break;
  996.         case MMI_PROFILE_OUTDOOR:
  997.             msg_id = STR_PROFILES_OUTDOOR;
  998.             break;
  999.         case MMI_PROFILE_INDOOR:
  1000.             msg_id = STR_PROFILES_INDOOR;
  1001.             break;
  1002.         case MMI_PROFILE_HEADSET:
  1003.             msg_id = STR_PROFILES_HEADSET;
  1004.             break;
  1005. //KP Jerry add on 2007-03-31 start
  1006. #ifdef __MMI_PROFILE_POWER_SAVING__
  1007.         case MMI_PROFILE_POWER_SAVING:
  1008.             msg_id = STR_PROFILES_POWER_SAVING;
  1009.             break;
  1010. #endif
  1011. //KP Jerry add on 2007-03-31 end
  1012.         case MMI_PROFILE_SILENT:
  1013.             msg_id = STR_PROFILES_SILENT;
  1014.             break;
  1015.     #ifdef __MMI_BT_PROFILE__
  1016.         case MMI_PROFILE_BT:
  1017.             msg_id = STR_PROFILES_BT;
  1018.             break;
  1019.     #endif /* __MMI_BT_PROFILE__ */ 
  1020.         default:
  1021.             MMI_ASSERT(0);
  1022.     }
  1023.     pfnUnicodeStrcpy(str_activate, GetString(msg_id));
  1024.     pfnUnicodeStrcat(str_activate, (S8*) L" ");
  1025.     pfnUnicodeStrcat(str_activate, GetString(STR_GENERAL_ACTIVATE_MESSAGE));
  1026.     gactivatedprofile = gprofileId = profileId;
  1027.     DisplayPopup((U8*) str_activate, IMG_GLOBAL_ACTIVATED, TRUE, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  1028.     WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  1029.     ActivateProfile();
  1030. }
  1031. /*****************************************************************************
  1032.  * FUNCTION
  1033.  *  EntryScrProfilesCustomize
  1034.  * DESCRIPTION
  1035.  *  Showing profile customize screen
  1036.  * PARAMETERS
  1037.  *  void
  1038.  * RETURNS
  1039.  *  void
  1040.  *****************************************************************************/
  1041. void EntryScrProfilesCustomize(void)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  1047.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  1048.     U16 nDispAttribute;                 /* Stores display attribue */
  1049.     U8 *guiBuffer;                      /* Buffer holding history data */
  1050.     U8 *PopUpList[MAX_SUB_MENUS];
  1051.     U16 Parentid;
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     /* 1 Call Exit Handler */
  1056.     /* Shall leave the exit handler for AT command set vibrator mode */
  1057.     EntryNewScreen(SCR_PROFILES_CUSTOMIZE, ExitScrProfilesCustomize, NULL, NULL);
  1058.     /* chinese no font size */
  1059.     if (IsChineseSet())
  1060.     {
  1061.     #ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
  1062.         if (mmi_profiles_is_device_profile())
  1063.         {
  1064.             Parentid = MENU_PROFILES_CUSTOMIZE_CHINESE_DEVICE;
  1065.         }
  1066.         else
  1067.     #endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */ 
  1068.             Parentid = MENU_PROFILES_CUSTOMIZE_CHINESE;
  1069.     }
  1070.     else
  1071.     {
  1072.     #ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
  1073.         if (mmi_profiles_is_device_profile())
  1074.         {
  1075.             Parentid = MENU_PROFILES_CUSTOMIZE_DEVICE;
  1076.         }
  1077.         else
  1078.     #endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */ 
  1079.             Parentid = MENU_PROFILES_CUSTOMIZE;
  1080.     }
  1081.     /* 2 Get current screen to gui buffer  for history purposes */
  1082.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CUSTOMIZE);
  1083.     /* 3. Retrieve no of child of menu item to be displayed */
  1084.     nNumofItem = GetNumOfChild(Parentid);
  1085.     /* 4. Get attribute of menu to be displayed */
  1086.     nDispAttribute = GetDispAttributeOfItem(Parentid);
  1087.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  1088.     GetSequenceStringIds(Parentid, nStrItemList);
  1089.     /* 6 Set current parent id */
  1090.     SetParentHandler(Parentid);
  1091.     /* 7 Register highlight handler to be called in menu screen */
  1092.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1093.     ConstructHintsList(Parentid, PopUpList);
  1094.     ShowCategory52Screen(
  1095.         STR_PROFILE_CUSTOMIZE_CAPTION,
  1096.         IMG_PROFILES_TITLEE,
  1097.         STR_GLOBAL_OK,
  1098.         IMG_GLOBAL_OK,
  1099.         STR_GLOBAL_BACK,
  1100.         IMG_GLOBAL_BACK,
  1101.         nNumofItem,
  1102.         nStrItemList,
  1103.         (PU16) gIndexIconsImageList,
  1104.         PopUpList,
  1105.         0,
  1106.         0,
  1107.         guiBuffer);
  1108.     gcommonvolumehandler = 0;
  1109.     /* 9.Register function with right softkey */
  1110.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1111.     /* 10. Register Exit handler */
  1112.     /* SetExitHandler(SCR_PROFILES_CUSTOMIZE, ExitScrProfilesCustomize); */
  1113. }
  1114. /*****************************************************************************
  1115.  * FUNCTION
  1116.  *  ExitScrProfilesCustomize
  1117.  * DESCRIPTION
  1118.  *  Exit profile Customize screen
  1119.  * PARAMETERS
  1120.  *  void
  1121.  * RETURNS
  1122.  *  void
  1123.  *****************************************************************************/
  1124. /* Shall leave the exit handler for AT command set vibrator mode */
  1125. void ExitScrProfilesCustomize(void)
  1126. {
  1127.     /*----------------------------------------------------------------*/
  1128.     /* Local Variables                                                */
  1129.     /*----------------------------------------------------------------*/
  1130.     history Scr;    /* Variable to hold the history data */
  1131.     S16 nHistory = 0;
  1132.     /*----------------------------------------------------------------*/
  1133.     /* Code Body                                                      */
  1134.     /*----------------------------------------------------------------*/
  1135.     Scr.scrnID = SCR_PROFILES_CUSTOMIZE;
  1136.     Scr.entryFuncPtr = EntryScrProfilesCustomize;
  1137.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  1138.     GetCategoryHistory(Scr.guiBuffer);
  1139.     AddHistory(Scr);
  1140. }
  1141. //PMT NEERAJ START 20050825
  1142. //PMT SUKRIT START 20051226
  1143. #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
  1144. /* PMT SUKRIT END 20051226 */
  1145. /*****************************************************************************
  1146.  * FUNCTION
  1147.  *  ring_volume_set_default_value
  1148.  * DESCRIPTION
  1149.  *  This function returns the default value for ring volume
  1150.  * PARAMETERS
  1151.  *  void
  1152.  * RETURNS
  1153.  *  void
  1154.  *****************************************************************************/
  1155. void ring_volume_set_default_value(void)
  1156. {
  1157.     /*----------------------------------------------------------------*/
  1158.     /* Local Variables                                                */
  1159.     /*----------------------------------------------------------------*/
  1160.     /*----------------------------------------------------------------*/
  1161.     /* Code Body                                                      */
  1162.     /*----------------------------------------------------------------*/
  1163.     if (gprofiles[gprofileId].ringVolumeLevel > LEVEL7)
  1164.     {
  1165.         gprofiles[gprofileId].ringVolumeLevel = LEVEL7;
  1166.     }
  1167.     default_value_ring_volume = gprofiles[gprofileId].ringVolumeLevel;
  1168. }
  1169. /*****************************************************************************
  1170.  * FUNCTION
  1171.  *  ring_volume_two_line_menuitem_get_data_callback
  1172.  * DESCRIPTION
  1173.  *  This function is called when ring volume inline menuitem is displayed
  1174.  * PARAMETERS
  1175.  *  item_index      [IN]        
  1176.  * RETURNS
  1177.  *  void
  1178.  *****************************************************************************/
  1179. pBOOL ring_volume_two_line_menuitem_get_data_callback(S32 item_index)
  1180. {
  1181.     /*----------------------------------------------------------------*/
  1182.     /* Local Variables                                                */
  1183.     /*----------------------------------------------------------------*/
  1184.     /*----------------------------------------------------------------*/
  1185.     /* Code Body                                                      */
  1186.     /*----------------------------------------------------------------*/
  1187.     if (item_index > 6)
  1188.     {
  1189.         return 0;
  1190.     }
  1191.     default_value_ring_volume = item_index;
  1192.     SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1193.     return 1;
  1194. }
  1195. /*****************************************************************************
  1196.  * FUNCTION
  1197.  *  ring_volume_two_line_menuitem_get_default_value_callback
  1198.  * DESCRIPTION
  1199.  *  This callback is called to get the default value for ring volume
  1200.  * PARAMETERS
  1201.  *  void
  1202.  * RETURNS
  1203.  *  void
  1204.  *****************************************************************************/
  1205. S32 ring_volume_two_line_menuitem_get_default_value_callback(void)
  1206. {
  1207.     /*----------------------------------------------------------------*/
  1208.     /* Local Variables                                                */
  1209.     /*----------------------------------------------------------------*/
  1210.     /*----------------------------------------------------------------*/
  1211.     /* Code Body                                                      */
  1212.     /*----------------------------------------------------------------*/
  1213.     return default_value_ring_volume;
  1214. }
  1215. /*****************************************************************************
  1216.  * FUNCTION
  1217.  *  ring_volume_line_menuitem_display_complete_callback
  1218.  * DESCRIPTION
  1219.  *  This callback is called to when the ring volume menuitem is unhighlighted
  1220.  * PARAMETERS
  1221.  *  item_index      [IN]        
  1222.  * RETURNS
  1223.  *  void
  1224.  *****************************************************************************/
  1225. void ring_volume_line_menuitem_display_complete_callback(S32 item_index)
  1226. {
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Local Variables                                                */
  1229.     /*----------------------------------------------------------------*/
  1230.     /*----------------------------------------------------------------*/
  1231.     /* Code Body                                                      */
  1232.     /*----------------------------------------------------------------*/
  1233.     mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
  1234.     gprofiles[gprofileId].ringVolumeLevel = (U8) item_index;
  1235.     SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1236. }
  1237. /*****************************************************************************
  1238.  * FUNCTION
  1239.  *  keypad_volume_set_default_value
  1240.  * DESCRIPTION
  1241.  *  This function returns the drfault value for key volume
  1242.  * PARAMETERS
  1243.  *  void
  1244.  * RETURNS
  1245.  *  void
  1246.  *****************************************************************************/
  1247. void keypad_volume_set_default_value(void)
  1248. {
  1249.     /*----------------------------------------------------------------*/
  1250.     /* Local Variables                                                */
  1251.     /*----------------------------------------------------------------*/
  1252.     /*----------------------------------------------------------------*/
  1253.     /* Code Body                                                      */
  1254.     /*----------------------------------------------------------------*/
  1255.     if (gprofiles[gprofileId].keypadVolumeLevel > LEVEL7)
  1256.     {
  1257.         gprofiles[gprofileId].keypadVolumeLevel = LEVEL7;
  1258.     }
  1259.     default_value_keypad_volume = gprofiles[gprofileId].keypadVolumeLevel;
  1260. }
  1261. /*****************************************************************************
  1262.  * FUNCTION
  1263.  *  keypad_volume_two_line_menuitem_get_data_callback
  1264.  * DESCRIPTION
  1265.  *  This function is called when keypad volume inline menuitem is displayed
  1266.  * PARAMETERS
  1267.  *  item_index      [IN]        
  1268.  * RETURNS
  1269.  *  void
  1270.  *****************************************************************************/
  1271. pBOOL keypad_volume_two_line_menuitem_get_data_callback(S32 item_index)
  1272. {
  1273.     /*----------------------------------------------------------------*/
  1274.     /* Local Variables                                                */
  1275.     /*----------------------------------------------------------------*/
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Code Body                                                      */
  1278.     /*----------------------------------------------------------------*/
  1279.     if (item_index > 6)
  1280.     {
  1281.         return 0;
  1282.     }
  1283.     default_value_keypad_volume = item_index;
  1284.     SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1285.     if (!IsSilentModeActivated())
  1286. #ifdef __MMI_SILENT_MEETING_PROFILE__
  1287.         if (!IsMeetingModeActivated())
  1288. #endif 
  1289.         {
  1290.             if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
  1291.             {
  1292.                 AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
  1293.             }
  1294.             else if (gprofiles[gprofileId].toneSetup.keypadTone != KEYPAD_SILENT)
  1295.             {
  1296.                 AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
  1297.             }
  1298.         }
  1299.     return 1;
  1300. }
  1301. /*****************************************************************************
  1302.  * FUNCTION
  1303.  *  keypad_volume_two_line_menuitem_get_default_value_callback
  1304.  * DESCRIPTION
  1305.  *  This callback is called to get the default keypad volume
  1306.  * PARAMETERS
  1307.  *  void
  1308.  * RETURNS
  1309.  *  void
  1310.  *****************************************************************************/
  1311. S32 keypad_volume_two_line_menuitem_get_default_value_callback(void)
  1312. {
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Local Variables                                                */
  1315.     /*----------------------------------------------------------------*/
  1316.     /*----------------------------------------------------------------*/
  1317.     /* Code Body                                                      */
  1318.     /*----------------------------------------------------------------*/
  1319.     return default_value_keypad_volume;
  1320. }
  1321. /*****************************************************************************
  1322.  * FUNCTION
  1323.  *  keypad_volume_line_menuitem_display_complete_callback
  1324.  * DESCRIPTION
  1325.  *  This callback is called when keypad volume menuitem is unhighlighted
  1326.  * PARAMETERS
  1327.  *  item_index      [IN]        
  1328.  * RETURNS
  1329.  *  void
  1330.  *****************************************************************************/
  1331. void keypad_volume_line_menuitem_display_complete_callback(S32 item_index)
  1332. {
  1333.     /*----------------------------------------------------------------*/
  1334.     /* Local Variables                                                */
  1335.     /*----------------------------------------------------------------*/
  1336.     /*----------------------------------------------------------------*/
  1337.     /* Code Body                                                      */
  1338.     /*----------------------------------------------------------------*/
  1339.     gprofiles[gprofileId].keypadVolumeLevel = (U8) item_index;
  1340.     AudioStopReq(gprofiles[gprofileId].toneSetup.keypadTone);
  1341.     SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1342. }
  1343. /*****************************************************************************
  1344.  * FUNCTION
  1345.  *  ExitScrProfilesVolumeType
  1346.  * DESCRIPTION
  1347.  *  Exit Screen for Profiles Volume Type Screen
  1348.  * PARAMETERS
  1349.  *  void
  1350.  * RETURNS
  1351.  *  void
  1352.  *****************************************************************************/
  1353. void ExitScrProfilesVolumeType(void)
  1354. {
  1355.     /*----------------------------------------------------------------*/
  1356.     /* Local Variables                                                */
  1357.     /*----------------------------------------------------------------*/
  1358.     /*----------------------------------------------------------------*/
  1359.     /* Code Body                                                      */
  1360.     /*----------------------------------------------------------------*/
  1361.     is_level_select_menuitem_displayed_in_volume_screen = 0;
  1362.     //PMT SUKRIT START FT1&2
  1363.     /* restore key tone state */
  1364.     mmi_frm_kbd_set_tone_state(key_tone_state);
  1365.     //PMT SUKRIT END FT1&2
  1366.     if (mmi_profiles_is_ring_tone_playing())
  1367.     {
  1368.         mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
  1369.     }
  1370. }
  1371. /*****************************************************************************
  1372.  * FUNCTION
  1373.  *  ContinueRingTone_TwoLine
  1374.  * DESCRIPTION
  1375.  *  Continue Ring tone after message received on ring tone volume two line screen.
  1376.  * PARAMETERS
  1377.  *  info        [?]     
  1378.  * RETURNS
  1379.  *  void
  1380.  *****************************************************************************/
  1381. void ContinueRingTone_TwoLine(void *info)
  1382. {
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Local Variables                                                */
  1385.     /*----------------------------------------------------------------*/
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Code Body                                                      */
  1388.     /*----------------------------------------------------------------*/
  1389.     SetRingerVolume(default_value_ring_volume);
  1390.     if (!IsSilentModeActivated())
  1391. #ifdef __MMI_SILENT_MEETING_PROFILE__
  1392.         if (!IsMeetingModeActivated())
  1393. #endif 
  1394.         {
  1395.             AudioPlayToneWithCallBackVolPath(
  1396.                 gprofiles[gprofileId].toneSetup.ringTone,
  1397.                 REPEAT,
  1398.                 INCOMING_CALL_TONE,
  1399.                 (U8) default_value_ring_volume,
  1400.                 MDI_DEVICE_SPEAKER2);
  1401.             mmi_profiles_set_ring_tone_playing(TRUE);
  1402.         }
  1403. }
  1404. /*****************************************************************************
  1405.  * FUNCTION
  1406.  *  set_current_volume_level
  1407.  * DESCRIPTION
  1408.  *  This function is to set the current volume level.
  1409.  * PARAMETERS
  1410.  *  void
  1411.  *  Input: None(?)
  1412.  * RETURNS
  1413.  *  void
  1414.  *****************************************************************************/
  1415. void set_current_volume_level()
  1416. {
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Local Variables                                                */
  1419.     /*----------------------------------------------------------------*/
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Code Body                                                      */
  1422.     /*----------------------------------------------------------------*/
  1423.     default_value_ring_volume = gprofiles[gprofileId].ringVolumeLevel;
  1424.     default_value_keypad_volume = gprofiles[gprofileId].keypadVolumeLevel;
  1425. }
  1426. /*****************************************************************************
  1427.  * FUNCTION
  1428.  *  ring_volume_two_line_menuitem_complete_callback
  1429.  * DESCRIPTION
  1430.  *  This function is called when ring volume menuitem is unhighlighted
  1431.  * PARAMETERS
  1432.  *  menuitem_index      [IN]        Menuitem index
  1433.  *  selected_index      [IN]        Inline item index
  1434.  * RETURNS
  1435.  *  void
  1436.  *****************************************************************************/
  1437. void ring_volume_two_line_menuitem_complete_callback(S32 menuitem_index, S32 selected_index)
  1438. {
  1439.     /*----------------------------------------------------------------*/
  1440.     /* Local Variables                                                */
  1441.     /*----------------------------------------------------------------*/
  1442.     /*----------------------------------------------------------------*/
  1443.     /* Code Body                                                      */
  1444.     /*----------------------------------------------------------------*/
  1445.     mdi_audio_stop_all();
  1446. }
  1447. /*****************************************************************************
  1448.  * FUNCTION
  1449.  *  ring_volume_two_line_menuitem_set_data
  1450.  * DESCRIPTION
  1451.  *  This function is used to set the ring volume
  1452.  * PARAMETERS
  1453.  *  item_index      [IN]        Inline item index
  1454.  * RETURNS
  1455.  *  pBOOL
  1456.  *****************************************************************************/
  1457. pBOOL ring_volume_two_line_menuitem_set_data(S32 item_index)
  1458. {
  1459.     /*----------------------------------------------------------------*/
  1460.     /* Local Variables                                                */
  1461.     /*----------------------------------------------------------------*/
  1462.     /*----------------------------------------------------------------*/
  1463.     /* Code Body                                                      */
  1464.     /*----------------------------------------------------------------*/
  1465.     if (item_index > LEVEL7)
  1466.     {
  1467.         return 0;
  1468.     }
  1469.     SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1470.     default_value_ring_volume = item_index;
  1471.     return 1;
  1472. }
  1473. /*****************************************************************************
  1474.  * FUNCTION
  1475.  *  keypad_volume_two_line_menuitem_set_data
  1476.  * DESCRIPTION
  1477.  *  This function is used to set the keypad ring volume
  1478.  * PARAMETERS
  1479.  *  item_index      [IN]        Inline item index
  1480.  * RETURNS
  1481.  *  pBOOL
  1482.  *****************************************************************************/
  1483. pBOOL keypad_volume_two_line_menuitem_set_data(S32 item_index)
  1484. {
  1485.     /*----------------------------------------------------------------*/
  1486.     /* Local Variables                                                */
  1487.     /*----------------------------------------------------------------*/
  1488.     /*----------------------------------------------------------------*/
  1489.     /* Code Body                                                      */
  1490.     /*----------------------------------------------------------------*/
  1491.     if (item_index > LEVEL7)
  1492.     {
  1493.         return 0;
  1494.     }
  1495.     default_value_keypad_volume = item_index;
  1496.     SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
  1497.     if (gcurrentprofile.toneSetup.keypadTone == KEYPAD_SILENT)
  1498.     {
  1499.         if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
  1500.         {
  1501.             AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
  1502.         }
  1503.         else
  1504.         {
  1505.             AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
  1506.         }
  1507.     }
  1508.     return 1;
  1509. }
  1510. /*****************************************************************************
  1511.  * FUNCTION
  1512.  *  mmi_get_volume_display_style
  1513.  * DESCRIPTION
  1514.  *  This function returns the display style of the volume
  1515.  * PARAMETERS
  1516.  *  index       [IN]        Menu item index
  1517.  * RETURNS
  1518.  *  U8
  1519.  *****************************************************************************/
  1520. U8 mmi_get_volume_display_style(S32 index)
  1521. {
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Local Variables                                                */
  1524.     /*----------------------------------------------------------------*/
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Code Body                                                      */
  1527.     /*----------------------------------------------------------------*/
  1528.     ring_volume_index = GetChildMenuIDIndexByParentMenuID(MENU_VOLUME_LEVEL, MENU_RING_VOLUME_LEVEL);
  1529.     keypad_volume_index = GetChildMenuIDIndexByParentMenuID(MENU_VOLUME_LEVEL, MENU_KEYPAD_VOLUME_LEVEL);
  1530.     if (index == ring_volume_index || index == keypad_volume_index)
  1531.     {
  1532.         return TWO_LINE_MENUITEM_STYLE_DISPLAY_LEVEL_SELECT;
  1533.     }
  1534.     else
  1535.     {
  1536.         return 0;
  1537.     }
  1538. }
  1539. /*****************************************************************************
  1540.  * FUNCTION
  1541.  *  mmi_volume_get_default_value
  1542.  * DESCRIPTION
  1543.  *  This function returns the default volume level
  1544.  * PARAMETERS
  1545.  *  menuitem_index      [IN]        Menu item index
  1546.  * RETURNS
  1547.  *  S32
  1548.  *****************************************************************************/
  1549. S32 mmi_volume_get_default_value(S32 menuitem_index)
  1550. {
  1551.     /*----------------------------------------------------------------*/
  1552.     /* Local Variables                                                */
  1553.     /*----------------------------------------------------------------*/
  1554.     /*----------------------------------------------------------------*/
  1555.     /* Code Body                                                      */
  1556.     /*----------------------------------------------------------------*/
  1557.     if (menuitem_index == ring_volume_index)
  1558.     {
  1559.         return default_value_ring_volume;
  1560.     }
  1561.     else if (menuitem_index == keypad_volume_index)
  1562.     {
  1563.         return default_value_keypad_volume;
  1564.     }
  1565.     else
  1566.     {
  1567.         return NULL;
  1568.     }
  1569. }
  1570. /*****************************************************************************
  1571.  * FUNCTION
  1572.  *  mmi_volume_get_and_set_level_select_data
  1573.  * DESCRIPTION
  1574.  *  This function sets the volume data for the menu item
  1575.  * PARAMETERS
  1576.  *  menuitem_index      [IN]        Menu item index
  1577.  *  item_index          [IN]        Inline item index
  1578.  * RETURNS
  1579.  *  pBOOL
  1580.  *****************************************************************************/
  1581. pBOOL mmi_volume_get_and_set_level_select_data(S32 menuitem_index, S32 item_index)
  1582. {
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Local Variables                                                */
  1585.     /*----------------------------------------------------------------*/
  1586.     /*----------------------------------------------------------------*/
  1587.     /* Code Body                                                      */
  1588.     /*----------------------------------------------------------------*/
  1589.     if (menuitem_index == ring_volume_index)
  1590.     {
  1591.         if (ring_volume_two_line_menuitem_set_data(item_index))
  1592.         {
  1593.             return 1;
  1594.         }
  1595.         else
  1596.         {
  1597.             return 0;
  1598.         }
  1599.     }
  1600.     else if (menuitem_index == keypad_volume_index)
  1601.     {
  1602.         if (keypad_volume_two_line_menuitem_set_data(item_index))
  1603.         {
  1604.             return 1;
  1605.         }
  1606.         else
  1607.         {
  1608.             return 0;
  1609.         }
  1610.     }
  1611.     else
  1612.     {
  1613.         return 0;
  1614.     }
  1615. }
  1616. /*****************************************************************************
  1617.  * FUNCTION
  1618.  *  mmi_volume_get_menuitem_properties
  1619.  * DESCRIPTION
  1620.  *  This function sets the properties of volume menuitems
  1621.  * PARAMETERS
  1622.  *  index                           [IN]        Menuitem index
  1623.  *  current_menuitem_properties     [?]         
  1624.  * RETURNS
  1625.  *  void
  1626.  *****************************************************************************/
  1627. void mmi_volume_get_menuitem_properties(int index, wgui_two_line_menuitem_struct *current_menuitem_properties)
  1628. {
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Local Variables                                                */
  1631.     /*----------------------------------------------------------------*/
  1632.     /*----------------------------------------------------------------*/
  1633.     /* Code Body                                                      */
  1634.     /*----------------------------------------------------------------*/
  1635.     if (index == ring_volume_index)
  1636.     {
  1637.         current_menuitem_properties->num_of_items = 7;
  1638.         current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
  1639.         current_menuitem_properties->defualt_value_callback = mmi_volume_get_default_value;
  1640.         current_menuitem_properties->complete_callback = ring_volume_two_line_menuitem_complete_callback;
  1641.         current_menuitem_properties->two_line_data_callback.get_data_for_level_select =
  1642.             mmi_volume_get_and_set_level_select_data;
  1643.     }
  1644.     else if (index == keypad_volume_index)
  1645.     {
  1646.         //PMT SUKRIT START FT1&2
  1647.         /* disable Right & Left Arrow key tone */
  1648.         mmi_frm_kbd_set_tone_state(MMI_KEY_RIGHT_LEFT_ARROW_TONE_DISABLED);
  1649.         //PMT SUKRIT END FT1&2
  1650.         current_menuitem_properties->num_of_items = 7;
  1651.         current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
  1652.         current_menuitem_properties->defualt_value_callback = mmi_volume_get_default_value;
  1653.         current_menuitem_properties->complete_callback = NULL;
  1654.         current_menuitem_properties->two_line_data_callback.get_data_for_level_select =
  1655.             mmi_volume_get_and_set_level_select_data;
  1656.     }
  1657. }
  1658. #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */ 
  1659. /* PMT SUKRIT END 20051226 */
  1660. /*****************************************************************************
  1661.  * FUNCTION
  1662.  *  EntryScrProfilesVolumeType
  1663.  * DESCRIPTION
  1664.  *  Entry function for Volume option
  1665.  * PARAMETERS
  1666.  *  void
  1667.  * RETURNS
  1668.  *  void
  1669.  *****************************************************************************/
  1670. void EntryScrProfilesVolumeType(void)
  1671. {
  1672.     /*----------------------------------------------------------------*/
  1673.     /* Local Variables                                                */
  1674.     /*----------------------------------------------------------------*/
  1675.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  1676.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  1677.     U16 nDispAttribute;                 /* Stores display attribue */
  1678.     U8 *guiBuffer;                      /* Buffer holding history data */
  1679.     U8 *PopUpList[MAX_SUB_MENUS];
  1680.     /*----------------------------------------------------------------*/
  1681.     /* Code Body                                                      */
  1682.     /*----------------------------------------------------------------*/
  1683.     /* PMT SUKRIT START 20051226 */
  1684. #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
  1685.     /* PMT SUKRIT END 20051226 */
  1686.     is_level_select_menuitem_displayed_in_volume_screen = 1;
  1687.     //PMT SUKRIT START FT1&2
  1688.     key_tone_state = mmi_frm_kbd_get_key_tone_state();
  1689.     //PMT SUKRIT END FT1&2
  1690.     EntryNewScreen(SCR_PROFILES_VOLUME_LEVEL, ExitScrProfilesVolumeType, EntryScrProfilesVolumeType, NULL);
  1691. #else /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */ 
  1692.     /* PMT NEERAJ END 20050825 */
  1693.     /* 1 Call Exit Handler */
  1694.     EntryNewScreen(SCR_PROFILES_VOLUME_LEVEL, NULL, EntryScrProfilesVolumeType, NULL);
  1695.     /* PMT NEERAJ START 20050825 */
  1696. #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */ 
  1697.     /* 2 Get current screen to gui buffer  for history purposes */
  1698.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_VOLUME_LEVEL);
  1699.     /* 3. Retrieve no of child of menu item to be displayed */
  1700.     nNumofItem = GetNumOfChild(MENU_VOLUME_LEVEL);
  1701.     /* 4. Get attribute of menu to be displayed */
  1702.     nDispAttribute = GetDispAttributeOfItem(MENU_VOLUME_LEVEL);
  1703.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  1704.     GetSequenceStringIds(MENU_VOLUME_LEVEL, nStrItemList);
  1705.     /* 6 Set current parent id */
  1706.     SetParentHandler(MENU_VOLUME_LEVEL);
  1707.     /* 7 Register highlight handler to be called in menu screen */
  1708.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1709.     ConstructHintsList(MENU_VOLUME_LEVEL, PopUpList);
  1710.     /* PMT SUKRIT START 20051226 */
  1711. #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
  1712.     wgui_set_pfn_to_get_display_style(mmi_get_volume_display_style);
  1713.     wgui_set_pfn_to_get_current_menu_item_properties(mmi_volume_get_menuitem_properties);
  1714.     if (!guiBuffer)
  1715.     {
  1716.         set_current_volume_level();
  1717.     }
  1718. #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */ 
  1719.     /* PMT SUKRIT END 20051226 */
  1720.     ShowCategory52Screen(
  1721.         STR_VOLUME_LEVEL_CAPTION,
  1722.         IMG_PROFILES_TITLEE,
  1723.         STR_GLOBAL_OK,
  1724.         IMG_GLOBAL_OK,
  1725.         STR_GLOBAL_BACK,
  1726.         IMG_GLOBAL_BACK,
  1727.         nNumofItem,
  1728.         nStrItemList,
  1729.         (PU16) gIndexIconsImageList,
  1730.         PopUpList,
  1731.         0,
  1732.         gcommonvolumehandler,
  1733.         guiBuffer);
  1734. //PMT SUKRIT START FT1&2
  1735.     Category52DisablePenMove();
  1736. //PMT SUKRIT END FT1&2
  1737.     /* 9.Register function with right softkey */
  1738.     /* SetExitHandler(SCR_PROFILES_VOLUME_LEVEL,ExitScrProfilesVolumeType ); */
  1739. }
  1740. /*****************************************************************************
  1741.  * FUNCTION
  1742.  *  EntryScrProfilesCommonVolumeLevel1
  1743.  * DESCRIPTION
  1744.  *  Does all settings before entering into the entry fn of volume screen.
  1745.  * PARAMETERS
  1746.  *  void
  1747.  * RETURNS
  1748.  *  void
  1749.  *****************************************************************************/
  1750. void EntryScrProfilesCommonVolumeLevel1(void)
  1751. {
  1752.     /*----------------------------------------------------------------*/
  1753.     /* Local Variables                                                */
  1754.     /*----------------------------------------------------------------*/
  1755.     /*----------------------------------------------------------------*/
  1756.     /* Code Body                                                      */
  1757.     /*----------------------------------------------------------------*/
  1758.     switch (gcommonvolumehandler)
  1759.     {
  1760.         case 0:
  1761.             gcommonvolumelevel = gprofiles[gprofileId].ringVolumeLevel;
  1762.             break;
  1763.         case 1:
  1764.             gcommonvolumelevel = gprofiles[gprofileId].keypadVolumeLevel;
  1765.             break;
  1766.     }
  1767.     EntryScrProfilesCommonVolumeLevel();
  1768. }
  1769. /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
  1770. /*****************************************************************************
  1771.  * FUNCTION
  1772.  *  ContinueRingTone
  1773.  * DESCRIPTION
  1774.  *  Continue Ring tone after message received on ring tone volume screen.
  1775.  * PARAMETERS
  1776.  *  info        [?]     
  1777.  * RETURNS
  1778.  *  void
  1779.  *****************************************************************************/
  1780. void ContinueRingTone(void *info)
  1781. {
  1782.     /*----------------------------------------------------------------*/
  1783.     /* Local Variables                                                */
  1784.     /*----------------------------------------------------------------*/
  1785.     /*----------------------------------------------------------------*/
  1786.     /* Code Body                                                      */
  1787.     /*----------------------------------------------------------------*/
  1788.     SetRingerVolume(gcommonvolumelevel);
  1789.     if (!IsSilentModeActivated())
  1790. #ifdef __MMI_SILENT_MEETING_PROFILE__
  1791.         if (!IsMeetingModeActivated())
  1792. #endif 
  1793.         {
  1794.             AudioPlayToneWithCallBackVolPath(
  1795.                 gprofiles[gprofileId].toneSetup.ringTone,
  1796.                 REPEAT,
  1797.                 INCOMING_CALL_TONE,
  1798.                 (U8) gcommonvolumelevel,
  1799.                 MDI_DEVICE_SPEAKER2);
  1800.             mmi_profiles_set_ring_tone_playing(TRUE);
  1801.         }
  1802. }
  1803. /*****************************************************************************
  1804.  * FUNCTION
  1805.  *  EntryScrProfilesCommonVolumeLevel
  1806.  * DESCRIPTION
  1807.  *  Set all Voulem screen handler functions and call the general entry screen of volume level.
  1808.  * PARAMETERS
  1809.  *  void
  1810.  * RETURNS
  1811.  *  void
  1812.  *****************************************************************************/
  1813. void EntryScrProfilesCommonVolumeLevel(void)
  1814. {
  1815.     /*----------------------------------------------------------------*/
  1816.     /* Local Variables                                                */
  1817.     /*----------------------------------------------------------------*/
  1818.     VOLUMEHANDLER_TYPE type;
  1819.     /*----------------------------------------------------------------*/
  1820.     /* Code Body                                                      */
  1821.     /*----------------------------------------------------------------*/
  1822.     /* ExecuteCurrExitHandler(); */
  1823.     EntryNewScreen(SCR_PROFILES_COMMON_VOLUME_LEVEL, NULL, NULL, NULL);
  1824.     switch (gcommonvolumehandler)
  1825.     {
  1826.         case 0:
  1827.             mdi_audio_suspend_background_play();    /* stop all because it might be play file or play id */
  1828.             SetRingerVolume(gcommonvolumelevel);
  1829.             type = VOLUMEHANDLER_RING_TONE;
  1830. /*** Set all function handlers volume level screen *****/
  1831.             SetVolumeKeyHandlerFunctions(
  1832.                 VolumeIncreaseDecreaseFunction,
  1833.                 VolumeIncreaseDecreaseFunction,
  1834.                 NULL,
  1835.                 NULL,
  1836.                 STR_COMMON_VOLUME_LEVEL_RING_CAPTION,
  1837.                 &gcommonvolumelevel,
  1838.                 STR_GLOBAL_OK,
  1839.                 STR_GLOBAL_BACK,
  1840.                 EntryScrSetCommonVolumeLevel,
  1841.                 GoBackCommonVolume,
  1842.                 0,
  1843.                 ExitScrProfilesCommonVolumeLevel,
  1844.                 1,
  1845.                 type);
  1846.             EntryScrSetKeyPadVolumeLevel();
  1847.             if (!IsSilentModeActivated())
  1848.     #ifdef __MMI_SILENT_MEETING_PROFILE__
  1849.                 if (!IsMeetingModeActivated())
  1850.     #endif 
  1851.                 {
  1852.                     AudioPlayToneWithCallBackVolPath(
  1853.                         gprofiles[gprofileId].toneSetup.ringTone,
  1854.                         REPEAT,
  1855.                         INCOMING_CALL_TONE,
  1856.                         (U8) gcommonvolumelevel,
  1857.                         MDI_DEVICE_SPEAKER2);
  1858.                     mmi_profiles_set_ring_tone_playing(TRUE);
  1859.                 }
  1860.             /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
  1861.             SetProtocolEventHandler(ContinueRingTone, PRT_EQ_PLAY_AUDIO_FINISH_IND);
  1862.             break;
  1863.         case 1:
  1864.             mdi_audio_suspend_background_play();
  1865.             /* disable UP DOWN key tone */
  1866.             key_tone_state = mmi_frm_kbd_get_key_tone_state();
  1867.             mmi_frm_kbd_set_tone_state(MMI_KEY_VOL_UP_DOWN_TONE_DISABLED);
  1868.             SetKeyPadVolume(gcommonvolumelevel);
  1869.             type = VOLUMEHANDLER_KEY_TONE;
  1870. /*** Set all function handlers volume level screen *****/
  1871.             SetVolumeKeyHandlerFunctions(
  1872.                 VolumeIncreaseDecreaseFunction,
  1873.                 VolumeIncreaseDecreaseFunction,
  1874.                 NULL,
  1875.                 NULL,
  1876.                 STR_COMMON_VOLUME_LEVEL_KEY_CAPTION,
  1877.                 &gcommonvolumelevel,
  1878.                 STR_GLOBAL_OK,
  1879.                 STR_GLOBAL_BACK,
  1880.                 EntryScrSetCommonVolumeLevel,
  1881.                 GoBackCommonVolume,
  1882.                 0,
  1883.                 ExitScrProfilesCommonVolumeLevel,
  1884.                 1,
  1885.                 type);
  1886.             EntryScrSetKeyPadVolumeLevel();
  1887.             AudioStopReq((U16) gprofiles[gprofileId].toneSetup.keypadTone);
  1888.             break;
  1889.     }
  1890.     SetKeyHandler(GoIdleScreenCommonVolume, KEY_END, KEY_EVENT_DOWN);
  1891.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1892. }
  1893. /*****************************************************************************
  1894.  * FUNCTION
  1895.  *  VolumeIncreaseDecreaseFunction
  1896.  * DESCRIPTION
  1897.  *  Call Back function for Volume increase and decrease.
  1898.  * PARAMETERS
  1899.  *  void
  1900.  * RETURNS
  1901.  *  void
  1902.  *****************************************************************************/
  1903. void VolumeIncreaseDecreaseFunction(void)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     /*----------------------------------------------------------------*/
  1909.     /* Code Body                                                      */
  1910.     /*----------------------------------------------------------------*/
  1911.     if (gcommonvolumehandler && !IsSilentModeActivated())
  1912. #ifdef __MMI_SILENT_MEETING_PROFILE__
  1913.         if (!IsMeetingModeActivated())
  1914. #endif 
  1915.         {
  1916.             if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
  1917.             {
  1918.                 AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
  1919.             }
  1920.             else if (gprofiles[gprofileId].toneSetup.keypadTone != KEYPAD_SILENT)
  1921.             {
  1922.                 AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
  1923.             }
  1924.         }
  1925. }
  1926. /*****************************************************************************
  1927.  * FUNCTION
  1928.  *  EntryScrSetCommonVolumeLevel
  1929.  * DESCRIPTION
  1930.  *  Set keypad volume level for press of OK on volume level screen
  1931.  * PARAMETERS
  1932.  *  void
  1933.  * RETURNS
  1934.  *  void
  1935.  *****************************************************************************/
  1936. void EntryScrSetCommonVolumeLevel(void)
  1937. {
  1938.     /*----------------------------------------------------------------*/
  1939.     /* Local Variables                                                */
  1940.     /*----------------------------------------------------------------*/
  1941.     U8 *guiBuffer;  /* Buffer holding history data */
  1942.     MMI_VOLUME_LEVEL_ENUM ringvolume;
  1943.     MMI_VOLUME_LEVEL_ENUM keypadvolume;
  1944.     /*----------------------------------------------------------------*/
  1945.     /* Code Body                                                      */
  1946.     /*----------------------------------------------------------------*/
  1947.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_STATUS);
  1948.     switch (gcommonvolumehandler)
  1949.     {
  1950.         case 0:
  1951.         {
  1952.             gringvol_level = volume_level_UI;
  1953.             gprofiles[gprofileId].ringVolumeLevel = (U8) gcommonvolumelevel;
  1954.             /*stop ring tone to prevent from ring tone volume change to active profile volume*/
  1955.             if (mmi_profiles_is_ring_tone_playing())
  1956.             {
  1957.                 mdi_audio_stop_all();
  1958.             }            
  1959.             switch (gringvol_level)
  1960.             {
  1961.                 case 0:
  1962.                     ringvolume = LEVEL1;
  1963.                     SetRingVolumeLevel(ringvolume);
  1964.                     break;
  1965.                 case 1:
  1966.                     ringvolume = LEVEL2;
  1967.                     SetRingVolumeLevel(ringvolume);
  1968.                     break;
  1969.                 case 2:
  1970.                     ringvolume = LEVEL3;
  1971.                     SetRingVolumeLevel(ringvolume);
  1972.                     break;
  1973.                 case 3:
  1974.                     ringvolume = LEVEL4;
  1975.                     SetRingVolumeLevel(ringvolume);
  1976.                     break;
  1977.                 case 4:
  1978.                     ringvolume = LEVEL5;
  1979.                     SetRingVolumeLevel(ringvolume);
  1980.                     break;
  1981.                 case 5:
  1982.                     ringvolume = LEVEL6;
  1983.                     SetRingVolumeLevel(ringvolume);
  1984.                     break;
  1985.                 case 6:
  1986.                     ringvolume = LEVEL7;
  1987.                     SetRingVolumeLevel(ringvolume);
  1988.                     break;
  1989.             }
  1990.         }
  1991.             break;
  1992.         case 1:
  1993.         {
  1994.             gkeypadvol_level = volume_level_UI;
  1995.             gprofiles[gprofileId].keypadVolumeLevel = (U8) gcommonvolumelevel;
  1996.             switch (gkeypadvol_level)
  1997.             {
  1998.                 case 0:
  1999.                     keypadvolume = LEVEL1;
  2000.                     SetKeypadVolumeLevel(keypadvolume);
  2001.                     break;
  2002.                 case 1:
  2003.                     keypadvolume = LEVEL2;
  2004.                     SetKeypadVolumeLevel(keypadvolume);
  2005.                     break;
  2006.                 case 2:
  2007.                     keypadvolume = LEVEL3;
  2008.                     SetKeypadVolumeLevel(keypadvolume);
  2009.                     break;
  2010.                 case 3:
  2011.                     keypadvolume = LEVEL4;
  2012.                     SetKeypadVolumeLevel(keypadvolume);
  2013.                     break;
  2014.                 case 4:
  2015.                     keypadvolume = LEVEL5;
  2016.                     SetKeypadVolumeLevel(keypadvolume);
  2017.                     break;
  2018.                 case 5:
  2019.                     keypadvolume = LEVEL6;
  2020.                     SetKeypadVolumeLevel(keypadvolume);
  2021.                     break;
  2022.                 case 6:
  2023.                     keypadvolume = LEVEL7;
  2024.                     SetKeypadVolumeLevel(keypadvolume);
  2025.                     break;
  2026.             }
  2027.         }
  2028.             break;
  2029.     }
  2030.     GoBackHistory();
  2031. }
  2032. /*****************************************************************************
  2033.  * FUNCTION
  2034.  *  GoBackCommonVolume
  2035.  * DESCRIPTION
  2036.  *  Function for go back in common volume screen
  2037.  * PARAMETERS
  2038.  *  void
  2039.  * RETURNS
  2040.  *  void
  2041.  *****************************************************************************/
  2042. void GoBackCommonVolume(void)
  2043. {
  2044.     /*----------------------------------------------------------------*/
  2045.     /* Local Variables                                                */
  2046.     /*----------------------------------------------------------------*/
  2047.     MMI_VOLUME_LEVEL_ENUM ringVolumeLevel, keypadVolumelevel;
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Code Body                                                      */
  2050.     /*----------------------------------------------------------------*/
  2051. /**** Restore Volume levels on press of BACK key on volume level screen*****/
  2052.     switch (gcommonvolumehandler)
  2053.     {
  2054.         case 0:
  2055.             ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
  2056.             SetRingerVolume(ringVolumeLevel);
  2057.             break;
  2058.         case 1:
  2059.             keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
  2060.             SetKeyPadVolume(keypadVolumelevel);
  2061.             break;
  2062.     }
  2063.     GoBackHistory();
  2064. }
  2065. /*****************************************************************************
  2066.  * FUNCTION
  2067.  *  GoIdleScreenCommonVolume
  2068.  * DESCRIPTION
  2069.  *  Go back from Volume screen through End Key
  2070.  * PARAMETERS
  2071.  *  void
  2072.  * RETURNS
  2073.  *  void
  2074.  *****************************************************************************/
  2075. void GoIdleScreenCommonVolume(void)
  2076. {
  2077.     /*----------------------------------------------------------------*/
  2078.     /* Local Variables                                                */
  2079.     /*----------------------------------------------------------------*/
  2080.     MMI_VOLUME_LEVEL_ENUM ringVolumeLevel, keypadVolumelevel;
  2081.     /*----------------------------------------------------------------*/
  2082.     /* Code Body                                                      */
  2083.     /*----------------------------------------------------------------*/
  2084. /**** Restore Volume levels on press of END key on volume level screen*****/
  2085.     switch (gcommonvolumehandler)
  2086.     {
  2087.         case 0:
  2088.             ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
  2089.             SetRingerVolume(ringVolumeLevel);
  2090.             break;
  2091.         case 1:
  2092.             keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
  2093.             SetKeyPadVolume(keypadVolumelevel);
  2094.             break;
  2095.     }
  2096.     DisplayIdleScreen();
  2097. }
  2098. /*****************************************************************************
  2099.  * FUNCTION
  2100.  *  ExitScrProfilesCommonVolumeLevel
  2101.  * DESCRIPTION
  2102.  *  Exit profile Volume Level screen
  2103.  * PARAMETERS
  2104.  *  void
  2105.  * RETURNS
  2106.  *  void
  2107.  *****************************************************************************/
  2108. void ExitScrProfilesCommonVolumeLevel(void)
  2109. {
  2110.     /*----------------------------------------------------------------*/
  2111.     /* Local Variables                                                */
  2112.     /*----------------------------------------------------------------*/
  2113.     MMI_VOLUME_LEVEL_ENUM ringVolumeLevel, keypadVolumelevel;
  2114.     history Scr;    /* Variable to hold the history data */
  2115.     S16 nHistory = 0;
  2116.     /*----------------------------------------------------------------*/
  2117.     /* Code Body                                                      */
  2118.     /*----------------------------------------------------------------*/
  2119.     Scr.scrnID = SCR_PROFILES_COMMON_VOLUME_LEVEL;
  2120.     Scr.entryFuncPtr = EntryScrProfilesCommonVolumeLevel;
  2121.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  2122.     GetCategoryHistory(Scr.guiBuffer);
  2123.     AddHistory(Scr);
  2124.     switch (gcommonvolumehandler)
  2125.     {
  2126.         case 0:
  2127.             if (mmi_profiles_is_ring_tone_playing())
  2128.             {
  2129.                 mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
  2130.             }
  2131.             ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
  2132.             SetRingerVolume(ringVolumeLevel);
  2133.             mdi_audio_resume_background_play();
  2134.             /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
  2135.             SetProtocolEventHandler(NULL, PRT_EQ_PLAY_AUDIO_FINISH_IND);
  2136.             break;
  2137.         case 1:
  2138.             AudioStopReq((U16) gprofiles[gprofileId].toneSetup.keypadTone);
  2139.             keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
  2140.             SetKeyPadVolume(keypadVolumelevel);
  2141.             /* restore key tone state */
  2142.             mmi_frm_kbd_set_tone_state(key_tone_state);
  2143.             mdi_audio_resume_background_play();
  2144.             break;
  2145.     }
  2146. }
  2147. /*****************************************************************************
  2148.  * FUNCTION
  2149.  *  EntryScrProfilesCallAlert
  2150.  * DESCRIPTION
  2151.  *  Showing profile Call Alert screen
  2152.  * PARAMETERS
  2153.  *  void
  2154.  * RETURNS
  2155.  *  void
  2156.  *****************************************************************************/
  2157. void EntryScrProfilesCallAlert(void)
  2158. {
  2159.     /*----------------------------------------------------------------*/
  2160.     /* Local Variables                                                */
  2161.     /*----------------------------------------------------------------*/
  2162.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  2163.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  2164.     U16 nDispAttribute;                 /* Stores display attribue */
  2165.     U8 *guiBuffer;                      /* Buffer holding history data */
  2166.     S8 i = 0;
  2167.     /* U8* PopUpList[MAX_SUB_MENUS]; */
  2168.     MMI_ALERT_TYPE data = 0;
  2169.     U16 ProfileMenuID[] = 
  2170.     {
  2171.         MENU_RING,
  2172.         MENU_VIBRATION_ONLY,
  2173.         MENU_VIBRATION_AND_RING,
  2174.         MENU_VIBRATION_THEN_RING,
  2175.         MENU_SILENT
  2176.     };
  2177.     /*----------------------------------------------------------------*/
  2178.     /* Code Body                                                      */
  2179.     /*----------------------------------------------------------------*/
  2180.     /* 1 Call Exit Handler */
  2181.     EntryNewScreen(SCR_PROFILES_CALL_ALERT, NULL, EntryScrProfilesCallAlert, NULL);
  2182.     /* 2 Get current screen to gui buffer  for history purposes */
  2183.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CALL_ALERT);
  2184.     /* 3. Retrieve no of child of menu item to be displayed */
  2185.     nNumofItem = GetNumOfChild(MENU_MT_CALL_ALERT_TYPE);
  2186.     /* 4. Get attribute of menu to be displayed */
  2187.     nDispAttribute = GetDispAttributeOfItem(MENU_MT_CALL_ALERT_TYPE);
  2188.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2189.     GetSequenceStringIds(MENU_MT_CALL_ALERT_TYPE, nStrItemList);
  2190.     /* 6 Set current parent id */
  2191.     SetParentHandler(MENU_MT_CALL_ALERT_TYPE);
  2192.     /* 7 Register highlight handler to be called in menu screen */
  2193.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2194.     /* MTK Brian modified for showing radio button, 2003/11/15 */
  2195. /****** Get the index of activated alert type menu ID*****/
  2196.     i = gprofiles[gprofileId].mtCallAlertTypeEnum;
  2197.     data = GetIndexOfStringId(MENU_MT_CALL_ALERT_TYPE, ProfileMenuID[i - 1]);
  2198.     /* 8 Display Category Screen */
  2199.     ShowCategory11Screen(
  2200.         STR_CALL_ALERT_CAPTION,
  2201.         IMG_PROFILES_TITLEE,
  2202.         STR_GLOBAL_OK,
  2203.         IMG_GLOBAL_OK,
  2204.         STR_GLOBAL_BACK,
  2205.         IMG_GLOBAL_BACK,
  2206.         nNumofItem,
  2207.         nStrItemList,
  2208.         (U16) data,
  2209.         guiBuffer);
  2210.     /* MTK end */
  2211.     /* SetExitHandler(SCR_PROFILES_CALL_ALERT, ExitScrProfilesCallAlert); */
  2212. }
  2213. /*****************************************************************************
  2214.  * FUNCTION
  2215.  *  GuardSilentMode
  2216.  * DESCRIPTION
  2217.  *  GuardSilentMode
  2218.  * PARAMETERS
  2219.  *  void
  2220.  * RETURNS
  2221.  *  U8
  2222.  *****************************************************************************/
  2223. U8 GuardSilentMode(void)
  2224. {
  2225.     /*----------------------------------------------------------------*/
  2226.     /* Local Variables                                                */
  2227.     /*----------------------------------------------------------------*/
  2228.     /*----------------------------------------------------------------*/
  2229.     /* Code Body                                                      */
  2230.     /*----------------------------------------------------------------*/
  2231.     if (gprofileId == MMI_PROFILE_SILENT)
  2232.     {
  2233.         MMI_fixed_list_menu.highlighted_item = GetIndexOfStringId(MENU_MT_CALL_ALERT_TYPE, MENU_VIBRATION_ONLY);
  2234.         DisplayPopup(
  2235.             (PU8) GetString(STR_PROFILES_CANNOT_CHANGE_SILENT_MODE_SETTING),
  2236.             IMG_GLOBAL_WARNING,
  2237.             0,
  2238.             1000,
  2239.             (U8) WARNING_TONE);
  2240.         return 1;
  2241.     }
  2242.     return 0;
  2243. }
  2244. /*****************************************************************************
  2245.  * FUNCTION
  2246.  *  SetMtCallAlertRing
  2247.  * DESCRIPTION
  2248.  *  Setting Call Alert type as ring for the current
  2249.  *  Profile.
  2250.  * PARAMETERS
  2251.  *  void
  2252.  * RETURNS
  2253.  *  void
  2254.  *****************************************************************************/
  2255. void SetMtCallAlertRing(void)
  2256. {
  2257.     /*----------------------------------------------------------------*/
  2258.     /* Local Variables                                                */
  2259.     /*----------------------------------------------------------------*/
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Code Body                                                      */
  2262.     /*----------------------------------------------------------------*/
  2263.     if (GuardSilentMode())
  2264.     {
  2265.         return;
  2266.     }
  2267.     SetMtCallAlertTypeEnum(MMI_RING);
  2268.     //MTK Brian modified to skip writing nvram if no change, 2003/11/26
  2269.     //SendSetVibrationMode(0);
  2270.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2271.     DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
  2272. }
  2273. /*****************************************************************************
  2274.  * FUNCTION
  2275.  *  SetMtCallAlertVibrationOnly
  2276.  * DESCRIPTION
  2277.  *  Setting Call Alert type as ring for the current
  2278.  *  Profile.
  2279.  * PARAMETERS
  2280.  *  void
  2281.  * RETURNS
  2282.  *  void
  2283.  *****************************************************************************/
  2284. void SetMtCallAlertVibrationOnly(void)
  2285. {
  2286.     /*----------------------------------------------------------------*/
  2287.     /* Local Variables                                                */
  2288.     /*----------------------------------------------------------------*/
  2289.     /*----------------------------------------------------------------*/
  2290.     /* Code Body                                                      */
  2291.     /*----------------------------------------------------------------*/
  2292.     SetMtCallAlertTypeEnum(MMI_VIBRATION_ONLY);
  2293.     //MTK Brian modified to skip writing nvram if no change, 2003/11/26
  2294.     //SendSetVibrationMode(1);
  2295.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2296.     DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
  2297. }
  2298. /*****************************************************************************
  2299.  * FUNCTION
  2300.  *  SetMtCallAlertVibrationAndRing
  2301.  * DESCRIPTION
  2302.  *  Setting Call Alert type as ring for the current
  2303.  *  Profile.
  2304.  * PARAMETERS
  2305.  *  void
  2306.  * RETURNS
  2307.  *  void
  2308.  *****************************************************************************/
  2309. void SetMtCallAlertVibrationAndRing(void)
  2310. {
  2311.     /*----------------------------------------------------------------*/
  2312.     /* Local Variables                                                */
  2313.     /*----------------------------------------------------------------*/
  2314.     /*----------------------------------------------------------------*/
  2315.     /* Code Body                                                      */
  2316.     /*----------------------------------------------------------------*/
  2317.     if (GuardSilentMode())
  2318.     {
  2319.         return;
  2320.     }
  2321.     SetMtCallAlertTypeEnum(MMI_VIBRATION_AND_RING);
  2322.     //MTK Brian modified to skip writing nvram if no change, 2003/11/26
  2323.     //SendSetVibrationMode(1);
  2324.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2325.     DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
  2326. }
  2327. /*****************************************************************************
  2328.  * FUNCTION
  2329.  *  SetMtCallAlertVibrationThenRing
  2330.  * DESCRIPTION
  2331.  *  Setting Call Alert type as ring for the current
  2332.  *  Profile.
  2333.  * PARAMETERS
  2334.  *  void
  2335.  * RETURNS
  2336.  *  void
  2337.  *****************************************************************************/
  2338. void SetMtCallAlertVibrationThenRing(void)
  2339. {
  2340.     /*----------------------------------------------------------------*/
  2341.     /* Local Variables                                                */
  2342.     /*----------------------------------------------------------------*/
  2343.     /*----------------------------------------------------------------*/
  2344.     /* Code Body                                                      */
  2345.     /*----------------------------------------------------------------*/
  2346.     if (GuardSilentMode())
  2347.     {
  2348.         return;
  2349.     }
  2350.     SetMtCallAlertTypeEnum(MMI_VIBRATION_THEN_RING);
  2351.     //MTK Brian modified to skip writing nvram if no change, 2003/11/26
  2352.     //SendSetVibrationMode(1);
  2353.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2354.     DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
  2355. }
  2356. /*****************************************************************************
  2357.  * FUNCTION
  2358.  *  SetMtCallAlertSilent
  2359.  * DESCRIPTION
  2360.  *  Setting Call Alert type as ring for the current
  2361.  *  Profile.
  2362.  * PARAMETERS
  2363.  *  void
  2364.  * RETURNS
  2365.  *  void
  2366.  *****************************************************************************/
  2367. void SetMtCallAlertSilent(void)
  2368. {
  2369.     /*----------------------------------------------------------------*/
  2370.     /* Local Variables                                                */
  2371.     /*----------------------------------------------------------------*/
  2372.     /*----------------------------------------------------------------*/
  2373.     /* Code Body                                                      */
  2374.     /*----------------------------------------------------------------*/
  2375.     if (GuardSilentMode())
  2376.     {
  2377.         return;
  2378.     }
  2379.     SetMtCallAlertTypeEnum(MMI_SILENT);
  2380.     //MTK Brian modified to skip writing nvram if no change, 2003/11/26
  2381.     //SendSetVibrationMode(0);
  2382.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2383.     DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
  2384. }
  2385. /*****************************************************************************
  2386.  * FUNCTION
  2387.  *  EntryScrProfilesRingType
  2388.  * DESCRIPTION
  2389.  *  Showing profile Ring Type screen
  2390.  * PARAMETERS
  2391.  *  void
  2392.  * RETURNS
  2393.  *  void
  2394.  *****************************************************************************/
  2395. void EntryScrProfilesRingType(void)
  2396. {
  2397.     /*----------------------------------------------------------------*/
  2398.     /* Local Variables                                                */
  2399.     /*----------------------------------------------------------------*/
  2400.     U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
  2401.     U16 nNumofItem;         /* Stores no of children in the submenu */
  2402.     U16 nDispAttribute;     /* Stores display attribue */
  2403.     U8 *guiBuffer;          /* Buffer holding history data */
  2404.     U8 i;
  2405.     MMI_RING_TYPE_ENUM data = 0;
  2406.     U16 ProfileMenuID[] = 
  2407.     {
  2408.         MENU_RING_TYPE_SINGLE,
  2409.         MENU_RING_TYPE_REPEAT,
  2410.         MENU_RING_TYPE_ASCENDING
  2411.     };
  2412.     /*----------------------------------------------------------------*/
  2413.     /* Code Body                                                      */
  2414.     /*----------------------------------------------------------------*/
  2415.     /* 1 Call Exit Handler */
  2416.     EntryNewScreen(SCR_PROFILES_RING_TYPE, NULL, EntryScrProfilesRingType, NULL);
  2417.     /* 2 Get current screen to gui buffer  for history purposes */
  2418.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_RING_TYPE);
  2419.     /* 3. Retrieve no of child of menu item to be displayed */
  2420.     nNumofItem = GetNumOfChild(MENU_RING_TYPE);
  2421.     /* 4. Get attribute of menu to be displayed */
  2422.     nDispAttribute = GetDispAttributeOfItem(MENU_RING_TYPE);
  2423.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2424.     GetSequenceStringIds(MENU_RING_TYPE, nStrItemList);
  2425.     /* 6 Set current parent id */
  2426.     SetParentHandler(MENU_RING_TYPE);
  2427.     /* 7 Register highlight handler to be called in menu screen */
  2428.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2429. /****** Get the index of activated ring type menu ID*****/
  2430.     i = gprofiles[gprofileId].ringTypeEnum;
  2431.     data = GetIndexOfStringId(MENU_RING_TYPE, ProfileMenuID[i]);
  2432.     /* 8 Display Category Screen */
  2433.     ShowCategory11Screen(
  2434.         STR_RING_TYPE_CAPTION,
  2435.         IMG_PROFILES_TITLEE,
  2436.         STR_GLOBAL_OK,
  2437.         0,
  2438.         STR_GLOBAL_BACK,
  2439.         0,
  2440.         nNumofItem,
  2441.         nStrItemList,
  2442.         (U16) data,
  2443.         guiBuffer);
  2444.     /* SetExitHandler(SCR_PROFILES_RING_TYPE, ExitScrProfilesRingType); */
  2445. }
  2446. /*****************************************************************************
  2447.  * FUNCTION
  2448.  *  SetRingTypeAscending
  2449.  * DESCRIPTION
  2450.  *  Set Ring Type as Ascending
  2451.  * PARAMETERS
  2452.  *  void
  2453.  * RETURNS
  2454.  *  void
  2455.  *****************************************************************************/
  2456. void SetRingTypeAscending(void)
  2457. {
  2458.     /*----------------------------------------------------------------*/
  2459.     /* Local Variables                                                */
  2460.     /*----------------------------------------------------------------*/
  2461.     /*----------------------------------------------------------------*/
  2462.     /* Code Body                                                      */
  2463.     /*----------------------------------------------------------------*/
  2464.     SetRingTypeEnum(ASCENDING);
  2465.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2466.     DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
  2467. }
  2468. /*****************************************************************************
  2469.  * FUNCTION
  2470.  *  SetRingTypeSingle
  2471.  * DESCRIPTION
  2472.  *  Set Ring Type as Single
  2473.  * PARAMETERS
  2474.  *  void
  2475.  * RETURNS
  2476.  *  void
  2477.  *****************************************************************************/
  2478. void SetRingTypeSingle(void)
  2479. {
  2480.     /*----------------------------------------------------------------*/
  2481.     /* Local Variables                                                */
  2482.     /*----------------------------------------------------------------*/
  2483.     /*----------------------------------------------------------------*/
  2484.     /* Code Body                                                      */
  2485.     /*----------------------------------------------------------------*/
  2486.     SetRingTypeEnum(SINGLE);
  2487.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2488.     DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
  2489. }
  2490. /*****************************************************************************
  2491.  * FUNCTION
  2492.  *  SetRingTypeRepeat
  2493.  * DESCRIPTION
  2494.  *  Set Ring Type as Repeat
  2495.  * PARAMETERS
  2496.  *  void
  2497.  * RETURNS
  2498.  *  void
  2499.  *****************************************************************************/
  2500. void SetRingTypeRepeat(void)
  2501. {
  2502.     /*----------------------------------------------------------------*/
  2503.     /* Local Variables                                                */
  2504.     /*----------------------------------------------------------------*/
  2505.     /*----------------------------------------------------------------*/
  2506.     /* Code Body                                                      */
  2507.     /*----------------------------------------------------------------*/
  2508.     SetRingTypeEnum(REPEAT);
  2509.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2510.     DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
  2511. }
  2512. #ifdef __MMI_CONNECT_NOTICE__
  2513. /*****************************************************************************
  2514.  * FUNCTION
  2515.  *  EntryScrProfilesConnectNotice
  2516.  * DESCRIPTION
  2517.  *  Showing profile Call Alert screen
  2518.  * PARAMETERS
  2519.  *  void
  2520.  * RETURNS
  2521.  *  void
  2522.  *****************************************************************************/
  2523. void EntryScrProfilesConnectNotice(void)
  2524. {
  2525.     /*----------------------------------------------------------------*/
  2526.     /* Local Variables                                                */
  2527.     /*----------------------------------------------------------------*/
  2528.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  2529.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  2530.     U16 nDispAttribute;                 /* Stores display attribue */
  2531.     U8 *guiBuffer;                      /* Buffer holding history data */
  2532.     S8 i = 0;
  2533.     MMI_CONNECT_NOTICE_TYPE data = 0;
  2534.     U16 ProfileMenuID[] = 
  2535.     {
  2536.         MENU_NOTICE_NONE,
  2537.         MENU_NOTICE_TONE_ONLY,
  2538.         MENU_NOTICE_VIB_ONLY,
  2539.         MENU_NOTICE_TONE_AND_VIB
  2540.     };
  2541.     /*----------------------------------------------------------------*/
  2542.     /* Code Body                                                      */
  2543.     /*----------------------------------------------------------------*/
  2544.     /* 1 Call Exit Handler */
  2545.     EntryNewScreen(SCR_PROFILES_CONNECT_NOTICE, NULL, EntryScrProfilesConnectNotice, NULL);
  2546.     /* 2 Get current screen to gui buffer  for history purposes */
  2547.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CONNECT_NOTICE);
  2548.     /* 3. Retrieve no of child of menu item to be displayed */
  2549.     nNumofItem = GetNumOfChild(MENU_CONNECT_NOTICE);
  2550.     /* 4. Get attribute of menu to be displayed */
  2551.     nDispAttribute = GetDispAttributeOfItem(MENU_CONNECT_NOTICE);
  2552.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2553.     GetSequenceStringIds(MENU_CONNECT_NOTICE, nStrItemList);
  2554.     /* 6 Set current parent id */
  2555.     SetParentHandler(MENU_CONNECT_NOTICE);
  2556.     /* 7 Register highlight handler to be called in menu screen */
  2557.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2558.     /* MTK Brian modified for showing radio button, 2003/11/15 */
  2559. /****** Get the index of activated alert type menu ID*****/
  2560.     i = gprofiles[gprofileId].extraTone.connectTone;
  2561.     data = GetIndexOfStringId(MENU_CONNECT_NOTICE, ProfileMenuID[i]);
  2562.     /* 8 Display Category Screen */
  2563.     ShowCategory11Screen(
  2564.         STR_CONNECT_NOTICE,
  2565.         IMG_PROFILES_TITLEE,
  2566.         STR_GLOBAL_OK,
  2567.         IMG_GLOBAL_OK,
  2568.         STR_GLOBAL_BACK,
  2569.         IMG_GLOBAL_BACK,
  2570.         nNumofItem,
  2571.         nStrItemList,
  2572.         (U16) data,
  2573.         guiBuffer);
  2574.     /* MTK end */
  2575.     /* SetExitHandler(SCR_PROFILES_CONNECT_NOTICE, ExitScrProfilesConnectNotice); */
  2576. }
  2577. /*****************************************************************************
  2578.  * FUNCTION
  2579.  *  SetConnectNoticeNone
  2580.  * DESCRIPTION
  2581.  *  Setting Connect Notice type as none for the current
  2582.  *  Profile.
  2583.  * PARAMETERS
  2584.  *  void
  2585.  * RETURNS
  2586.  *  void
  2587.  *****************************************************************************/
  2588. void SetConnectNoticeNone(void)
  2589. {
  2590.     /*----------------------------------------------------------------*/
  2591.     /* Local Variables                                                */
  2592.     /*----------------------------------------------------------------*/
  2593.     /*----------------------------------------------------------------*/
  2594.     /* Code Body                                                      */
  2595.     /*----------------------------------------------------------------*/
  2596.     SetConnectNotice(MMI_NOTICE_NONE);
  2597.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2598.     DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
  2599. }
  2600. /*****************************************************************************
  2601.  * FUNCTION
  2602.  *  SetConnectNoticeToneOnly
  2603.  * DESCRIPTION
  2604.  *  Setting Connect Notice type as tone only for the current
  2605.  *  Profile.
  2606.  * PARAMETERS
  2607.  *  void
  2608.  * RETURNS
  2609.  *  void
  2610.  *****************************************************************************/
  2611. void SetConnectNoticeToneOnly(void)
  2612. {
  2613.     /*----------------------------------------------------------------*/
  2614.     /* Local Variables                                                */
  2615.     /*----------------------------------------------------------------*/
  2616.     /*----------------------------------------------------------------*/
  2617.     /* Code Body                                                      */
  2618.     /*----------------------------------------------------------------*/
  2619.     SetConnectNotice(MMI_NOTICE_TONE_ONLY);
  2620.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2621.     DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
  2622. }
  2623. /*****************************************************************************
  2624.  * FUNCTION
  2625.  *  SetConnectNoticeVibOnly
  2626.  * DESCRIPTION
  2627.  *  Setting Connect Notice type as vib only for the current
  2628.  *  Profile.
  2629.  * PARAMETERS
  2630.  *  void
  2631.  * RETURNS
  2632.  *  void
  2633.  *****************************************************************************/
  2634. void SetConnectNoticeVibOnly(void)
  2635. {
  2636.     /*----------------------------------------------------------------*/
  2637.     /* Local Variables                                                */
  2638.     /*----------------------------------------------------------------*/
  2639.     /*----------------------------------------------------------------*/
  2640.     /* Code Body                                                      */
  2641.     /*----------------------------------------------------------------*/
  2642.     SetConnectNotice(MMI_NOTICE_VIB_ONLY);
  2643.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2644.     DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
  2645. }
  2646. /*****************************************************************************
  2647.  * FUNCTION
  2648.  *  SetConnectNoticeToneAndVib
  2649.  * DESCRIPTION
  2650.  *  Setting Connect Notice type as tone and vib for the current
  2651.  *  Profile.
  2652.  * PARAMETERS
  2653.  *  void
  2654.  * RETURNS
  2655.  *  void
  2656.  *****************************************************************************/
  2657. void SetConnectNoticeToneAndVib(void)
  2658. {
  2659.     /*----------------------------------------------------------------*/
  2660.     /* Local Variables                                                */
  2661.     /*----------------------------------------------------------------*/
  2662.     /*----------------------------------------------------------------*/
  2663.     /* Code Body                                                      */
  2664.     /*----------------------------------------------------------------*/
  2665.     SetConnectNotice(MMI_NOTICE_TONE_AND_VIB);
  2666.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2667.     DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
  2668. }
  2669. #endif /* __MMI_CONNECT_NOTICE__ */ 
  2670. /*****************************************************************************
  2671.  * FUNCTION
  2672.  *  ProfileGoBack2History
  2673.  * DESCRIPTION
  2674.  *  
  2675.  * PARAMETERS
  2676.  *  void
  2677.  * RETURNS
  2678.  *  void
  2679.  *****************************************************************************/
  2680. void ProfileGoBack2History(void)
  2681. {
  2682.     /*----------------------------------------------------------------*/
  2683.     /* Local Variables                                                */
  2684.     /*----------------------------------------------------------------*/
  2685.     /*----------------------------------------------------------------*/
  2686.     /* Code Body                                                      */
  2687.     /*----------------------------------------------------------------*/
  2688.     GoBacknHistory(1);
  2689. }
  2690. /*****************************************************************************
  2691.  * FUNCTION
  2692.  *  EntryScrProfilesAnsweringMode
  2693.  * DESCRIPTION
  2694.  *  Showing profile Answering Mode screen
  2695.  * PARAMETERS
  2696.  *  void
  2697.  * RETURNS
  2698.  *  void
  2699.  *****************************************************************************/
  2700. void EntryScrProfilesAnsweringMode(void)
  2701. {
  2702.     /*----------------------------------------------------------------*/
  2703.     /* Local Variables                                                */
  2704.     /*----------------------------------------------------------------*/
  2705.     U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
  2706.     U16 nNumofItem;         /* Stores no of children in the submenu */
  2707.     U16 nDispAttribute;     /* Stores display attribue */
  2708.     U8 *guiBuffer;          /* Buffer holding history data */
  2709.     U16 i;
  2710.     U16 ParentId;
  2711.     /*----------------------------------------------------------------*/
  2712.     /* Code Body                                                      */
  2713.     /*----------------------------------------------------------------*/
  2714.     /* 1 Call Exit Handler */
  2715.     EntryNewScreen(SCR_PROFILES_ANSWERING_MODE, NULL, EntryScrProfilesAnsweringMode, NULL);
  2716. /***** If earphone is connected then also show auto mode in answering mode list */
  2717.     if (gprofileId != MMI_PROFILE_HEADSET)
  2718.     {
  2719.         ParentId = MENU_ANSEWRING_MODE;
  2720.     }
  2721.     else
  2722.     {
  2723.         ParentId = MENU_ANSEWRING_MODE_HEADSET;
  2724.     }
  2725.     /* 2 Get current screen to gui buffer  for history purposes */
  2726.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_ANSWERING_MODE);
  2727.     /* 3. Retrieve no of child of menu item to be displayed */
  2728.     nNumofItem = GetNumOfChild(ParentId);
  2729.     /* 4. Get attribute of menu to be displayed */
  2730.     nDispAttribute = GetDispAttributeOfItem(ParentId);
  2731.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2732.     GetSequenceStringIds(ParentId, nStrItemList);
  2733.     for (i = 0; i < nNumofItem; i++)
  2734.     {
  2735.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  2736.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[i], GetString(nStrItemList[i]), MAX_SUBMENU_CHARACTERS);
  2737.     }
  2738.     /* 6 Set current parent id */
  2739.     SetParentHandler(ParentId);
  2740.     /* MTK Brian added for SUBLCD freature, 2003/10/18 */
  2741. #ifdef __MMI_CLAMSHELL__
  2742.     fieldStates[0] = (U8) gprofiles[gprofileId].answeringMode.coverAnswer;
  2743.     fieldStates[1] = (U8) gprofiles[gprofileId].answeringMode.anyKey;
  2744.     fieldStates[2] = (U8) gprofiles[gprofileId].answeringMode.automatic;
  2745. #else /* __MMI_CLAMSHELL__ */ 
  2746.     fieldStates[0] = (U8) gprofiles[gprofileId].answeringMode.anyKey;
  2747.     fieldStates[1] = (U8) gprofiles[gprofileId].answeringMode.automatic;
  2748. #endif /* __MMI_CLAMSHELL__ */ 
  2749.     SetCheckboxToggleRightSoftkeyFunctions(ProfilesAnsweringModePopup, GoBackHistory);
  2750.     /* 8 Display Category Screen */
  2751.     ShowCategory140Screen(
  2752.         STR_ANSEWRING_MODE_CAPTION,
  2753.         IMG_PROFILES_TITLEE,
  2754.         nNumofItem,
  2755.         (U8 **) subMenuDataPtrs,
  2756.         fieldStates,
  2757.         0,
  2758.         guiBuffer);
  2759.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2760.     /* SetExitHandler(SCR_PROFILES_ANSWERING_MODE,ExitScrProfilesAnsweringMode); */
  2761. }
  2762. /*****************************************************************************
  2763.  * FUNCTION
  2764.  *  EntryScrSetAnsweringMode
  2765.  * DESCRIPTION
  2766.  *  Set answering mode
  2767.  * PARAMETERS
  2768.  *  void
  2769.  * RETURNS
  2770.  *  void
  2771.  *****************************************************************************/
  2772. void EntryScrSetAnsweringMode(void)
  2773. {
  2774.     /*----------------------------------------------------------------*/
  2775.     /* Local Variables                                                */
  2776.     /*----------------------------------------------------------------*/
  2777.     MMI_ANSWERING_MODE answeringmode;
  2778.     /*----------------------------------------------------------------*/
  2779.     /* Code Body                                                      */
  2780.     /*----------------------------------------------------------------*/
  2781.     /* MTK Brian added for SUBLCD freature, 2003/10/18 */
  2782. #ifdef __MMI_CLAMSHELL__
  2783.     answeringmode.coverAnswer = gprofiles[gprofileId].answeringMode.coverAnswer = fieldStates[0];
  2784.     answeringmode.anyKey = gprofiles[gprofileId].answeringMode.anyKey = fieldStates[1];
  2785.     answeringmode.automatic = gprofiles[gprofileId].answeringMode.automatic = fieldStates[2];
  2786. #else /* __MMI_CLAMSHELL__ */ 
  2787.     answeringmode.anyKey = gprofiles[gprofileId].answeringMode.anyKey = fieldStates[0];
  2788.     answeringmode.automatic = gprofiles[gprofileId].answeringMode.automatic = fieldStates[1];
  2789. #endif /* __MMI_CLAMSHELL__ */ 
  2790.     SetAnsweringMode(answeringmode);
  2791.     /* DisplayPopupCheckBox((PU8)GetString(STR_GLOBAL_DONE) ,IMG_GLOBAL_ACTIVATED, 1,UI_POPUP_NOTIFYDURATION_TIME,SUCCESS_TONE); */
  2792.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2793.     DeleteScreenIfPresent(SCR_PROFILES_ANSWERING_MODE);
  2794. }
  2795. /*****************************************************************************
  2796.  * FUNCTION
  2797.  *  ProfilesAnsweringModePopup
  2798.  * DESCRIPTION
  2799.  *  Set call back functions for Answering mode.
  2800.  * PARAMETERS
  2801.  *  void
  2802.  * RETURNS
  2803.  *  void
  2804.  *****************************************************************************/
  2805. void ProfilesAnsweringModePopup(void)
  2806. {
  2807.     /*----------------------------------------------------------------*/
  2808.     /* Local Variables                                                */
  2809.     /*----------------------------------------------------------------*/
  2810.     /*----------------------------------------------------------------*/
  2811.     /* Code Body                                                      */
  2812.     /*----------------------------------------------------------------*/
  2813.     EntryScrProfilesQueryPopup(EntryScrSetAnsweringMode, ProfileGoBack2History);
  2814. }
  2815. #ifdef __MMI_STATUS_LED__
  2816. /*****************************************************************************
  2817.  * FUNCTION
  2818.  *  EntryScrStatusLEDPatterns
  2819.  * DESCRIPTION
  2820.  *  Showing profile Status Screen
  2821.  * PARAMETERS
  2822.  *  void
  2823.  * RETURNS
  2824.  *  void
  2825.  *****************************************************************************/
  2826. void EntryScrStatusLEDPatterns(void)
  2827. {
  2828.     /*----------------------------------------------------------------*/
  2829.     /* Local Variables                                                */
  2830.     /*----------------------------------------------------------------*/
  2831.     U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
  2832.     U16 nNumofItem;         /* Stores no of children in the submenu */
  2833.     U16 nDispAttribute;     /* Stores display attribue */
  2834.     U8 *guiBuffer;          /* Buffer holding history data */
  2835.     MMI_LEDLIGHT_STATUS_ENUM data = 0;
  2836.     /*----------------------------------------------------------------*/
  2837.     /* Code Body                                                      */
  2838.     /*----------------------------------------------------------------*/
  2839.     /* 1 Call Exit Handler */
  2840.     EntryNewScreen(SCR_PROFILES_STATUS, ExitScrStatusLEDPatterns, EntryScrStatusLEDPatterns, NULL);
  2841.     /* 2 Get current screen to gui buffer  for history purposes */
  2842.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_STATUS);
  2843.     /* 3. Retrieve no of child of menu item to be displayed */
  2844.     nNumofItem = GetNumOfChild(MENU_LIGHT_STATUS);
  2845.     /* 4. Get attribute of menu to be displayed */
  2846.     nDispAttribute = GetDispAttributeOfItem(MENU_LIGHT_STATUS);
  2847.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2848.     GetSequenceStringIds(MENU_LIGHT_STATUS, nStrItemList);
  2849.     /* 6 Set current parent id */
  2850.     SetParentHandler(MENU_LIGHT_STATUS);
  2851.     /* 7 Register highlight handler to be called in menu screen */
  2852.     RegisterHighlightHandler(GetCurrScreenHandlerfour);
  2853.     data = gprofiles[gprofileId].light.status;
  2854.     /* 8 Display Category Screen */
  2855.     ShowCategory11Screen(
  2856.         STR_LIGHT_STATUS_CAPTION,
  2857.         IMG_PROFILES_TITLEE,
  2858.         STR_GLOBAL_OK,
  2859.         0,
  2860.         STR_GLOBAL_BACK,
  2861.         0,
  2862.         nNumofItem,
  2863.         nStrItemList,
  2864.         (U16) data,
  2865.         guiBuffer);
  2866.     /* 9.Register function with right softkey */
  2867.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2868.     /* 10.Register function with Left softkey */
  2869.     SetLeftSoftkeyFunction(EntryScrSetLightColor, KEY_EVENT_UP);
  2870.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2871.     /* SetExitHandler(SCR_PROFILES_STATUS,ExitScrStatusLEDPatterns); */
  2872. }
  2873. /*****************************************************************************
  2874.  * FUNCTION
  2875.  *  ExitScrStatusLEDPatterns
  2876.  * DESCRIPTION
  2877.  *  Exit profile LED Status Screen
  2878.  * PARAMETERS
  2879.  *  void
  2880.  * RETURNS
  2881.  *  void
  2882.  *****************************************************************************/
  2883. void ExitScrStatusLEDPatterns(void)
  2884. {
  2885. #if 0
  2886. /* under construction !*/
  2887. /* under construction !*/
  2888. /* under construction !*/
  2889. /* under construction !*/
  2890. /* under construction !*/
  2891. /* under construction !*/
  2892. /* under construction !*/
  2893. /* under construction !*/
  2894. /* under construction !*/
  2895. /* under construction !*/
  2896. #endif /* 0 */ 
  2897.     /*----------------------------------------------------------------*/
  2898.     /* Code Body                                                      */
  2899.     /*----------------------------------------------------------------*/
  2900.     StopColorId();
  2901. }
  2902. /*****************************************************************************
  2903.  * FUNCTION
  2904.  *  EntryScrSetLightColor
  2905.  * DESCRIPTION
  2906.  *  Set Light color
  2907.  * PARAMETERS
  2908.  *  void
  2909.  * RETURNS
  2910.  *  void
  2911.  *****************************************************************************/
  2912. void EntryScrSetLightColor(void)
  2913. {
  2914.     /*----------------------------------------------------------------*/
  2915.     /* Local Variables                                                */
  2916.     /*----------------------------------------------------------------*/
  2917.     MMI_LEDLIGHT_STATUS_ENUM lightstaus;
  2918.     /*----------------------------------------------------------------*/
  2919.     /* Code Body                                                      */
  2920.     /*----------------------------------------------------------------*/
  2921.     switch (gcurrHiliteIndexOne)
  2922.     {
  2923.         case 0:
  2924.             lightstaus = NO_COLOR;
  2925.             SetLightStatus(lightstaus);
  2926.             break;
  2927.         case 1:
  2928.             lightstaus = COLOR_PATTERN1;
  2929.             SetLightStatus(lightstaus);
  2930.             break;
  2931.         case 2:
  2932.             lightstaus = COLOR_PATTERN2;
  2933.             SetLightStatus(lightstaus);
  2934.             break;
  2935.         case 3:
  2936.             lightstaus = COLOR_PATTERN3;