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

MTK

开发平台:

C/C++

  1.             SetLightStatus(lightstaus);
  2.             break;
  3.         case 4:
  4.             lightstaus = COLOR_PATTERN4;
  5.             SetLightStatus(lightstaus);
  6.             break;
  7.         case 5:
  8.             lightstaus = COLOR_PATTERN5;
  9.             SetLightStatus(lightstaus);
  10.             break;
  11.         case 6:
  12.             lightstaus = COLOR_PATTERN6;
  13.             SetLightStatus(lightstaus);
  14.             break;
  15.     }
  16.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  17.     DeleteScreenIfPresent(SCR_PROFILES_STATUS);
  18. }
  19. #endif /* __MMI_STATUS_LED__ */ 
  20. //KP Jerry add on 2007-03-31 start
  21. #ifdef __MMI_PROFILE_POWER_SAVING__
  22. S32 TempLCDBKLevel, TempLCDBKTime;
  23. MMI_BOOL GetCurrentActivatedProfileKeyBKStatus(void)
  24. {
  25. return gcurrentprofile.keybacklight;
  26. }
  27. U32 GetCurrentProfileLCDBKLevel(void)
  28. {
  29. return gprofiles[gprofileId].lcdbacklight.lcdBacklightlevel;
  30. }
  31. U32 GetCurrentActivatedProfileLCDBKLevel(void)
  32. {
  33. return gcurrentprofile.lcdbacklight.lcdBacklightlevel;
  34. }
  35. U32 GetCurrentActivatedProfileLCDBKTime(void)
  36. {
  37. return gcurrentprofile.lcdbacklight.lcdBacklighttime;
  38. }
  39. void ProfilesSetLCDBackLiteLSKHdlr(void)
  40. {
  41.     /*----------------------------------------------------------------*/
  42.     /* Local Variables                                                */
  43.     /*----------------------------------------------------------------*/
  44.     S16 error = 0;
  45.     U16 j = 1;
  46.     /*----------------------------------------------------------------*/
  47.     /* Code Body                                                      */
  48.     /*----------------------------------------------------------------*/
  49.     gprofiles[gprofileId].lcdbacklight.lcdBacklightlevel = TempLCDBKLevel;
  50.     gprofiles[gprofileId].lcdbacklight.lcdBacklighttime = TempLCDBKTime;
  51.     if (WriteRecord(
  52.             NVRAM_EF_PROFILES_LID,
  53.             j,
  54.             &gprofiles[0],
  55.             NVRAM_PROFILES_RECORD_SIZE,
  56.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  57.     {
  58.         PRINT_INFORMATION(("## ERROR: SetRingTypeEnum: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  59.     }
  60.     if (gactivatedprofile == gprofileId)
  61.     {
  62.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  63.     }
  64.     g_phnset_gpio_cntx_p->bl_setting_level = gcurrentprofile.lcdbacklight.lcdBacklightlevel;
  65.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  66.     g_phnset_gpio_cntx_p->bl_setting_hftime = gcurrentprofile.lcdbacklight.lcdBacklighttime;
  67.     
  68.     DisplayPopup(
  69.         (U8*) GetString(STR_GLOBAL_DONE),
  70.         IMG_GLOBAL_ACTIVATED,
  71.         1,
  72.         UI_POPUP_NOTIFYDURATION_TIME,
  73.         (U8) SUCCESS_TONE);
  74.     DeleteScreenIfPresent(SCR_PROFILES_LCDBL);
  75. }
  76. void ProfilesSetLCDBackLiteEndHdlr(void)
  77. {
  78.     /*----------------------------------------------------------------*/
  79.     /* Local Variables                                                */
  80.     /*----------------------------------------------------------------*/
  81.     /*----------------------------------------------------------------*/
  82.     /* Code Body                                                      */
  83.     /*----------------------------------------------------------------*/
  84.     g_phnset_gpio_cntx_p->bl_setting_level = gcurrentprofile.lcdbacklight.lcdBacklightlevel;
  85.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  86.     g_phnset_gpio_cntx_p->bl_setting_hftime = gcurrentprofile.lcdbacklight.lcdBacklighttime;
  87.     DisplayIdleScreen();
  88. }
  89. void ProfilesSetLCDBackLiteRSKHdlr(void)
  90. {
  91.     /*----------------------------------------------------------------*/
  92.     /* Local Variables                                                */
  93.     /*----------------------------------------------------------------*/
  94.     /*----------------------------------------------------------------*/
  95.     /* Code Body                                                      */
  96.     /*----------------------------------------------------------------*/
  97.     g_phnset_gpio_cntx_p->bl_setting_level = gcurrentprofile.lcdbacklight.lcdBacklightlevel;
  98.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  99.     g_phnset_gpio_cntx_p->bl_setting_hftime = gcurrentprofile.lcdbacklight.lcdBacklighttime;
  100.     GoBackHistory();
  101. }
  102. void EntryProfilesSetLCDBackLite(void)
  103. {
  104.     /*----------------------------------------------------------------*/
  105.     /* Local Variables                                                */
  106.     /*----------------------------------------------------------------*/
  107.     U8 *guiBuffer, *BLHFTime = NULL, *BLLevel = NULL;
  108. #ifndef __MMI_GPIO_SUPPORT_BL_LEVEL__       //Old:#ifdef __MMI_GPIO_SUPPORT_BL_LEVEL__      //KP Jerry modify on 2007-3-6
  109.     S32 lower_limit[1];
  110.     S32 upper_limit[1];
  111.     S32 *current_value[1];
  112.     void (*cb_func[1]) (S32 value);
  113. #else /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  114.     S32 lower_limit[2];
  115.     S32 upper_limit[2];
  116.     S32 *current_value[2];
  117.     void (*cb_func[2]) (S32 value);
  118.     U8 *str_list[2];
  119. #endif /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  120.     /*----------------------------------------------------------------*/
  121.     /* Code Body                                                      */
  122.     /*----------------------------------------------------------------*/
  123.     /* Call Exit Handler */
  124.     EntryNewScreen(SCR_PROFILES_LCDBL, NULL, EntryProfilesSetLCDBackLite, NULL);
  125.     /* Get current screen to gui buffer  for history purposes */
  126.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_LCDBL);
  127.     BLLevel = (U8*) GetString(STR_ID_PHNSET_GPIO_BACKLITE_LEVEL);
  128.     BLHFTime = (U8*) GetString(STR_ID_PHNSET_GPIO_BACKLITE_HF_TIME);
  129.     /* Set current parent id */
  130.     SetParentHandler(MENU_LCDBL);
  131. #ifndef __MMI_GPIO_SUPPORT_BL_LEVEL__       //Old:#ifdef __MMI_GPIO_SUPPORT_BL_LEVEL__      //KP Jerry modify on 2007-3-6
  132.     lower_limit[0] = 5;
  133.     upper_limit[0] = 60;
  134.     TempLCDBKTime = gprofiles[gprofileId].lcdbacklight.lcdBacklighttime;
  135.     current_value[0] = &(TempLCDBKTime);
  136.     cb_func[0] = HighlightProfilesSetBackLiteHFTime;
  137.     ShowCategory88Screen(
  138.         STR_PROFILES_LCDBL,
  139.         IMG_PROFILES_TITLEE,
  140.         STR_GLOBAL_OK,
  141.         IMG_GLOBAL_OK,
  142.         0,
  143.         0,
  144.         0,
  145.         1,
  146.         NULL,
  147.         lower_limit,
  148.         upper_limit,
  149.         current_value,
  150.         cb_func,
  151.         guiBuffer);
  152. #else /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */
  153.     lower_limit[0] = 1;
  154.     upper_limit[0] = 5;
  155.     TempLCDBKLevel = gprofiles[gprofileId].lcdbacklight.lcdBacklightlevel;
  156.     current_value[0] = &(TempLCDBKLevel);
  157.     cb_func[0] = HighlightProfilesSetBackLiteLevel;
  158.     str_list[0] = BLLevel;
  159.     lower_limit[1] = 5;
  160.     upper_limit[1] = 60;
  161.     TempLCDBKTime = gprofiles[gprofileId].lcdbacklight.lcdBacklighttime;
  162.     current_value[1] = &(TempLCDBKTime);
  163.     cb_func[1] = HighlightProfilesSetBackLiteHFTime;
  164.     str_list[1] = BLHFTime;
  165.     ShowCategory88Screen(
  166.         STR_ID_PHNSET_GPIO_BACKLITE,
  167.         MAIN_MENU_TITLE_SETTINGS_ICON,
  168.         STR_GLOBAL_OK,
  169.         0,
  170.         STR_GLOBAL_BACK,
  171.         0,
  172.         0,
  173.         2,
  174.         str_list,
  175.         lower_limit,
  176.         upper_limit,
  177.         current_value,
  178.         cb_func,
  179.         guiBuffer);
  180. #endif /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  181.     /* Register function with right softkey */
  182.     SetKeyHandler(ProfilesSetLCDBackLiteEndHdlr, KEY_END, KEY_EVENT_DOWN);
  183.     SetLeftSoftkeyFunction(ProfilesSetLCDBackLiteLSKHdlr, KEY_EVENT_UP);
  184.     SetRightSoftkeyFunction(ProfilesSetLCDBackLiteRSKHdlr, KEY_EVENT_UP);
  185. }
  186. void ProfilesTurnOffKeyBacklight(void)
  187. {
  188. StopTimer(GPIO_KEYPAD_LIGHT_TIMER);
  189. KeyPadBackLightOff();
  190. }
  191. /*****************************************************************************
  192.  * FUNCTION
  193.  *  ProfilesTurnOffKeyBacklight
  194.  * DESCRIPTION
  195.  *  ...
  196.  * PARAMETERS
  197.  *  void
  198.  * RETURNS
  199.  *  void
  200.  *****************************************************************************/
  201. extern idle_keylock_struct g_keylock_context;      
  202. extern void SetkeypadBacklightStuatus(U8 value);
  203.   void ProfilesResetKeyBacklight(void)
  204. {
  205. if(gcurrentprofile.keybacklight && gMMIClamState == 1 && g_keylock_context.gKeyPadLockFlag == 0)
  206.        {
  207.   KeyPadBackLightOn();
  208. SetkeypadBacklightStuatus(1);
  209. StartTimer(GPIO_KEYPAD_LIGHT_TIMER, gcurrentprofile.lcdbacklight.lcdBacklighttime*1000, ProfilesTurnOffKeyBacklight);
  210.        }
  211. else
  212. {
  213.     StopTimer(GPIO_KEYPAD_LIGHT_TIMER);
  214. KeyPadBackLightOff();        
  215. }
  216. }
  217. void EntryProfilesSetKeyBacklight(void)
  218. {
  219.     /*----------------------------------------------------------------*/
  220.     /* Local Variables                                                */
  221.     /*----------------------------------------------------------------*/
  222.     U16 index;
  223.     S16 error = 0;
  224.     U16 j = 1;
  225.     index = GetCurrHiliteID();
  226.     /*----------------------------------------------------------------*/
  227.     /* Code Body                                                      */
  228.     /*----------------------------------------------------------------*/
  229.     if (GetExitScrnID() != POPUP_SCREENID)
  230.     {
  231.         if (gprofiles[gprofileId].keybacklight)
  232.         {
  233.             gprofiles[gprofileId].keybacklight = 0;
  234.             DisplayPopup(
  235.                 (U8*) GetString(STR_GLOBAL_OFF),
  236.                 IMG_GLOBAL_ACTIVATED,
  237.                 1,
  238.                 UI_POPUP_NOTIFYDURATION_TIME,
  239.                 (U8) SUCCESS_TONE);
  240.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  241.             Category52ChangeItemDescription(index, hintData[index]);
  242.         }
  243.         else
  244.         {
  245.             gprofiles[gprofileId].keybacklight = 1;
  246.             DisplayPopup(
  247.                 (U8*) GetString(STR_GLOBAL_ON),
  248.                 IMG_GLOBAL_ACTIVATED,
  249.                 1,
  250.                 UI_POPUP_NOTIFYDURATION_TIME,
  251.                 (U8) SUCCESS_TONE);
  252.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  253.             Category52ChangeItemDescription(index, hintData[index]);
  254.         }
  255.         if (WriteRecord(
  256.             NVRAM_EF_PROFILES_LID,
  257.             j,
  258.             &gprofiles[0],
  259.             NVRAM_PROFILES_RECORD_SIZE,
  260.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  261.  {
  262.         PRINT_INFORMATION(("## ERROR: SetRingTypeEnum: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  263.         //return error;
  264.  }
  265.  if (gactivatedprofile == gprofileId)
  266.  {
  267.        memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  268. ProfilesResetKeyBacklight();
  269.   }
  270.     }
  271. }
  272. #endif
  273. //KP Jerry add on 2007-03-31 end
  274. /*****************************************************************************
  275.  * FUNCTION
  276.  *  EntryScrProfilesToneSetup
  277.  * DESCRIPTION
  278.  *  Showing profile Tone Setup Screen
  279.  * PARAMETERS
  280.  *  void
  281.  * RETURNS
  282.  *  void
  283.  *****************************************************************************/
  284. void EntryScrProfilesToneSetup(void)
  285. {
  286.     /*----------------------------------------------------------------*/
  287.     /* Local Variables                                                */
  288.     /*----------------------------------------------------------------*/
  289.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  290.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  291.     U16 nDispAttribute;                 /* Stores display attribue */
  292.     U8 *guiBuffer;                      /* Buffer holding history data */
  293.     U8 *PopUpList[MAX_SUB_MENUS];
  294.     /*----------------------------------------------------------------*/
  295.     /* Code Body                                                      */
  296.     /*----------------------------------------------------------------*/
  297.     /* 1 Call Exit Handler */
  298.     EntryNewScreen(SCR_PROFILES_TONE_SETUP, NULL, EntryScrProfilesToneSetup, NULL);
  299.     /* 2 Get current screen to gui buffer  for history purposes */
  300.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_TONE_SETUP);
  301.     /* 3. Retrieve no of child of menu item to be displayed */
  302.     nNumofItem = GetNumOfChild(MENU_TONE_SETUP);
  303.     /* 4. Get attribute of menu to be displayed */
  304.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP);
  305.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  306.     GetSequenceStringIds(MENU_TONE_SETUP, nStrItemList);
  307.     /* 6 Set current parent id */
  308.     SetParentHandler(MENU_TONE_SETUP);
  309.     /* 7 Register highlight handler to be called in menu screen */
  310.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  311.     /* 8 Display Category Screen */
  312.     ConstructHintsList(MENU_TONE_SETUP, PopUpList);
  313.     ShowCategory52Screen(
  314.         STR_PROFILES_TONE_SETUP_CAPTION,
  315.         IMG_PROFILES_TITLEE,
  316.         STR_GLOBAL_OK,
  317.         IMG_GLOBAL_OK,
  318.         STR_GLOBAL_BACK,
  319.         IMG_GLOBAL_BACK,
  320.         nNumofItem,
  321.         nStrItemList,
  322.         (PU16) gIndexIconsImageList,
  323.         PopUpList,
  324.         0,
  325.         0,
  326.         guiBuffer);
  327.     /* 9.Register function with right softkey */
  328.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  329.     /* 10. Register Exit handler */
  330.     /* SetExitHandler(SCR_PROFILES_TONE_SETUP,ExitScrProfilesToneSetup); */
  331. }
  332. #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  333. /*****************************************************************************
  334.  * FUNCTION
  335.  *  AudioFileDeletedFromFmgr
  336.  * DESCRIPTION
  337.  *  IF audio folder get deleted or fomatted
  338.  *  from File manager activate default audio as incoming tone
  339.  * PARAMETERS
  340.  *  tone_id         [IN]        
  341.  *  Audio(?)        [IN]        ID
  342.  * RETURNS
  343.  * BOOL
  344.  *  
  345.  *****************************************************************************/
  346. pBOOL AudioFileDeletedFromFmgr(U16 tone_id)
  347. {
  348.     /*----------------------------------------------------------------*/
  349.     /* Local Variables                                                */
  350.     /*----------------------------------------------------------------*/
  351.     S8 buf[(FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH];
  352.     FILE_HANDLE file;
  353.     /*----------------------------------------------------------------*/
  354.     /* Code Body                                                      */
  355.     /*----------------------------------------------------------------*/
  356.     GetAudioNameWithPathInFileSystem(tone_id, (PS8) buf);
  357.     file = FS_Open((const WCHAR*)buf, FS_READ_ONLY);
  358.     if (file < 0)
  359.     {
  360.         FS_Close(file);
  361.         return TRUE;
  362.     }
  363.     else
  364.     {
  365.         FS_Close(file);
  366.         return FALSE;
  367.     }
  368. }
  369. #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  370. /*****************************************************************************
  371.  * FUNCTION
  372.  *  mmi_profiles_get_melody_list
  373.  * DESCRIPTION
  374.  *  Build melody list
  375.  * PARAMETERS
  376.  *  CurMelodyID         [IN]        
  377.  *  selecteditem        [IN]        
  378.  * RETURNS
  379.  *  void
  380.  *****************************************************************************/
  381. U8 mmi_profiles_get_melody_list(U16 CurMelodyID, U16 *selecteditem)
  382. {
  383.     /*----------------------------------------------------------------*/
  384.     /* Local Variables                                                */
  385.     /*----------------------------------------------------------------*/
  386. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  387.     DYNEXTMELODYINFO *ExtMelodyInfo;
  388. #endif 
  389. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  390.     DYNAUDIOINFO *DownloadThemeTones;
  391. #endif 
  392.     int index, data;
  393.     U16 nNumofItem = gtotalRingId + gtotalMidiId;
  394.     /*----------------------------------------------------------------*/
  395.     /* Code Body                                                      */
  396.     /*----------------------------------------------------------------*/
  397.     /* init hint data */
  398.     memset(hintData, 0, sizeof(hintData));
  399.     for (data = 0; data < MAX_SUB_MENUS; data++)
  400.     {
  401.         hintDataPtrs[data] = hintData[data];
  402.     }
  403.     /* copy the names of fixed list (IMY) */
  404.     for (index = 0; index < gtotalRingId; index++)
  405.     {
  406.         pfnUnicodeStrcpy((PS8) subMenuDataPtrs[index], GetString((U16) (STR_PROFILES_RING_1 + index)));
  407.     }
  408.     /* copy the names of fixed list (MIDI) */
  409.     for (index = 0; index < gtotalMidiId; index++)
  410.     {
  411.         pfnUnicodeStrcpy((PS8) subMenuDataPtrs[index + gtotalRingId], GetString((U16) (STR_PROFILES_MIDI_1 + index)));
  412.     }
  413. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  414. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  415.     PmgSetToneType( PRFSET_MELODY_TYPE_RING);   
  416. #endif
  417. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  418.     /* make a listing of ext melodies. */
  419. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  420.     PmgGetExtMelodyInfo(&ExtMelodyInfo);
  421.     for (index = nNumofItem, data = 0; data < MAXIMUM_EXT_MELODY_NUM; index++, data++)
  422.     {
  423.         if (PmgIsEmptySlot((U8) data) == MMI_FALSE)
  424.         {
  425.             if (PmgQueryFileExistBySlot((U8) data) == MMI_FALSE)
  426.             {
  427.                 pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_TONE_FILE_NOT_EXIST));
  428.             }
  429.             if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[data].filepath))
  430.             {
  431.                 mmi_chset_mixed_text_to_ucs2_str(
  432.                     subMenuDataPtrs[index],
  433.                     (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
  434.                     (U8*) ExtMelodyInfo->info[data].filename,
  435.                     g_chset_text_encoding);
  436.             }
  437.             else
  438.             {
  439.                 pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index], (S8*) ((ExtMelodyInfo->info[data]).filename));
  440.             }
  441.         #if (!defined(__MMI_SHOW_FILE_EXT__))
  442.             PmgRemoveFileExt((S8*) subMenuDataPtrs[index]);
  443.         #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
  444.             PmgRemoveFileDAFExt((S8*) subMenuDataPtrs[index]);
  445.         #endif 
  446.         }
  447.         else
  448.         {
  449.             pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  450.         }
  451.     }
  452. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  453. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  454.     if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
  455.     {
  456.         pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index++], (S8*) GetString(STR_PROFILES_CURR_THEME));
  457.     }
  458. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  459.     /* find highlight selection */
  460.     if (CurMelodyID >= gstartRingId && CurMelodyID < gstartRingId + gtotalRingId)
  461.     {
  462.         *selecteditem = CurMelodyID - gstartRingId;
  463.     }
  464.     else if (CurMelodyID >= gstartMidiId && CurMelodyID < gstartMidiId + gtotalMidiId)
  465.     {
  466.         *selecteditem = CurMelodyID - gstartMidiId + gtotalRingId;
  467.     }
  468.     else
  469.     {
  470.         BOOL selected = FALSE;
  471.     #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  472.         for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
  473.         {
  474.             if (PmgIsEmptySlot((U8) data) == MMI_FALSE && CurMelodyID == (ExtMelodyInfo->info[data]).id)
  475.             {
  476.                 *selecteditem = nNumofItem + data;
  477.                 selected = TRUE;
  478.                 break;
  479.             }
  480.         }
  481.         nNumofItem += MAXIMUM_EXT_MELODY_NUM;
  482.     #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  483.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  484.         if (!selected)
  485.         {
  486.             if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
  487.             {
  488.                 if ((U16)DownloadThemeTones[0].AudioId == CurMelodyID)
  489.                 {
  490.                     selected = TRUE;
  491.                     *selecteditem = nNumofItem;
  492.                     if (AudioFileDeletedFromFmgr(CurMelodyID))
  493.                     {
  494.                         pfnUnicodeStrcpy((S8*) hintData[nNumofItem], GetString(STR_TONE_FILE_NOT_EXIST));
  495.                     }
  496.                 }
  497.             }
  498.         }
  499.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  500.         ASSERT(selected);
  501.     }
  502.     return (U8) index;
  503. }
  504. /*****************************************************************************
  505.  * FUNCTION
  506.  *  mmi_profiles_entry_ring_tone_list
  507.  * DESCRIPTION
  508.  *  Showing profile Ring Tone Setup Screen
  509.  * PARAMETERS
  510.  *  void
  511.  * RETURNS
  512.  *  void
  513.  *****************************************************************************/
  514. void mmi_profiles_entry_ring_tone_list(void)
  515. {
  516.     /*----------------------------------------------------------------*/
  517.     /* Local Variables                                                */
  518.     /*----------------------------------------------------------------*/
  519.     U8 *guiBuffer;      /* Buffer holding history data */
  520.     U16 nDispAttribute; /* Stores display attribue */
  521.     U16 selecteditem = 0;
  522.     U8 totalItems = 0;
  523.     /*----------------------------------------------------------------*/
  524.     /* Code Body                                                      */
  525.     /*----------------------------------------------------------------*/
  526.     /* 1 Call Exit Handler */
  527.     EntryNewScreen(
  528.         SCR_PROFILES_RING_TONE_SETUP,
  529.         mmi_profiles_exit_ring_tone_list,
  530.         mmi_profiles_entry_ring_tone_list,
  531.         NULL);
  532.     /* 2 Get current screen to gui buffer  for history purposes */
  533.     guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_RING_TONE_SETUP);
  534.     /* 4. Get attribute of menu to be displayed */
  535.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_RING_TONE);
  536.     /* 3. Retrieve no of child of menu item to be displayed */
  537.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  538.     totalItems = mmi_profiles_get_melody_list(gprofiles[gprofileId].toneSetup.ringTone, &selecteditem);
  539.     /* 6 Set current parent id */
  540.     SetParentHandler(MENU_TONE_SETUP_RING_TONE);
  541.     /* 7 Register highlight handler to be called in menu screen */
  542.     RegisterHighlightHandler(mmi_profiles_melody_list_highlight_hdlr);
  543.     /* 8 Display Category Screen */
  544.     ShowCategory89Screen(
  545.         STR_PROFILES_RING_TONE_SETUP_CAPTION,
  546.         IMG_PROFILES_TITLEE,
  547.         STR_GLOBAL_OK,
  548.         IMG_GLOBAL_OK,
  549.         STR_GLOBAL_BACK,
  550.         IMG_GLOBAL_BACK,
  551.         totalItems,
  552.         subMenuDataPtrs,
  553.         hintDataPtrs,
  554.         0,
  555.         selecteditem,
  556.         guiBuffer);
  557.     /* 9.Register function with right softkey */
  558.     SetRightSoftkeyFunction(StopRingToneBack, KEY_EVENT_UP);
  559.     SetLeftSoftkeyFunction(EntryScrSetRingToneId, KEY_EVENT_UP);
  560.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  561. }
  562. /*****************************************************************************
  563.  * FUNCTION
  564.  *  mmi_profiles_exit_ring_tone_list
  565.  * DESCRIPTION
  566.  *  Exit profile Ring ToneSetup Screen
  567.  * PARAMETERS
  568.  *  void
  569.  * RETURNS
  570.  *  void
  571.  *****************************************************************************/
  572. void mmi_profiles_exit_ring_tone_list(void)
  573. {
  574.     /*----------------------------------------------------------------*/
  575.     /* Local Variables                                                */
  576.     /*----------------------------------------------------------------*/
  577.     /*----------------------------------------------------------------*/
  578.     /* Code Body                                                      */
  579.     /*----------------------------------------------------------------*/
  580.     StopToneAudio();
  581. }
  582. /*****************************************************************************
  583.  * FUNCTION
  584.  *  StopRingToneBack
  585.  * DESCRIPTION
  586.  *  StopRingToneBack
  587.  * PARAMETERS
  588.  *  void
  589.  * RETURNS
  590.  *  void
  591.  *****************************************************************************/
  592. void StopRingToneBack(void)
  593. {
  594.     /*----------------------------------------------------------------*/
  595.     /* Local Variables                                                */
  596.     /*----------------------------------------------------------------*/
  597.     /*----------------------------------------------------------------*/
  598.     /* Code Body                                                      */
  599.     /*----------------------------------------------------------------*/
  600.     StopToneAudio();
  601.     GoBackHistory();
  602. }
  603. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  604. /*****************************************************************************
  605.  * FUNCTION
  606.  *  PrfCallBackExtMldReplace
  607.  * DESCRIPTION
  608.  *  
  609.  * PARAMETERS
  610.  *  path            [?]         
  611.  *  is_short        [IN]        
  612.  * RETURNS
  613.  *  void
  614.  *****************************************************************************/
  615. void PrfCallBackExtMldReplace(void *path, int is_short)
  616. {
  617.     /*----------------------------------------------------------------*/
  618.     /* Local Variables                                                */
  619.     /*----------------------------------------------------------------*/
  620.     S8 *filepath = (S8*) path;
  621.     PMG_ADDFILE_ERRNO err = PMG_ADDFILE_ERR_UNKNOWN;
  622.     /*----------------------------------------------------------------*/
  623.     /* Code Body                                                      */
  624.     /*----------------------------------------------------------------*/
  625.     if (filepath)
  626.     {
  627.     #if defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P)
  628.         if (!mmi_profiles_check_DRM_content_forwardable((UI_string_type) filepath))
  629.         {
  630.             err = PMG_ADDFILE_ERR_DRM_PROHIBTED;
  631.         }
  632.         else
  633.     #endif /* defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P) */ 
  634.         if (PmgCheckImyMidFileSize(filepath) == PMG_ADDFILE_ERR_FILE_TOO_LARGE)
  635.         {
  636.             err = PMG_ADDFILE_ERR_FILE_TOO_LARGE;
  637.         }
  638.         else
  639.         {
  640.             PmgSetShortFileName((BOOL) is_short);
  641.             if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
  642.             {
  643.                 err = PmgReplaceExtMelodyBySlotPathFileName(filepath, g_ext_melody_idx);
  644.             }
  645.             else
  646.             {
  647.                 err = PmgAddExtMelodyBySlotPathFileName(filepath, g_ext_melody_idx);
  648.             }
  649.         }
  650.         switch (err)
  651.         {
  652.             case PMG_ADDFILE_ERR_SUCCESS:
  653.                 DisplayPopup(
  654.                     (PU8) GetString(STR_GLOBAL_DONE),
  655.                     IMG_GLOBAL_ACTIVATED,
  656.                     1,
  657.                     UI_POPUP_NOTIFYDURATION_TIME,
  658.                     SUCCESS_TONE);
  659.                 break;
  660.             case PMG_ADDFILE_ERR_STR_TOO_LONG:
  661.             case PMG_ADDFILE_ERR_STRFILE_TOO_LONG:
  662.             case PMG_ADDFILE_ERR_STRPATH_TOO_LONG:
  663.                 DisplayPopup(
  664.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_NAMETOOLONG),
  665.                     IMG_GLOBAL_UNFINISHED,
  666.                     1,
  667.                     UI_POPUP_NOTIFYDURATION_TIME,
  668.                     WARNING_TONE);
  669.                 break;
  670.             case PMG_ADDFILE_ERR_SLOT_FULL:
  671.                 DisplayPopup(
  672.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_LISTFULL),
  673.                     IMG_GLOBAL_UNFINISHED,
  674.                     1,
  675.                     UI_POPUP_NOTIFYDURATION_TIME,
  676.                     WARNING_TONE);
  677.                 break;
  678.             case PMG_ADDFILE_ERR_FILE_TOO_LARGE:
  679.                 DisplayPopup(
  680.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_FILETOOLARGE),
  681.                     IMG_GLOBAL_UNFINISHED,
  682.                     1,
  683.                     UI_POPUP_NOTIFYDURATION_TIME,
  684.                     WARNING_TONE);
  685.                 break;
  686.             case PMG_ADDFILE_ERR_DUPLICATED:
  687.                 DisplayPopup(
  688.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_DUPLICATED),
  689.                     IMG_GLOBAL_UNFINISHED,
  690.                     1,
  691.                     UI_POPUP_NOTIFYDURATION_TIME,
  692.                     WARNING_TONE);
  693.                 break;
  694.         #if defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P)
  695.             case PMG_ADDFILE_ERR_DRM_PROHIBTED:
  696.                 DisplayPopup(
  697.                     (PU8) GetString(STR_GLOBAL_DRM_PROHIBITED),
  698.                     IMG_GLOBAL_UNFINISHED,
  699.                     1,
  700.                     UI_POPUP_NOTIFYDURATION_TIME,
  701.                     WARNING_TONE);
  702.                 break;
  703.         #endif /* defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P) */ 
  704.             default:
  705.                 DisplayPopup(
  706.                     (PU8) GetString(STR_GLOBAL_UNFINISHED),
  707.                     IMG_GLOBAL_UNFINISHED,
  708.                     1,
  709.                     UI_POPUP_NOTIFYDURATION_TIME,
  710.                     WARNING_TONE);
  711.                 break;
  712.         }
  713.         DeleteUptoScrID(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
  714.         DeleteScreenIfPresent(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
  715.     }
  716.     else
  717.     {
  718.         GoBackToHistory(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
  719.     }
  720. }
  721. /*****************************************************************************
  722.  * FUNCTION
  723.  *  PrfSetRingToneConvertEmptySlotMenuList
  724.  * DESCRIPTION
  725.  *  
  726.  * PARAMETERS
  727.  *  idx     [IN]        
  728.  * RETURNS
  729.  *  
  730.  *****************************************************************************/
  731. static U8 PrfSetRingToneConvertEmptySlotMenuList(U8 idx)
  732. {
  733.     /*----------------------------------------------------------------*/
  734.     /* Local Variables                                                */
  735.     /*----------------------------------------------------------------*/
  736.     /*----------------------------------------------------------------*/
  737.     /* Code Body                                                      */
  738.     /*----------------------------------------------------------------*/
  739. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  740. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  741.     PmgSetToneType( PRFSET_MELODY_TYPE_RING);   
  742. #endif
  743. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  744.     if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
  745.     {   /* Not Empty slot */
  746.         return idx;
  747.     }
  748.     else
  749.     {
  750.         if (idx == 0)
  751.         {
  752.             return PRF_MENU_EXTMLD_ADD; /* PRF_MENU_EXTMLD_DONE */
  753.         }
  754.     #if MMI_ON_HARDWARE_P
  755.         else
  756.         {
  757.             MMI_ASSERT(MMI_FALSE);
  758.         }
  759.     #endif /* MMI_ON_HARDWARE_P */ 
  760.     }
  761.     return PRF_MENU_EXTMLD_MAX;
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  PrfSetRingToneExtMelodyDrvSelect
  766.  * DESCRIPTION
  767.  *  
  768.  * PARAMETERS
  769.  *  void
  770.  * RETURNS
  771.  *  void
  772.  *****************************************************************************/
  773. void PrfSetRingToneExtMelodyDrvSelect(void)
  774. {
  775. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  776.     /*----------------------------------------------------------------*/
  777.     /* Local Variables                                                */
  778.     /*----------------------------------------------------------------*/
  779.     S16 phoneDrvLetter, cardDrvLetter;
  780.     S8 temp[3];
  781.     UI_character_type dir_phone_root[4];
  782.     UI_character_type dir_card_root[4];
  783.     FMGR_FILTER filter;
  784.     /*----------------------------------------------------------------*/
  785.     /* Code Body                                                      */
  786.     /*----------------------------------------------------------------*/
  787.     FMGR_FILTER_INIT(&filter);
  788.     FMGR_FILTER_SET_AUDIO(&filter);
  789.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  790.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  791.     //#define MMI_PUBLIC_DRV  FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_V_NORMAL | FS_DRIVE_I_SYSTEM)
  792.     //#define MMI_CARD_DRV  FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE)
  793.     phoneDrvLetter = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_I_SYSTEM | FS_DRIVE_V_NORMAL);
  794.     cardDrvLetter = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
  795.     sprintf(temp, "%c:\", (S8) phoneDrvLetter);
  796.     AnsiiToUnicodeString((S8*) dir_phone_root, temp);
  797.     sprintf(temp, "%c:\", (S8) cardDrvLetter);
  798.     AnsiiToUnicodeString((S8*) dir_card_root, temp);
  799.     if (extMldHlitItem == PRF_MENU_EXTMLD_DRV_CARD)
  800.     {
  801.     #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
  802.         if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  803.         {
  804.             mmi_fmgr_select_path_and_enter(
  805.                 APP_PHONEBOOK,
  806.                 FMGR_SELECT_FILE,
  807.                 filter,
  808.                 (PS8) dir_card_root,
  809.                 PrfCallBackExtMldReplace);
  810.         }
  811.         else
  812.     #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */ 
  813.             mmi_fmgr_select_path_and_enter(
  814.                 APP_PROFILES,
  815.                 FMGR_SELECT_FILE,
  816.                 filter,
  817.                 (PS8) dir_card_root,
  818.                 PrfCallBackExtMldReplace);
  819.     }
  820.     else    /* if( extMldHlitItem == PRF_MENU_EXTMLD_DRV_PHONE) */
  821.     {
  822.     #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
  823.         if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  824.         {
  825.             mmi_fmgr_select_path_and_enter(
  826.                 APP_PHONEBOOK,
  827.                 FMGR_SELECT_FILE,
  828.                 filter,
  829.                 (PS8) dir_phone_root,
  830.                 PrfCallBackExtMldReplace);
  831.         }
  832.         else
  833.     #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */ 
  834.             mmi_fmgr_select_path_and_enter(
  835.                 APP_PROFILES,
  836.                 FMGR_SELECT_FILE,
  837.                 filter,
  838.                 (PS8) dir_phone_root,
  839.                 PrfCallBackExtMldReplace);
  840.     }
  841. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  842. }
  843. #if 0
  844. /* under construction !*/
  845. /* under construction !*/
  846. /* under construction !*/
  847. /* under construction !*/
  848. /* under construction !*/
  849. /* under construction !*/
  850. /* under construction !*/
  851. /* under construction !*/
  852. /* under construction !*/
  853. /* under construction !*/
  854. /* under construction !*/
  855. /* under construction !*/
  856. /* under construction !*/
  857. /* under construction !*/
  858. /* under construction !*/
  859. /* under construction !*/
  860. /* under construction !*/
  861. /* under construction !*/
  862. /* under construction !*/
  863. #endif /* 0 */ 
  864. /*****************************************************************************
  865.  * FUNCTION
  866.  *  EntryPrfSetRingToneExtMelodyDrv
  867.  * DESCRIPTION
  868.  *  
  869.  * PARAMETERS
  870.  *  void
  871.  * RETURNS
  872.  *  void
  873.  *****************************************************************************/
  874. void EntryPrfSetRingToneExtMelodyDrv(void)
  875. {
  876. #if 0
  877. /* under construction !*/
  878. /* under construction !*/
  879. /* under construction !*/
  880. /* under construction !*/
  881. /* under construction !*/
  882. /* under construction !*/
  883. #else /* 0 */ 
  884.     U8 *nStrItemList[PRF_MENU_EXTMLD_DRV_MAX];
  885.     U8 nNumofItem = (U8) PRF_MENU_EXTMLD_DRV_MAX;
  886.     U8 *guiBuffer;
  887.     S16 CardDrv = -1;
  888.     /*----------------------------------------------------------------*/
  889.     /* Code Body                                                      */
  890.     /*----------------------------------------------------------------*/
  891. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  892.     // #define MMI_CARD_DRV  FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE)
  893.     CardDrv = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
  894. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  895.     if (CardDrv > 0)    /* Card Storage is present */
  896.     {
  897.         U16 StrIDTitle = 0;
  898.         if (prfset_conf_type == PRFSET_MELODY_TYPE_RING)
  899.         {
  900.             StrIDTitle = STR_PROFILES_RING_TONE_SETUP_CAPTION;
  901.         }
  902.     #ifndef __MMI_ALM_CUSTOMIZE_TONE__
  903.         else if (prfset_conf_type == PRFSET_MELODY_TYPE_ALARM)
  904.         {
  905.             StrIDTitle = STR_ALARM_TONE_CAPTION;
  906.         }
  907.     #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */ 
  908.     #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
  909.         else if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  910.         {
  911.             StrIDTitle = STR_ID_PHB_CALLER_RING;
  912.         }
  913.     #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */ 
  914.         else
  915.         {
  916.             ASSERT(0);
  917.         }
  918.         nStrItemList[PRF_MENU_EXTMLD_DRV_PHONE] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_PHONE);
  919.         nStrItemList[PRF_MENU_EXTMLD_DRV_CARD] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_CARD);
  920.         EntryNewScreen(MENU_TONE_SETUP_RING_TONE_EXT_MELODY_DRV, NULL, EntryPrfSetRingToneExtMelodyDrv, NULL);
  921.         guiBuffer = GetCurrGuiBuffer(MENU_TONE_SETUP_RING_TONE_EXT_MELODY_DRV);
  922.         RegisterHighlightHandler(HighlightPrfSetRingToneExtMelody);
  923.         ShowCategory56Screen(
  924.             StrIDTitle,
  925.             (U16) (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING ? IMG_SCR_PBOOK_CAPTION : IMG_PROFILES_TITLEE),
  926.             STR_GLOBAL_OK,
  927.             IMG_GLOBAL_OK,
  928.             STR_GLOBAL_BACK,
  929.             IMG_GLOBAL_BACK,
  930.             (S32) nNumofItem,
  931.             nStrItemList,
  932.             NULL,
  933.             0,
  934.             guiBuffer);
  935.         SetLeftSoftkeyFunction(PrfSetRingToneExtMelodyDrvSelect, KEY_EVENT_UP);
  936.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  937.         /* SetExitHandler (MENU_TONE_SETUP_RING_TONE_EXT_MELODY_DRV, ExitPrfSetRingToneExtMelodyDrv); */
  938.     }
  939.     else    /* Card Storage not present */
  940.     {
  941.         extMldHlitItem = PRF_MENU_EXTMLD_DRV_PHONE;
  942.         PrfSetRingToneExtMelodyDrvSelect();
  943.     }
  944. #endif /* 0 */ 
  945. }
  946. /*****************************************************************************
  947.  * FUNCTION
  948.  *  PrfSetRingToneExtMelody
  949.  * DESCRIPTION
  950.  *  
  951.  * PARAMETERS
  952.  *  void
  953.  * RETURNS
  954.  *  void
  955.  *****************************************************************************/
  956. void PrfSetRingToneExtMelody(void)
  957. {
  958.     /*----------------------------------------------------------------*/
  959.     /* Local Variables                                                */
  960.     /*----------------------------------------------------------------*/
  961.     U8 idx = PrfSetRingToneConvertEmptySlotMenuList(extMldHlitItem);
  962.     /*----------------------------------------------------------------*/
  963.     /* Code Body                                                      */
  964.     /*----------------------------------------------------------------*/
  965. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  966. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  967.     PmgSetToneType( PRFSET_MELODY_TYPE_RING);   
  968. #endif
  969. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  970.     if (idx == PRF_MENU_EXTMLD_DONE)
  971.     {
  972.         if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
  973.         {
  974.             if (prfset_conf_type == PRFSET_MELODY_TYPE_RING)
  975.             {
  976.                 SetRingToneID((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
  977.             }
  978.         #ifndef __MMI_ALM_CUSTOMIZE_TONE__
  979.             else if (prfset_conf_type == PRFSET_MELODY_TYPE_ALARM)
  980.             {
  981.                 SetAlarmToneID((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
  982.             }
  983.         #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */ 
  984.         #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
  985.             else if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  986.             {
  987.                 mmi_phb_caller_ring_forward_to_entry((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
  988.             }
  989.         #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */ 
  990.             else
  991.             {
  992.                 MMI_ASSERT(0);
  993.             }
  994.             if (prfset_conf_type != PRFSET_MELODY_TYPE_PHB_RING)
  995.             {
  996.                 DisplayPopup(
  997.                     (PU8) GetString(STR_GLOBAL_DONE),
  998.                     IMG_GLOBAL_ACTIVATED,
  999.                     1,
  1000.                     UI_POPUP_NOTIFYDURATION_TIME,
  1001.                     SUCCESS_TONE);
  1002.             }
  1003.         }
  1004.         else
  1005.         {
  1006.             DisplayPopup(
  1007.                 (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1008.                 IMG_GLOBAL_UNFINISHED,
  1009.                 1,
  1010.                 UI_POPUP_NOTIFYDURATION_TIME,
  1011.                 WARNING_TONE);
  1012.         }
  1013.     }
  1014.     else if (idx == PRF_MENU_EXTMLD_DEL)
  1015.     {
  1016.         if (PmgDelExtMelodyById((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx)) == MMI_TRUE)
  1017.         {
  1018.             DisplayPopup(
  1019.                 (PU8) GetString(STR_GLOBAL_DONE),
  1020.                 IMG_GLOBAL_ACTIVATED,
  1021.                 1,
  1022.                 UI_POPUP_NOTIFYDURATION_TIME,
  1023.                 SUCCESS_TONE);
  1024.         }
  1025.         else
  1026.         {
  1027.             DisplayPopup(
  1028.                 (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1029.                 IMG_GLOBAL_UNFINISHED,
  1030.                 1,
  1031.                 UI_POPUP_NOTIFYDURATION_TIME,
  1032.                 WARNING_TONE);
  1033.         }
  1034.     }
  1035.     else if (idx == PRF_MENU_EXTMLD_ADD)
  1036.     {
  1037.         EntryPrfSetRingToneExtMelodyDrv();
  1038.     }
  1039.     else
  1040.     {
  1041.         DisplayPopup(
  1042.             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1043.             IMG_GLOBAL_UNFINISHED,
  1044.             1,
  1045.             UI_POPUP_NOTIFYDURATION_TIME,
  1046.             WARNING_TONE);
  1047.     }
  1048. }
  1049. /*****************************************************************************
  1050.  * FUNCTION
  1051.  *  HighlightPrfSetRingToneExtMelody
  1052.  * DESCRIPTION
  1053.  *  
  1054.  * PARAMETERS
  1055.  *  index       [IN]        
  1056.  * RETURNS
  1057.  *  void
  1058.  *****************************************************************************/
  1059. void HighlightPrfSetRingToneExtMelody(S32 index)
  1060. {
  1061.     /*----------------------------------------------------------------*/
  1062.     /* Local Variables                                                */
  1063.     /*----------------------------------------------------------------*/
  1064.     /*----------------------------------------------------------------*/
  1065.     /* Code Body                                                      */
  1066.     /*----------------------------------------------------------------*/
  1067.     extMldHlitItem = (U8) index;
  1068. }
  1069. /*****************************************************************************
  1070.  * FUNCTION
  1071.  *  EntryPrfSetRingToneExtMelody
  1072.  * DESCRIPTION
  1073.  *  
  1074.  * PARAMETERS
  1075.  *  void
  1076.  * RETURNS
  1077.  *  void
  1078.  *****************************************************************************/
  1079. void EntryPrfSetRingToneExtMelody(void)
  1080. {
  1081.     /*----------------------------------------------------------------*/
  1082.     /* Local Variables                                                */
  1083.     /*----------------------------------------------------------------*/
  1084.     U8 *nStrItemList[PRF_MENU_EXTMLD_MAX];
  1085.     U8 nNumofItem = 0;
  1086.     U8 *guiBuffer;
  1087.     U16 StrIDToneSet = 0, StrIDToneDel = 0, StrIDToneAdd = 0, StrIDTitle = 0;
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Code Body                                                      */
  1090.     /*----------------------------------------------------------------*/
  1091.     if (prfset_conf_type == PRFSET_MELODY_TYPE_RING || prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  1092.     {
  1093.         if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
  1094.         {
  1095.             StrIDToneSet = STR_TONE_SETUP_RING_TONE_PHB_EXT_SET;
  1096.         #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
  1097.             StrIDTitle = STR_ID_PHB_CALLER_RING;
  1098.         #endif 
  1099.         }
  1100.         else
  1101.         {
  1102.             StrIDToneSet = STR_TONE_SETUP_RING_TONE_EXT_SET;
  1103.             StrIDTitle = STR_PROFILES_RING_TONE_SETUP_CAPTION;
  1104.         }
  1105.         StrIDToneDel = STR_TONE_SETUP_RING_TONE_EXT_DEL;
  1106.         StrIDToneAdd = STR_TONE_SETUP_RING_TONE_EXT_ADD;
  1107.     }
  1108. #ifndef __MMI_ALM_CUSTOMIZE_TONE__
  1109.     else
  1110.     {
  1111.         StrIDToneSet = STR_TONE_SETUP_ALARM_TONE_EXT_SET;
  1112.         StrIDToneDel = STR_TONE_SETUP_ALARM_TONE_EXT_DEL;
  1113.         StrIDToneAdd = STR_TONE_SETUP_ALARM_TONE_EXT_ADD;
  1114.         StrIDTitle = STR_ALARM_TONE_CAPTION;
  1115.     }
  1116. #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */ 
  1117.     if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
  1118.     {
  1119.         /* Not Empty Slot */
  1120.         nStrItemList[PRF_MENU_EXTMLD_DONE] = (U8*) GetString(StrIDToneSet);
  1121.         nStrItemList[PRF_MENU_EXTMLD_DEL] = (U8*) GetString(StrIDToneDel);
  1122.         nStrItemList[PRF_MENU_EXTMLD_ADD] = (U8*) GetString(StrIDToneAdd);
  1123.         nNumofItem = (U8) PRF_MENU_EXTMLD_MAX;
  1124.     }
  1125.     else    /* Empty slot, show replace only */
  1126.     {
  1127.         nStrItemList[0] = (U8*) GetString(StrIDToneAdd);
  1128.         nNumofItem = 1;
  1129.     }
  1130.     EntryNewScreen(MENU_TONE_SETUP_RING_TONE_EXT_MELODY, NULL, EntryPrfSetRingToneExtMelody, NULL);
  1131.     guiBuffer = GetCurrGuiBuffer(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
  1132.     RegisterHighlightHandler(HighlightPrfSetRingToneExtMelody);
  1133.     ShowCategory56Screen(
  1134.         StrIDTitle,
  1135.         (U16) (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING ? IMG_SCR_PBOOK_CAPTION : IMG_PROFILES_TITLEE),
  1136.         STR_GLOBAL_OK,
  1137.         IMG_GLOBAL_OK,
  1138.         STR_GLOBAL_BACK,
  1139.         IMG_GLOBAL_BACK,
  1140.         (S32) nNumofItem,
  1141.         nStrItemList,
  1142.         NULL,
  1143.         0,
  1144.         guiBuffer);
  1145.     SetLeftSoftkeyFunction(PrfSetRingToneExtMelody, KEY_EVENT_UP);
  1146.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1147.     /* SetExitHandler (MENU_TONE_SETUP_RING_TONE_EXT_MELODY, ExitPrfSetRingToneExtMelody); */
  1148. }
  1149. /*****************************************************************************
  1150.  * FUNCTION
  1151.  *  PrfSetRingToneConfType
  1152.  * DESCRIPTION
  1153.  *  
  1154.  * PARAMETERS
  1155.  *  type        [IN]        
  1156.  * RETURNS
  1157.  *  void
  1158.  *****************************************************************************/
  1159. void PrfSetRingToneConfType(PRFSET_MELODY_CONF_TYPE type)
  1160. {
  1161.     /*----------------------------------------------------------------*/
  1162.     /* Local Variables                                                */
  1163.     /*----------------------------------------------------------------*/
  1164.     /*----------------------------------------------------------------*/
  1165.     /* Code Body                                                      */
  1166.     /*----------------------------------------------------------------*/
  1167.     prfset_conf_type = type;
  1168. }
  1169. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  1170. /*****************************************************************************
  1171.  * FUNCTION
  1172.  *  EntryScrSetRingToneId
  1173.  * DESCRIPTION
  1174.  *  Setting Ringtone ID.
  1175.  * PARAMETERS
  1176.  *  void
  1177.  * RETURNS
  1178.  *  void
  1179.  *****************************************************************************/
  1180. void EntryScrSetRingToneId(void)
  1181. {
  1182.     /*----------------------------------------------------------------*/
  1183.     /* Local Variables                                                */
  1184.     /*----------------------------------------------------------------*/
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Code Body                                                      */
  1187.     /*----------------------------------------------------------------*/
  1188.     EntryScrSetRingToneIdCountId(EntryScrSetRingToneId_Ext);
  1189. }
  1190. /*****************************************************************************
  1191.  * FUNCTION
  1192.  *  EntryScrSetRingToneIdCountId
  1193.  * DESCRIPTION
  1194.  *  Count Ringtone ID.
  1195.  * PARAMETERS
  1196.  *  Func_Callback       [IN]        
  1197.  * RETURNS
  1198.  *  void
  1199.  *****************************************************************************/
  1200. void EntryScrSetRingToneIdCountId(void (*Func_Callback) (U8, U16))
  1201. {
  1202.     /*----------------------------------------------------------------*/
  1203.     /* Local Variables                                                */
  1204.     /*----------------------------------------------------------------*/
  1205.     U8 is_ext_melody = MMI_FALSE;
  1206.     U16 numOfItem = gtotalRingId + gtotalMidiId;
  1207.     U16 ring_id = 0;
  1208.     /*----------------------------------------------------------------*/
  1209.     /* Code Body                                                      */
  1210.     /*----------------------------------------------------------------*/
  1211.     if (g_profiles_melody_list_index < gtotalRingId)
  1212.     {
  1213.         ring_id = g_profiles_melody_list_index + gstartRingId;
  1214.     }
  1215.     else if (g_profiles_melody_list_index < numOfItem)
  1216.     {
  1217.         ring_id = g_profiles_melody_list_index + gstartMidiId - gtotalRingId;
  1218.     }
  1219. #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  1220.     else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
  1221.     {
  1222.         g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
  1223.         ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
  1224.         is_ext_melody = MMI_TRUE;
  1225.     }
  1226. #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */ 
  1227.     else
  1228.     {
  1229.     #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  1230.         numOfItem += MAXIMUM_EXT_MELODY_NUM;
  1231.     #endif 
  1232.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  1233.         if (g_profiles_melody_list_index == numOfItem)
  1234.         {
  1235.             DYNAUDIOINFO *download_theme_tones;
  1236.             if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
  1237.             {
  1238.                 ring_id = (U16) download_theme_tones[0].AudioId;
  1239.             }
  1240.             else
  1241.             {
  1242.                 ASSERT(0);
  1243.             }
  1244.         }
  1245.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  1246.     }
  1247.     Func_Callback(is_ext_melody, ring_id);
  1248. }
  1249. /*****************************************************************************
  1250.  * FUNCTION
  1251.  *  EntryScrSetRingToneId_Ext
  1252.  * DESCRIPTION
  1253.  *  Setting Ringtone ID.
  1254.  * PARAMETERS
  1255.  *  ExtMelodyFlag       [IN]        
  1256.  *  ringTone            [IN]        
  1257.  * RETURNS
  1258.  *  void
  1259.  *****************************************************************************/
  1260. void EntryScrSetRingToneId_Ext(U8 ExtMelodyFlag, U16 ringTone)
  1261. {
  1262.     /*----------------------------------------------------------------*/
  1263.     /* Local Variables                                                */
  1264.     /*----------------------------------------------------------------*/
  1265.     /*----------------------------------------------------------------*/
  1266.     /* Code Body                                                      */
  1267.     /*----------------------------------------------------------------*/
  1268. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  1269.     if (ExtMelodyFlag == MMI_TRUE)
  1270.     {
  1271.         prfset_conf_type = PRFSET_MELODY_TYPE_RING;
  1272. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  1273. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  1274.     PmgSetToneType( PRFSET_MELODY_TYPE_RING);   
  1275. #endif
  1276. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  1277.         EntryPrfSetRingToneExtMelody();
  1278.     }
  1279.     else
  1280. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  1281.     {
  1282.         DisplayPopup(
  1283.             (PU8) GetString(STR_GLOBAL_DONE),
  1284.             IMG_GLOBAL_ACTIVATED,
  1285.             1,
  1286.             UI_POPUP_NOTIFYDURATION_TIME,
  1287.             SUCCESS_TONE);
  1288.         SetRingToneID(ringTone);
  1289.         DeleteScreenIfPresent(SCR_PROFILES_RING_TONE_SETUP);
  1290.     }
  1291. }
  1292. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  1293. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  1294. /*****************************************************************************
  1295.  * FUNCTION
  1296.  *  EntryScrProfilesPoweronToneSetup
  1297.  * DESCRIPTION
  1298.  *  Showing profile Poweron Tone Setup Screen
  1299.  * PARAMETERS
  1300.  *  void
  1301.  * RETURNS
  1302.  *  void
  1303.  *****************************************************************************/
  1304. void EntryScrProfilesPoweronToneSetup(void)
  1305. {
  1306.     /*----------------------------------------------------------------*/
  1307.     /* Local Variables                                                */
  1308.     /*----------------------------------------------------------------*/
  1309.     U16 nDispAttribute; /* Stores display attribue */
  1310.     U16 selecteditem = 0;
  1311.     U8 totalItems = 0;
  1312.     U8 *guiBuffer;              /* Buffer holding history data */
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Code Body                                                      */
  1315.     /*----------------------------------------------------------------*/
  1316.     /* 1 Call Exit Handler */
  1317.     EntryNewScreen(SCR_POWERON_TONE_SETUP, ExitScrProfilesPoweronToneSetup, EntryScrProfilesPoweronToneSetup, NULL);
  1318.     /* 2 Get current screen to gui buffer  for history purposes */
  1319.     guiBuffer = GetCurrGuiBuffer(SCR_POWERON_TONE_SETUP);
  1320.     /* 3. Retrieve no of child of menu item to be displayed */
  1321.     /* nNumofItem = GetNumOfChild(MENU_TONE_SETUP_POWERON_TONE); */
  1322.    totalItems =mmi_profiles_get_POn_Off_tone_list((U16)gprofiles[gprofileId].toneSetup.powerOnTone, &selecteditem);
  1323.     /* 4. Get attribute of menu to be displayed */
  1324.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_POWERON_TONE);
  1325.     /* 6 Set current parent id */
  1326.     SetParentHandler(MENU_TONE_SETUP_POWERON_TONE);
  1327.     /* 7 Register highlight handler to be called in menu screen */
  1328.     RegisterHighlightHandler(mmi_profiles_POn_Off_tone_list_highlight_hdlr);
  1329.     /* 8 Display Category Screen */
  1330.     ShowCategory89Screen(
  1331.         STR_POWERON_TONE_SETUP_CAPTION,
  1332.         IMG_PROFILES_TITLEE,
  1333.         STR_GLOBAL_OK,
  1334.         IMG_GLOBAL_OK,
  1335.         STR_GLOBAL_BACK,
  1336.         IMG_GLOBAL_BACK,
  1337.         totalItems,
  1338.         subMenuDataPtrs,
  1339.         hintDataPtrs,
  1340.         0,
  1341.         selecteditem,
  1342.         guiBuffer);
  1343.     /* 9.Register function with right softkey */
  1344.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1345.     SetLeftSoftkeyFunction(EntryScrSetPowerOnToneId, KEY_EVENT_UP);
  1346.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1347.     /* SetExitHandler(SCR_POWERON_TONE_SETUP, ExitScrProfilesPoweronToneSetup); */
  1348. }
  1349. /*****************************************************************************
  1350.  * FUNCTION
  1351.  *  mmi_profiles_get_POn_Off_tone_list
  1352.  * DESCRIPTION
  1353.  *  Build melody list
  1354.  * PARAMETERS
  1355.  *  CurMelodyID         [IN]        
  1356.  *  selecteditem        [IN]        
  1357.  * RETURNS
  1358.  *  void
  1359.  *****************************************************************************/
  1360. U8 mmi_profiles_get_POn_Off_tone_list(U16 CurMelodyID, U16 * selecteditem)
  1361. {
  1362.     /*----------------------------------------------------------------*/
  1363.     /* Local Variables                                                */
  1364.     U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
  1365.     U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
  1366.     U8 i = 0;
  1367.     /*----------------------------------------------------------------*/
  1368. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  1369.     DYNEXTMELODYINFO *ExtMSMelodyInfo;
  1370. #endif 
  1371. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1372.     DYNAUDIOINFO *DownloadThemeTones;
  1373. #endif 
  1374.     int index, data;
  1375.     U16 nNumofItem = gtotalGeneralToneId + 1;
  1376.     /*----------------------------------------------------------------*/
  1377.     /* Code Body                                                      */
  1378.     /*----------------------------------------------------------------*/
  1379.     /* init hint data */
  1380.     memset(hintData, 0, sizeof(hintData));
  1381.    for (data = 0; data < MAX_SUB_MENUS; data++)
  1382.     {
  1383.         hintDataPtrs[data] = hintData[data];
  1384.     }
  1385.     memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
  1386.     pfnUnicodeStrncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
  1387.     for (i = 1; i <= gtotalGeneralToneId; i++)
  1388.     {
  1389.         S32 len = 0;
  1390.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  1391.         sprintf((PS8) AsciinStrItemList, "%d", i);
  1392.         AnsiiToUnicodeString((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
  1393.         len = pfnUnicodeStrlen((PS8) UnicodenStrItemList);
  1394.         len = MAX_SUBMENU_CHARACTERS - len;
  1395.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
  1396.         pfnUnicodeStrcat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
  1397.     }
  1398.     /* make a listing of ext melodies. */
  1399. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  1400.     PmgSetToneType( PRFSET_MELODY_TYPE_POWERON);    //Joey added for changing the MS tone style on 2007-4-05
  1401.     POnOffPmgGetExtMelodyInfo(&ExtMSMelodyInfo);
  1402.     for (index = nNumofItem, data = 0; data < MAXIMUM_EXT_MELODY_NUM; index++, data++)
  1403.     {
  1404.         if (POnOffPmgIsEmptySlot((U8) data) == MMI_FALSE)
  1405.         {
  1406.             if (POnOffPmgQueryFileExistBySlot((U8) data) == MMI_FALSE)
  1407.             {
  1408.                 pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_TONE_FILE_NOT_EXIST));
  1409.             }
  1410.             if (IS_EXTMELODY_SHORTNAME(ExtMSMelodyInfo->info[data].filepath))
  1411.             {
  1412.                 mmi_chset_mixed_text_to_ucs2_str(
  1413.                     subMenuDataPtrs[index],
  1414.                     (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
  1415.                     (U8*) ExtMSMelodyInfo->info[data].filename,
  1416.                     g_chset_text_encoding);
  1417.             }
  1418.             else
  1419.             {
  1420.                 pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index], (S8*) ((ExtMSMelodyInfo->info[data]).filename));
  1421.             }
  1422.         #if (!defined(__MMI_SHOW_FILE_EXT__))
  1423.             PmgRemoveFileExt((S8*) subMenuDataPtrs[index]);
  1424.         #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
  1425.             PmgRemoveFileDAFExt((S8*) subMenuDataPtrs[index]);
  1426.         #endif 
  1427.         }
  1428.         else
  1429.         {
  1430.             pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
  1431.         }
  1432.     }
  1433. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  1434. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1435.     if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
  1436.     {
  1437.         pfnUnicodeStrcpy((S8*) subMenuDataPtrs[index++], (S8*) GetString(STR_PROFILES_CURR_THEME));
  1438.     }
  1439. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  1440.     /* find highlight selection */
  1441.     if (CurMelodyID >= gstartGeneralToneId && CurMelodyID < gstartGeneralToneId + gtotalGeneralToneId)
  1442.     {
  1443.         *selecteditem = CurMelodyID - gstartGeneralToneId + 1;
  1444.     }
  1445.     else if (MESSAGE_SILENT==CurMelodyID)
  1446.     {
  1447.         *selecteditem = 0;
  1448.     }
  1449.     else
  1450.     {
  1451.         BOOL selected = FALSE;
  1452.     #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  1453.         for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
  1454.         {
  1455.             if (POnOffPmgIsEmptySlot((U8) data) == MMI_FALSE && CurMelodyID == (ExtMSMelodyInfo->info[data]).id)
  1456.             {
  1457.                 *selecteditem = nNumofItem + data;
  1458.                 selected = TRUE;
  1459.                 break;
  1460.             }
  1461.         }
  1462.         nNumofItem += MAXIMUM_EXT_MELODY_NUM;
  1463.     #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  1464.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  1465.         if (!selected)
  1466.         {
  1467.             if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
  1468.             {
  1469.                 if ((U16)DownloadThemeTones[0].AudioId == CurMelodyID)
  1470.                 {
  1471.                     selected = TRUE;
  1472.                     *selecteditem = nNumofItem;
  1473.                     if (AudioFileDeletedFromFmgr(CurMelodyID))
  1474.                     {
  1475.                         pfnUnicodeStrcpy((S8*) hintData[nNumofItem], GetString(STR_TONE_FILE_NOT_EXIST));
  1476.                     }
  1477.                 }
  1478.             }
  1479.         }
  1480.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  1481.         ASSERT(selected);
  1482.     }
  1483.     return (U8) index;
  1484. }
  1485. /*****************************************************************************
  1486.  * FUNCTION
  1487.  *  mmi_profiles_Pon_tone_list_highlight_hdlr
  1488.  * DESCRIPTION
  1489.  *  Getting Current Screen Handler
  1490.  * PARAMETERS
  1491.  *  item_index          [IN]        
  1492.  *  index_index(?)      [IN]        
  1493.  * RETURNS
  1494.  *  void
  1495.  *****************************************************************************/
  1496. void mmi_profiles_POn_Off_tone_list_highlight_hdlr(S32 item_index)
  1497. {
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     BOOL play_it = TRUE;
  1502.     U16 numOfItem = gtotalGeneralToneId + 1;// gtotalRingId + gtotalMidiId;
  1503.     /*----------------------------------------------------------------*/
  1504.     /* Code Body                                                      */
  1505.     /*----------------------------------------------------------------*/
  1506.     gcurrHiliteIndexOne  = (U16) item_index;
  1507.     StopToneAudio();
  1508.     if (0 == gcurrHiliteIndexOne)
  1509.     {
  1510.         gcurrentaudioId = 0;
  1511.         glastaudioId = gcurrentaudioId;
  1512.         /* MTK Brian added for stop timer in case of 0-->0, 2003/11/18 */
  1513.     }
  1514.     else if (gcurrHiliteIndexOne  < numOfItem)
  1515.     {
  1516.         gcurrentaudioId = gcurrHiliteIndexOne  + gstartGeneralToneId - 1;
  1517.     }
  1518. #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  1519.     else if (gcurrHiliteIndexOne  < numOfItem + MAXIMUM_EXT_MELODY_NUM)
  1520.     {
  1521.         g_pon_off_ext_melody_idx = (U8) (gcurrHiliteIndexOne  - numOfItem);
  1522.         gcurrentaudioId = (U16) g_pon_off_ext_melody_idx + PMG_EXT_PON_OFF_MELODY_BEGIN;
  1523.     }
  1524. #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */ 
  1525.     else
  1526.     {
  1527.     #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  1528.         numOfItem += MAXIMUM_EXT_MELODY_NUM;
  1529.     #endif 
  1530.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  1531.         if (gcurrHiliteIndexOne  == numOfItem)
  1532.         {
  1533.             DYNAUDIOINFO *download_theme_tones;
  1534.             if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
  1535.             {
  1536.                 gcurrentaudioId = (U16) download_theme_tones[0].AudioId;
  1537.                 if (AudioFileDeletedFromFmgr(gcurrentaudioId))
  1538.                 {
  1539.                     play_it = FALSE;
  1540.                 }
  1541.             }
  1542.             else
  1543.             {
  1544.                 ASSERT(0);
  1545.             }
  1546.         }
  1547.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  1548.     }
  1549.     if (play_it)
  1550.     {
  1551.         StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, PlayToneAudio);
  1552.     }
  1553. }
  1554. /*****************************************************************************
  1555.  * FUNCTION
  1556.  *  PrfCallBackExtMldReplace
  1557.  * DESCRIPTION
  1558.  *   
  1559.  * PARAMETERS
  1560.  *  path            [?]         
  1561.  *  is_short        [IN]        
  1562.  * RETURNS
  1563.  *  void
  1564.  *****************************************************************************/
  1565. void PrfCallBackExtMldPOnOffReplace(void *path, int is_short)
  1566. {
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Local Variables                                                */
  1569.     /*----------------------------------------------------------------*/
  1570.     S8 *filepath = (S8*) path;
  1571.     PMG_ADDFILE_ERRNO err = PMG_ADDFILE_ERR_UNKNOWN;
  1572.     /*----------------------------------------------------------------*/
  1573.     /* Code Body                                                      */
  1574.     /*----------------------------------------------------------------*/
  1575.     if (filepath)
  1576.     {
  1577.     #if defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P)
  1578.         if (!mmi_profiles_check_DRM_content_forwardable((UI_string_type) filepath))
  1579.         {
  1580.             err = PMG_ADDFILE_ERR_DRM_PROHIBTED;
  1581.         }
  1582.         else
  1583.     #endif /* defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P) */ 
  1584.         if (PmgCheckImyMidFileSize(filepath) == PMG_ADDFILE_ERR_FILE_TOO_LARGE)
  1585.         {
  1586.             err = PMG_ADDFILE_ERR_FILE_TOO_LARGE;
  1587.         }
  1588.         else
  1589.         {
  1590.             POnOffPmgSetShortFileName((BOOL) is_short);
  1591.             if (POnOffPmgIsEmptySlot(g_pon_off_ext_melody_idx) == MMI_FALSE)
  1592.             {
  1593.                 err = POnOffPmgReplaceExtMelodyBySlotPathFileName(filepath, g_pon_off_ext_melody_idx);
  1594.             }
  1595.             else
  1596.             {
  1597.                 err = POnOffPmgAddExtMelodyBySlotPathFileName(filepath, g_pon_off_ext_melody_idx);
  1598.             }
  1599.         }
  1600.         switch (err)
  1601.         {
  1602.             case PMG_ADDFILE_ERR_SUCCESS:
  1603.                 DisplayPopup(
  1604.                     (PU8) GetString(STR_GLOBAL_DONE),
  1605.                     IMG_GLOBAL_ACTIVATED,
  1606.                     1,
  1607.                     UI_POPUP_NOTIFYDURATION_TIME,
  1608.                     SUCCESS_TONE);
  1609.                 break;
  1610.             case PMG_ADDFILE_ERR_STR_TOO_LONG:
  1611.             case PMG_ADDFILE_ERR_STRFILE_TOO_LONG:
  1612.             case PMG_ADDFILE_ERR_STRPATH_TOO_LONG:
  1613.                 DisplayPopup(
  1614.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_NAMETOOLONG),
  1615.                     IMG_GLOBAL_UNFINISHED,
  1616.                     1,
  1617.                     UI_POPUP_NOTIFYDURATION_TIME,
  1618.                     WARNING_TONE);
  1619.                 break;
  1620.             case PMG_ADDFILE_ERR_SLOT_FULL:
  1621.                 DisplayPopup(
  1622.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_LISTFULL),
  1623.                     IMG_GLOBAL_UNFINISHED,
  1624.                     1,
  1625.                     UI_POPUP_NOTIFYDURATION_TIME,
  1626.                     WARNING_TONE);
  1627.                 break;
  1628.             case PMG_ADDFILE_ERR_FILE_TOO_LARGE:
  1629.                 DisplayPopup(
  1630.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_FILETOOLARGE),
  1631.                     IMG_GLOBAL_UNFINISHED,
  1632.                     1,
  1633.                     UI_POPUP_NOTIFYDURATION_TIME,
  1634.                     WARNING_TONE);
  1635.                 break;
  1636.             case PMG_ADDFILE_ERR_DUPLICATED:
  1637.                 DisplayPopup(
  1638.                     (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_DUPLICATED),
  1639.                     IMG_GLOBAL_UNFINISHED,
  1640.                     1,
  1641.                     UI_POPUP_NOTIFYDURATION_TIME,
  1642.                     WARNING_TONE);
  1643.                 break;
  1644.         #if defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P)
  1645.             case PMG_ADDFILE_ERR_DRM_PROHIBTED:
  1646.                 DisplayPopup(
  1647.                     (PU8) GetString(STR_GLOBAL_DRM_PROHIBITED),
  1648.                     IMG_GLOBAL_UNFINISHED,
  1649.                     1,
  1650.                     UI_POPUP_NOTIFYDURATION_TIME,
  1651.                     WARNING_TONE);
  1652.                 break;
  1653.         #endif /* defined(__DRM_SUPPORT__) && defined(MMI_ON_HARDWARE_P) */ 
  1654.             default:
  1655.                 DisplayPopup(
  1656.                     (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1657.                     IMG_GLOBAL_UNFINISHED,
  1658.                     1,
  1659.                     UI_POPUP_NOTIFYDURATION_TIME,
  1660.                     WARNING_TONE);
  1661.                 break;
  1662.         }
  1663.   DeleteUptoScrID(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY);
  1664.         DeleteScreenIfPresent(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY);
  1665.     }
  1666.     else
  1667.     {
  1668.   GoBackToHistory(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY);
  1669.     }
  1670. }
  1671. /*****************************************************************************
  1672.  * FUNCTION
  1673.  *  PrfSetPOnOffToneConvertEmptySlotMenuList
  1674.  * DESCRIPTION
  1675.  *  
  1676.  * PARAMETERS
  1677.  *  idx     [IN]        
  1678.  * RETURNS
  1679.  *  If change it or not ? decided by the global g_ext_melody_idx
  1680.  *****************************************************************************/
  1681. static U8 PrfSetPOnOffToneConvertEmptySlotMenuList(U8 idx)
  1682. {
  1683.     /*----------------------------------------------------------------*/
  1684.     /* Local Variables                                                */
  1685.     /*----------------------------------------------------------------*/
  1686.     /*----------------------------------------------------------------*/
  1687.     /* Code Body                                                      */
  1688.     /*----------------------------------------------------------------*/
  1689.   PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  1690.     
  1691.     if (POnOffPmgIsEmptySlot(g_pon_off_ext_melody_idx) == MMI_FALSE)
  1692.     {   /* Not Empty slot */
  1693.         return idx;
  1694.     }
  1695.     else
  1696.     {
  1697.         if (idx == 0)
  1698.         {
  1699.             return PRF_MENU_EXTMLD_ADD; /* PRF_MENU_EXTMLD_DONE */
  1700.         }
  1701.     #if MMI_ON_HARDWARE_P
  1702.         else
  1703.         {
  1704.             MMI_ASSERT(MMI_FALSE);
  1705.         }
  1706.     #endif /* MMI_ON_HARDWARE_P */ 
  1707.     }
  1708.     return PRF_MENU_EXTMLD_MAX;
  1709. }
  1710. /*****************************************************************************
  1711.  * FUNCTION
  1712.  *  PrfSetMSExtMelodyDrvSelect
  1713.  * DESCRIPTION
  1714.  *  Joey added select card or phone
  1715.  * PARAMETERS
  1716.  *  void
  1717.  * RETURNS
  1718.  *  void
  1719.  *****************************************************************************/
  1720. void PrfSetPOnOffExtMelodyDrvSelect(void)
  1721. {
  1722. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1723.     /*----------------------------------------------------------------*/
  1724.     /* Local Variables                                                */
  1725.     /*----------------------------------------------------------------*/
  1726.     S16 phoneDrvLetter, cardDrvLetter;
  1727.     S8 temp[3];
  1728.     UI_character_type dir_phone_root[4];
  1729.     UI_character_type dir_card_root[4];
  1730.     FMGR_FILTER filter;
  1731.     /*----------------------------------------------------------------*/
  1732.     /* Code Body                                                      */
  1733.     /*----------------------------------------------------------------*/
  1734.     FMGR_FILTER_INIT(&filter);
  1735.     FMGR_FILTER_SET_AUDIO(&filter);
  1736.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  1737.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  1738.     //#define MMI_PUBLIC_DRV  FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_V_NORMAL | FS_DRIVE_I_SYSTEM)
  1739.     //#define MMI_CARD_DRV  FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE)
  1740.     phoneDrvLetter = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_I_SYSTEM | FS_DRIVE_V_NORMAL);
  1741.     cardDrvLetter = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
  1742.     sprintf(temp, "%c:\", (S8) phoneDrvLetter);
  1743.     AnsiiToUnicodeString((S8*) dir_phone_root, temp);
  1744.     sprintf(temp, "%c:\", (S8) cardDrvLetter);
  1745.     AnsiiToUnicodeString((S8*) dir_card_root, temp);
  1746.    PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  1747.     if (pon_off_extMldHlitItem == PRF_MENU_EXTMLD_DRV_CARD)
  1748.     {
  1749.             mmi_fmgr_select_path_and_enter(
  1750.                 APP_PROFILES,
  1751.                 FMGR_SELECT_FILE,
  1752.                 filter,
  1753.                 (PS8) dir_card_root,
  1754.               PrfCallBackExtMldPOnOffReplace);//Joey  PrfCallBackExtMldReplace
  1755.     }
  1756.     else    /* if( extMldHlitItem == PRF_MENU_EXTMLD_DRV_PHONE) */
  1757.     {
  1758.             mmi_fmgr_select_path_and_enter(
  1759.                 APP_PROFILES,
  1760.                 FMGR_SELECT_FILE,
  1761.                 filter,
  1762.                 (PS8) dir_phone_root,
  1763.                 PrfCallBackExtMldPOnOffReplace);//Joey PrfCallBackExtMldReplace
  1764.     }
  1765. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1766. }
  1767. /*****************************************************************************
  1768.  * FUNCTION
  1769.  *  EntryPrfSetMSToneExtMelodyDrv
  1770.  * DESCRIPTION
  1771.  *  
  1772.  * PARAMETERS
  1773.  *  void
  1774.  * RETURNS
  1775.  *  void
  1776.  *****************************************************************************/
  1777. void EntryPrfSetPOnOffToneExtMelodyDrv(void)
  1778. {
  1779. #if 0
  1780. /* under construction !*/
  1781. /* under construction !*/
  1782. /* under construction !*/
  1783. /* under construction !*/
  1784. /* under construction !*/
  1785. /* under construction !*/
  1786. #else /* 0 */ 
  1787.     U8 *nStrItemList[PRF_MENU_EXTMLD_DRV_MAX];
  1788.     U8 nNumofItem = (U8) PRF_MENU_EXTMLD_DRV_MAX;
  1789.     U8 *guiBuffer;
  1790.     S16 CardDrv = -1;
  1791.     /*----------------------------------------------------------------*/
  1792.     /* Code Body                                                      */
  1793.     /*----------------------------------------------------------------*/
  1794. #if (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  1795.     // #define MMI_CARD_DRV  FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE)
  1796.     CardDrv = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
  1797. #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  1798.     if (CardDrv > 0)    /* Card Storage is present */
  1799.     {
  1800.         U16 StrIDTitle = 0;
  1801. if (prfset_conf_type == PRFSET_MELODY_TYPE_POWERON)
  1802. {
  1803.     StrIDTitle = STR_POWERON_TONE_SETUP_CAPTION;
  1804. }
  1805. else if (prfset_conf_type == PRFSET_MELODY_TYPE_COVEROPEN)
  1806. {
  1807.     StrIDTitle = STR_COVEROPEN_TONE_CAPTION;
  1808. }
  1809. else if (prfset_conf_type == PRFSET_MELODY_TYPE_COVERCLOSE)
  1810. {
  1811.     StrIDTitle = STR_COVERCLOSE_TONE_CAPTION;
  1812. }
  1813. else
  1814. {
  1815.     StrIDTitle = STR_POWEROFF_TONE_SETUP_CAPTION;
  1816. }
  1817.  
  1818.         nStrItemList[PRF_MENU_EXTMLD_DRV_PHONE] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_PHONE);
  1819.         nStrItemList[PRF_MENU_EXTMLD_DRV_CARD] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_CARD);
  1820.         EntryNewScreen(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY_DRV, NULL, EntryPrfSetPOnOffToneExtMelodyDrv, NULL);
  1821.         guiBuffer = GetCurrGuiBuffer(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY_DRV);
  1822.         RegisterHighlightHandler(HighlightPrfSetPOnOffToneExtMelody);
  1823.         ShowCategory56Screen(
  1824.             StrIDTitle,
  1825.             (U16) (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING ? IMG_SCR_PBOOK_CAPTION : IMG_PROFILES_TITLEE),
  1826.             STR_GLOBAL_OK,
  1827.             IMG_GLOBAL_OK,
  1828.             STR_GLOBAL_BACK,
  1829.             IMG_GLOBAL_BACK,
  1830.             (S32) nNumofItem,
  1831.             nStrItemList,
  1832.             NULL,
  1833.             0,
  1834.             guiBuffer);
  1835.       
  1836.  
  1837.         SetLeftSoftkeyFunction(PrfSetPOnOffExtMelodyDrvSelect, KEY_EVENT_UP);
  1838.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1839.         /* SetExitHandler (MENU_TONE_SETUP_RING_TONE_EXT_MELODY_DRV, ExitPrfSetRingToneExtMelodyDrv); */
  1840.     }
  1841.     else    /* Card Storage not present */
  1842.     {
  1843.         pon_off_extMldHlitItem = PRF_MENU_EXTMLD_DRV_PHONE;
  1844.         PrfSetPOnOffExtMelodyDrvSelect();
  1845.     }
  1846. #endif /* 0 */ 
  1847. }
  1848. /*****************************************************************************
  1849.  * FUNCTION
  1850.  *  PrfSetPOnOffToneExtMelody
  1851.  * DESCRIPTION
  1852.  *  
  1853.  * PARAMETERS
  1854.  *  void
  1855.  * RETURNS
  1856.  *  void
  1857.  *****************************************************************************/
  1858. void PrfSetPOnOffToneExtMelody(void)
  1859. {
  1860.     /*----------------------------------------------------------------*/
  1861.     /* Local Variables                                                */
  1862.     /*----------------------------------------------------------------*/
  1863.     U8 idx = PrfSetPOnOffToneConvertEmptySlotMenuList(pon_off_extMldHlitItem);
  1864.     TONE_SETUP tone;//Joey added for passing the MS tone type on 2007-4-03
  1865.     /*----------------------------------------------------------------*/
  1866.     /* Code Body                                                      */
  1867.     /*----------------------------------------------------------------*/
  1868.     PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  1869.     
  1870.     if (idx == PRF_MENU_EXTMLD_DONE)
  1871.     {
  1872.         if (POnOffPmgIsEmptySlot(g_pon_off_ext_melody_idx) == MMI_FALSE)
  1873.         {
  1874. if (prfset_conf_type == PRFSET_MELODY_TYPE_POWERON)
  1875.             {
  1876.                 tone.powerOnTone = PMG_EXT_PON_OFF_MELODY_BEGIN + g_pon_off_ext_melody_idx;
  1877.                 SetPowerOnToneType(tone);
  1878.             }
  1879.             else if (prfset_conf_type == PRFSET_MELODY_TYPE_POWEROFF)
  1880.             {
  1881.                 tone.powerOffTone = PMG_EXT_PON_OFF_MELODY_BEGIN + g_pon_off_ext_melody_idx;        
  1882.                 SetPowerOffToneType(tone);
  1883.             }
  1884. #ifdef __MMI_CLAMSHELL__
  1885.             else if (prfset_conf_type == PRFSET_MELODY_TYPE_COVEROPEN)
  1886.             {
  1887.                 tone.coverOpenTone= PMG_EXT_PON_OFF_MELODY_BEGIN + g_pon_off_ext_melody_idx;        
  1888.                 SetCoverOpenToneType(tone);
  1889.             }
  1890.             else if (prfset_conf_type == PRFSET_MELODY_TYPE_COVERCLOSE)
  1891.             {
  1892.                 tone.coverCloseTone= PMG_EXT_PON_OFF_MELODY_BEGIN + g_pon_off_ext_melody_idx;        
  1893.                 SetCoverCloseToneType(tone);
  1894.             }
  1895. #endif
  1896. else
  1897. {
  1898. ASSERT(0);
  1899. }
  1900.             DisplayPopup(
  1901.                 (PU8) GetString(STR_GLOBAL_DONE),
  1902.                 IMG_GLOBAL_ACTIVATED,
  1903.                 1,
  1904.                 UI_POPUP_NOTIFYDURATION_TIME,
  1905.                 SUCCESS_TONE);
  1906.         }
  1907.         else
  1908.         {
  1909.             DisplayPopup(
  1910.                 (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1911.                 IMG_GLOBAL_UNFINISHED,
  1912.                 1,
  1913.                 UI_POPUP_NOTIFYDURATION_TIME,
  1914.                 WARNING_TONE);
  1915.         }
  1916.     }
  1917.     else if (idx == PRF_MENU_EXTMLD_DEL)
  1918.     {
  1919.         if (POnOffPmgDelExtMelodyById((U16) (PMG_EXT_PON_OFF_MELODY_BEGIN + g_pon_off_ext_melody_idx)) == MMI_TRUE)
  1920.         {
  1921.             DisplayPopup(
  1922.                 (PU8) GetString(STR_GLOBAL_DONE),
  1923.                 IMG_GLOBAL_ACTIVATED,
  1924.                 1,
  1925.                 UI_POPUP_NOTIFYDURATION_TIME,
  1926.                 SUCCESS_TONE);
  1927.         }
  1928.         else
  1929.         {
  1930.             DisplayPopup(
  1931.                 (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1932.                 IMG_GLOBAL_UNFINISHED,
  1933.                 1,
  1934.                 UI_POPUP_NOTIFYDURATION_TIME,
  1935.                 WARNING_TONE);
  1936.         }
  1937.     }
  1938.     else if (idx == PRF_MENU_EXTMLD_ADD)
  1939.     {
  1940.         EntryPrfSetPOnOffToneExtMelodyDrv();
  1941.     }
  1942.     else
  1943.     {
  1944.         DisplayPopup(
  1945.             (PU8) GetString(STR_GLOBAL_UNFINISHED),
  1946.             IMG_GLOBAL_UNFINISHED,
  1947.             1,
  1948.             UI_POPUP_NOTIFYDURATION_TIME,
  1949.             WARNING_TONE);
  1950.     }
  1951. }
  1952. /*****************************************************************************
  1953.  * FUNCTION
  1954.  *  HighlightPrfSetPOnOffToneExtMelody
  1955.  * DESCRIPTION
  1956.  *  
  1957.  * PARAMETERS
  1958.  *  index       [IN]        
  1959.  * RETURNS
  1960.  *  void
  1961.  *****************************************************************************/
  1962. void HighlightPrfSetPOnOffToneExtMelody(S32 index)
  1963. {
  1964.     /*----------------------------------------------------------------*/
  1965.     /* Local Variables                                                */
  1966.     /*----------------------------------------------------------------*/
  1967.     /*----------------------------------------------------------------*/
  1968.     /* Code Body                                                      */
  1969.     /*----------------------------------------------------------------*/
  1970.     pon_off_extMldHlitItem = (U8) index;
  1971. }
  1972. /*****************************************************************************
  1973.  * FUNCTION
  1974.  *  EntryPrfSetRingToneExtMelody
  1975.  * DESCRIPTION
  1976.  *  
  1977.  * PARAMETERS
  1978.  *  void
  1979.  * RETURNS
  1980.  *  void
  1981.  *****************************************************************************/
  1982. void EntryPrfSetPOnOffToneExtMelody(void)
  1983. {
  1984.     /*----------------------------------------------------------------*/
  1985.     /* Local Variables                                                */
  1986.     /*----------------------------------------------------------------*/
  1987.     U8 *nStrItemList[PRF_MENU_EXTMLD_MAX];
  1988.     U8 nNumofItem = 0;
  1989.     U8 *guiBuffer;
  1990.     U16 StrIDToneSet = 0, StrIDToneDel = 0, StrIDToneAdd = 0, StrIDTitle = 0;
  1991.     /*----------------------------------------------------------------*/
  1992.     /* Code Body                                                      */
  1993.     /*----------------------------------------------------------------*/
  1994.     PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  1995.     
  1996. //Joey added for changing the MS tone style on 2007-4-03 start
  1997. if(prfset_conf_type == PRFSET_MELODY_TYPE_POWERON)
  1998. {
  1999.    StrIDTitle = STR_POWERON_TONE_SETUP_CAPTION;
  2000. }
  2001. else if(prfset_conf_type == PRFSET_MELODY_TYPE_COVEROPEN)
  2002. {
  2003.    StrIDTitle = STR_COVEROPEN_TONE_CAPTION;
  2004. }
  2005. else if(prfset_conf_type == PRFSET_MELODY_TYPE_COVERCLOSE)
  2006. {
  2007.    StrIDTitle = STR_COVERCLOSE_TONE_CAPTION;
  2008. }
  2009. else
  2010. {
  2011.    StrIDTitle = STR_POWEROFF_TONE_SETUP_CAPTION;
  2012. }
  2013.    StrIDToneSet = STR_TONE_SETUP_RING_TONE_EXT_SET;
  2014.    StrIDToneDel = STR_TONE_SETUP_RING_TONE_EXT_DEL;
  2015.    StrIDToneAdd = STR_TONE_SETUP_RING_TONE_EXT_ADD;// "replace"
  2016.     if (POnOffPmgIsEmptySlot(g_pon_off_ext_melody_idx) == MMI_FALSE)
  2017.     {
  2018.         /* Not Empty Slot */
  2019.         nStrItemList[PRF_MENU_EXTMLD_DONE] = (U8*) GetString(StrIDToneSet);
  2020.         nStrItemList[PRF_MENU_EXTMLD_DEL] = (U8*) GetString(StrIDToneDel);
  2021.         nStrItemList[PRF_MENU_EXTMLD_ADD] = (U8*) GetString(StrIDToneAdd);
  2022.         nNumofItem = (U8) PRF_MENU_EXTMLD_MAX;
  2023.     }
  2024.     else    /* Empty slot, show replace only */
  2025.     {
  2026.         nStrItemList[0] = (U8*) GetString(StrIDToneAdd);
  2027.         nNumofItem = 1;
  2028.     }
  2029. EntryNewScreen(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY, NULL, EntryPrfSetPOnOffToneExtMelody, NULL);
  2030. guiBuffer = GetCurrGuiBuffer(MENU_TONE_SETUP_POWERON_OFF_TONE_EXT_MELODY);
  2031.     RegisterHighlightHandler(HighlightPrfSetPOnOffToneExtMelody);
  2032.     ShowCategory56Screen(
  2033.         StrIDTitle,
  2034.         (U16) (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING ? IMG_SCR_PBOOK_CAPTION : IMG_PROFILES_TITLEE),
  2035.         STR_GLOBAL_OK,
  2036.         IMG_GLOBAL_OK,
  2037.         STR_GLOBAL_BACK,
  2038.         IMG_GLOBAL_BACK,
  2039.         (S32) nNumofItem,
  2040.         nStrItemList,
  2041.         NULL,
  2042.         0,
  2043.         guiBuffer);
  2044.     SetLeftSoftkeyFunction(PrfSetPOnOffToneExtMelody, KEY_EVENT_UP);
  2045.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2046.     /* SetExitHandler (MENU_TONE_SETUP_RING_TONE_EXT_MELODY, ExitPrfSetRingToneExtMelody); */
  2047. }
  2048. /*****************************************************************************
  2049.  * FUNCTION
  2050.  *  PrfSetPOnOffToneConfType
  2051.  * DESCRIPTION
  2052.  *  
  2053.  * PARAMETERS
  2054.  *  type        [IN]        
  2055.  * RETURNS
  2056.  *  void
  2057.  *****************************************************************************/
  2058. void PrfSetPOnOffToneConfType(PRFSET_MELODY_CONF_TYPE type)
  2059. {
  2060.     /*----------------------------------------------------------------*/
  2061.     /* Local Variables                                                */
  2062.     /*----------------------------------------------------------------*/
  2063.     /*----------------------------------------------------------------*/
  2064.     /* Code Body                                                      */
  2065.     /*----------------------------------------------------------------*/
  2066.     prfset_conf_type = type;
  2067. }
  2068. /*****************************************************************************
  2069.  * FUNCTION
  2070.  *  ExitScrProfilesPoweronToneSetup
  2071.  * DESCRIPTION
  2072.  *  Exit profile Poweron ToneSetup Screen
  2073.  * PARAMETERS
  2074.  *  void
  2075.  * RETURNS
  2076.  *  voidgtotalGeneralToneId
  2077.  *****************************************************************************/
  2078. void ExitScrProfilesPoweronToneSetup(void)
  2079. {
  2080.     /*----------------------------------------------------------------*/
  2081.     /* Local Variables                                                */
  2082.     /*----------------------------------------------------------------*/
  2083.     /*----------------------------------------------------------------*/
  2084.     /* Code Body                                                      */
  2085.     /*----------------------------------------------------------------*/
  2086.     if (glastaudioId != POWERON_SILENT);
  2087.     StopToneAudio();
  2088. }
  2089. /*****************************************************************************
  2090.  * FUNCTION
  2091.  *  EntryScrSetRingToneId
  2092.  * DESCRIPTION
  2093.  *  Setting Ringtone ID.
  2094.  * PARAMETERS
  2095.  *  void
  2096.  * RETURNS
  2097.  *  void
  2098.  *****************************************************************************/
  2099. void EntryScrSetPowerOnToneId(void)
  2100. {
  2101.     /*----------------------------------------------------------------*/
  2102.     /* Local Variables                                                */
  2103.     /*----------------------------------------------------------------*/
  2104.     /*----------------------------------------------------------------*/
  2105.     /* Code Body                                                      */
  2106.     /*----------------------------------------------------------------*/
  2107.     EntryScrSetPowerOnToneIdCountId(EntryScrSetPowerOnToneId_Ext);
  2108. }
  2109. /*****************************************************************************
  2110.  * FUNCTION
  2111.  *  EntryScrSetRingToneIdCountId
  2112.  * DESCRIPTION
  2113.  *  Count Ringtone ID.
  2114.  * PARAMETERS
  2115.  *  Func_Callback       [IN]        
  2116.  * RETURNS
  2117.  *  void
  2118.  *****************************************************************************/
  2119. void EntryScrSetPowerOnToneIdCountId(void (*Func_Callback) (U8, U16))
  2120. {
  2121.     /*----------------------------------------------------------------*/
  2122.     /* Local Variables                                                */
  2123.     /*----------------------------------------------------------------*/
  2124.     U8 is_ext_melody = MMI_FALSE;
  2125.     U16 numOfItem = gtotalGeneralToneId + 1;
  2126.     U16 ring_id = 0;
  2127.     /*----------------------------------------------------------------*/
  2128.     /* Code Body                                                      */
  2129.     /*----------------------------------------------------------------*/
  2130.     if(0==gcurrHiliteIndexOne )
  2131.     {
  2132.        ring_id = MESSAGE_SILENT;
  2133.     }
  2134.     else if (gcurrHiliteIndexOne < numOfItem)
  2135.     {
  2136.         ring_id =gcurrHiliteIndexOne + gstartGeneralToneId - 1;
  2137.     }
  2138. #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  2139.     else if (gcurrHiliteIndexOne < numOfItem + MAXIMUM_EXT_MELODY_NUM)
  2140.     {
  2141.         g_pon_off_ext_melody_idx = (U8) (gcurrHiliteIndexOne - numOfItem);
  2142.         ring_id = (U16) g_pon_off_ext_melody_idx + PMG_EXT_PON_OFF_MELODY_BEGIN;
  2143.         is_ext_melody = MMI_TRUE;
  2144.     }
  2145. #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */ 
  2146.     else
  2147.     {
  2148.     #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  2149.         numOfItem += MAXIMUM_EXT_MELODY_NUM;
  2150.     #endif 
  2151.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  2152.         if (gcurrHiliteIndexOne == numOfItem)
  2153.         {
  2154.             DYNAUDIOINFO *download_theme_tones;
  2155.             if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
  2156.             {
  2157.                 ring_id = (U16) download_theme_tones[0].AudioId;
  2158.             }
  2159.             else
  2160.             {
  2161.                 ASSERT(0);
  2162.             }
  2163.         }
  2164.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  2165.     }
  2166.     Func_Callback(is_ext_melody, ring_id);
  2167. }
  2168. /*****************************************************************************
  2169.  * FUNCTION
  2170.  *  EntryScrSetRingToneId
  2171.  * DESCRIPTION
  2172.  *  Setting Ringtone ID.
  2173.  * PARAMETERS
  2174.  *  void
  2175.  * RETURNS
  2176.  *  void
  2177.  *****************************************************************************/
  2178. void EntryScrSetPowerOffToneId(void)
  2179. {
  2180.     /*----------------------------------------------------------------*/
  2181.     /* Local Variables                                                */
  2182.     /*----------------------------------------------------------------*/
  2183.     /*----------------------------------------------------------------*/
  2184.     /* Code Body                                                      */
  2185.     /*----------------------------------------------------------------*/
  2186.     EntryScrSetPowerOffToneIdCountId(EntryScrSetPowerOffToneId_Ext);
  2187. }
  2188. /*****************************************************************************
  2189.  * FUNCTION
  2190.  *  EntryScrSetRingToneIdCountId
  2191.  * DESCRIPTION
  2192.  *  Count Ringtone ID.
  2193.  * PARAMETERS
  2194.  *  Func_Callback       [IN]        
  2195.  * RETURNS
  2196.  *  void
  2197.  *****************************************************************************/
  2198. void EntryScrSetPowerOffToneIdCountId(void (*Func_Callback) (U8, U16))
  2199. {
  2200.     /*----------------------------------------------------------------*/
  2201.     /* Local Variables                                                */
  2202.     /*----------------------------------------------------------------*/
  2203.     U8 is_ext_melody = MMI_FALSE;
  2204.     U16 numOfItem = gtotalGeneralToneId + 1;
  2205.     U16 ring_id = 0;
  2206.     /*----------------------------------------------------------------*/
  2207.     /* Code Body                                                      */
  2208.     /*----------------------------------------------------------------*/
  2209.     if(0==gcurrHiliteIndexOne )
  2210.     {
  2211.        ring_id = MESSAGE_SILENT;
  2212.     }
  2213.     else if (gcurrHiliteIndexOne < numOfItem)
  2214.     {
  2215.         ring_id =gcurrHiliteIndexOne + gstartGeneralToneId - 1;
  2216.     }
  2217. #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  2218.     else if (gcurrHiliteIndexOne < numOfItem + MAXIMUM_EXT_MELODY_NUM)
  2219.     {
  2220.         g_pon_off_ext_melody_idx = (U8) (gcurrHiliteIndexOne - numOfItem);
  2221.         ring_id = (U16) g_pon_off_ext_melody_idx + PMG_EXT_PON_OFF_MELODY_BEGIN;
  2222.         is_ext_melody = MMI_TRUE;
  2223.     }
  2224. #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */ 
  2225.     else
  2226.     {
  2227.     #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
  2228.         numOfItem += MAXIMUM_EXT_MELODY_NUM;
  2229.     #endif 
  2230.     #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
  2231.         if (gcurrHiliteIndexOne == numOfItem)
  2232.         {
  2233.             DYNAUDIOINFO *download_theme_tones;
  2234.             if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
  2235.             {
  2236.                 ring_id = (U16) download_theme_tones[0].AudioId;
  2237.             }
  2238.             else
  2239.             {
  2240.                 ASSERT(0);
  2241.             }
  2242.         }
  2243.     #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */ 
  2244.     }
  2245.     Func_Callback(is_ext_melody, ring_id);
  2246. }
  2247. /*****************************************************************************
  2248.  * FUNCTION
  2249.  *  EntryScrSetRingToneId_Ext
  2250.  * DESCRIPTION
  2251.  *  Setting Ringtone ID.
  2252.  * PARAMETERS
  2253.  *  ExtMelodyFlag       [IN]        
  2254.  *  ringTone            [IN]        
  2255.  * RETURNS
  2256.  *  void
  2257.  *****************************************************************************/
  2258. void EntryScrSetPowerOnToneId_Ext(U8 ExtMelodyFlag, U16 ringTone)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     /*----------------------------------------------------------------*/
  2264.     /* Code Body                                                      */
  2265.     /*----------------------------------------------------------------*/
  2266. TONE_SETUP tone;
  2267. tone.powerOnTone = ringTone;
  2268. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  2269.     if (ExtMelodyFlag == MMI_TRUE)
  2270.     {
  2271.         prfset_conf_type = PRFSET_MELODY_TYPE_POWERON;
  2272.       PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  2273.         EntryPrfSetPOnOffToneExtMelody();
  2274.     }
  2275.     else
  2276. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  2277.     {
  2278.         DisplayPopup(
  2279.             (PU8) GetString(STR_GLOBAL_DONE),
  2280.             IMG_GLOBAL_ACTIVATED,
  2281.             1,
  2282.             UI_POPUP_NOTIFYDURATION_TIME,
  2283.             SUCCESS_TONE);
  2284.         SetPowerOnToneType(tone);
  2285.         DeleteScreenIfPresent(SCR_POWERON_TONE_SETUP);
  2286.     }
  2287. }
  2288. /*****************************************************************************
  2289.  * FUNCTION
  2290.  *  EntryScrSetRingToneId_Ext
  2291.  * DESCRIPTION
  2292.  *  Setting Ringtone ID.
  2293.  * PARAMETERS
  2294.  *  ExtMelodyFlag       [IN]        
  2295.  *  ringTone            [IN]        
  2296.  * RETURNS
  2297.  *  void
  2298.  *****************************************************************************/
  2299. void EntryScrSetPowerOffToneId_Ext(U8 ExtMelodyFlag, U16 ringTone)
  2300. {
  2301.     /*----------------------------------------------------------------*/
  2302.     /* Local Variables                                                */
  2303.     /*----------------------------------------------------------------*/
  2304.     /*----------------------------------------------------------------*/
  2305.     /* Code Body                                                      */
  2306.     /*----------------------------------------------------------------*/
  2307. TONE_SETUP tone;
  2308. tone.powerOffTone = ringTone;
  2309. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  2310.     if (ExtMelodyFlag == MMI_TRUE)
  2311.     {
  2312.         prfset_conf_type = PRFSET_MELODY_TYPE_POWEROFF;
  2313.       PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  2314.         EntryPrfSetPOnOffToneExtMelody();
  2315.     }
  2316.     else
  2317. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  2318.     {
  2319.         DisplayPopup(
  2320.             (PU8) GetString(STR_GLOBAL_DONE),
  2321.             IMG_GLOBAL_ACTIVATED,
  2322.             1,
  2323.             UI_POPUP_NOTIFYDURATION_TIME,
  2324.             SUCCESS_TONE);
  2325.         SetPowerOffToneType(tone);
  2326.         DeleteScreenIfPresent(SCR_POWEROFF_TONE_SETUP);
  2327.     }
  2328. }
  2329. /*****************************************************************************
  2330.  * FUNCTION
  2331.  *  EntryScrProfilesPoweroffToneSetup
  2332.  * DESCRIPTION
  2333.  *  Showing profile Poweroff Tone Setup Screen
  2334.  * PARAMETERS
  2335.  *  void
  2336.  * RETURNS
  2337.  *  void
  2338.  *****************************************************************************/
  2339. void EntryScrProfilesPoweroffToneSetup(void)
  2340. {
  2341.     /*----------------------------------------------------------------*/
  2342.     /* Local Variables                                                */
  2343.     /*----------------------------------------------------------------*/
  2344.     U16 nDispAttribute; /* Stores display attribue */
  2345.     U16 selecteditem = 0;
  2346.     U8 totalItems = 0;
  2347.     U8 *guiBuffer;              /* Buffer holding history data */
  2348.     /*----------------------------------------------------------------*/
  2349.     /* Code Body                                                      */
  2350.     /*----------------------------------------------------------------*/
  2351.     /* 1 Call Exit Handler */
  2352.     EntryNewScreen(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup, EntryScrProfilesPoweroffToneSetup, NULL);
  2353.     /* 2 Get current screen to gui buffer  for history purposes */
  2354.     guiBuffer = GetCurrGuiBuffer(SCR_POWEROFF_TONE_SETUP);
  2355.     
  2356.     /* 3. Retrieve no of child of menu item to be displayed */
  2357.    totalItems =mmi_profiles_get_POn_Off_tone_list((U16)gprofiles[gprofileId].toneSetup.powerOffTone, &selecteditem);
  2358.     /* 4. Get attribute of menu to be displayed */
  2359.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_POWEROFF_TONE);
  2360.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2361.     /* 6 Set current parent id */
  2362.     SetParentHandler(MENU_TONE_SETUP_POWEROFF_TONE);
  2363.     /* 7 Register highlight handler to be called in menu screen */
  2364.     RegisterHighlightHandler(mmi_profiles_POn_Off_tone_list_highlight_hdlr);
  2365.     /* 8 Display Category Screen */
  2366.     ShowCategory89Screen(
  2367.         STR_POWEROFF_TONE_SETUP_CAPTION,
  2368.         IMG_PROFILES_TITLEE,
  2369.         STR_GLOBAL_OK,
  2370.         IMG_GLOBAL_OK,
  2371.         STR_GLOBAL_BACK,
  2372.         IMG_GLOBAL_BACK,
  2373.         totalItems,
  2374.         subMenuDataPtrs,
  2375.         hintDataPtrs,
  2376.         0,
  2377.         selecteditem,
  2378.         guiBuffer);
  2379.     /* 9.Register function with right softkey */
  2380.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2381.     SetLeftSoftkeyFunction(EntryScrSetPowerOffToneId, KEY_EVENT_UP);
  2382.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2383.     /* SetExitHandler(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup); */
  2384. }
  2385. /*****************************************************************************
  2386.  * FUNCTION
  2387.  *  ExitScrProfilesPoweroffToneSetup
  2388.  * DESCRIPTION
  2389.  *  Exit profile Poweron ToneSetup Screen
  2390.  * PARAMETERS
  2391.  *  void
  2392.  * RETURNS
  2393.  *  void
  2394.  *****************************************************************************/
  2395. void ExitScrProfilesPoweroffToneSetup(void)
  2396. {
  2397.     /*----------------------------------------------------------------*/
  2398.     /* Local Variables                                                */
  2399.     /*----------------------------------------------------------------*/
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Code Body                                                      */
  2402.     /*----------------------------------------------------------------*/
  2403.     if (glastaudioId != POWERON_SILENT);
  2404.     StopToneAudio();
  2405. }
  2406. void StopExtPowerOnTone()
  2407. {
  2408. stopRequestedTone(POWER_ON_TONE);
  2409. }
  2410. #else 
  2411. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  2412. /*****************************************************************************
  2413.  * FUNCTION
  2414.  *  EntryScrProfilesPoweronToneSetup
  2415.  * DESCRIPTION
  2416.  *  Showing profile Poweron Tone Setup Screen
  2417.  * PARAMETERS
  2418.  *  void
  2419.  * RETURNS
  2420.  *  void
  2421.  *****************************************************************************/
  2422. void EntryScrProfilesPoweronToneSetup(void)
  2423. {
  2424.     /*----------------------------------------------------------------*/
  2425.     /* Local Variables                                                */
  2426.     /*----------------------------------------------------------------*/
  2427.     U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
  2428.     U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
  2429.     U16 nNumofItem;     /* Stores no of children in the submenu */
  2430.     U16 nDispAttribute; /* Stores display attribue */
  2431.     U8 *guiBuffer;      /* Buffer holding history data */
  2432.     U8 i = 0;
  2433.     POWERON_TONE_ENUM data = 0;
  2434.     /*----------------------------------------------------------------*/
  2435.     /* Code Body                                                      */
  2436.     /*----------------------------------------------------------------*/
  2437.     /* 1 Call Exit Handler */
  2438.     EntryNewScreen(SCR_POWERON_TONE_SETUP, ExitScrProfilesPoweronToneSetup, EntryScrProfilesPoweronToneSetup, NULL);
  2439.     /* 2 Get current screen to gui buffer  for history purposes */
  2440.     guiBuffer = GetCurrGuiBuffer(SCR_POWERON_TONE_SETUP);
  2441.     /* 3. Retrieve no of child of menu item to be displayed */
  2442.     /* nNumofItem = GetNumOfChild(MENU_TONE_SETUP_POWERON_TONE); */
  2443.     nNumofItem = gtotalGeneralToneId + 1;
  2444.     /* 4. Get attribute of menu to be displayed */
  2445.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_POWERON_TONE);
  2446.     memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
  2447.     pfnUnicodeStrncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
  2448.     for (i = 1; i <= gtotalGeneralToneId; i++)
  2449.     {
  2450.         S32 len = 0;
  2451.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  2452.         sprintf((PS8) AsciinStrItemList, "%d", i);
  2453.         AnsiiToUnicodeString((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
  2454.         len = pfnUnicodeStrlen((PS8) UnicodenStrItemList);
  2455.         len = MAX_SUBMENU_CHARACTERS - len;
  2456.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
  2457.         pfnUnicodeStrcat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
  2458.     }
  2459.     /* 6 Set current parent id */
  2460.     SetParentHandler(MENU_TONE_SETUP_POWERON_TONE);
  2461.     /* 7 Register highlight handler to be called in menu screen */
  2462.     RegisterHighlightHandler(GetCurrScreenHandlerfive);
  2463.     if (gprofiles[gprofileId].toneSetup.powerOnTone != POWERON_SILENT)
  2464.     {
  2465.         data = (gprofiles[gprofileId].toneSetup.powerOnTone - gstartGeneralToneId) + 1;
  2466.     }
  2467.     else
  2468.     {
  2469.         data = 0;
  2470.     }
  2471.     /* 8 Display Category Screen */
  2472.     ShowCategory89Screen(
  2473.         STR_POWERON_TONE_SETUP_CAPTION,
  2474.         IMG_PROFILES_TITLEE,
  2475.         STR_GLOBAL_OK,
  2476.         IMG_GLOBAL_OK,
  2477.         STR_GLOBAL_BACK,
  2478.         IMG_GLOBAL_BACK,
  2479.         nNumofItem,
  2480.         subMenuDataPtrs,
  2481.         NULL,
  2482.         0,
  2483.         (U16) data,
  2484.         guiBuffer);
  2485.     /* 9.Register function with right softkey */
  2486.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2487.     SetLeftSoftkeyFunction(EntryScrSetPoweronTone, KEY_EVENT_UP);
  2488.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2489.     /* SetExitHandler(SCR_POWERON_TONE_SETUP, ExitScrProfilesPoweronToneSetup); */
  2490. }
  2491. /*****************************************************************************
  2492.  * FUNCTION
  2493.  *  EntryScrSetPoweronTone
  2494.  * DESCRIPTION
  2495.  *  SetPoweronTone
  2496.  * PARAMETERS
  2497.  *  void
  2498.  * RETURNS
  2499.  *  void
  2500.  *****************************************************************************/
  2501. void EntryScrSetPoweronTone(void)
  2502. {
  2503.     /*----------------------------------------------------------------*/
  2504.     /* Local Variables                                                */
  2505.     /*----------------------------------------------------------------*/
  2506.     TONE_SETUP tonesetup;
  2507.     /*----------------------------------------------------------------*/
  2508.     /* Code Body                                                      */
  2509.     /*----------------------------------------------------------------*/
  2510.     if (gcurrHiliteIndexOne == 0)
  2511.     {
  2512.         tonesetup.powerOnTone = POWERON_SILENT;
  2513.     }
  2514.     else
  2515.     {
  2516.         tonesetup.powerOnTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
  2517.     }
  2518.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2519.     SetPowerOnToneType(tonesetup);
  2520.     DeleteScreenIfPresent(SCR_POWERON_TONE_SETUP);
  2521. }
  2522. /*****************************************************************************
  2523.  * FUNCTION
  2524.  *  ExitScrProfilesPoweronToneSetup
  2525.  * DESCRIPTION
  2526.  *  Exit profile Poweron ToneSetup Screen
  2527.  * PARAMETERS
  2528.  *  void
  2529.  * RETURNS
  2530.  *  void
  2531.  *****************************************************************************/
  2532. void ExitScrProfilesPoweronToneSetup(void)
  2533. {
  2534.     /*----------------------------------------------------------------*/
  2535.     /* Local Variables                                                */
  2536.     /*----------------------------------------------------------------*/
  2537.     /*----------------------------------------------------------------*/
  2538.     /* Code Body                                                      */
  2539.     /*----------------------------------------------------------------*/
  2540.     if (glastaudioId != POWERON_SILENT);
  2541.     StopToneAudio();
  2542. }
  2543. /*****************************************************************************
  2544.  * FUNCTION
  2545.  *  EntryScrProfilesPoweroffToneSetup
  2546.  * DESCRIPTION
  2547.  *  Showing profile Poweroff Tone Setup Screen
  2548.  * PARAMETERS
  2549.  *  void
  2550.  * RETURNS
  2551.  *  void
  2552.  *****************************************************************************/
  2553. void EntryScrProfilesPoweroffToneSetup(void)
  2554. {
  2555.     /*----------------------------------------------------------------*/
  2556.     /* Local Variables                                                */
  2557.     /*----------------------------------------------------------------*/
  2558.     U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
  2559.     U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
  2560.     U16 nNumofItem;             /* Stores no of children in the submenu */
  2561.     U16 nDispAttribute;         /* Stores display attribue */
  2562.     U8 *guiBuffer;              /* Buffer holding history data */
  2563.     U8 i = 0;
  2564.     POWEROFF_TONE_ENUM data = 0;
  2565.     /*----------------------------------------------------------------*/
  2566.     /* Code Body                                                      */
  2567.     /*----------------------------------------------------------------*/
  2568.     /* 1 Call Exit Handler */
  2569.     EntryNewScreen(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup, EntryScrProfilesPoweroffToneSetup, NULL);
  2570.     /* 2 Get current screen to gui buffer  for history purposes */
  2571.     guiBuffer = GetCurrGuiBuffer(SCR_POWEROFF_TONE_SETUP);
  2572.     /* 3. Retrieve no of child of menu item to be displayed */
  2573.     nNumofItem = gtotalGeneralToneId + 1;
  2574.     /* 4. Get attribute of menu to be displayed */
  2575.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_POWEROFF_TONE);
  2576.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2577.     memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
  2578.     pfnUnicodeStrncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
  2579.     for (i = 1; i <= gtotalGeneralToneId; i++)
  2580.     {
  2581.         S32 len = 0;
  2582.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  2583.         sprintf((PS8) AsciinStrItemList, "%d", i);
  2584.         AnsiiToUnicodeString((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
  2585.         len = pfnUnicodeStrlen((PS8) UnicodenStrItemList);
  2586.         len = MAX_SUBMENU_CHARACTERS - len;
  2587.         pfnUnicodeStrncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
  2588.         pfnUnicodeStrcat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
  2589.     }
  2590.     /* 6 Set current parent id */
  2591.     SetParentHandler(MENU_TONE_SETUP_POWEROFF_TONE);
  2592.     /* 7 Register highlight handler to be called in menu screen */
  2593.     RegisterHighlightHandler(GetCurrScreenHandlerfive);
  2594.     /* 8 Display Category Screen */
  2595.     if (gprofiles[gprofileId].toneSetup.powerOffTone != POWEROFF_SILENT)
  2596.     {
  2597.         data = (gprofiles[gprofileId].toneSetup.powerOffTone - gstartGeneralToneId) + 1;
  2598.     }
  2599.     else
  2600.     {
  2601.         data = 0;
  2602.     }
  2603.     ShowCategory89Screen(
  2604.         STR_POWEROFF_TONE_SETUP_CAPTION,
  2605.         IMG_PROFILES_TITLEE,
  2606.         STR_GLOBAL_OK,
  2607.         IMG_GLOBAL_OK,
  2608.         STR_GLOBAL_BACK,
  2609.         IMG_GLOBAL_BACK,
  2610.         nNumofItem,
  2611.         subMenuDataPtrs,
  2612.         NULL,
  2613.         0,
  2614.         (U16) data,
  2615.         guiBuffer);
  2616.     /* 9.Register function with right softkey */
  2617.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2618.     SetLeftSoftkeyFunction(EntryScrSetPoweroffTone, KEY_EVENT_UP);
  2619.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2620.     /* SetExitHandler(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup); */
  2621. }
  2622. /*****************************************************************************
  2623.  * FUNCTION
  2624.  *  EntryScrSetPoweroffTone
  2625.  * DESCRIPTION
  2626.  *  Set PowerOff Tone
  2627.  * PARAMETERS
  2628.  *  void
  2629.  * RETURNS
  2630.  *  void
  2631.  *****************************************************************************/
  2632. void EntryScrSetPoweroffTone(void)
  2633. {
  2634.     /*----------------------------------------------------------------*/
  2635.     /* Local Variables                                                */
  2636.     /*----------------------------------------------------------------*/
  2637.     TONE_SETUP tonesetup;
  2638.     /*----------------------------------------------------------------*/
  2639.     /* Code Body                                                      */
  2640.     /*----------------------------------------------------------------*/
  2641.     if (gcurrHiliteIndexOne == 0)
  2642.     {
  2643.         tonesetup.powerOffTone = POWEROFF_SILENT;
  2644.     }
  2645.     else
  2646.     {
  2647.         tonesetup.powerOffTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
  2648.     }
  2649.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  2650.     SetPowerOffToneType(tonesetup);
  2651.     DeleteScreenIfPresent(SCR_POWEROFF_TONE_SETUP);
  2652. }
  2653. /*****************************************************************************
  2654.  * FUNCTION
  2655.  *  ExitScrProfilesPoweroffToneSetup
  2656.  * DESCRIPTION
  2657.  *  Exit profile Poweron ToneSetup Screen
  2658.  * PARAMETERS
  2659.  *  void
  2660.  * RETURNS
  2661.  *  void
  2662.  *****************************************************************************/
  2663. void ExitScrProfilesPoweroffToneSetup(void)
  2664. {
  2665.     /*----------------------------------------------------------------*/
  2666.     /* Local Variables                                                */
  2667.     /*----------------------------------------------------------------*/
  2668.     /*----------------------------------------------------------------*/
  2669.     /* Code Body                                                      */
  2670.     /*----------------------------------------------------------------*/
  2671.     if (glastaudioId != POWERON_SILENT);
  2672.     StopToneAudio();
  2673. }
  2674. #endif     //KP Jerry add for changing the style of message tone list on 2007-4-10
  2675. /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  2676. #ifdef __MMI_CLAMSHELL__
  2677. /*****************************************************************************
  2678.  * FUNCTION
  2679.  *  HighlightProfilesCoverOpenToneSetup
  2680.  * DESCRIPTION
  2681.  *  Highlight profile Cover Open Setup menu item
  2682.  * PARAMETERS
  2683.  *  void
  2684.  * RETURNS
  2685.  *  void
  2686.  *****************************************************************************/
  2687. void HighlightProfilesCoverOpenToneSetup(void)
  2688. {
  2689.     /*----------------------------------------------------------------*/
  2690.     /* Local Variables                                                */
  2691.     /*----------------------------------------------------------------*/
  2692.     /*----------------------------------------------------------------*/
  2693.     /* Code Body                                                      */
  2694.     /*----------------------------------------------------------------*/
  2695.     /* 1 Change left soft key icon and label */
  2696.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  2697.     /* 2 Change right soft key icon and label */
  2698.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  2699.     /* 3 Register function for left soft key */
  2700.     SetLeftSoftkeyFunction(EntryScrProfilesCoverOpenToneSetup, KEY_EVENT_UP);
  2701.     /* 4 Register function for right soft key */
  2702.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2703.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2704.     SetKeyHandler(EntryScrProfilesCoverOpenToneSetup, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2705. }
  2706. /*****************************************************************************
  2707.  * FUNCTION
  2708.  *  HighlightProfilesCoverCloseToneSetup
  2709.  * DESCRIPTION
  2710.  *  Highlight profile Cover Close Setup menu item
  2711.  * PARAMETERS
  2712.  *  void
  2713.  * RETURNS
  2714.  *  void
  2715.  *****************************************************************************/
  2716. void HighlightProfilesCoverCloseToneSetup(void)
  2717. {
  2718.     /*----------------------------------------------------------------*/
  2719.     /* Local Variables                                                */
  2720.     /*----------------------------------------------------------------*/
  2721.     /*----------------------------------------------------------------*/
  2722.     /* Code Body                                                      */
  2723.     /*----------------------------------------------------------------*/
  2724.     /* 1 Change left soft key icon and label */
  2725.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  2726.     /* 2 Change right soft key icon and label */
  2727.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  2728.     /* 3 Register function for left soft key */
  2729.     SetLeftSoftkeyFunction(EntryScrProfilesCoverCloseToneSetup, KEY_EVENT_UP);
  2730.     /* 4 Register function for right soft key */
  2731.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2732.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2733.     SetKeyHandler(EntryScrProfilesCoverCloseToneSetup, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2734. }
  2735. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  2736. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  2737. /*****************************************************************************
  2738.  * FUNCTION
  2739.  *  EntryScrProfilesPoweroffToneSetup
  2740.  * DESCRIPTION
  2741.  *  Showing profile Poweroff Tone Setup Screen
  2742.  * PARAMETERS
  2743.  *  void
  2744.  * RETURNS
  2745.  *  void
  2746.  *****************************************************************************/
  2747. void EntryScrProfilesCoverOpenToneSetup(void)
  2748. {
  2749.     /*----------------------------------------------------------------*/
  2750.     /* Local Variables                                                */
  2751.     /*----------------------------------------------------------------*/
  2752.     U16 nDispAttribute; /* Stores display attribue */
  2753.     U16 selecteditem = 0;
  2754.     U8 totalItems = 0;
  2755.     U8 *guiBuffer;              /* Buffer holding history data */
  2756.     /*----------------------------------------------------------------*/
  2757.     /* Code Body                                                      */
  2758.     /*----------------------------------------------------------------*/
  2759.     /* 1 Call Exit Handler */
  2760.     EntryNewScreen(SCR_COVEROPEN_TONE_SETUP, ExitScrProfilesCoverOpenToneSetup, EntryScrProfilesCoverOpenToneSetup, NULL);
  2761.     /* 2 Get current screen to gui buffer  for history purposes */
  2762.     guiBuffer = GetCurrGuiBuffer(SCR_COVEROPEN_TONE_SETUP);
  2763.     
  2764.     /* 3. Retrieve no of child of menu item to be displayed */
  2765.    totalItems =mmi_profiles_get_POn_Off_tone_list((U16)gprofiles[gprofileId].toneSetup.coverOpenTone, &selecteditem);
  2766.     /* 4. Get attribute of menu to be displayed */
  2767.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_COVEROPEN_TONE);
  2768.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2769.     /* 6 Set current parent id */
  2770.     SetParentHandler(MENU_TONE_SETUP_COVEROPEN_TONE);
  2771.     /* 7 Register highlight handler to be called in menu screen */
  2772.     RegisterHighlightHandler(mmi_profiles_POn_Off_tone_list_highlight_hdlr);
  2773.     /* 8 Display Category Screen */
  2774.     ShowCategory89Screen(
  2775.         STR_COVEROPEN_TONE_CAPTION,
  2776.         IMG_PROFILES_TITLEE,
  2777.         STR_GLOBAL_OK,
  2778.         IMG_GLOBAL_OK,
  2779.         STR_GLOBAL_BACK,
  2780.         IMG_GLOBAL_BACK,
  2781.         totalItems,
  2782.         subMenuDataPtrs,
  2783.         hintDataPtrs,
  2784.         0,
  2785.         selecteditem,
  2786.         guiBuffer);
  2787.     /* 9.Register function with right softkey */
  2788.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2789.     SetLeftSoftkeyFunction(EntryScrSetCoverOpenToneId, KEY_EVENT_UP);
  2790.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2791.     /* SetExitHandler(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup); */
  2792. }
  2793. /*****************************************************************************
  2794.  * FUNCTION
  2795.  *  EntryScrSetRingToneId
  2796.  * DESCRIPTION
  2797.  *  Setting Ringtone ID.
  2798.  * PARAMETERS
  2799.  *  void
  2800.  * RETURNS
  2801.  *  void
  2802.  *****************************************************************************/
  2803. void EntryScrSetCoverOpenToneId(void)
  2804. {
  2805.     /*----------------------------------------------------------------*/
  2806.     /* Local Variables                                                */
  2807.     /*----------------------------------------------------------------*/
  2808.     /*----------------------------------------------------------------*/
  2809.     /* Code Body                                                      */
  2810.     /*----------------------------------------------------------------*/
  2811.     EntryScrSetPowerOffToneIdCountId(EntryScrSetCoverOpenToneId_Ext);
  2812. }
  2813. /*****************************************************************************
  2814.  * FUNCTION
  2815.  *  EntryScrSetCoverOpenToneId_Ext
  2816.  * DESCRIPTION
  2817.  *  Setting Ringtone ID.
  2818.  * PARAMETERS
  2819.  *  ExtMelodyFlag       [IN]        
  2820.  *  ringTone            [IN]        
  2821.  * RETURNS
  2822.  *  void
  2823.  *****************************************************************************/
  2824. void EntryScrSetCoverOpenToneId_Ext(U8 ExtMelodyFlag, U16 ringTone)
  2825. {
  2826.     /*----------------------------------------------------------------*/
  2827.     /* Local Variables                                                */
  2828.     /*----------------------------------------------------------------*/
  2829.     /*----------------------------------------------------------------*/
  2830.     /* Code Body                                                      */
  2831.     /*----------------------------------------------------------------*/
  2832. TONE_SETUP tone;
  2833. tone.coverOpenTone= ringTone;
  2834. #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
  2835.     if (ExtMelodyFlag == MMI_TRUE)
  2836.     {
  2837.         prfset_conf_type = PRFSET_MELODY_TYPE_COVEROPEN;
  2838.       PmgSetToneType( prfset_conf_type);    //Joey added for changing the MS tone style on 2007-4-05
  2839.         EntryPrfSetPOnOffToneExtMelody();
  2840.     }
  2841.     else
  2842. #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */ 
  2843.     {
  2844.         DisplayPopup(
  2845.             (PU8) GetString(STR_GLOBAL_DONE),
  2846.             IMG_GLOBAL_ACTIVATED,
  2847.             1,
  2848.             UI_POPUP_NOTIFYDURATION_TIME,
  2849.             SUCCESS_TONE);
  2850.         SetCoverOpenToneType(tone);
  2851.         DeleteScreenIfPresent(SCR_COVEROPEN_TONE_SETUP);
  2852.     }
  2853. }
  2854. /*****************************************************************************
  2855.  * FUNCTION
  2856.  *  EntryScrProfilesPoweroffToneSetup
  2857.  * DESCRIPTION
  2858.  *  Showing profile Poweroff Tone Setup Screen
  2859.  * PARAMETERS
  2860.  *  void
  2861.  * RETURNS
  2862.  *  void
  2863.  *****************************************************************************/
  2864. void EntryScrProfilesCoverCloseToneSetup(void)
  2865. {
  2866.     /*----------------------------------------------------------------*/
  2867.     /* Local Variables                                                */
  2868.     /*----------------------------------------------------------------*/
  2869.     U16 nDispAttribute; /* Stores display attribue */
  2870.     U16 selecteditem = 0;
  2871.     U8 totalItems = 0;
  2872.     U8 *guiBuffer;              /* Buffer holding history data */
  2873.     /*----------------------------------------------------------------*/
  2874.     /* Code Body                                                      */
  2875.     /*----------------------------------------------------------------*/
  2876.     /* 1 Call Exit Handler */
  2877.     EntryNewScreen(SCR_COVERCLOSE_TONE_SETUP, ExitScrProfilesCoverCloseToneSetup, EntryScrProfilesCoverCloseToneSetup, NULL);
  2878.     /* 2 Get current screen to gui buffer  for history purposes */
  2879.     guiBuffer = GetCurrGuiBuffer(SCR_COVERCLOSE_TONE_SETUP);
  2880.     
  2881.     /* 3. Retrieve no of child of menu item to be displayed */
  2882.    totalItems =mmi_profiles_get_POn_Off_tone_list((U16)gprofiles[gprofileId].toneSetup.coverCloseTone, &selecteditem);
  2883.     /* 4. Get attribute of menu to be displayed */
  2884.     nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_COVERCLOSE_TONE);
  2885.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  2886.     /* 6 Set current parent id */
  2887.     SetParentHandler(MENU_TONE_SETUP_COVERCLOSE_TONE);
  2888.     /* 7 Register highlight handler to be called in menu screen */
  2889.     RegisterHighlightHandler(mmi_profiles_POn_Off_tone_list_highlight_hdlr);
  2890.     /* 8 Display Category Screen */
  2891.     ShowCategory89Screen(
  2892.         STR_COVERCLOSE_TONE_CAPTION,
  2893.         IMG_PROFILES_TITLEE,
  2894.         STR_GLOBAL_OK,
  2895.         IMG_GLOBAL_OK,
  2896.         STR_GLOBAL_BACK,
  2897.         IMG_GLOBAL_BACK,
  2898.         totalItems,
  2899.         subMenuDataPtrs,
  2900.         hintDataPtrs,
  2901.         0,
  2902.         selecteditem,
  2903.         guiBuffer);
  2904.     /* 9.Register function with right softkey */
  2905.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2906.     SetLeftSoftkeyFunction(EntryScrSetCoverCloseToneId, KEY_EVENT_UP);
  2907.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2908.     /* SetExitHandler(SCR_POWEROFF_TONE_SETUP, ExitScrProfilesPoweroffToneSetup); */
  2909. }
  2910. /*****************************************************************************
  2911.  * FUNCTION
  2912.  *  EntryScrSetCoverCloseToneId
  2913.  * DESCRIPTION