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

MTK

开发平台:

C/C++

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