MTK信息铃声

来源:互联网 发布:大恒相机软件 编辑:程序博客网 时间:2024/04/28 20:52

#ifdef __CKT_EXTMEM_MSGTONE__
extern U8 msg_tone_played;
extern U8 Card2_msg_tong_played;
extern void stopRequestedTone(ALL_TONE_ENUM playtone);
#endif
KeyBrd.c

static void exec_key_handler(mmi_key_evt_struct *evt_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 ucs2_value = 0;
    U32 special_key_flag = 0;
    FuncPtr curr_func_ptr;

//add by liumoujun at 2010.01.05
#ifdef __CKT_EXTMEM_MSGTONE__ //modified by heshenning 2008/12/19
  if(msg_tone_played)
  {
        msg_tone_played = 0;
        stopRequestedTone(MESSAGE_TONE);
  }
 #endif//end liguang

ProfilesDefs.h

typedef enum
{
    PRFSET_MELODY_TYPE_UNKNOW,
    PRFSET_MELODY_TYPE_RING,
    PRFSET_MELODY_TYPE_CARD2_RING,
    PRFSET_MELODY_TYPE_ALARM,
    PRFSET_MELODY_TYPE_PHB_RING,
    PRFSET_MELODY_TYPE_ENGINEERMODE,
    PRFSET_MELODY_TYPE_VIDEO_CALL,
#if defined(__CKT_EXTMEM_MSGTONE__)
    PRFSET_MELODY_TYPE_MSG_TONE,
    PRFSET_MELODY_TYPE_CARD2_MSG_TONE, //added by heshenning 2008/12/22
#endif /* __CKT_EXTMEM_MSGTONE__ */
    PRFSET_MELODY_TYPE_MAX
} PRFSET_MELODY_CONF_TYPE;

 

#ifdef __CKT_EXTMEM_MSGTONE__
//liguang for msg tone
U8 msg_tone_played = 0;
U8 Card2_msg_tong_played = 0;
#define MAX_EXT_RING_DELAY_TIME (30000)
void StopExtRingTimerHandler(void)
{
 stopRequestedTone(MESSAGE_TONE);
 msg_tone_played = 0;
}
//end liguang
#endif
SettingProf.c

#ifdef __CKT_EXTMEM_MSGTONE__
//liguang for msg tone
U8 msg_tone_played = 0;
U8 Card2_msg_tong_played = 0;
#define MAX_EXT_RING_DELAY_TIME (30000)
void StopExtRingTimerHandler(void)
{
 stopRequestedTone(MESSAGE_TONE);
 msg_tone_played = 0;
}
//end liguang
#endif
void playRequestedTone(ALL_TONE_ENUM playtone)

 case MESSAGE_TONE:
            {               
  #ifdef __CKT_EXTMEM_MSGTONE__  
  msg_tone_played = 1; //play message tone 
  #endif

  case CARD2_MESSAGE_TONE:
            {
  #ifdef __CKT_EXTMEM_MSGTONE__  
  Card2_msg_tong_played = 1; //play message tone 
  #endif

void UpdateDeleteExtMldToneSetup(U16 ToneId)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i, dirtyFlag = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Update alarm ring tone list */
#if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_ALM_CUSTOMIZE_TONE__)
    mmi_alm_tone_setup_delete_ext_melody(ToneId);
#endif

    for (i = 0; i < MAX_ELEMENTS; i++)
    {
        if (gprofiles[i].toneSetup.ringTone == ToneId)
        {
            gprofiles[i].toneSetup.ringTone = gstartMidiId;
            dirtyFlag = 1;
        }
    #ifdef __MMI_VIDEO_TELEPHONY__
        if(gprofiles[i].toneSetup.videoCallTone== ToneId)
        {
            gprofiles[i].toneSetup.ringTone = gstartMidiId + 1;
            dirtyFlag = 1;
        }
    #endif /*__MMI_VIDEO_TELEPHONY__*/
        if (gprofiles[i].toneSetup.alarmTone == ToneId)
        {
            gprofiles[i].toneSetup.alarmTone = gstartMidiId + 2;
            dirtyFlag = 1;
        }
#ifdef __MMI_DUAL_PROFILE_SUPPORT__
 if(gprofiles[i].toneSetup.card2_ringTone==ToneId)
        {
             gprofiles[i].toneSetup.card2_ringTone = gstartMidiId;
             dirtyFlag = 1;
        }
#endif /*__MMI_DUAL_PROFILE_SUPPORT__*/
    #if defined(__CKT_EXTMEM_MSGTONE__)
        if (gprofiles[i].toneSetup.messageTone == ToneId)
        {
            gprofiles[i].toneSetup.messageTone = gstartMiscToneId;
        }
 //added by heshenning 2008/12/22
#ifdef __MMI_DUAL_PROFILE_SUPPORT__
 if(gprofiles[i].toneSetup.card2_messageTone==ToneId)
        {
             gprofiles[i].toneSetup.card2_messageTone = gstartMidiId;
             dirtyFlag = 1;
        }
#endif /*__MMI_DUAL_PROFILE_SUPPORT__*/
 //added end
    #endif /* __CKT_EXTMEM_MSGTONE__ */

    }

    if (gactivatedprofile == gprofileId)
    {
        memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(mmi_profiles_cntx_struct));
    }

    mmi_profiles_Ext_melody_delete_menu_screen(ToneId);

    if (dirtyFlag == 1)
    {
        if(!mmi_profiles_write_cntx_to_nvram())
        {
            MMI_TRACE(MMI_MEDIA_TRC_G3_APP_DETAIL,MMI_USER_PROF_ERR_UPDTAE_DELETE_EXTMLD);
            return;
        }
    }

}
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */

 

 

*  *****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 * SettingScreenProf.c
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This file is intends for Screens for Profiles application
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 *
 *
 * removed!
 * removed!
 *
 *
 * removed!
 * removed!
 *
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/**
 * Copyright Notice
 * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
 * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
 *  (It is illegal to remove this copyright notice from this software or any
 *  portion of it)
 */
/***************** Settings Application implementation *********************/

/**************************************************************

   FILENAME : SettingScreenProf.c

   PURPOSE     : Screens for Profiles application

   REMARKS     : nil

   AUTHOR      : Ashima Bajaj,Deepali Gupta

   DATE     : 5/5/2003

**************************************************************/
#include "MMI_include.h"

#include "MainMenuDef.h"
#include "settingdefs.h"
#include "settingprot.h"
#include "HardwareEvents.h"
#include "Thrdosinterface.h"
#include "OSThreadInterfaceGprot.h"
#include "settinggprots.h"
#include "ProtocolEvents.h"
#include "SettingProfile.h"
#include "Profiles_prot.h"
#include "UserProfilesResDef.h"
#include "ProfilesGdcl.h"
#include "ProfileGprots.h"
#include "GpioInc.h"
#include "VolumeHandler.h"
#include "wgui_status_icons.h"

#include "CommonScreens.h"
#include "IdleAppProt.h"
#include "IdleAppDef.h"
#include "ATHandlerProt.h"
#include "USBDeviceGprot.h"
#include "ExtDeviceDefs.h"
#include "SimDetectionGprot.h"
#include "SimDetectionGexdcl.h"
#include "ProfilesDefs.h"


#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
#include "mmi_imps_gprot.h"
#endif

/* Leo add for DLT */
/* Leo end */

#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
#include "FileMgr.h"
#include "FileManagerDef.h"
#include "FileManagerGProt.h"
#include "Conversions.h"
#include "ProfileMgr.h" /* Profile Magager General Include file */
#include "ProfileMgrGProt.h"    /* Profile Magager Extern Include file */
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
#include "phonebookdef.h"

#include "mdi_datatype.h"
#include "mdi_audio.h"
#include "CallManagementGprot.h"

#ifdef __DRM_SUPPORT__
#include "FileMgr.h"
#include "Drm_gprot.h"
#endif /* __DRM_SUPPORT__ */

#include "custom_equipment.h"

#if defined(__EM_MODE__) && defined (__MMI_ENGINEER_MODE__)
#include "EngineerModeDef.h"
#include "EngineerModeTracer.h"
#endif /* defined(__EM_MODE__) && defined (__MMI_ENGINEER_MODE__) */

#ifdef __MMI_BACKGROUND_CALL__
#include "UCMGProt.h"
#endif

/*for MTPNP data type*/
#ifdef __MMI_DUAL_PROFILE_SUPPORT__
#include "MTPNP_SDK_common_if.h"
#endif

/* Leo add for DLT */
#include "MMIThemes.h"  /* ritesh */
/* Leo end */
/* PMT SUKRIT START 20051226 */
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
#include "MessagesExDcl.h"
S32 default_value_ring_volume;
S32 default_value_keypad_volume;
S32 is_level_select_menuitem_displayed_in_volume_screen = 1;
S32 default_value_ring_volume;
S32 default_value_keypad_volume;
S32 ring_volume_index = -1;
S32 keypad_volume_index = -1;
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
/* PMT SUKRIT END 20051226 */

void (*gfnprofilelsk) (void);
void (*gfnprofilersk) (void);

extern void EntryScrSetKeyPadVolumeLevel(void);
extern void GetRingToneRange(U8 *startId, U8 *totalId);
extern void GetMidiRange(U8 *startId, U8 *totalId);
extern void GetToneRange(U8 *startId, U8 *totalId);
extern S32 volume_level_UI;

#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
static PRFSET_MELODY_CONF_TYPE prfset_conf_type = PRFSET_MELODY_TYPE_UNKNOW;
static U8 g_ext_melody_idx = 0;
static U8 extMldHlitItem = 0;
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */

#if defined(__MMI_PHB_CALLER_RES_SETTING__)
extern void mmi_phb_caller_ring_forward_to_entry(U16 ringToneId);
#endif

#ifdef __MMI_BT_PROFILE__
void mmi_profiles_bt_open_stream_callback(U8 profile, mdi_result result, U16 error_cause);
void mmi_profiles_bt_close_stream_callback(U8 profile, mdi_result result, U16 error_cause);
#endif /* __MMI_BT_PROFILE__*/

#ifdef __USB_IN_NORMAL_MODE__
extern pBOOL mmi_usb_is_in_mass_storage_mode(void);
extern void mmi_usb_app_unavailable_popup(U16 stringId);
#endif

#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
extern S8 *GetAudioNameWithPathInFileSystem(U16 AudioId, PS8 AudioData);
#endif

static BOOL ring_tone_playing = FALSE;
static mmi_frm_kbd_tone_state_enum key_tone_state;

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_tone_playing
 * DESCRIPTION
 *  set ring tone playing flag
 * 
 *  used for AudioPlayToneWithCallBackVolPath
 * PARAMETERS
 *  is_playing      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_tone_playing(BOOL is_playing)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ring_tone_playing = is_playing;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_is_ring_tone_playing
 * DESCRIPTION
 *  check does ring tone is playing
 * 
 *  used for AudioPlayToneWithCallBackVolPath
 * PARAMETERS
 *  void
 * RETURNS
 * BOOL
 *****************************************************************************/
BOOL mmi_profiles_is_ring_tone_playing(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return ring_tone_playing;
}

#if defined(__DRM_SUPPORT__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_check_DRM_content_forwardable
 * DESCRIPTION
 *  check does the file is DRM prohibted to forward
 * PARAMETERS
 *  filename        [IN]       
 * RETURNS
 * S32
 *****************************************************************************/
S32 mmi_profiles_check_DRM_content_forwardable(UI_string_type filename)
{

    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE handle;
    S32 result = 0 ;
   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    handle = DRM_open_file((PU16)filename, FS_READ_ONLY, DRM_PERMISSION_PLAY);

    if (handle >= FS_NO_ERROR)
    {
        BOOL is_permitted = DRM_validate_forward_rule(handle, DRM_PERMISSION_PLAY);
        if(is_permitted)
        {
           result = 1 ;
        }
        DRM_close_file(handle);
    }
    else
    {
        return handle;
    }

    return result ;

}
#endif /* defined(__DRM_SUPPORT__) */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_is_device_profile
 * DESCRIPTION
 *  check does the selected or activated profile a device profile which can't be activated manually
 * PARAMETERS
 *  void
 *  BOOL(?)     [OUT]      
 * RETURNS
 *  void
 *****************************************************************************/
BOOL mmi_profiles_is_device_profile(void)
{
#ifdef __MMI_BT_PROFILE__
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1) || (gprofileId == MMI_PROFILE_BT) ||
        (gactivatedprofile == MMI_PROFILE_BT))
    {
        return TRUE;
    }
#else /* __MMI_BT_PROFILE__ */
    if ((gprofileId == MMI_PROFILE_HEADSET) || (gprofileheadset == 1))
    {
        return TRUE;
    }
#endif /* __MMI_BT_PROFILE__ */
    return FALSE;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_read_cntx_from_nvram
 * DESCRIPTION
 *  read profile context from nvram and assign to correspongding variables
 * PARAMETERS
 *  void
 *  num     [IN]    to indicate which LID number to be read
 * RETURNS
 *  MMI_BOOL        [OUT]
 *****************************************************************************/
MMI_BOOL mmi_profiles_read_cntx_from_nvram(U8 num)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    PROFILE* temp_profile;
    S16 error;
    U16 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(num<2);

    temp_profile = get_ctrl_buffer(NVRAM_PROFILES_RECORD_SIZE);
    if (ReadRecord(
            NVRAM_EF_PROFILES_LID,
            num,
            temp_profile,
            NVRAM_PROFILES_RECORD_SIZE,
            &error) < NVRAM_PROFILES_RECORD_SIZE)
    {

        MMI_TRACE(MMI_MEDIA_TRC_G3_APP_DETAIL,MMI_USER_PROF_ERR_READ_NVRAM,error);
        free_ctrl_buffer(temp_profile);
        return MMI_FALSE;
    }

    for(i=0;i<MAX_ELEMENTS;i++)
    {
        gprofiles[i].ringVolumeLevel = temp_profile[i].ringVolumeLevel;
        gprofiles[i].keypadVolumeLevel = temp_profile[i].keypadVolumeLevel;
        gprofiles[i].loudSpeakerVolumeLevel = temp_profile[i].loudSpeakerVolumeLevel;
        gprofiles[i].mtCallAlertTypeEnum = temp_profile[i].mtCallAlertTypeEnum;
        gprofiles[i].light.status = temp_profile[i].light.status;
    #ifdef LCDBACKLIGHT
        gprofiles[i].light.lcdBacklight = temp_profile[i].light.lcdBacklight;
    #endif
        gprofiles[i].light.timer = temp_profile[i].light.timer;
    #if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)   
        gprofiles[i].impsStatus = temp_profile[i].impsStatus;
    #endif
        gprofiles[i].ringTypeEnum = temp_profile[i].ringTypeEnum;

        gprofiles[i].toneSetup.ringTone = temp_profile[i].toneSetup.ringTone;
    #ifdef __MMI_VIDEO_TELEPHONY__
        gprofiles[i].toneSetup.videoCallTone = temp_profile[i].toneSetup.videoCallTone;
    #endif
    #if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
        gprofiles[i].toneSetup.IMPSChatroomNotificationTone = temp_profile[i].toneSetup.IMPSChatroomNotificationTone;
        gprofiles[i].toneSetup.IMPSContactOnlineTone = temp_profile[i].toneSetup.IMPSContactOnlineTone;
        gprofiles[i].toneSetup.IMPSNewInvitationTone = temp_profile[i].toneSetup.IMPSNewInvitationTone;
        gprofiles[i].toneSetup.IMPSNewMessageTone = temp_profile[i].toneSetup.IMPSNewMessageTone;
    #endif
    #ifndef __MMI_POWER_ON_OFF_MUTE__
        gprofiles[i].toneSetup.powerOffTone = temp_profile[i].toneSetup.powerOffTone;
        gprofiles[i].toneSetup.powerOnTone = temp_profile[i].toneSetup.powerOnTone;
    #endif
    #ifdef __MMI_CLAMSHELL__
        gprofiles[i].toneSetup.coverOpenTone = temp_profile[i].toneSetup.coverOpenTone;
        gprofiles[i].toneSetup.coverCloseTone = temp_profile[i].toneSetup.coverCloseTone;
    #endif
    #ifndef __MMI_PROF_SPLIT_MSG_TONES__
        gprofiles[i].toneSetup.messageTone = temp_profile[i].toneSetup.messageTone;
    #else
        #ifdef MMS_SUPPORT
        gprofiles[i].toneSetup.mmsTone = temp_profile[i].toneSetup.mmsTone;
        #endif
        gprofiles[i].toneSetup.smsTone = temp_profile[i].toneSetup.smsTone;
        #ifdef __MMI_EMAIL__
        gprofiles[i].toneSetup.emailTone = temp_profile[i].toneSetup.emailTone;
        #endif
        #ifdef __MMI_OP11_MMS_SUPPORT_AUDIO_MSG__
/* under construction !*/
        #endif
    #endif /*__MMI_PROF_SPLIT_MSG_TONES__*/
        gprofiles[i].toneSetup.keypadTone = temp_profile[i].toneSetup.keypadTone;
        gprofiles[i].toneSetup.alarmTone = temp_profile[i].toneSetup.alarmTone;
    #ifdef __MMI_DUAL_PROFILE_SUPPORT__   
        gprofiles[i].toneSetup.card2_ringTone = temp_profile[i].toneSetup.card2_ringTone;
        gprofiles[i].toneSetup.card2_messageTone = temp_profile[i].toneSetup.card2_messageTone;
    #endif   

    #ifdef __MMI_CLAMSHELL__
        gprofiles[i].answeringMode.coverAnswer = temp_profile[i].answeringMode.coverAnswer;
    #endif
        gprofiles[i].answeringMode.anyKey = temp_profile[i].answeringMode.anyKey;
        gprofiles[i].answeringMode.automatic = temp_profile[i].answeringMode.automatic;
        gprofiles[i].fontSizeEnum = temp_profile[i].fontSizeEnum;
        gprofiles[i].intelligentCallAlert = temp_profile[i].intelligentCallAlert;

        gprofiles[i].extraTone.errorTone = temp_profile[i].extraTone.errorTone;
        gprofiles[i].extraTone.connectTone = temp_profile[i].extraTone.connectTone;
        gprofiles[i].extraTone.campOnTone = temp_profile[i].extraTone.campOnTone;
        gprofiles[i].extraTone.warningTone = temp_profile[i].extraTone.warningTone;
    }

    free_ctrl_buffer(temp_profile);

    return MMI_TRUE;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_write_cntx_to_nvram
 * DESCRIPTION
 *  write profile context from nvram and assign to correspongding variables
 * PARAMETERS
 *  void
 *  MMI_BOOL        [OUT]
 * RETURNS
 *  void
 *****************************************************************************/
MMI_BOOL mmi_profiles_write_cntx_to_nvram(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    PROFILE* temp_profile;
    S16 error;
    U16 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    temp_profile = get_ctrl_buffer(NVRAM_PROFILES_RECORD_SIZE);

    for(i=0;i<MAX_ELEMENTS;i++)
    {
        temp_profile[i].ringVolumeLevel = gprofiles[i].ringVolumeLevel;
        temp_profile[i].keypadVolumeLevel = gprofiles[i].keypadVolumeLevel;
        temp_profile[i].loudSpeakerVolumeLevel = gprofiles[i].loudSpeakerVolumeLevel;
        temp_profile[i].mtCallAlertTypeEnum = gprofiles[i].mtCallAlertTypeEnum;
        temp_profile[i].light.status = gprofiles[i].light.status;
#ifdef LCDBACKLIGHT
        temp_profile[i].light.lcdBacklight = gprofiles[i].light.lcdBacklight;
#endif
        temp_profile[i].light.timer = gprofiles[i].light.timer;
#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)   
        temp_profile[i].impsStatus = gprofiles[i].impsStatus;
#endif
        temp_profile[i].ringTypeEnum = gprofiles[i].ringTypeEnum;

        temp_profile[i].toneSetup.ringTone = gprofiles[i].toneSetup.ringTone;
#ifdef __MMI_VIDEO_TELEPHONY__
        temp_profile[i].toneSetup.videoCallTone = gprofiles[i].toneSetup.videoCallTone;
#endif
#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
        temp_profile[i].toneSetup.IMPSChatroomNotificationTone = gprofiles[i].toneSetup.IMPSChatroomNotificationTone;
        temp_profile[i].toneSetup.IMPSContactOnlineTone = gprofiles[i].toneSetup.IMPSContactOnlineTone;
        temp_profile[i].toneSetup.IMPSNewInvitationTone = gprofiles[i].toneSetup.IMPSNewInvitationTone;
        temp_profile[i].toneSetup.IMPSNewMessageTone = gprofiles[i].toneSetup.IMPSNewMessageTone;
#endif
#ifndef __MMI_POWER_ON_OFF_MUTE__
        temp_profile[i].toneSetup.powerOffTone = gprofiles[i].toneSetup.powerOffTone;
        temp_profile[i].toneSetup.powerOnTone = gprofiles[i].toneSetup.powerOnTone;
#endif
#ifdef __MMI_CLAMSHELL__
        temp_profile[i].toneSetup.coverOpenTone = gprofiles[i].toneSetup.coverOpenTone;
        temp_profile[i].toneSetup.coverCloseTone = gprofiles[i].toneSetup.coverCloseTone;
#endif
#ifndef __MMI_PROF_SPLIT_MSG_TONES__
        temp_profile[i].toneSetup.messageTone = gprofiles[i].toneSetup.messageTone;
#else
    #ifdef MMS_SUPPORT
        temp_profile[i].toneSetup.mmsTone = gprofiles[i].toneSetup.mmsTone;
    #endif
        temp_profile[i].toneSetup.smsTone = gprofiles[i].toneSetup.smsTone;
    #ifdef __MMI_EMAIL__
        temp_profile[i].toneSetup.emailTone = gprofiles[i].toneSetup.emailTone;
    #endif
    #ifdef __MMI_OP11_MMS_SUPPORT_AUDIO_MSG__
/* under construction !*/
    #endif
#endif /*__MMI_PROF_SPLIT_MSG_TONES__*/
        temp_profile[i].toneSetup.keypadTone = gprofiles[i].toneSetup.keypadTone;
        temp_profile[i].toneSetup.alarmTone = gprofiles[i].toneSetup.alarmTone;
#ifdef __MMI_DUAL_PROFILE_SUPPORT__   
        temp_profile[i].toneSetup.card2_ringTone = gprofiles[i].toneSetup.card2_ringTone;
        temp_profile[i].toneSetup.card2_messageTone = gprofiles[i].toneSetup.card2_messageTone;
#endif   

#ifdef __MMI_CLAMSHELL__
        temp_profile[i].answeringMode.coverAnswer = gprofiles[i].answeringMode.coverAnswer;
#endif
        temp_profile[i].answeringMode.anyKey = gprofiles[i].answeringMode.anyKey;
        temp_profile[i].answeringMode.automatic = gprofiles[i].answeringMode.automatic;
        temp_profile[i].fontSizeEnum = gprofiles[i].fontSizeEnum;
        temp_profile[i].intelligentCallAlert = gprofiles[i].intelligentCallAlert;

        temp_profile[i].extraTone.errorTone = gprofiles[i].extraTone.errorTone;
        temp_profile[i].extraTone.connectTone = gprofiles[i].extraTone.connectTone;
        temp_profile[i].extraTone.campOnTone = gprofiles[i].extraTone.campOnTone;
        temp_profile[i].extraTone.warningTone = gprofiles[i].extraTone.warningTone;
    }

    if(WriteRecord(
        NVRAM_EF_PROFILES_LID,
        1,
        temp_profile,
        NVRAM_PROFILES_RECORD_SIZE,
        &error) <NVRAM_PROFILES_RECORD_SIZE)
    {
        MMI_TRACE(MMI_MEDIA_TRC_G3_APP_DETAIL,MMI_USER_PROF_ERR_WRITE_NVRAM,error);
        free_ctrl_buffer(temp_profile);
        return MMI_FALSE;
    }

    free_ctrl_buffer(temp_profile);
    return MMI_TRUE;

}


/*****************************************************************************
 * FUNCTION
 *  InitProfileApp
 * DESCRIPTION
 *  Initialize Profile Application
 * PARAMETERS
 *  void
 *  S16(?)      [OUT]      
 * RETURNS
 *  void
 *****************************************************************************/
S16 InitProfileApp(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gprofilenvram == 0)
    {
        initializeProfiles();
        ActivatefirstProfile();
    #ifndef USE_NVRAM_FOR_PROFILES
        gprofilenvram = 1 ;
    #endif
    }

#ifdef __MMI_BT_PROFILE__
#ifdef __MMI_HFP_SUPPORT__
        mdi_audio_bt_init(BT_HFP, mmi_profiles_bt_open_stream_callback, mmi_profiles_bt_close_stream_callback);
#endif
#endif /* __MMI_BT_PROFILE__ */

    return 0;
}


/*****************************************************************************
 * FUNCTION
 *  initnvramprofapp
 * DESCRIPTION
 *  Initialize NVRAM for Profile
 * PARAMETERS
 *  void
 *  S16(?)      [OUT]      
 * RETURNS
 *  void
 *****************************************************************************/
void initnvramprofapp(void)
{
#ifdef USE_NVRAM_FOR_PROFILES
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gprofilenvram = 1;
    mmi_profiles_read_cntx_from_nvram(1);
    ReadValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
    ReadValue(NVRAM_PROFILES_LASTACTIVATED, &glastactivatedprofile, DS_BYTE, &error);
#endif /* USE_NVRAM_FOR_PROFILES */
    if( mmi_gpio_is_earphone_plug_in() )
        mmi_profiles_headset_activate_profile();
    else
    {
        ActivateProfile();
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_main_screen
 * DESCRIPTION
 *  Entry function for main profile screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_main_screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U16 gimagearray2[MAX_SUB_MENUS];    /* array for profilenames */
    U8 i = 0, data = 0;
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U16 ItemIcons[MAX_SUB_MENUS];
    static U8 prev_data = 0;
    U16 menu_id = 0;
    MMI_BOOL profile_changed = MMI_FALSE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE(MMI_MEDIA_TRC_G2_APP,MMI_USER_PROF_TRC_ENTRY_PROFILE);

    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES, mmi_profiles_exit_main_screen, mmi_profiles_entry_main_screen, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES);

/****** Get the index of activated profile menu ID*****/
    switch (gactivatedprofile)
    {
        case MMI_PROFILE_GENERAL:
            menu_id = MAIN_MENU_PROFILES_GENERAL;
            break;
        case MMI_PROFILE_MEETING:
            menu_id = MAIN_MENU_PROFILES_MEETING;
            break;
        case MMI_PROFILE_OUTDOOR:
            menu_id = MAIN_MENU_PROFILES_OUTDOOR;
            break;
        case MMI_PROFILE_INDOOR:
            menu_id = MAIN_MENU_PROFILES_INDOOR;
            break;
        case MMI_PROFILE_SILENT:
#ifdef __MMI_PROF_SHOW_SILENT_PROFILE__
            menu_id = MAIN_MENU_PROFILES_SILENT;
#else
            data = 0;           
#endif
            break;
        case MMI_PROFILE_HEADSET:
            menu_id = MAIN_MENU_PROFILES_HEADSET;
            break;
    #ifdef __MMI_BT_PROFILE__
        case MMI_PROFILE_BT:
            menu_id = MAIN_MENU_PROFILES_BT;
            break;
    #endif /* __MMI_BT_PROFILE__ */
        default:
            ASSERT(0);
    }


    data = GetIndexOfStringId(MAIN_MENU_PROFILES_MENUID, menu_id);

    if(prev_data != data)
    {
        profile_changed = MMI_TRUE;
    }

    prev_data = data;

#ifdef __MMI_PROF_SHOW_SILENT_PROFILE__
    switch(gactivatedprofile)
    {
        case MMI_PROFILE_HEADSET:
    #ifdef __MMI_BT_PROFILE__
        case MMI_PROFILE_BT:
    #endif
        {
            mmi_frm_hide_menu_item(MAIN_MENU_PROFILES_SILENT);
            break;
        }
        default:
        {
            mmi_frm_unhide_menu_item(MAIN_MENU_PROFILES_SILENT);
            break;
        }
    }
#endif

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild_Ext(MAIN_MENU_PROFILES_MENUID);

    /* 6. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds_Ext(MAIN_MENU_PROFILES_MENUID, nStrItemList);

    GetSequenceImageIds_Ext(MAIN_MENU_PROFILES_MENUID, ItemIcons);

    SetParentHandler(MAIN_MENU_PROFILES_MENUID);

    for (i = 0; i < nNumofItem; i++)
    {
        gimagearray2[i] = IMG_PROFILES_NO_IMAGE;
    }

    for (i = 0; i < nNumofItem; i++)
    {
        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], GetString(nStrItemList[i]), MAX_SUBMENU_CHARACTERS);
    }

    /* If activated profile is silent then no profile should be seen as activated */
#ifndef __MMI_PROF_SHOW_SILENT_PROFILE__
    if (gactivatedprofile != MMI_PROFILE_SILENT)
#endif
    {
        data = GetIndexOfStringId_Ext(MAIN_MENU_PROFILES_MENUID, menu_id);
        gimagearray2[data] = IMG_PROFILES_ACTIVATED;
    }

//added by qinss,2010-1-4
#ifdef __MMI_POWER_SAVE_PROFILES__
    if(PowerSaveProfileIsActivated())
    {
        gimagearray2[nNumofItem-1] = IMG_PROFILES_ACTIVATED;
    }
    else
    {
        gimagearray2[nNumofItem-1] = IMG_PROFILES_NO_IMAGE;       
    }
#endif

    /* ingore guiBuffer when previous activated profile is different thant current profile after back history */
    if (guiBuffer != NULL && profile_changed)
    {
        change_list_menu_category_history(guiBuffer, data, nNumofItem, 0);
    }

    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* MTK Leo add, mini_tab_bar */
#ifdef __MMI_WGUI_MINI_TAB_BAR__
    wgui_enable_mini_tab_bar(MAIN_MENU_PROFILES_MENUID);
#endif
    /* MTK Leo end */

    ShowCategory73Screen(
        STR_PROFILE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OPTIONS,
        0,
        STR_GLOBAL_BACK,
        0,
        nNumofItem,
        (U8 **) subMenuDataPtrs,
        (U16*) gimagearray2,
        ItemIcons,
        (U16) data,
        guiBuffer,
        1);

    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_main_screen
 * DESCRIPTION
 *  Exit function for main profile screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_main_screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gprofileId = (U8) gcurrHiliteIndexOne;

    /* MTK Leo add, mini_tab_Bar */
#ifdef __MMI_WGUI_MINI_TAB_BAR__
    wgui_disable_mini_tab_bar();
#endif
    /* MTK Leo end */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_options
 * DESCRIPTION
 *  Entry function for Profiles Options
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_options(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U8 *PopUpList[MAX_SUB_MENUS];
    S8 i = 0;
    U16 ParentId;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_OPTIONS);

#ifdef __MMI_PROF_SHOW_SILENT_PROFILE__
    if(guiBuffer!= NULL && gprofileId == MMI_PROFILE_SILENT)
    {
        switch(gactivatedprofile)
        {
            case MMI_PROFILE_HEADSET:
        #ifdef __MMI_BT_PROFILE__
            case MMI_PROFILE_BT:
        #endif
            {
                GoBackHistory();
                return;
            }

            default:
            {
                break;
            }
        }
    }
#endif

    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_OPTIONS, NULL, mmi_profiles_entry_options, NULL);

/****If headset is connected then options menu should show Customize only*******/
    if (mmi_profiles_is_device_profile())
    {
        ParentId = MENU_PROFILES_OPTIONS_CUSTOMIZE;
    }
#if 1 //#if defined  __YAK__  || defined __YELLOW__ //mod by liumoujun at 2009.09.04 //add by heyimin 20091026
//modified by qinss,2009-12-8
#ifdef __CUSTOMER_SPICE__
    else if(gprofileId == MMI_PROFILE_SILENT)
#else
    else if(gprofileId == MMI_PROFILE_SILENT) //wenxiaojuan20100121
#endif
#else
    else if(gprofileId == MMI_PROFILE_SILENT)
#endif
    {
        ParentId = MENU_PROFILES_OPTIONS_ACTIVATE;
    }
    else
    {
        ParentId = MENU_PROFILES_OPTIONS;
    }

    /* 1 Set parent handler */
    SetParentHandler(ParentId);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(ParentId);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(ParentId, nStrItemList);

    for (i = 0; i < nNumofItem; i++)
    {
        PopUpList[i] = NULL;
    }

    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* 8 Display Category Screen */

#if defined(__MMI_POPUP_OPTION_STYLE__)
    mmi_cat2010_set_vertical_gap(0);
    ShowCategory2010Screen(
        STR_GLOBAL_OK,
        NULL,//IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        NULL,//IMG_GLOBAL_BACK,
        guiBuffer);
#else /* __MMI_POPUP_OPTION_STYLE__ */
    ShowCategory52Screen(
        STR_PROFILE_OPTION_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (PU16) gIndexIconsImageList,
        PopUpList,
        0,
        0,
        guiBuffer);
#endif /* __MMI_POPUP_OPTION_STYLE__ */ 

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_activate_profile
 * DESCRIPTION
 *  Activates the Highlighted profile
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_activate_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 error = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* SetParentHandler(MENU_PROFILES_ACTIVATE); */

    if(gprofileId == MMI_PROFILE_SILENT)
    {
        ActivateSilentProfile();
        return;
    }

    gactivatedprofile = gprofileId;

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_ACTIVATED),MMI_EVENT_SUCCESS);

    DeleteNHistory(1);

    WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
    ActivateProfile();

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_activate_profile_by_id
 * DESCRIPTION
 *  Activates the profileId
 * PARAMETERS
 *  profileId       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_activate_profile_by_id(U8 profileId)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 str_activate[100];
    U16 msg_id = 0;
    S16 error = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (profileId)
    {
        case MMI_PROFILE_GENERAL:
            msg_id = STR_PROFILES_GENERAL;
            break;
        case MMI_PROFILE_MEETING:
            msg_id = STR_PROFILES_MEETING;
            break;
        case MMI_PROFILE_OUTDOOR:
            msg_id = STR_PROFILES_OUTDOOR;
            break;
        case MMI_PROFILE_INDOOR:
            msg_id = STR_PROFILES_INDOOR;
            break;
        case MMI_PROFILE_HEADSET:
            msg_id = STR_PROFILES_HEADSET;
            break;
        case MMI_PROFILE_SILENT:
            msg_id = STR_PROFILES_SILENT_PROFILE;
            break;
    #ifdef __MMI_BT_PROFILE__
        case MMI_PROFILE_BT:
            msg_id = STR_PROFILES_BT;
            break;
    #endif /* __MMI_BT_PROFILE__ */
        default:
            MMI_ASSERT(0);
    }

    mmi_ucs2cpy(str_activate, GetString(msg_id));
    mmi_ucs2cat(str_activate, (S8*) L" ");
    mmi_ucs2cat(str_activate, GetString(STR_GLOBAL_ACTIVATED));

    gactivatedprofile = gprofileId = profileId;

    mmi_display_popup((UI_string_type)str_activate,MMI_EVENT_SUCCESS);

    WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
    ActivateProfile();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_customize
 * DESCRIPTION
 *  Entry function for customize screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_customize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U8 *PopUpList[MAX_SUB_MENUS];
    U16 Parentid;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    /* Shall leave the exit handler for AT command set vibrator mode */
    EntryNewScreen(SCR_PROFILES_CUSTOMIZE, mmi_profiles_exit_customize, NULL, NULL);

    /* chinese no font size */
    if (IsChineseSet())
    {
    #ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
        if (mmi_profiles_is_device_profile())
        {
            Parentid = MENU_PROFILES_CUSTOMIZE_CHINESE_DEVICE;
        }
        else
    #endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
            Parentid = MENU_PROFILES_CUSTOMIZE_CHINESE;
    }
    else
    {
    #ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
        if (mmi_profiles_is_device_profile())
        {
            Parentid = MENU_PROFILES_CUSTOMIZE_DEVICE;
        }
        else
    #endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
            Parentid = MENU_PROFILES_CUSTOMIZE;
    }

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CUSTOMIZE);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(Parentid);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(Parentid, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(Parentid);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    ConstructHintsList(Parentid, PopUpList);

    ShowCategory52Screen(
        STR_PROFILE_CUSTOMIZE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (PU16) gIndexIconsImageList,
        PopUpList,
        0,
        0,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_customize
 * DESCRIPTION
 *  Exit fucntino for Customize screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
/* Shall leave the exit handler for AT command set vibrator mode */
void mmi_profiles_exit_customize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    history Scr;    /* Variable to hold the history data */
    S16 nHistory = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    Scr.scrnID = SCR_PROFILES_CUSTOMIZE;
    Scr.entryFuncPtr = mmi_profiles_entry_customize;
    mmi_ucs2cpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
    GetCategoryHistory(Scr.guiBuffer);
    AddHistory(Scr);
}

//PMT NEERAJ START 20050825
//PMT SUKRIT START 20051226
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
/* PMT SUKRIT END 20051226 */


/*****************************************************************************
 * FUNCTION
 *  ring_volume_set_default_value
 * DESCRIPTION
 *  This function returns the default value for ring volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ring_volume_set_default_value(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gprofiles[gprofileId].ringVolumeLevel > LEVEL7)
    {
        gprofiles[gprofileId].ringVolumeLevel = LEVEL7;
    }
    default_value_ring_volume = gprofiles[gprofileId].ringVolumeLevel;
}


/*****************************************************************************
 * FUNCTION
 *  ring_volume_two_line_menuitem_get_data_callback
 * DESCRIPTION
 *  This function is called when ring volume inline menuitem is displayed
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL ring_volume_two_line_menuitem_get_data_callback(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (item_index > 6)
    {
        return 0;
    }
    default_value_ring_volume = item_index;
    SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
    return 1;
}


/*****************************************************************************
 * FUNCTION
 *  ring_volume_two_line_menuitem_get_default_value_callback
 * DESCRIPTION
 *  This callback is called to get the default value for ring volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
S32 ring_volume_two_line_menuitem_get_default_value_callback(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return default_value_ring_volume;
}


/*****************************************************************************
 * FUNCTION
 *  ring_volume_line_menuitem_display_complete_callback
 * DESCRIPTION
 *  This callback is called to when the ring volume menuitem is unhighlighted
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void ring_volume_line_menuitem_display_complete_callback(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
    gprofiles[gprofileId].ringVolumeLevel = (U8) item_index;
    SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
}


/*****************************************************************************
 * FUNCTION
 *  keypad_volume_set_default_value
 * DESCRIPTION
 *  This function returns the drfault value for key volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void keypad_volume_set_default_value(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gprofiles[gprofileId].keypadVolumeLevel > LEVEL7)
    {
        gprofiles[gprofileId].keypadVolumeLevel = LEVEL7;
    }
    default_value_keypad_volume = gprofiles[gprofileId].keypadVolumeLevel;
}


/*****************************************************************************
 * FUNCTION
 *  keypad_volume_two_line_menuitem_get_data_callback
 * DESCRIPTION
 *  This function is called when keypad volume inline menuitem is displayed
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL keypad_volume_two_line_menuitem_get_data_callback(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (item_index > 6)
    {
        return 0;
    }
    default_value_keypad_volume = item_index;
    SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
    if (!IsSilentModeActivated())
#ifdef __MMI_SILENT_MEETING_PROFILE__
        if (!IsMeetingModeActivated())
#endif
        {
            if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
            {
                AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
            }
            else if (gprofiles[gprofileId].toneSetup.keypadTone != KEYPAD_SILENT)
            {
                AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
            }
        }
    return 1;
}


/*****************************************************************************
 * FUNCTION
 *  keypad_volume_two_line_menuitem_get_default_value_callback
 * DESCRIPTION
 *  This callback is called to get the default keypad volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
S32 keypad_volume_two_line_menuitem_get_default_value_callback(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return default_value_keypad_volume;
}


/*****************************************************************************
 * FUNCTION
 *  keypad_volume_line_menuitem_display_complete_callback
 * DESCRIPTION
 *  This callback is called when keypad volume menuitem is unhighlighted
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void keypad_volume_line_menuitem_display_complete_callback(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gprofiles[gprofileId].keypadVolumeLevel = (U8) item_index;
    AudioStopReq(gprofiles[gprofileId].toneSetup.keypadTone);
    SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_volume_type
 * DESCRIPTION
 *  Exit fucntion for Volume Type
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_volume_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    is_level_select_menuitem_displayed_in_volume_screen = 0;
    if (mmi_profiles_is_ring_tone_playing())
    {
        mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
    }
}


/*****************************************************************************
 * FUNCTION
 *  ContinueRingTone_TwoLine
 * DESCRIPTION
 *  Continue Ring tone after message received on ring tone volume two line screen.
 * PARAMETERS
 *  info        [?]    
 * RETURNS
 *  void
 *****************************************************************************/
void ContinueRingTone_TwoLine(void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetRingerVolume(default_value_ring_volume);
    if (!IsSilentModeActivated())
#ifdef __MMI_SILENT_MEETING_PROFILE__
        if (!IsMeetingModeActivated())
#endif
        {
            AudioPlayToneWithCallBackVolPath(
                gstartMidiId,
                REPEAT,
                INCOMING_CALL_TONE,
                (U8) default_value_ring_volume,
                MDI_DEVICE_SPEAKER2);
            mmi_profiles_set_ring_tone_playing(TRUE);
        }
}


/*****************************************************************************
 * FUNCTION
 *  set_current_volume_level
 * DESCRIPTION
 *  This function is to set the current volume level.
 * PARAMETERS
 *  void
 *  Input: None(?)
 * RETURNS
 *  void
 *****************************************************************************/
void set_current_volume_level()
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    default_value_ring_volume = gprofiles[gprofileId].ringVolumeLevel;
    default_value_keypad_volume = gprofiles[gprofileId].keypadVolumeLevel;
}


/*****************************************************************************
 * FUNCTION
 *  ring_volume_two_line_menuitem_complete_callback
 * DESCRIPTION
 *  This function is called when ring volume menuitem is unhighlighted
 * PARAMETERS
 *  menuitem_index      [IN]        Menuitem index
 *  selected_index      [IN]        Inline item index
 * RETURNS
 *  void
 *****************************************************************************/
void ring_volume_two_line_menuitem_complete_callback(S32 menuitem_index, S32 selected_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mdi_audio_stop_all();
}


/*****************************************************************************
 * FUNCTION
 *  ring_volume_two_line_menuitem_set_data
 * DESCRIPTION
 *  This function is used to set the ring volume
 * PARAMETERS
 *  item_index      [IN]        Inline item index
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL ring_volume_two_line_menuitem_set_data(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (item_index > LEVEL7)
    {
        return 0;
    }
    SetRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
    default_value_ring_volume = item_index;
    return 1;
}


/*****************************************************************************
 * FUNCTION
 *  keypad_volume_two_line_menuitem_set_data
 * DESCRIPTION
 *  This function is used to set the keypad ring volume
 * PARAMETERS
 *  item_index      [IN]        Inline item index
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL keypad_volume_two_line_menuitem_set_data(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (item_index > LEVEL7)
    {
        return 0;
    }
    default_value_keypad_volume = item_index;
    SetKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) item_index);
    if (gcurrentprofile.toneSetup.keypadTone == KEYPAD_SILENT)
    {
        if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
        {
            AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
        }
        else
        {
            AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
        }
    }
    return 1;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_get_volume_display_style
 * DESCRIPTION
 *  This function returns the display style of the volume
 * PARAMETERS
 *  index       [IN]        Menu item index
 * RETURNS
 *  U8
 *****************************************************************************/
U8 mmi_get_volume_display_style(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ring_volume_index = GetChildMenuIDIndexByParentMenuID(MENU_VOLUME_LEVEL, MENU_RING_VOLUME_LEVEL);
    keypad_volume_index = GetChildMenuIDIndexByParentMenuID(MENU_VOLUME_LEVEL, MENU_KEYPAD_VOLUME_LEVEL);

    if (index == ring_volume_index || index == keypad_volume_index)
    {
        return TWO_LINE_MENUITEM_STYLE_DISPLAY_LEVEL_SELECT;
    }
    else
    {
        return 0;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_volume_get_default_value
 * DESCRIPTION
 *  This function returns the default volume level
 * PARAMETERS
 *  menuitem_index      [IN]        Menu item index
 * RETURNS
 *  S32
 *****************************************************************************/
S32 mmi_volume_get_default_value(S32 menuitem_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (menuitem_index == ring_volume_index)
    {
        return default_value_ring_volume;
    }
    else if (menuitem_index == keypad_volume_index)
    {
        return default_value_keypad_volume;
    }
    else
    {
        return NULL;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_volume_get_and_set_level_select_data
 * DESCRIPTION
 *  This function sets the volume data for the menu item
 * PARAMETERS
 *  menuitem_index      [IN]        Menu item index
 *  item_index          [IN]        Inline item index
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL mmi_volume_get_and_set_level_select_data(S32 menuitem_index, S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (menuitem_index == ring_volume_index)
    {
        if (ring_volume_two_line_menuitem_set_data(item_index))
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    else if (menuitem_index == keypad_volume_index)
    {
        if (keypad_volume_two_line_menuitem_set_data(item_index))
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    else
    {
        return 0;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_volume_get_menuitem_properties
 * DESCRIPTION
 *  This function sets the properties of volume menuitems
 * PARAMETERS
 *  index                           [IN]        Menuitem index
 *  current_menuitem_properties     [?]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_volume_get_menuitem_properties(int index, wgui_two_line_menuitem_struct *current_menuitem_properties)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (index == ring_volume_index)
    {
        current_menuitem_properties->num_of_items = 7;
        current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
        current_menuitem_properties->defualt_value_callback = mmi_volume_get_default_value;
        current_menuitem_properties->complete_callback = ring_volume_two_line_menuitem_complete_callback;
        current_menuitem_properties->two_line_data_callback.get_data_for_level_select =
            mmi_volume_get_and_set_level_select_data;
    }
    else if (index == keypad_volume_index)
    {
        current_menuitem_properties->num_of_items = 7;
        current_menuitem_properties->image_flags = UI_TWO_LINE_MENUITEM_NO_THUMBNAIL;
        current_menuitem_properties->defualt_value_callback = mmi_volume_get_default_value;
        current_menuitem_properties->complete_callback = NULL;
        current_menuitem_properties->two_line_data_callback.get_data_for_level_select =
            mmi_volume_get_and_set_level_select_data;
    }
}
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
/* PMT SUKRIT END 20051226 */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_volume_type
 * DESCRIPTION
 *  Entry function for Volume type
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_volume_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U8 *PopUpList[MAX_SUB_MENUS];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if( gprofileId == MMI_PROFILE_SILENT )
    {
        mmi_display_popup((UI_string_type)GetString(STR_SILENT_ACTIVATE_MESSAGE),MMI_EVENT_FAILURE);
        return;
    }

    /* PMT SUKRIT START 20051226 */
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    /* PMT SUKRIT END 20051226 */
    is_level_select_menuitem_displayed_in_volume_screen = 1;
    EntryNewScreen(SCR_PROFILES_VOLUME_LEVEL, mmi_profiles_exit_volume_type, mmi_profiles_entry_volume_type, NULL);
#else /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
    /* PMT NEERAJ END 20050825 */
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_VOLUME_LEVEL, NULL, mmi_profiles_entry_volume_type, NULL);
    /* PMT NEERAJ START 20050825 */
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_VOLUME_LEVEL);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_VOLUME_LEVEL);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_VOLUME_LEVEL, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_VOLUME_LEVEL);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    ConstructHintsList(MENU_VOLUME_LEVEL, PopUpList);

    /* PMT SUKRIT START 20051226 */
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    wgui_set_pfn_to_get_display_style(mmi_get_volume_display_style);
    wgui_set_pfn_to_get_current_menu_item_properties(mmi_volume_get_menuitem_properties);
    if (!guiBuffer)
    {
        set_current_volume_level();
    }
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
    /* PMT SUKRIT END 20051226 */
    ShowCategory52Screen(
        STR_GLOBAL_VOLUME,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (PU16) gIndexIconsImageList,
        PopUpList,
        0,
        0,
        guiBuffer);

}


/*****************************************************************************
 * FUNCTION
 *  EntryScrProfilesCommonVolumeLevel1
 * DESCRIPTION
 *  Does all settings before entering into the entry fn of volume screen.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryScrProfilesCommonVolumeLevel1(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (gcommonvolumehandler)
    {
        case 0:
            gcommonvolumelevel = gprofiles[gprofileId].ringVolumeLevel;

            break;
        case 1:
            gcommonvolumelevel = gprofiles[gprofileId].keypadVolumeLevel;
            break;
    }
    EntryScrProfilesCommonVolumeLevel();
}

/* MTK Brian added for play ring tone after MT message, 2003/11/10 */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_continue_volume_ring_tone
 * DESCRIPTION
 *  Continue Ring tone after finish ind received on ring tone volume screen.
 * PARAMETERS
 *  info        [IN]    
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_continue_volume_ring_tone(void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetRingerVolume(gcommonvolumelevel);
    if (!IsSilentModeActivated())
#ifdef __MMI_SILENT_MEETING_PROFILE__
        if (!IsMeetingModeActivated())
#endif
        {
            AudioPlayToneWithCallBackVolPath(
                gstartMidiId,
                REPEAT,
                INCOMING_CALL_TONE,
                (U8) gcommonvolumelevel,
                MDI_DEVICE_SPEAKER2);
            mmi_profiles_set_ring_tone_playing(TRUE);
        }
}


/*****************************************************************************
 * FUNCTION
 *  EntryScrProfilesCommonVolumeLevel
 * DESCRIPTION
 *  Set all Voulem screen handler functions and call the general entry screen of volume level.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryScrProfilesCommonVolumeLevel(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    VOLUMEHANDLER_TYPE type;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#ifdef __MMI_BACKGROUND_CALL__
    if( mmi_ucm_app_incoming_call(MMI_UCM_CALL_TYPE_ALL) > 0 ||
        mmi_ucm_app_outgoing_call(MMI_UCM_CALL_TYPE_ALL) > 0 ||
        mmi_ucm_app_total_call(MMI_UCM_CALL_TYPE_NO_CSD) > 0)
    {
        PU8 gui_buffer = NULL;

        gui_buffer = GetCurrGuiBuffer(SCR_PROFILES_COMMON_VOLUME_LEVEL);

        if(gui_buffer == NULL)
        {
            mmi_ucm_app_entry_error_message();
            return;
        }
    }
#endif

    /* ExecuteCurrExitHandler(); */
    EntryNewScreen(SCR_PROFILES_COMMON_VOLUME_LEVEL, NULL, NULL, NULL);

    switch (gcommonvolumehandler)
    {
        case 0:
            mdi_audio_suspend_background_play();    /* stop all because it might be play file or play id */
            SetRingerVolume(gcommonvolumelevel);
            type = VOLUMEHANDLER_RING_TONE;
/*** Set all function handlers volume level screen *****/
            SetVolumeKeyHandlerFunctions(
                mmi_profiles_vol_inc_dec_play_keypad_tone,
                mmi_profiles_vol_inc_dec_play_keypad_tone,
                NULL,
                NULL,
                STR_GLOBAL_RINGTONE,
                &gcommonvolumelevel,
                STR_GLOBAL_OK,
                STR_GLOBAL_BACK,
                mmi_profiles_entry_volume_level_hdlr,
                GoBackHistory,//GoBackCommonVolume,
                0,
                ExitScrProfilesCommonVolumeLevel,
                1,
                type);
            EntryScrSetKeyPadVolumeLevel();
            if (!IsSilentModeActivated())
    #ifdef __MMI_SILENT_MEETING_PROFILE__
                if (!IsMeetingModeActivated())
    #endif
                {
                    AudioPlayToneWithCallBackVolPath(
                        gstartMidiId,
                        REPEAT,
                        INCOMING_CALL_TONE,
                        (U8) gcommonvolumelevel,
                        MDI_DEVICE_SPEAKER2);
                    mmi_profiles_set_ring_tone_playing(TRUE);
                }
            /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
            SetProtocolEventHandler(mmi_profiles_continue_volume_ring_tone, PRT_EQ_PLAY_AUDIO_FINISH_IND);

            break;
        case 1:
            mdi_audio_suspend_background_play();
            /* disable UP DOWN key tone */
            key_tone_state = mmi_frm_kbd_get_key_tone_state();
            mmi_frm_kbd_set_tone_state(MMI_KEY_VOL_UP_DOWN_TONE_DISABLED);
            SetKeyPadVolume(gcommonvolumelevel);
            type = VOLUMEHANDLER_KEY_TONE;
/*** Set all function handlers volume level screen *****/
            SetVolumeKeyHandlerFunctions(
                mmi_profiles_vol_inc_dec_play_keypad_tone,
                mmi_profiles_vol_inc_dec_play_keypad_tone,
                NULL,
                NULL,
                STR_COMMON_VOLUME_LEVEL_KEY_CAPTION,
                &gcommonvolumelevel,
                STR_GLOBAL_OK,
                STR_GLOBAL_BACK,
                mmi_profiles_entry_volume_level_hdlr,
                GoBackHistory,//GoBackCommonVolume,
                0,
                ExitScrProfilesCommonVolumeLevel,
                1,
                type);
            EntryScrSetKeyPadVolumeLevel();
            AudioStopReq((U16) gprofiles[gprofileId].toneSetup.keypadTone);
            break;
    }

//    SetKeyHandler(GoIdleScreenCommonVolume, KEY_END, KEY_EVENT_DOWN);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_vol_inc_dec_play_keypad_tone
 * DESCRIPTION
 *  when change keypad tone volume, need to play key pad tone again after
 *  set new volume because it is not ring tone and it will only play once.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_vol_inc_dec_play_keypad_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcommonvolumehandler && !IsSilentModeActivated())
#ifdef __MMI_SILENT_MEETING_PROFILE__
        if (!IsMeetingModeActivated())
#endif
        {
            if (gprofiles[gprofileId].toneSetup.keypadTone == KEYPAD_CLICK)
            {
                AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
            }
            else if (gprofiles[gprofileId].toneSetup.keypadTone != KEYPAD_SILENT)
            {
                AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
            }
        }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_volume_level_hdlr
 * DESCRIPTION
 *  Set keypad volume level for press of OK on volume level screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_volume_level_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_VOLUME_LEVEL_ENUM ringvolume;
    MMI_VOLUME_LEVEL_ENUM keypadvolume;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    switch (gcommonvolumehandler)
    {
        case 0:
        {
            gprofiles[gprofileId].ringVolumeLevel = (U8) gcommonvolumelevel;

            /*stop ring tone to prevent from ring tone volume change to active profile volume*/
            if (mmi_profiles_is_ring_tone_playing())
            {
                mdi_audio_stop_all();
            }           
            switch (volume_level_UI)
            {
                case 0:
                    ringvolume = LEVEL1;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 1:
                    ringvolume = LEVEL2;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 2:
                    ringvolume = LEVEL3;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 3:
                    ringvolume = LEVEL4;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 4:
                    ringvolume = LEVEL5;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 5:
                    ringvolume = LEVEL6;
                    SetRingVolumeLevel(ringvolume);
                    break;
                case 6:
                    ringvolume = LEVEL7;
                    SetRingVolumeLevel(ringvolume);
                    break;
            }
        }
            break;
        case 1:
        {
            gprofiles[gprofileId].keypadVolumeLevel = (U8) gcommonvolumelevel;
            switch (volume_level_UI)
            {
                case 0:
                    keypadvolume = LEVEL1;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 1:
                    keypadvolume = LEVEL2;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 2:
                    keypadvolume = LEVEL3;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 3:
                    keypadvolume = LEVEL4;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 4:
                    keypadvolume = LEVEL5;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 5:
                    keypadvolume = LEVEL6;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
                case 6:
                    keypadvolume = LEVEL7;
                    SetKeypadVolumeLevel(keypadvolume);
                    break;
            }
        }
            break;
    }
    GoBackHistory();
}

/*****************************************************************************
 * FUNCTION
 *  GoIdleScreenCommonVolume
 * DESCRIPTION
 *  Go back from Volume screen through End Key
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void GoIdleScreenCommonVolume(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_VOLUME_LEVEL_ENUM ringVolumeLevel, keypadVolumelevel;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
/**** Restore Volume levels on press of END key on volume level screen*****/
    switch (gcommonvolumehandler)
    {
        case 0:
            ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
            SetRingerVolume(ringVolumeLevel);
            break;
        case 1:
            keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
            SetKeyPadVolume(keypadVolumelevel);
            break;
    }

    DisplayIdleScreen();
}


/*****************************************************************************
 * FUNCTION
 *  ExitScrProfilesCommonVolumeLevel
 * DESCRIPTION
 *  Exit profile Volume Level screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitScrProfilesCommonVolumeLevel(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_VOLUME_LEVEL_ENUM ringVolumeLevel, keypadVolumelevel;

    history Scr;    /* Variable to hold the history data */
    S16 nHistory = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    switch (gcommonvolumehandler)
    {
        case 0:
            if (mmi_profiles_is_ring_tone_playing())
            {
                mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
            }
            ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
            SetRingerVolume(ringVolumeLevel);
            mdi_audio_resume_background_play();
            /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
            SetProtocolEventHandler(NULL, PRT_EQ_PLAY_AUDIO_FINISH_IND);
            break;
        case 1:
            AudioStopReq((U16) gprofiles[gprofileId].toneSetup.keypadTone);
            keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
            SetKeyPadVolume(keypadVolumelevel);
            /* restore key tone state */
            mmi_frm_kbd_set_tone_state(key_tone_state);
            mdi_audio_resume_background_play();
            break;
    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_alert_type
 * DESCRIPTION
 *  Entry fucntion for Call Alert
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_alert_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    S8 i = 0;

    /* U8* PopUpList[MAX_SUB_MENUS]; */
    U8 data = 0;
    U16 ProfileMenuID[] =
    {
        MENU_RING,
        MENU_VIBRATION_ONLY,
        MENU_VIBRATION_AND_RING,
        MENU_VIBRATION_THEN_RING,
        MENU_SILENT
    };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if( gprofileId == MMI_PROFILE_SILENT )
    {
        mmi_display_popup((UI_string_type)GetString(STR_SILENT_ACTIVATE_MESSAGE),MMI_EVENT_FAILURE);
        return;
    }
    
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_CALL_ALERT, NULL, mmi_profiles_entry_alert_type, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CALL_ALERT);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_MT_CALL_ALERT_TYPE);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_MT_CALL_ALERT_TYPE, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_MT_CALL_ALERT_TYPE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* MTK Brian modified for showing radio button, 2003/11/15 */

/****** Get the index of activated alert type menu ID*****/
    i = gprofiles[gprofileId].mtCallAlertTypeEnum;
    data = GetIndexOfStringId(MENU_MT_CALL_ALERT_TYPE, ProfileMenuID[i - 1]);

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_CALL_ALERT_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);
    /* MTK end */
   
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_alert_type_ring_hdlr
 * DESCRIPTION
 *  Set alert type as ring
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_alert_type_ring_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetMtCallAlertTypeEnum(MMI_RING);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_alert_type_vib_only_hdlr
 * DESCRIPTION
 *  set alert type as vibration only
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_alert_type_vib_only_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetMtCallAlertTypeEnum(MMI_VIBRATION_ONLY);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_alert_type_vib_and_ring_hdlr
 * DESCRIPTION
 *  Set alert type as vibration and ring
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_alert_type_vib_and_ring_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    SetMtCallAlertTypeEnum(MMI_VIBRATION_AND_RING);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_alert_type_vib_then_ring_hdlr
 * DESCRIPTION
 *  set alert type as vibration then ring
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_alert_type_vib_then_ring_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    SetMtCallAlertTypeEnum(MMI_VIBRATION_THEN_RING);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_alert_type_light_only_hdlr
 * DESCRIPTION
 *  set alert type as light only
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_alert_type_light_only_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    SetMtCallAlertTypeEnum(MMI_SILENT);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_ring_type
 * DESCRIPTION
 *  Entry function for Ring Type
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_ring_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 *guiBuffer;          /* Buffer holding history data */
    U8 i;
    MMI_RING_TYPE_ENUM data = 0;
    U16 ProfileMenuID[] =
    {
        MENU_RING_TYPE_SINGLE,
        MENU_RING_TYPE_REPEAT,
        MENU_RING_TYPE_ASCENDING
    };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_RING_TYPE, NULL, mmi_profiles_entry_ring_type, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_RING_TYPE);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_RING_TYPE);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_RING_TYPE, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_RING_TYPE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

/****** Get the index of activated ring type menu ID*****/
    i = gprofiles[gprofileId].ringTypeEnum;
    data = GetIndexOfStringId(MENU_RING_TYPE, ProfileMenuID[i]);

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_RING_TYPE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        0,
        STR_GLOBAL_BACK,
        0,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_type_ascending_hdlr
 * DESCRIPTION
 *  set ring type as Ascending
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_type_ascending_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetRingTypeEnum(ASCENDING);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_type_single_hdlr
 * DESCRIPTION
 *  set ring type as Single
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_type_single_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetRingTypeEnum(SINGLE);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_type_repeat_hdlr
 * DESCRIPTION
 *  set ring type as Repeat
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_type_repeat_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetRingTypeEnum(REPEAT);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_RING_TYPE);
}

#ifdef __MMI_CONNECT_NOTICE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_connect_notice
 * DESCRIPTION
 *  Showing profile Call Alert screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_connect_notice(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    S8 i = 0;
    MMI_CONNECT_NOTICE_TYPE data = 0;
    U16 ProfileMenuID[] =
    {
        MENU_NOTICE_NONE,
        MENU_NOTICE_TONE_ONLY,
        MENU_NOTICE_VIB_ONLY,
        MENU_NOTICE_TONE_AND_VIB
    };

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_CONNECT_NOTICE, NULL, mmi_profiles_entry_connect_notice, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CONNECT_NOTICE);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_CONNECT_NOTICE);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_CONNECT_NOTICE, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_CONNECT_NOTICE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* MTK Brian modified for showing radio button, 2003/11/15 */

/****** Get the index of activated alert type menu ID*****/
    i = gprofiles[gprofileId].extraTone.connectTone;
    data = GetIndexOfStringId(MENU_CONNECT_NOTICE, ProfileMenuID[i]);

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_CONNECT_NOTICE,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);
    /* MTK end */

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_connect_notice_none_hdlr
 * DESCRIPTION
 *  set connect notice type as none
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_connect_notice_none_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetConnectNotice(MMI_NOTICE_NONE);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_connect_notice_tone_only_hdlr
 * DESCRIPTION
 *  set connect notice type as tone only
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_connect_notice_tone_only_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetConnectNotice(MMI_NOTICE_TONE_ONLY);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_connect_notice_vib_only_hdlr
 * DESCRIPTION
 *  set connect notice type as vib only
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_connect_notice_vib_only_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetConnectNotice(MMI_NOTICE_VIB_ONLY);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_connect_notice_tone_and_vib_hdlr
 * DESCRIPTION
 *  set connect notice type as tone and vib
 *  Profile.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_connect_notice_tone_and_vib_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetConnectNotice(MMI_NOTICE_TONE_AND_VIB);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_CONNECT_NOTICE);
}
#endif /* __MMI_CONNECT_NOTICE__ */


/*****************************************************************************
 * FUNCTION
 *  ProfileGoBack2History
 * DESCRIPTION
 * 
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ProfileGoBack2History(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    GoBacknHistory(1);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_answering_mode
 * DESCRIPTION
 *  Entry function for Answering Mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_answering_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 *guiBuffer;          /* Buffer holding history data */
    U16 i;
    U16 ParentId;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_ANSWERING_MODE, NULL, mmi_profiles_entry_answering_mode, NULL);

/***** If earphone is connected then also show auto mode in answering mode list */
    if (gprofileId != MMI_PROFILE_HEADSET)
    {
        ParentId = MENU_ANSEWRING_MODE;
    }
    else
    {
        ParentId = MENU_ANSEWRING_MODE_HEADSET;
    }

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_ANSWERING_MODE);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(ParentId);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(ParentId, nStrItemList);

    for (i = 0; i < nNumofItem; i++)
    {
        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], GetString(nStrItemList[i]), MAX_SUBMENU_CHARACTERS);
    }

    /* 6 Set current parent id */
    SetParentHandler(ParentId);

    /* MTK Brian added for SUBLCD freature, 2003/10/18 */
#ifdef __MMI_CLAMSHELL__
    fieldStates[0] = (U8) gprofiles[gprofileId].answeringMode.coverAnswer;
    fieldStates[1] = (U8) gprofiles[gprofileId].answeringMode.anyKey;
    fieldStates[2] = (U8) gprofiles[gprofileId].answeringMode.automatic;
#else /* __MMI_CLAMSHELL__ */
    fieldStates[0] = (U8) gprofiles[gprofileId].answeringMode.anyKey;
    fieldStates[1] = (U8) gprofiles[gprofileId].answeringMode.automatic;
#endif /* __MMI_CLAMSHELL__ */

    SetCheckboxToggleRightSoftkeyFunctions(mmi_profiles_set_answering_mode_query_popup, GoBackHistory);

    /* 8 Display Category Screen */

    ShowCategory140Screen(
        STR_ANSEWRING_MODE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        nNumofItem,
        (U8 **) subMenuDataPtrs,
        fieldStates,
        0,
        guiBuffer);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_answering_mode_hdlr
 * DESCRIPTION
 *  set answering mode hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_answering_mode_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_answering_mode_struct answeringmode;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* MTK Brian added for SUBLCD freature, 2003/10/18 */
#ifdef __MMI_CLAMSHELL__
    answeringmode.coverAnswer = gprofiles[gprofileId].answeringMode.coverAnswer = fieldStates[0];
    answeringmode.anyKey = gprofiles[gprofileId].answeringMode.anyKey = fieldStates[1];
    answeringmode.automatic = gprofiles[gprofileId].answeringMode.automatic = fieldStates[2];
#else /* __MMI_CLAMSHELL__ */
    answeringmode.anyKey = gprofiles[gprofileId].answeringMode.anyKey = fieldStates[0];
    answeringmode.automatic = gprofiles[gprofileId].answeringMode.automatic = fieldStates[1];
#endif /* __MMI_CLAMSHELL__ */

    SetAnsweringMode(answeringmode);
    /* DisplayPopupCheckBox((PU8)GetString(STR_GLOBAL_DONE) ,IMG_GLOBAL_ACTIVATED, 1,UI_POPUP_NOTIFYDURATION_TIME,SUCCESS_TONE); */
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_SAVED),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_ANSWERING_MODE);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_answering_mode_query_popup
 * DESCRIPTION
 *  set call back functions for Answering mode query popup.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_answering_mode_query_popup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_set_query_popup(mmi_profiles_entry_answering_mode_hdlr, ProfileGoBack2History);
}

#if !defined(HARDWARE_LED_NOT_SUPPORT)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_status_LED
 * DESCRIPTION
 *  Entry function for Status LED
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_status_LED(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 *guiBuffer;          /* Buffer holding history data */
    MMI_LEDLIGHT_STATUS_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_STATUS, mmi_profiles_exit_status_LED, mmi_profiles_entry_status_LED, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_STATUS);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_LIGHT_STATUS);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_LIGHT_STATUS, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_LIGHT_STATUS);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(GetCurrScreenHandlerfour);

    data = gprofiles[gprofileId].light.status;

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_LIGHT_STATUS_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        0,
        STR_GLOBAL_BACK,
        0,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_entry_status_LED_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_status_LED
 * DESCRIPTION
 *  Exit function for Status LED
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_status_LED(void)
{
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_color_id();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_status_LED_hdlr
 * DESCRIPTION
 *  Set Light color
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_status_LED_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_LEDLIGHT_STATUS_ENUM lightstaus;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (gcurrHiliteIndexOne)
    {
        case 0:
            lightstaus = NO_COLOR;
            SetLightStatus(lightstaus);
            break;
        case 1:
            lightstaus = COLOR_PATTERN1;
            SetLightStatus(lightstaus);
            break;
        case 2:
            lightstaus = COLOR_PATTERN2;
            SetLightStatus(lightstaus);
            break;
        case 3:
            lightstaus = COLOR_PATTERN3;
            SetLightStatus(lightstaus);
            break;
        case 4:
            lightstaus = COLOR_PATTERN4;
            SetLightStatus(lightstaus);
            break;
        case 5:
            lightstaus = COLOR_PATTERN5;
            SetLightStatus(lightstaus);
            break;
        case 6:
            lightstaus = COLOR_PATTERN6;
            SetLightStatus(lightstaus);
            break;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_STATUS);
}

#endif /* HARDWARE_LED_NOT_SUPPORT */

#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
/*****************************************************************************
 * FUNCTION
 *  EntryScrIMPSStatus
 * DESCRIPTION
 *  Showing profile Status Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryScrIMPSStatus(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 *guiBuffer;          /* Buffer holding history data */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_STATUS, NULL, EntryScrIMPSStatus, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_STATUS);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_PROFILES_IMPS_STATUS);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_PROFILES_IMPS_STATUS, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_PROFILES_IMPS_STATUS);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(GetCurrScreenHandler);

    data = gprofiles[gprofileId].impsStatus;

    /* since imps enum offline starts with 1, 0 is reserved for unknown*/
    data-- ;;

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_IMPS_STATUS_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        0,
        STR_GLOBAL_BACK,
        0,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(EntryScrSetIMPSStatus, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

/*****************************************************************************
 * FUNCTION
 *  EntryScrSetIMPSStatus
 * DESCRIPTION
 *  Set IMPS Status
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryScrSetIMPSStatus(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 impsStatus;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (gcurrHiliteIndexOne)
    {
        case 0:
            impsStatus = IMPS_PHB_PA_USER_OFFLINE;
            SetIMPSStatus(impsStatus);
            break;
        case 1:
            impsStatus = IMPS_PHB_PA_USER_AVAILABLE;
            SetIMPSStatus(impsStatus);
            break;
        case 2:
            impsStatus = IMPS_PHB_PA_USER_DISCREET;
            SetIMPSStatus(impsStatus);
            break;
        case 3:
            impsStatus = IMPS_PHB_PA_USER_NOT_AVAILABLE;
            SetIMPSStatus(impsStatus);
            break;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_IMPS_STATUS);
}
#endif /* __MMI_IMPS__ && IMPS_WV13_ENHANCEMENT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_tone_setup
 * DESCRIPTION
 *  Entry function for Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_tone_setup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U8 *PopUpList[MAX_SUB_MENUS];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if( gprofileId == MMI_PROFILE_SILENT )
    {
        mmi_display_popup((UI_string_type)GetString(STR_SILENT_ACTIVATE_MESSAGE),MMI_EVENT_FAILURE);
        return;
    }

#ifdef __USB_IN_NORMAL_MODE__
    /* check is in mass storage mode */
    if (mmi_usb_is_in_mass_storage_mode())
    {
        /* phone drive is exported, cant use this app */
        mmi_usb_app_unavailable_popup(0);   /* pass 0 will show default string */
        return;
    }
#endif /* __USB_IN_NORMAL_MODE__ */

#if 0 //remove by heyimin 20100104  [S01][情景模式]蓝牙模式中铃声设置中缺少开机铃声设置菜单.
#ifdef __MMI_BT_PROFILE__
    if( gprofileId == MMI_PROFILE_BT )
    {
        mmi_frm_hide_menu_item(MENU_TONE_SETUP_POWERON_TONE);
    }
    else
#endif
#endif
        mmi_frm_unhide_menu_item(MENU_TONE_SETUP_POWERON_TONE);

    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_TONE_SETUP, NULL, mmi_profiles_entry_tone_setup, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild_Ext(MENU_TONE_SETUP);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds_Ext(MENU_TONE_SETUP, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* 8 Display Category Screen */
    ConstructHintsList(MENU_TONE_SETUP, PopUpList);
    ShowCategory52Screen(
        STR_PROFILES_TONE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (PU16) gIndexIconsImageList,
        PopUpList,
        0,
        0,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

}

#if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)


/*****************************************************************************
 * FUNCTION
 *  AudioFileDeletedFromFmgr
 * DESCRIPTION
 *  IF audio folder get deleted or fomatted
 *  from File manager activate default audio as incoming tone
 * PARAMETERS
 *  tone_id         [IN]       
 *  Audio(?)        [IN]        ID
 * RETURNS
 * BOOL
 * 
 *****************************************************************************/
pBOOL AudioFileDeletedFromFmgr(U16 tone_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 buf[(FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH];
    FS_HANDLE file;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    GetAudioNameWithPathInFileSystem(tone_id, (PS8) buf);
    file = FS_Open((const WCHAR*)buf, FS_READ_ONLY);
    if (file < 0)
    {
        FS_Close(file);
        return TRUE;
    }
    else
    {
        FS_Close(file);
        return FALSE;
    }
}
#endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_get_melody_list
 * DESCRIPTION
 *  Build melody list
 * PARAMETERS
 *  CurMelodyID         [IN]       
 *  selecteditem        [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
U8 mmi_profiles_get_melody_list(U16 CurMelodyID, U16 *selecteditem)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyInfo;
#endif
#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
    DYNAUDIOINFO *DownloadThemeTones;
#endif
    int index, data;
    U16 nNumofItem = gtotalRingId + gtotalMidiId;
#ifdef __DRM_SUPPORT__
    S32 result = 0 ;
#endif

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* init hint data */
    memset(hintData, 0, sizeof(hintData));
    for (data = 0; data < MAX_SUB_MENUS; data++)
    {
        hintDataPtrs[data] = hintData[data];
    }

    /* copy the names of fixed list (IMY) */
    for (index = 0; index < gtotalRingId; index++)
    {
        mmi_ucs2cpy((PS8) subMenuDataPtrs[index], GetString((U16) (STR_PROFILES_RING_1 + index)));
    }

    /* copy the names of fixed list (MIDI) */
    for (index = 0; index < gtotalMidiId; index++)
    {
        mmi_ucs2cpy((PS8) subMenuDataPtrs[index + gtotalRingId], GetString((U16) (STR_PROFILES_MIDI_1 + index)));
    }

    /* make a listing of ext melodies. */
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    PmgGetExtMelodyInfo(&ExtMelodyInfo);
    for (index = nNumofItem, data = 0; data < MAXIMUM_EXT_MELODY_NUM; index++, data++)
    {
        if (PmgIsEmptySlot((U8) data) == MMI_FALSE)
        {
        #ifdef __USB_IN_NORMAL_MODE__
            if(mmi_usb_is_in_mass_storage_mode())
            {
                mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(FMGR_FS_DEVICE_EXPORTED_ERROR_TEXT));
            }
            else
        #endif           
            if (PmgQueryFileExistBySlot((U8) data) == MMI_FALSE)
            {
                mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(STR_TONE_FILE_NOT_EXIST));
            }
        #if defined(__DRM_SUPPORT__)
            else if(  (result = PmgQueryFileDRMForwardableBySlot((U8)data)) < 1)
            {
                if(result == 0)
                {
                    mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(STR_GLOBAL_DRM_PROHIBITED));
                }
                else
                {
                    mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(GetFileSystemErrorString(result)));
                }
            }
        #endif /*__DRM_SUPPORT__*/
       
            if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[data].filepath))
            {
                mmi_chset_mixed_text_to_ucs2_str(
                    subMenuDataPtrs[index],
                    (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                    (U8*) ExtMelodyInfo->info[data].filename,
                    g_chset_text_encoding);
            }
            else
            {
                mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) ((ExtMelodyInfo->info[data]).filename));
            }
        #if (!defined(__MMI_SHOW_FILE_EXT__))
            PmgRemoveFileExt((S8*) subMenuDataPtrs[index]);
        #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
            PmgRemoveFileDAFExt((S8*) subMenuDataPtrs[index]);
        #endif
        }
        else
        {
            mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
        }
    }
#else
    index = nNumofItem ;
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */

#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
    if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
    {
        mmi_ucs2cpy((S8*) subMenuDataPtrs[index++], (S8*) GetString(STR_PROFILES_CURR_THEME));
    }
#endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */

    /* find highlight selection */
    if (CurMelodyID >= gstartRingId && CurMelodyID < gstartRingId + gtotalRingId)
    {
        *selecteditem = CurMelodyID - gstartRingId;
    }
    else if (CurMelodyID >= gstartMidiId && CurMelodyID < gstartMidiId + gtotalMidiId)
    {
        *selecteditem = CurMelodyID - gstartMidiId + gtotalRingId;
    }
    else
    {
        BOOL selected = FALSE;

    #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if (PmgIsEmptySlot((U8) data) == MMI_FALSE && CurMelodyID == (ExtMelodyInfo->info[data]).id)
            {
                *selecteditem = nNumofItem + data;
                selected = TRUE;
                break;
            }
        }
        nNumofItem += MAXIMUM_EXT_MELODY_NUM;
    #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
        if (!selected)
        {
            if (GetThemeV2TonesInfo(&DownloadThemeTones) != 0 && mmi_tm_get_current_theme_ringtone())
            {
                if ((U16)DownloadThemeTones[0].AudioId == CurMelodyID)
                {
                    selected = TRUE;
                    *selecteditem = nNumofItem;
                    if (AudioFileDeletedFromFmgr(CurMelodyID))
                    {
                        mmi_ucs2cpy((S8*) hintData[nNumofItem], GetString(STR_TONE_FILE_NOT_EXIST));
                    }
                }
            }
        }
    #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
        if(!selected)
        {
            /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
            gprofiles[gprofileId].toneSetup.ringTone = gstartMidiId ;
            gprofiles[gprofileId].toneSetup.alarmTone = gstartMidiId ;
            *selecteditem = gtotalRingId;
        }
    }

    return (U8) index;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_ring_tone_list
 * DESCRIPTION
 *  Showing profile Ring Tone Setup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_ring_tone_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;      /* Buffer holding history data */
    U16 selecteditem = 0;
    U8 totalItems = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(
        SCR_PROFILES_RING_TONE_SETUP,
        mmi_profiles_exit_ring_tone_list,
        mmi_profiles_entry_ring_tone_list,
        NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_RING_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    totalItems = mmi_profiles_get_melody_list(gprofiles[gprofileId].toneSetup.ringTone, &selecteditem);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_RING_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(mmi_profiles_melody_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_PROFILES_RING_TONE_SETUP_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        totalItems,
        subMenuDataPtrs,
        hintDataPtrs,
        0,
        selecteditem,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(mmi_profiles_stop_tone_and_go_back, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_entry_ring_tone_list_hdlr, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_ring_tone_list
 * DESCRIPTION
 *  Exit profile Ring ToneSetup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_ring_tone_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_stop_tone_and_go_back
 * DESCRIPTION
 *  stop tone and go back
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_stop_tone_and_go_back(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
    GoBackHistory();
}

#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_replace_callback
 * DESCRIPTION
 * 
 * PARAMETERS
 *  path            [IN] path string ptr from filemgr
 *  is_short        [IN] flag to identify if it is short char
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_replace_callback(void *path, int is_short)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 *filepath = (S8*) path;
    PMG_ADDFILE_ERRNO err = PMG_ADDFILE_ERR_UNKNOWN;
#ifdef __DRM_SUPPORT__
    S32 result = 0;
#endif
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (filepath)
    {
    #if defined(__DRM_SUPPORT__)
        if ( (result = mmi_profiles_check_DRM_content_forwardable((UI_string_type) filepath)) < 1 )
        {
            if(result == 0)
            {
                err = PMG_ADDFILE_ERR_DRM_PROHIBTED;
            }
            else
            {
                err = PMG_ADDFILE_ERR_UNKNOWN; /*FS open error, pop up unfinished*/
            }
        }
        else
    #endif /* defined(__DRM_SUPPORT__)*/
        if (PmgCheckImyMidFileSize(filepath) == PMG_ADDFILE_ERR_FILE_TOO_LARGE)
        {
            err = PMG_ADDFILE_ERR_FILE_TOO_LARGE;
        }
        else
        {
            PmgSetShortFileName((BOOL) is_short);
            if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
            {
                err = PmgReplaceExtMelodyBySlotPathFileName(filepath, g_ext_melody_idx);
            }
            else
            {
                err = PmgAddExtMelodyBySlotPathFileName(filepath, g_ext_melody_idx);
            }
        }

        PmgDisplayPopup(err);

        if(err == PMG_ADDFILE_ERR_SUCCESS)
        {
            DeleteUptoScrID(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
            DeleteScreenIfPresent(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
        }

    }
    else
    {
        GoBackHistory();
    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_convert_empty_slot_menu_list
 * DESCRIPTION
 *  empty slot only has add option
 * PARAMETERS
 *  idx     [IN]       
 * RETURNS
 * 
 *****************************************************************************/
static U8 mmi_profiles_Ext_melody_convert_empty_slot_menu_list(U8 idx)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
    {   /* Not Empty slot */
        return idx;
    }
    else
    {
        if (idx == 0)
        {
            return PRF_MENU_EXTMLD_ADD; /* PRF_MENU_EXTMLD_DONE */
        }
        else
        {
            MMI_ASSERT(MMI_FALSE);
        }
    }

    return PRF_MENU_EXTMLD_MAX;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_replace_action
 * DESCRIPTION
 *  external melody replace action
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_replace_action(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    FMGR_FILTER filter;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    FMGR_FILTER_INIT(&filter);
    FMGR_FILTER_SET_AUDIO(&filter);
    FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
    FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
#ifdef __DRM_V02__
    FMGR_FILTER_SET(&filter, FMGR_TYPE_ODF);
#endif

#if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
    if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
    {
        mmi_fmgr_select_path_and_enter(
            APP_PHONEBOOK,
            FMGR_SELECT_REPEAT | FMGR_SELECT_FILE | FMGR_FLAG_PREVIEW_AUDIO,
            filter,
            (S8*) L"root",
            mmi_profiles_Ext_melody_replace_callback);
    }
    else
#endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */
        mmi_fmgr_select_path_and_enter(
            APP_PROFILES,
            FMGR_SELECT_REPEAT | FMGR_SELECT_FILE | FMGR_FLAG_PREVIEW_AUDIO,
            filter,
            (S8*) L"root",
            mmi_profiles_Ext_melody_replace_callback);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_action_hdlr
 * DESCRIPTION
 * 
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_action_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 idx = mmi_profiles_Ext_melody_convert_empty_slot_menu_list(extMldHlitItem);

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (idx == PRF_MENU_EXTMLD_DONE)
    {
        if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
        {
            if (prfset_conf_type == PRFSET_MELODY_TYPE_RING)
            {
                SetRingToneID((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #ifdef __MMI_DUAL_PROFILE_SUPPORT__
            else if(prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_RING)
            {
                SetCard2RingToneID((U16)(PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #endif /* __MMI_DUAL_PROFILE_SUPPORT__ */
        #ifndef __MMI_ALM_CUSTOMIZE_TONE__
            else if (prfset_conf_type == PRFSET_MELODY_TYPE_ALARM)
            {
                SetAlarmToneID((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */
        #if defined(__MMI_PHB_CALLER_RES_SETTING__)     /* Forward res to phonebook */
            else if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
            {
                mmi_phb_caller_ring_forward_to_entry((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #endif /* defined(__MMI_PHB_CALLER_RES_SETTING__) */
        #if defined(__MMI_EM_NW_EVENT_NOTIFY__)
            else if (prfset_conf_type == PRFSET_MELODY_TYPE_ENGINEERMODE)
            {
                em_nw_event_select_ring_done((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #endif /* #if defined(__MMI_EM_NW_EVENT_NOTIFY__) */
        #ifdef __MMI_VIDEO_TELEPHONY__
            else if(prfset_conf_type == PRFSET_MELODY_TYPE_VIDEO_CALL)
            {
                SetVideoCallToneID((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx));
            }
        #endif
        #if defined(__CKT_EXTMEM_MSGTONE__)
            else if (prfset_conf_type == PRFSET_MELODY_TYPE_MSG_TONE)
            {
                mmi_profiles_tone_struct tonesetup;
                tonesetup.messageTone = (U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx);
                SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_MESSAGE);
            }
  //added by heshenning 2008/12/22
  #ifdef __MMI_DUAL_PROFILE_SUPPORT__
  else if (prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_MSG_TONE)
            {
                mmi_profiles_tone_struct tonesetup;
                tonesetup.card2_messageTone = (U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx);
                SetCard2MessageToneType(tonesetup);
            }
  #endif
  //added end
        #endif /* __CKT_EXTMEM_MSGTONE__ */
            else
            {
                MMI_ASSERT(0);
            }

            if (prfset_conf_type != PRFSET_MELODY_TYPE_PHB_RING)
            {
                mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
                if(prfset_conf_type != PRFSET_MELODY_TYPE_ENGINEERMODE)
                {
                    DeleteScreenIfPresent(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
                }
            }
        }
        else
        {
            mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_UNFINISHED),MMI_EVENT_FAILURE);
        }

    }
    else if (idx == PRF_MENU_EXTMLD_DEL)
    {
        if (PmgDelExtMelodyById((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx)) == MMI_TRUE)
        {
            mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
        }
        else
        {
            mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_UNFINISHED),MMI_EVENT_FAILURE);
        }
    }
    else if (idx == PRF_MENU_EXTMLD_ADD)
    {
        mmi_profiles_Ext_melody_replace_action();
    }
    else
    {
        mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_UNFINISHED),MMI_EVENT_FAILURE);
    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_hilite_hdlr
 * DESCRIPTION
 * 
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_hilite_hdlr(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    extMldHlitItem = (U8) index;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_entry_menu
 * DESCRIPTION
 *  entry function of external melody menu main screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_entry_menu(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[PRF_MENU_EXTMLD_MAX];
    U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2, IMG_GLOBAL_L3};
    U8 nNumofItem = 0;
    U8 *guiBuffer;
    U16 StrIDToneSet = 0, StrIDToneDel = 0, StrIDToneAdd = 0, StrIDTitle = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (prfset_conf_type == PRFSET_MELODY_TYPE_RING || prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING
        || prfset_conf_type == PRFSET_MELODY_TYPE_ENGINEERMODE || prfset_conf_type == PRFSET_MELODY_TYPE_VIDEO_CALL
    #if defined(__CKT_EXTMEM_MSGTONE__)
        || prfset_conf_type == PRFSET_MELODY_TYPE_MSG_TONE || prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_MSG_TONE //modified by heshenning 2008/12/22
    #endif /* __CKT_EXTMEM_MSGTONE__ */
        || prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_RING)
    {
        if (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING)
        {
            StrIDToneSet = STR_TONE_SETUP_RING_TONE_PHB_EXT_SET;
            StrIDTitle = STR_ID_PHB_CALLER_RING;
        }
        else if(prfset_conf_type == PRFSET_MELODY_TYPE_VIDEO_CALL)
        {
            StrIDToneSet = STR_TONE_SETUP_VDIEO_RING_TONE_EXT_SET;
            StrIDTitle = STR_PROFILES_VIDEO_RING_TONE_SETUP_CAPTION;           
        }
    #if defined(__CKT_EXTMEM_MSGTONE__)
        else if(prfset_conf_type == PRFSET_MELODY_TYPE_MSG_TONE)
        {
            StrIDTitle = STR_SIM1_MESSAGE_TONE_CAPTION;
            StrIDToneSet = STR_TONE_SETUP_RING_TONE_EXT_SET;
            StrIDToneDel = STR_TONE_SETUP_RING_TONE_EXT_DEL;
            StrIDToneAdd = STR_TONE_SETUP_RING_TONE_EXT_ADD;
        }
 //added by heshenning 2008/12/22 
 #ifdef __MMI_DUAL_PROFILE_SUPPORT__ 
        else if(prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_MSG_TONE)
        {
            StrIDTitle = STR_SIM2_MESSAGE_TONE_CAPTION;
            StrIDToneSet = STR_TONE_SETUP_RING_TONE_EXT_SET;
            StrIDToneDel = STR_TONE_SETUP_RING_TONE_EXT_DEL;
            StrIDToneAdd = STR_TONE_SETUP_RING_TONE_EXT_ADD;
        }
 #endif
 //added end
    #endif /* __CKT_EXTMEM_MSGTONE__ */
        else
        {
            StrIDToneSet = STR_TONE_SETUP_RING_TONE_EXT_SET;
        #ifdef __MMI_DUAL_PROFILE_SUPPORT__
            if(prfset_conf_type == PRFSET_MELODY_TYPE_CARD2_RING)
            {
                StrIDTitle = STR_PROFILES_SIM2_RING_TONE_SETUP_CAPTION_DEF;   
            }
            else
        #endif
            StrIDTitle = STR_PROFILES_RING_TONE_SETUP_CAPTION_DEF;
        }
        StrIDToneDel = STR_TONE_SETUP_RING_TONE_EXT_DEL;
        StrIDToneAdd = STR_TONE_SETUP_RING_TONE_EXT_ADD;
    }
#ifndef __MMI_ALM_CUSTOMIZE_TONE__
    else
    {
        StrIDToneSet = STR_TONE_SETUP_ALARM_TONE_EXT_SET;
        StrIDToneDel = STR_TONE_SETUP_ALARM_TONE_EXT_DEL;
        StrIDToneAdd = STR_TONE_SETUP_ALARM_TONE_EXT_ADD;
        StrIDTitle = STR_ALARM_TONE_CAPTION;
    }
#endif /* __MMI_ALM_CUSTOMIZE_TONE__ */

    if (PmgIsEmptySlot(g_ext_melody_idx) == MMI_FALSE)
    {
        /* Not Empty Slot */
        nStrItemList[PRF_MENU_EXTMLD_DONE] = StrIDToneSet;
        nStrItemList[PRF_MENU_EXTMLD_DEL] = StrIDToneDel;
        nStrItemList[PRF_MENU_EXTMLD_ADD] = StrIDToneAdd;
        nNumofItem = (U8) PRF_MENU_EXTMLD_MAX;
    }
    else    /* Empty slot, show replace only */
    {
        nStrItemList[0] = StrIDToneAdd;
        nNumofItem = 1;
    }

    EntryNewScreen(MENU_TONE_SETUP_RING_TONE_EXT_MELODY, NULL, mmi_profiles_Ext_melody_entry_menu, NULL);

    guiBuffer = GetCurrGuiBuffer(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);

    RegisterHighlightHandler(mmi_profiles_Ext_melody_hilite_hdlr);

    ShowCategory52Screen(
        StrIDTitle,
        (U16) (prfset_conf_type == PRFSET_MELODY_TYPE_PHB_RING ? IMG_SCR_PBOOK_CAPTION : GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID)),//IMG_PROFILES_TITLEE),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        (S32) nNumofItem,
        nStrItemList,
        item_icons,
        NULL,
        0,
        0,
        guiBuffer);

    SetLeftSoftkeyFunction(mmi_profiles_Ext_melody_action_hdlr, KEY_EVENT_UP);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_UP);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_set_tone_type
 * DESCRIPTION
 *  for modlues who uese the related apis to set the tone type.
 * PARAMETERS
 *  type        [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_set_tone_type(PRFSET_MELODY_CONF_TYPE type)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    prfset_conf_type = type;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_Ext_melody_delete_menu_screen
 * DESCRIPTION
 *  to delete the menu screen in the history when this ext melody has been deleted
 * PARAMETERS
 *  Tone_id        [IN]
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_Ext_melody_delete_menu_screen(U16 Tone_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 ring_id = 0;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;

    if(ring_id == Tone_id)
    {
        DeleteScreenIfPresent(MENU_TONE_SETUP_RING_TONE_EXT_MELODY);
    }
    return;
}
       
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_ring_tone_list_hdlr
 * DESCRIPTION
 *  ring tone list lsk hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_ring_tone_list_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_set_ring_tone_id_count_id(mmi_profiles_set_ring_tone_id_callback);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_tone_id_count_id
 * DESCRIPTION
 *  Count ring tone id to check which type of incoming call tone it belongs to
 * PARAMETERS
 *  Func_Callback       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_tone_id_count_id(void (*Func_Callback) (U8, U16))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 is_ext_melody = MMI_FALSE;
    U16 numOfItem = gtotalRingId + gtotalMidiId;
    U16 ring_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_profiles_melody_list_index < gtotalRingId)
    {
        ring_id = g_profiles_melody_list_index + gstartRingId;
    }
    else if (g_profiles_melody_list_index < numOfItem)
    {
        ring_id = g_profiles_melody_list_index + gstartMidiId - gtotalRingId;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
        is_ext_melody = MMI_TRUE;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
        if (g_profiles_melody_list_index == numOfItem)
        {
            DYNAUDIOINFO *download_theme_tones;

            if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
            {
                ring_id = (U16) download_theme_tones[0].AudioId;
            }
            else
            {
                ASSERT(0);
            }
        }
    #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
    }
    Func_Callback(is_ext_melody, ring_id);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_ring_tone_id_callback
 * DESCRIPTION
 *  set incoming call tone id callback.
 * PARAMETERS
 *  ExtMelodyFlag       [IN]       
 *  ringTone            [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_ring_tone_id_callback(U8 ExtMelodyFlag, U16 ringTone)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    if (ExtMelodyFlag == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_RING;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    {
        mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);

        SetRingToneID(ringTone);
        DeleteScreenIfPresent(SCR_PROFILES_RING_TONE_SETUP);
    }
}

#ifdef __MMI_DUAL_PROFILE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_card2_ring_tone_list
 * DESCRIPTION
 *  Showing profile Card2 Ring Tone Setup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_card2_ring_tone_list(void)
{

    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    U8 *guiBuffer;      /* Buffer holding history data */
    U16 selecteditem = 0;
    U8 totalItems = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_CARD2_RING_TONE_SETUP,
                   mmi_profiles_exit_card2_ring_tone_list,
                   mmi_profiles_entry_card2_ring_tone_list,
                   NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_CARD2_RING_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    totalItems = mmi_profiles_get_melody_list(gprofiles[gprofileId].toneSetup.card2_ringTone, &selecteditem);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_CARD2_RING_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(mmi_profiles_melody_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_PROFILES_SIM2_RING_TONE_SETUP_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        totalItems,
        subMenuDataPtrs,
        hintDataPtrs,
        0,
        selecteditem,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_entry_card2_ring_tone_list_hdlr, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_card2_ring_tone_list
 * DESCRIPTION
 *  Exit profile Card2 Ring ToneSetup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_card2_ring_tone_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_card2_ring_tone_id_callback
 * DESCRIPTION
 *  set card2 incoming call tone id callback.
 * PARAMETERS
 *  ExtMelodyFlag       [IN]       
 *  ringTone            [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_card2_ring_tone_id_callback(U8 ExtMelodyFlag, U16 ringTone)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    if (ExtMelodyFlag == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_CARD2_RING;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    {
        mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);

        SetCard2RingToneID(ringTone);
        DeleteScreenIfPresent(SCR_PROFILES_CARD2_RING_TONE_SETUP);
     }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_card2_ring_tone_list_hdlr
 * DESCRIPTION
 *  card2 ring tone list hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_card2_ring_tone_list_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_set_ring_tone_id_count_id(mmi_profiles_set_card2_ring_tone_id_callback);
}

#if defined(__CKT_EXTMEM_MSGTONE__)
U8 ckt_profiles_card2_get_msgtone_list(U16 CurMelodyID, U16 *selecteditem)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyInfo;
#endif
    int index, data;
    U16 nNumofItem = gtotalMiscToneId + 1;
    S32 result = 0 ;
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* init hint data */
    memset(hintData, 0, sizeof(hintData));
    for (data = 0; data < MAX_SUB_MENUS; data++)
    {
        hintDataPtrs[data] = hintData[data];
    }

    /* init submenu text */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (index = 1; index <= gtotalMiscToneId; index++)
    {
        memset((S8*) subMenuDataPtrs[index], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", index);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[index], (PS8) UnicodenStrItemList);
    }

    /* make a listing of ext melodies. */
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    PmgGetExtMelodyInfo(&ExtMelodyInfo);
    for (index = nNumofItem, data = 0; data < MAXIMUM_EXT_MELODY_NUM; index++, data++)
    {
        if (PmgIsEmptySlot((U8) data) == MMI_FALSE)
        {
            if (PmgQueryFileExistBySlot((U8) data) == MMI_FALSE)
            {
                mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(STR_TONE_FILE_NOT_EXIST));
            }

            if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[data].filepath))
            {
                mmi_chset_mixed_text_to_ucs2_str(
                    subMenuDataPtrs[index],
                    (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                    (U8*) ExtMelodyInfo->info[data].filename,
                    g_chset_text_encoding);
            }
            else
            {
                mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) ((ExtMelodyInfo->info[data]).filename));
            }
           
        #if (!defined(__MMI_SHOW_FILE_EXT__))
            PmgRemoveFileExt((S8*) subMenuDataPtrs[index]);
        #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
            PmgRemoveFileDAFExt((S8*) subMenuDataPtrs[index]);
        #endif
        }
        else
        {
            mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
        }
    }
#else
    index = nNumofItem ;
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */

    /* find highlight selection */
    if (CurMelodyID == MESSAGE_SILENT)
    {
        *selecteditem = 0;
    }
    else if ((CurMelodyID >= gstartMiscToneId)
        && (CurMelodyID < gstartMiscToneId + gtotalMiscToneId))
    {
        *selecteditem = (gprofiles[gprofileId].toneSetup.card2_messageTone - gstartMiscToneId) + 1;
    }
    else
    {
        BOOL selected = FALSE;

    #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if (PmgIsEmptySlot((U8) data) == MMI_FALSE && CurMelodyID == (ExtMelodyInfo->info[data]).id)
            {
                *selecteditem = nNumofItem + data;
                selected = TRUE;
                break;
            }
        }
        nNumofItem += MAXIMUM_EXT_MELODY_NUM;
    #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
       
        if(!selected)
        {
            /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
            gprofiles[gprofileId].toneSetup.card2_messageTone = gstartMiscToneId ;
            *selecteditem = 1;
        }
    }

    return (U8) index;
}

void ckt_profiles_card2_set_msgtone_id_callback(U8 ExtMelodyFlag, U16 ringTone)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    if (ExtMelodyFlag == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_CARD2_MSG_TONE;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    {
        tonesetup.card2_messageTone = ringTone;
        SetCard2MessageToneType(tonesetup);
        DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
        DeleteScreenIfPresent(SCR_CARD2_MESSAGE_TONE_SETUP);
    }
}

void ckt_profiles_card2_set_msgtone_id_count_id(void (*Func_Callback) (U8, U16))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 is_ext_melody = MMI_FALSE;
    U16 numOfItem = gtotalMiscToneId + 1;
    U16 ring_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_profiles_melody_list_index == 0)
    {
        ring_id = MESSAGE_SILENT;
    }
    else if ((g_profiles_melody_list_index >= 1)
        && (g_profiles_melody_list_index <= gtotalMiscToneId))
    {
        ring_id = g_profiles_melody_list_index + gstartMiscToneId - 1;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
        is_ext_melody = MMI_TRUE;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    }
   
    Func_Callback(is_ext_melody, ring_id);
}

void ckt_profiles_card2_entry_msgtone_list_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ckt_profiles_card2_set_msgtone_id_count_id(ckt_profiles_card2_set_msgtone_id_callback);
}

void ckt_profiles_card2_msgtone_list_highlight_hdlr(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    BOOL play_it = TRUE;
    U16 numOfItem = gtotalMiscToneId + 1;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_profiles_melody_list_index = (U16) item_index;

    mmi_profiles_preview_stop_tone();

    if (g_profiles_melody_list_index == 0)
    {
        return;
    }
    else if ((g_profiles_melody_list_index >= 1)
        && (g_profiles_melody_list_index <= gtotalMiscToneId))
    {
        gcurrentaudioId = g_profiles_melody_list_index + gstartMiscToneId - 1;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        gcurrentaudioId = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    }
   
    if (play_it)
    {
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}

void mmi_profiles_exit_message_tone(void);
void mmi_profiles_entry_card2_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U16 nDispAttribute;         /* Stores display attribue */
    U8 *guiBuffer;              /* Buffer holding history data */
    U16 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_CARD2_MESSAGE_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_card2_message_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_CARD2_MESSAGE_TONE_SETUP);

    /* 4. Get attribute of menu to be displayed */
    nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_CARD2_MESSAGE_TONE);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    nNumofItem = ckt_profiles_card2_get_msgtone_list(gprofiles[gprofileId].toneSetup.card2_messageTone, &data);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_CARD2_MESSAGE_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    /* MTK Brian modified for playing message tone, 2003/11/7 */
    RegisterHighlightHandler(ckt_profiles_card2_msgtone_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_SIM2_MESSAGE_TONE_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(mmi_profiles_stop_tone_and_go_back, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(ckt_profiles_card2_entry_msgtone_list_hdlr, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_stop_tone_and_go_back, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
#else /* __CKT_EXTMEM_MSGTONE__ */
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_card2_message_tone
 * DESCRIPTION
 *  Entry function for Card2 Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_card2_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_CARD2_MESSAGE_TONE_SETUP,
                            mmi_profiles_exit_card2_message_tone,
                            mmi_profiles_entry_card2_message_tone,
                            NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_CARD2_MESSAGE_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_CARD2_MESSAGE_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    /* MTK Brian modified for playing message tone, 2003/11/7 */
    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.card2_messageTone != MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.card2_messageTone - gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_SIM2_MESSAGE_TONE_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_card2_message_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
#endif //__CKT_EXTMEM_MSGTONE__

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_card2_message_tone
 * DESCRIPTION
 *  Exit profile Card2 Ring ToneSetup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_card2_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_card2_message_tone_hdlr
 * DESCRIPTION
 *  card2 message tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_card2_message_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.card2_messageTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.card2_messageTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);

    SetCard2MessageToneType(tonesetup);
    DeleteScreenIfPresent(SCR_CARD2_MESSAGE_TONE_SETUP);
}
#endif /* __MMI_DUAL_PROFILE_SUPPORT__*/


#ifdef __MMI_VIDEO_TELEPHONY__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_video_call_ring_tone_list
 * DESCRIPTION
 *  Showing profile Video Call Ring Tone Setup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_video_call_ring_tone_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;      /* Buffer holding history data */
    U16 selecteditem = 0;
    U8 totalItems = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(
        SCR_PROFILES_VIDEO_CALL_RING_TONE_SETUP,
        mmi_profiles_exit_video_call_ring_tone_list,
        mmi_profiles_entry_video_call_ring_tone_list,
        NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_VIDEO_CALL_RING_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    totalItems = mmi_profiles_get_melody_list(gprofiles[gprofileId].toneSetup.videoCallTone, &selecteditem);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_VIDEO_CALL_RING_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(mmi_profiles_melody_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_PROFILES_VIDEO_RING_TONE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        totalItems,
        subMenuDataPtrs,
        hintDataPtrs,
        0,
        selecteditem,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_entry_video_call_tone_list_hdlr, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_video_call_ring_tone_list
 * DESCRIPTION
 *  Exit profile Video Call Ring ToneSetup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_video_call_ring_tone_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_video_call_tone_list_hdlr
 * DESCRIPTION
 *  Setting video call tone ID.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_video_call_tone_list_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_set_ring_tone_id_count_id(mmi_profiles_set_video_call_tone_id_callback);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_video_call_tone_id_callback
 * DESCRIPTION
 *  video call tone setup callback after user select a ring tone from list
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_video_call_tone_id_callback(U8 ExtMelodyFlag, U16 videoCallTone)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    if (ExtMelodyFlag == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_VIDEO_CALL;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    {
        mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);

        SetVideoCallToneID(videoCallTone);
        DeleteScreenIfPresent(SCR_PROFILES_VIDEO_CALL_RING_TONE_SETUP);                   
    }

}
#endif /*__MMI_VIDEO_TELEPHONY__*/

#ifndef __MMI_POWER_ON_OFF_MUTE__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_power_on_tone
 * DESCRIPTION
 *  Entry function for Poweron Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_power_on_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */

    U16 nNumofItem;     /* Stores no of children in the submenu */
    U8 *guiBuffer;      /* Buffer holding history data */
    U8 i = 0;
    POWERON_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_POWERON_TONE_SETUP, mmi_profiles_exit_power_on_tone, mmi_profiles_entry_power_on_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_POWERON_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* nNumofItem = GetNumOfChild(MENU_TONE_SETUP_POWERON_TONE); */
    nNumofItem = gtotalGeneralToneId + 1;

    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalGeneralToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }
    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_POWERON_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlerfive);

    if (gprofiles[gprofileId].toneSetup.powerOnTone != POWERON_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.powerOnTone - gstartGeneralToneId) + 1;
    }
    else
    {
        data = 0;
    }

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_POWERON_TONE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);
    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_power_on_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_power_on_tone_hdlr
 * DESCRIPTION
 *  entry power on tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_power_on_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.powerOnTone = POWERON_SILENT;
    }
    else
    {
        tonesetup.powerOnTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetPowerOnToneType(tonesetup);
    DeleteScreenIfPresent(SCR_POWERON_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_power_on_tone
 * DESCRIPTION
 *  Exit fucntion for Poweron Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_power_on_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_power_off_tone
 * DESCRIPTION
 *  Entry function for Poweroff Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_power_off_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    POWEROFF_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_POWEROFF_TONE_SETUP, mmi_profiles_exit_power_off_tone, mmi_profiles_entry_power_off_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_POWEROFF_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalGeneralToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalGeneralToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_POWEROFF_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlerfive);

    /* 8 Display Category Screen */

    if (gprofiles[gprofileId].toneSetup.powerOffTone != POWEROFF_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.powerOffTone - gstartGeneralToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_POWEROFF_TONE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_power_off_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_power_off_tone_hdlr
 * DESCRIPTION
 *  Set PowerOff Tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_power_off_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.powerOffTone = POWEROFF_SILENT;
    }
    else
    {
        tonesetup.powerOffTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetPowerOffToneType(tonesetup);
    DeleteScreenIfPresent(SCR_POWEROFF_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_power_off_tone
 * DESCRIPTION
 *  Exit functino for Poweron Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_power_off_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}
#endif /*__MMI_POWER_ON_OFF_MUTE__*/


#ifdef __MMI_CLAMSHELL__
/*****************************************************************************
 * FUNCTION
 *  HighlightProfilesCoverOpenToneSetup
 * DESCRIPTION
 *  Highlight profile Cover Open Setup menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightProfilesCoverOpenToneSetup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_cover_open_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_cover_open_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_cover_open_tone
 * DESCRIPTION
 *  Entry function forCover Open Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_cover_open_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    COVER_OPEN_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(
        SCR_COVEROPEN_TONE_SETUP,
        mmi_profiles_exit_cover_open_tone,
        mmi_profiles_entry_cover_open_tone,
        NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_COVEROPEN_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalGeneralToneId + 1;

    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalGeneralToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_COVEROPEN_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlerfive);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.coverOpenTone != COVER_OPEN_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.coverOpenTone - gstartGeneralToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_COVEROPEN_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_cover_open_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_cover_open_tone_hdlr
 * DESCRIPTION
 *  set cover open tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_cover_open_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.coverOpenTone = COVER_OPEN_SILENT;
    }
    else
    {
        tonesetup.coverOpenTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetCoverOpenToneType(tonesetup);
    DeleteScreenIfPresent(SCR_COVEROPEN_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_cover_open_tone
 * DESCRIPTION
 *  Exit function for Cover Open Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_cover_open_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


/*****************************************************************************
 * FUNCTION
 *  HighlightProfilesCoverCloseToneSetup
 * DESCRIPTION
 *  Highlight profile Cover Close Setup menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightProfilesCoverCloseToneSetup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_cover_close_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_cover_close_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_cover_close_tone
 * DESCRIPTION
 *  Entry function for Cover Close Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_cover_close_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    COVER_CLOSE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(
        SCR_COVERCLOSE_TONE_SETUP,
        mmi_profiles_exit_cover_close_tone,
        mmi_profiles_entry_cover_close_tone,
        NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_COVERCLOSE_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalGeneralToneId + 1;

    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalGeneralToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_COVERCLOSE_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(GetCurrScreenHandlerfive);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.coverCloseTone != COVER_CLOSE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.coverCloseTone - gstartGeneralToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_COVERCLOSE_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_cover_close_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_cover_close_tone_hdlr
 * DESCRIPTION
 *  set cover close tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_cover_close_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.coverCloseTone = COVER_CLOSE_SILENT;
    }
    else
    {
        tonesetup.coverCloseTone = (gcurrHiliteIndexOne + gstartGeneralToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetCoverCloseToneType(tonesetup);
    DeleteScreenIfPresent(SCR_COVERCLOSE_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_cover_close_tone
 * DESCRIPTION
 *  Exit function for Cover Close Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_cover_close_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}
#endif /* __MMI_CLAMSHELL__ */

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_message_tone
 * DESCRIPTION
 *  Exit function for Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}

#ifndef __MMI_PROF_SPLIT_MSG_TONES__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_message_tone_hdlr
 * DESCRIPTION
 *  set message tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_message_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.messageTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.messageTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_MESSAGE);
    DeleteScreenIfPresent(SCR_MESSAGE_TONE_SETUP);
}

#if defined(__CKT_EXTMEM_MSGTONE__)
U8 ckt_profiles_get_msgtone_list(U16 CurMelodyID, U16 *selecteditem)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyInfo;
#endif
    int index, data;
    U16 nNumofItem = gtotalMiscToneId + 1;
    S32 result = 0 ;
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* init hint data */
    memset(hintData, 0, sizeof(hintData));
    for (data = 0; data < MAX_SUB_MENUS; data++)
    {
        hintDataPtrs[data] = hintData[data];
    }

    /* init submenu text */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (index = 1; index <= gtotalMiscToneId; index++)
    {
        memset((S8*) subMenuDataPtrs[index], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", index);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[index], (PS8) UnicodenStrItemList);
    }

    /* make a listing of ext melodies. */
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    PmgGetExtMelodyInfo(&ExtMelodyInfo);
    for (index = nNumofItem, data = 0; data < MAXIMUM_EXT_MELODY_NUM; index++, data++)
    {
        if (PmgIsEmptySlot((U8) data) == MMI_FALSE)
        {
            if (PmgQueryFileExistBySlot((U8) data) == MMI_FALSE)
            {
                mmi_ucs2cpy((S8*) hintData[index], (S8*) GetString(STR_TONE_FILE_NOT_EXIST));
            }

            if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[data].filepath))
            {
                mmi_chset_mixed_text_to_ucs2_str(
                    subMenuDataPtrs[index],
                    (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                    (U8*) ExtMelodyInfo->info[data].filename,
                    g_chset_text_encoding);
            }
            else
            {
                mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) ((ExtMelodyInfo->info[data]).filename));
            }
           
        #if (!defined(__MMI_SHOW_FILE_EXT__))
            PmgRemoveFileExt((S8*) subMenuDataPtrs[index]);
        #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
            PmgRemoveFileDAFExt((S8*) subMenuDataPtrs[index]);
        #endif
        }
        else
        {
            mmi_ucs2cpy((S8*) subMenuDataPtrs[index], (S8*) GetString(STR_GLOBAL_EMPTY_LIST));
        }
    }
#else
    index = nNumofItem ;
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */

    /* find highlight selection */
    if (CurMelodyID == MESSAGE_SILENT)
    {
        *selecteditem = 0;
    }
    else if ((CurMelodyID >= gstartMiscToneId)
        && (CurMelodyID < gstartMiscToneId + gtotalMiscToneId))
    {
        *selecteditem = (gprofiles[gprofileId].toneSetup.messageTone - gstartMiscToneId) + 1;
    }
    else
    {
        BOOL selected = FALSE;

    #ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if (PmgIsEmptySlot((U8) data) == MMI_FALSE && CurMelodyID == (ExtMelodyInfo->info[data]).id)
            {
                *selecteditem = nNumofItem + data;
                selected = TRUE;
                break;
            }
        }
        nNumofItem += MAXIMUM_EXT_MELODY_NUM;
    #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
       
        if(!selected)
        {
            /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
            gprofiles[gprofileId].toneSetup.messageTone = gstartMiscToneId ;
            *selecteditem = 1;
        }
    }

    return (U8) index;
}

void ckt_profiles_set_msgtone_id_callback(U8 ExtMelodyFlag, U16 ringTone)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    if (ExtMelodyFlag == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_MSG_TONE;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
    {
        tonesetup.messageTone = ringTone;
        SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_MESSAGE);
        DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
        DeleteScreenIfPresent(SCR_MESSAGE_TONE_SETUP);
    }
}

void ckt_profiles_set_msgtone_id_count_id(void (*Func_Callback) (U8, U16))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 is_ext_melody = MMI_FALSE;
    U16 numOfItem = gtotalMiscToneId + 1;
    U16 ring_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_profiles_melody_list_index == 0)
    {
        ring_id = MESSAGE_SILENT;
    }
    else if ((g_profiles_melody_list_index >= 1)
        && (g_profiles_melody_list_index <= gtotalMiscToneId))
    {
        ring_id = g_profiles_melody_list_index + gstartMiscToneId - 1;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
        is_ext_melody = MMI_TRUE;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    }
   
    Func_Callback(is_ext_melody, ring_id);
}

void ckt_profiles_entry_msgtone_list_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ckt_profiles_set_msgtone_id_count_id(ckt_profiles_set_msgtone_id_callback);
}

void ckt_profiles_msgtone_list_highlight_hdlr(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    BOOL play_it = TRUE;
    U16 numOfItem = gtotalMiscToneId + 1;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_profiles_melody_list_index = (U16) item_index;

    mmi_profiles_preview_stop_tone();

    if (g_profiles_melody_list_index == 0)
    {
        return;
    }
    else if ((g_profiles_melody_list_index >= 1)
        && (g_profiles_melody_list_index <= gtotalMiscToneId))
    {
        gcurrentaudioId = g_profiles_melody_list_index + gstartMiscToneId - 1;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        gcurrentaudioId = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    }
   
    if (play_it)
    {
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}

void mmi_profiles_entry_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U16 nDispAttribute;         /* Stores display attribue */
    U8 *guiBuffer;              /* Buffer holding history data */
    U16 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_MESSAGE_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_message_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_MESSAGE_TONE_SETUP);

    /* 4. Get attribute of menu to be displayed */
    nDispAttribute = GetDispAttributeOfItem(MENU_TONE_SETUP_MESSAGE_TONE);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    nNumofItem = ckt_profiles_get_msgtone_list(gprofiles[gprofileId].toneSetup.messageTone, &data);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_MESSAGE_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    /* MTK Brian modified for playing message tone, 2003/11/7 */
    RegisterHighlightHandler(ckt_profiles_msgtone_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_MESSAGE_TONE_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(mmi_profiles_stop_tone_and_go_back, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(ckt_profiles_entry_msgtone_list_hdlr, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_stop_tone_and_go_back, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
#else /* __CKT_EXTMEM_MSGTONE__ */
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_message_tone
 * DESCRIPTION
 *  Entry function for Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_MESSAGE_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_message_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_MESSAGE_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_MESSAGE_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    /* MTK Brian modified for playing message tone, 2003/11/7 */
    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.messageTone != MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.messageTone - gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_MESSAGE_TONE_CAPTION_DEF,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_message_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}
#endif /* __CKT_EXTMEM_MSGTONE__ */
#else /*__MMI_PROF_SPLIT_MSG_TONES__*/
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_split_message_hilite_hdlr
 * DESCRIPTION
 *  split message hilite hdlr
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_split_message_hilite_hdlr(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = item_index;

    if (glastaudioId > 0)
    {
        mmi_profiles_preview_stop_tone();
    }

    if (gcurrHiliteIndexOne == 0)
    {
        gcurrentaudioId = 0;
        glastaudioId = gcurrentaudioId;
        StopTimer(TIMER_PROFILES_TONE_PLAY);
    }
    else
    {
        gcurrentaudioId = gcurrHiliteIndexOne + gstartMiscToneId - 1;   
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}


#ifdef MMS_SUPPORT
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_message_tone_hdlr
 * DESCRIPTION
 *  set MMS message tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_mms_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.mmsTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.mmsTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_MMS);
    DeleteScreenIfPresent(SCR_MMS_TONE_SETUP);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_mms_tone
 * DESCRIPTION
 *  Entry function for MMS Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_mms_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    U16 data = 0;
    U16 soundid;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_MMS_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_mms_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_MMS_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    i++;

    for (; i <= nNumofItem; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_MMS_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(mmi_profiles_split_message_hilite_hdlr);

    /* 8 Display Category Screen */
    soundid = gprofiles[gprofileId].toneSetup.mmsTone;

    if (soundid == MESSAGE_SILENT)
    {
        data = 0 ;
    }
    else
    {
        data = (gprofiles[gprofileId].toneSetup.mmsTone - gstartMiscToneId) + 1;
    }

    ShowCategory89Screen(
        STR_PROFILES_MMS_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_mms_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}
#endif /*MMS_SUPPORT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_message_tone_hdlr
 * DESCRIPTION
 *  set SMS message tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_sms_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.smsTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.smsTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_SMS);
    DeleteScreenIfPresent(SCR_SMS_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_sms_tone
 * DESCRIPTION
 *  Entry function for SMS Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_sms_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    U16 data = 0;
    U16 soundid;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_SMS_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_sms_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_SMS_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    i++;

    for (; i <= nNumofItem; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_SMS_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(mmi_profiles_split_message_hilite_hdlr);

    /* 8 Display Category Screen */
    soundid = gprofiles[gprofileId].toneSetup.smsTone;

    if (soundid == MESSAGE_SILENT)
    {
        data = 0 ;
    }
    else
    {
        data = (soundid - gstartMiscToneId) + 1;
    }

    ShowCategory89Screen(
        STR_GLOBAL_TEXT_MESSAGE,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_sms_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

#ifdef __MMI_EMAIL__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_email_tone_hdlr
 * DESCRIPTION
 *  set email tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_email_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.emailTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.emailTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetMessageToneType(tonesetup,MMI_PROFILE_MESSAGE_TYPE_EMAIL);
    DeleteScreenIfPresent(SCR_EMAIL_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_email_tone
 * DESCRIPTION
 *  Entry function for email Message Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_email_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    U16 data = 0;
    U16 soundid;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_EMAIL_TONE_SETUP, mmi_profiles_exit_message_tone, mmi_profiles_entry_email_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_EMAIL_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    i++;

    for (; i <= nNumofItem; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);
    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_EMAIL_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(mmi_profiles_split_message_hilite_hdlr);

    /* 8 Display Category Screen */
    soundid = gprofiles[gprofileId].toneSetup.emailTone;

    if (soundid == MESSAGE_SILENT)
    {
        data = 0 ;
    }
    else
    {
        data = (soundid - gstartMiscToneId) + 1;
    }

    ShowCategory89Screen(
        STR_GLOBAL_EMAIL,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_email_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}
#endif /*__MMI_EMAIL__*/

#ifdef __MMI_OP11_MMS_SUPPORT_AUDIO_MSG__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /*__MMI_OP11_MMS_SUPPORT_AUDIO_MSG__*/

#endif /*__MMI_PROF_SPLIT_MSG_TONES__*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_keypad_tone
 * DESCRIPTION
 *  Entry function for Keypad Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_keypad_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 *guiBuffer;          /* Buffer holding history data */
    KEYPAD_TONE_ENUM data = 0;
    U8 i = 0;
    U16 ProfileMenuID;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_KEYPAD_TONE_SETUP, NULL, mmi_profiles_entry_keypad_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_KEYPAD_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_TONE_SETUP_KEYPAD_TONE);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_TONE_SETUP_KEYPAD_TONE, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_KEYPAD_TONE);

    /* 7 Register highlight handler to be called in menu screen */

    /* 8 Display Category Screen */
    i = gprofiles[gprofileId].toneSetup.keypadTone;
    switch (i)
    {
        case KEYPAD_SILENT:
            ProfileMenuID = MENU_KEYPAD_TONE_SILENT;
            break;
        case KEYPAD_CLICK:
            ProfileMenuID = MENU_KEYPAD_TONE_CLICK;
            break;
        case KEYPAD_TONE:
            ProfileMenuID = MENU_KEYPAD_TONE_TONE;
            break;
    #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
        case KEYPAD_TONE_HUMAN_VOICE_1:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_1;
            break;
        case KEYPAD_TONE_HUMAN_VOICE_2:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_2;
            break;
        case KEYPAD_TONE_HUMAN_VOICE_3:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_3;
            break;
        case KEYPAD_TONE_HUMAN_VOICE_4:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_4;
            break;
        case KEYPAD_TONE_HUMAN_VOICE_5:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_5;
            break;
        case KEYPAD_TONE_HUMAN_VOICE_6:
            ProfileMenuID = MENU_KEYPAD_TONE_HUMAN_VOICE_6;
            break;
    #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
    #if defined(__MMI_CUST_KEYPAD_TONE__)
        case KEYPAD_TONE_CUST_1:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_1;
            break;
        case KEYPAD_TONE_CUST_2:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_2;
            break;
        case KEYPAD_TONE_CUST_3:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_3;
            break;
        case KEYPAD_TONE_CUST_4:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_4;
            break;
        case KEYPAD_TONE_CUST_5:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_5;
            break;
        case KEYPAD_TONE_CUST_6:
            ProfileMenuID = MENU_KEYPAD_TONE_CUST_6;
            break;
    #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
        default:
            ProfileMenuID = 0;
            break;
    }
    data = GetIndexOfStringId(MENU_TONE_SETUP_KEYPAD_TONE, ProfileMenuID);

    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    ShowCategory11Screen(
        STR_KEYPAD_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        0,
        STR_GLOBAL_BACK,
        0,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_silent_hdlr
 * DESCRIPTION
 *  set keypad tone as Silent
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_silent_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_SILENT);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_click_hdlr
 * DESCRIPTION
 *  set keypad tone as Click
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_click_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_CLICK);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_tone_hdlr
 * DESCRIPTION
 *  set keypad tone as Tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}

#if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human1_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 1
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human1_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_1);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human2_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 2
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human2_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_2);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human3_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 3
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human3_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_3);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human4_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 4
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human4_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_4);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human5_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 5
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human5_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_5);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_human6_hdlr
 * DESCRIPTION
 *  set keypad tone as human voice 6
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_human6_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_HUMAN_VOICE_6);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}
#endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */

#if defined(__MMI_CUST_KEYPAD_TONE__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust1_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 1
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust1_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_1);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust2_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 2
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust2_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_2);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust3_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 3
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust3_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_3);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust4_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 4
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust4_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_4);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust5_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 5
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust5_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_5);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_key_pad_tone_cust6_hdlr
 * DESCRIPTION
 *  set keypad tone as customer keypad tone 6
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_key_pad_tone_cust6_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeypadToneType(KEYPAD_TONE_CUST_6);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_KEYPAD_TONE_SETUP);
}
#endif /* defined(__MMI_CUST_KEYPAD_TONE__) */

#ifndef __MMI_ALM_CUSTOMIZE_TONE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_alarm_tone
 * DESCRIPTION
 *  Entry function for Alarm Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_alarm_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;      /* Buffer holding history data */
    U16 selecteditem = 0;
    U8 totalItems = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_ALARM_TONE_SETUP, mmi_profiles_exit_alarm_tone, mmi_profiles_entry_alarm_tone, NULL);

    gcurrHiliteIndexOne = 0;

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_ALARM_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    totalItems = mmi_profiles_get_melody_list(gprofiles[gprofileId].toneSetup.alarmTone, &selecteditem);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_ALARM_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(mmi_profiles_melody_list_highlight_hdlr);

    /* 8 Display Category Screen */
    ShowCategory89Screen(
        STR_ALARM_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        totalItems,
        subMenuDataPtrs,
        hintDataPtrs,
        0,
        selecteditem,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_alarm_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_alarm_tone_hdlr
 * DESCRIPTION
 *  Set Alarm Tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_alarm_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 is_ext_melody = MMI_FALSE;
    U16 numOfItem = gtotalRingId + gtotalMidiId;
    U16 ring_id = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_profiles_melody_list_index < gtotalRingId)
    {
        ring_id = g_profiles_melody_list_index + gstartRingId;
    }
    else if (g_profiles_melody_list_index < numOfItem)
    {
        ring_id = g_profiles_melody_list_index + gstartMidiId - gtotalRingId;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        ring_id = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
        is_ext_melody = MMI_TRUE;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
        if (g_profiles_melody_list_index == numOfItem)
        {
            DYNAUDIOINFO *download_theme_tones;

            if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
            {
                ring_id = (U16) download_theme_tones[0].AudioId;
            }
            else
            {
                ASSERT(0);
            }
        }
    #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    if (is_ext_melody == MMI_TRUE)
    {
        prfset_conf_type = PRFSET_MELODY_TYPE_ALARM;
        mmi_profiles_Ext_melody_entry_menu();
    }
    else
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    {
        mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
        SetAlarmToneID(ring_id);
        DeleteScreenIfPresent(SCR_ALARM_TONE_SETUP);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_alarm_tone
 * DESCRIPTION
 *  Exit function for Alarm Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_alarm_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}
#endif /* __MMI_ALM_CUSTOMIZE_TONE__ */

#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone
 * DESCRIPTION
 *  Entry function for IMPS Tone Setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    U8 *PopUpList[MAX_SUB_MENUS];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_TONE_SETUP, NULL, mmi_profiles_entry_IMPS_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild_Ext(MENU_TONE_SETUP_IMPS_TONE);

    /* 5. Retrieve string ids in sequence @of given menu item to be displayed */
    GetSequenceStringIds_Ext(MENU_TONE_SETUP_IMPS_TONE, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_IMPS_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    /* 8 Display Category Screen */
    ConstructHintsList(MENU_TONE_SETUP_IMPS_TONE, PopUpList);
    ShowCategory52Screen(
        STR_PROFILES_IMPS_TONE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (PU16) gIndexIconsImageList,
        PopUpList,
        0,
        0,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_contact_online
 * DESCRIPTION
 *  Entry function for IMPS Tone Setup : contact online
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_contact_online(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_CONNECT_ONLINE_TONE_SETUP,
                   mmi_profiles_exit_IMPS_tone_contact_online,
                   mmi_profiles_entry_IMPS_tone_contact_online, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_CONNECT_ONLINE_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_IMPS_TONE_CONTACT_ONLINE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.IMPSContactOnlineTone!= MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.IMPSContactOnlineTone- gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_PROFILES_IMPS_TONE_CONTACT_ONLINE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_contact_online_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_contact_online_hdlr
 * DESCRIPTION
 *  set IMPS tone : contact online hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_contact_online_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.IMPSContactOnlineTone= MESSAGE_SILENT;
    }
    else
    {
        tonesetup.IMPSContactOnlineTone= (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetIMPSContactOnlineToneType(tonesetup);
    DeleteScreenIfPresent(SCR_PROFILES_IMPS_CONNECT_ONLINE_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_IMPS_tone_contact_online
 * DESCRIPTION
 *  Exit function for IMPS Tone Setup : contact online
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_IMPS_tone_contact_online(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_new_message
 * DESCRIPTION
 *  Entry function for IMPS Tone Setup : new message
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_new_message(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_NEW_MESSAGE_TONE_SETUP,
                   mmi_profiles_exit_IMPS_tone_new_message,
                   mmi_profiles_entry_IMPS_tone_new_message, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_NEW_MESSAGE_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_IMPS_TONE_NEW_MESSAGE);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.IMPSNewMessageTone!= MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.IMPSNewMessageTone - gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_PROFILES_IMPS_TONE_NEW_MESSAGE_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_new_message_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_new_message_hdlr
 * DESCRIPTION
 *  set IMPS tone : new message hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_new_message_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.IMPSNewMessageTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.IMPSNewMessageTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetIMPSNewMessageToneType(tonesetup);
    DeleteScreenIfPresent(SCR_PROFILES_IMPS_NEW_MESSAGE_TONE_SETUP);
}

 

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_IMPS_tone_new_message
 * DESCRIPTION
 *  Exit function for IMPS Tone Setup : new message
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_IMPS_tone_new_message(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_new_invitation
 * DESCRIPTION
 *  Entry function for IMPS Tone Setup : new invitation
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_new_invitation(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_NEW_INVITATION_TONE_SETUP,
                   mmi_profiles_exit_IMPS_tone_new_invitation,
                   mmi_profiles_entry_IMPS_tone_new_invitation, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_NEW_INVITATION_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_IMPS_TONE_NEW_INVITATION);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.IMPSNewInvitationTone!= MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.IMPSNewInvitationTone - gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_PROFILES_IMPS_TONE_NEW_INVITATION_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_new_invitation_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_new_invitation_hdlr
 * DESCRIPTION
 *  set IMPS tone : new invitation hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_new_invitation_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.IMPSNewInvitationTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.IMPSNewInvitationTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetIMPSNewInvitationToneType(tonesetup);
    DeleteScreenIfPresent(SCR_PROFILES_IMPS_NEW_INVITATION_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_IMPS_tone_new_invitation
 * DESCRIPTION
 *  Exit function for IMPS Tone Setup : new invitation
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_IMPS_tone_new_invitation(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_chatroom_notification
 * DESCRIPTION
 *  Entry function for IMPS Tone Setup : chatroom notification
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_chatroom_notification(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;             /* Stores no of children in the submenu */
    U8 *guiBuffer;              /* Buffer holding history data */
    U8 i = 0;
    MESSAGE_TONE_ENUM data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_IMPS_CHATROOM_NOTIFICATION_TONE_SETUP,
                   mmi_profiles_exit_IMPS_tone_chatroom_notification,
                   mmi_profiles_entry_IMPS_tone_chatroom_notification, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_IMPS_CHATROOM_NOTIFICATION_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = gtotalMiscToneId + 1;

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    memset((S8*) subMenuDataPtrs[0], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);

    for (i = 1; i <= gtotalMiscToneId; i++)
    {
        S32 len = 0;

        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", i);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], (S8*) GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((PS8) subMenuDataPtrs[i], (PS8) UnicodenStrItemList);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_TONE_SETUP_IMPS_TONE_CHATROOM_NOTIFICATION);

    /* 7 Register highlight handler to be called in menu screen */

    RegisterHighlightHandler(GetCurrScreenHandlersix);

    /* 8 Display Category Screen */
    if (gprofiles[gprofileId].toneSetup.IMPSChatroomNotificationTone!= MESSAGE_SILENT)
    {
        data = (gprofiles[gprofileId].toneSetup.IMPSChatroomNotificationTone - gstartMiscToneId) + 1;
    }
    else
    {
        data = 0;
    }

    ShowCategory89Screen(
        STR_PROFILES_IMPS_TONE_CHATROOM_NOTIFICATION_SETUP_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        subMenuDataPtrs,
        NULL,
        0,
        (U16) data,
        guiBuffer);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_chatroom_notification_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_IMPS_tone_chatroom_notification_hdlr
 * DESCRIPTION
 *  set IMPS tone : chatroom notification hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_IMPS_tone_chatroom_notification_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_profiles_tone_struct tonesetup;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (gcurrHiliteIndexOne == 0)
    {
        tonesetup.IMPSChatroomNotificationTone = MESSAGE_SILENT;
    }
    else
    {
        tonesetup.IMPSChatroomNotificationTone = (gcurrHiliteIndexOne + gstartMiscToneId) - 1;
    }

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    SetIMPSChatroomNotificationToneType(tonesetup);
    DeleteScreenIfPresent(SCR_PROFILES_IMPS_CHATROOM_NOTIFICATION_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_exit_IMPS_tone_chatroom_notification
 * DESCRIPTION
 *  Exit function for IMPS Tone Setup : chatroom notification
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_exit_IMPS_tone_chatroom_notification(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_preview_stop_tone();
}


#endif /*__MMI_IMPS__ && IMPS_WV13_ENHANCEMENT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_extra_tone
 * DESCRIPTION
 *  Showing profile Extra Tone Setup Screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_extra_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[15];   /* Stores the strings id of submenus returned */
    U16 nNumofItem;         /* Stores no of children in the submenu */
    U8 i = 0;
    U8 *guiBuffer;          /* Buffer holding history data */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_EXTRA_TONE_SETUP, NULL, mmi_profiles_entry_extra_tone, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_EXTRA_TONE_SETUP);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_EXTRA_TONE);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_EXTRA_TONE, nStrItemList);

    for (i = 0; i < nNumofItem; i++)
    {
        memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
        mmi_ucs2ncpy((S8*) subMenuDataPtrs[i], GetString(nStrItemList[i]), MAX_SUBMENU_CHARACTERS);

    }

    /* 6 Set current parent id */
    SetParentHandler(MENU_EXTRA_TONE);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    fieldStatesExtraTone[0] = (U8) gprofiles[gprofileId].extraTone.warningTone;
    fieldStatesExtraTone[1] = (U8) gprofiles[gprofileId].extraTone.errorTone;
    fieldStatesExtraTone[2] = (U8) gprofiles[gprofileId].extraTone.campOnTone;
    fieldStatesExtraTone[3] = (U8) gprofiles[gprofileId].extraTone.connectTone;

    SetCheckboxToggleRightSoftkeyFunctions(mmi_profiles_set_extra_tone_query_popup, GoBackHistory);

    /* 8 Display Category Screen */
    ShowCategory140Screen(
        STR_EXTRA_TONE_CAPTION,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        nNumofItem,
        (U8 **) subMenuDataPtrs,
        fieldStatesExtraTone,
        0,
        guiBuffer);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_extra_tone_hdlr
 * DESCRIPTION
 *  set extra tone hdlr
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_extra_tone_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    EXTRA_TONE extraTone;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    extraTone.warningTone = gprofiles[gprofileId].extraTone.warningTone = fieldStatesExtraTone[0];
    extraTone.errorTone = gprofiles[gprofileId].extraTone.errorTone = fieldStatesExtraTone[1];
    extraTone.campOnTone = gprofiles[gprofileId].extraTone.campOnTone = fieldStatesExtraTone[2];
    extraTone.connectTone = gprofiles[gprofileId].extraTone.connectTone = fieldStatesExtraTone[3];

    SetExtraTone(extraTone);

    /* DisplayPopupCheckBox((PU8)GetString(STR_GLOBAL_DONE) ,IMG_GLOBAL_ACTIVATED, 1,UI_POPUP_NOTIFYDURATION_TIME,SUCCESS_TONE); */

    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_SAVED),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_EXTRA_TONE_SETUP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_extra_tone_query_popup
 * DESCRIPTION
 *  set the call back functios for Extra tone query popup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_extra_tone_query_popup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_profiles_set_query_popup(mmi_profiles_entry_extra_tone_hdlr, ProfileGoBack2History);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_preview_play_tone
 * DESCRIPTION
 *  preview tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_preview_play_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    StopTimer(TIMER_PROFILES_TONE_PLAY);
    glastaudioId = gcurrentaudioId;

    if (!IsSilentModeActivated() && !isInCall())    /* need to check if it's in call because phonebook use this function, too */
    {
    #ifdef __DRM_SUPPORT__
        if (gcurrentaudioId >= PMG_EXT_MELODY_BEGIN && gcurrentaudioId <= PMG_EXT_MELODY_END)
        {
            S8 buf[MAX_EXT_MELODY_FULLNAME_WIDTH];
            if (PmgGetFilePathNameByAudioId(buf, sizeof(buf), gcurrentaudioId) == MMI_TRUE)
            {
                FS_HANDLE handle;
                handle = DRM_open_file((PU16)buf, FS_READ_ONLY, DRM_PERMISSION_PLAY);

                if (handle >= FS_NO_ERROR)
                {
                    if(!DRM_validate_forward_rule(handle, DRM_PERMISSION_PLAY))
                    {
                        DRM_close_file(handle);
                        return;
                    }
                    DRM_close_file(handle);
                    mdi_audio_drm_disable_consume_all();
                }
                else
                {
                    return;
                }
            }
        }
    #endif
    #ifdef __MMI_SILENT_MEETING_PROFILE__
        if (!IsMeetingModeActivated())
        {
            AudioPlayReq(gcurrentaudioId, (U8) DEVICE_AUDIO_PLAY_INFINITE);
        }
        else
        {
            glastaudioId = 0 ;
        }
    #else
            AudioPlayReq(gcurrentaudioId, (U8) DEVICE_AUDIO_PLAY_INFINITE);
    #endif
    }
    else
    {
        /*reset to 0 so that mmi_profiles_preview_stop_tone will not try to stop the un-plyaed tone*/
        glastaudioId = 0 ;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_preview_stop_tone
 * DESCRIPTION
 *  stop preview tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_preview_stop_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    StopTimer(TIMER_PROFILES_TONE_PLAY);
    if (!isInCall()) /* need to check if it's in call because phonebook use this function, too */
    {
        if (glastaudioId != 0)
        {
            AudioStopReq(glastaudioId);
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_show_alert_status_icon
 * DESCRIPTION
 *  show/switch alert status icon
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_show_alert_status_icon(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    static S16 currentStatusIcon;

    /* MTK Brian added for wrap sublcd display, 2003/10/18 */
#ifdef __MMI_SUBLCD__
    static S16 currentStatusSubLcdIcon;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (currentStatusSubLcdIcon != 0)
    {
        HideStatusIcon(currentStatusSubLcdIcon);
    }
#endif /* __MMI_SUBLCD__ */

    if(g_pwr_context.PowerOnMode != POWER_ON_KEYPAD && g_pwr_context.PowerOnMode != POWER_ON_EXCEPTION)
    {
        return;
    }

    if (currentStatusIcon != 0)
    {
        HideStatusIcon(currentStatusIcon);
    }

    switch (gcurrentprofile.mtCallAlertTypeEnum)
    {
        case MMI_RING:
            currentStatusIcon = STATUS_ICON_RING;
            ShowStatusIcon(STATUS_ICON_RING);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_RING;
            ShowStatusIcon(STATUS_ICON_SUBLCD_RING);
        #endif /* __MMI_SUBLCD__ */
            break;
        case MMI_VIBRATION_ONLY:
            currentStatusIcon = STATUS_ICON_VIBRATION;
            ShowStatusIcon(STATUS_ICON_VIBRATION);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_VIBRATE;
            ShowStatusIcon(STATUS_ICON_SUBLCD_VIBRATE);
        #endif /* __MMI_SUBLCD__ */
            break;
        case MMI_VIBRATION_AND_RING:
            currentStatusIcon = STATUS_ICON_VIBRATE_AND_RING;
            ShowStatusIcon(STATUS_ICON_VIBRATE_AND_RING);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_VIBRATE_AND_RING;
            ShowStatusIcon(STATUS_ICON_SUBLCD_VIBRATE_AND_RING);
        #endif /* __MMI_SUBLCD__ */
            break;
        case MMI_VIBRATION_THEN_RING:
            currentStatusIcon = STATUS_ICON_VIBRATE_THEN_RING;
            ShowStatusIcon(STATUS_ICON_VIBRATE_THEN_RING);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_VIBRATE_THEN_RING;
            ShowStatusIcon(STATUS_ICON_SUBLCD_VIBRATE_THEN_RING);
        #endif /* __MMI_SUBLCD__ */
            break;
        case MMI_SILENT:
            currentStatusIcon = STATUS_ICON_SILENT;
            ShowStatusIcon(STATUS_ICON_SILENT);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_SILENT;
            ShowStatusIcon(STATUS_ICON_SUBLCD_SILENT);
        #endif /* __MMI_SUBLCD__ */
            break;
        default:
            currentStatusIcon = STATUS_ICON_RING;
            ShowStatusIcon(STATUS_ICON_RING);
        #ifdef __MMI_SUBLCD__
            currentStatusSubLcdIcon = STATUS_ICON_SUBLCD_RING;
            ShowStatusIcon(STATUS_ICON_SUBLCD_RING);
        #endif /* __MMI_SUBLCD__ */
            break;
    }
    UpdateStatusIcons();
}


/*****************************************************************************
 * FUNCTION
 *  ReturnRequiredNumberImageId
 * DESCRIPTION
 * 
 * PARAMETERS
 *  imageId     [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
U16 ReturnRequiredNumberImageId(U8 imageId)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __CUSTOMER_SPICE__ //add by heyimin 20091224
 if(GetThemes() == 1)
 {
     switch (imageId + 1)
     {
         case 1:
             return IMG_GLOBAL_L1;
         case 2:
             return IMG_GLOBAL_L2;
         case 3:
             return IMG_GLOBAL_L3;
         case 4:
             return IMG_GLOBAL_L4;
         case 5:
             return IMG_GLOBAL_L5;
         case 6:
             return IMG_GLOBAL_L6;
         case 7:
             return IMG_GLOBAL_L7;
         case 8:
             return IMG_GLOBAL_L8;
         case 9:
             return IMG_GLOBAL_L9;
         case 10:
             return IMG_GLOBAL_L10;
         case 11:
             return IMG_GLOBAL_L11;
         case 12:
             return IMG_GLOBAL_L12;
         case 13:
             return IMG_GLOBAL_L13;
         case 14:
             return IMG_GLOBAL_L14;
         case 15:
             return IMG_GLOBAL_L15;
         case 16:
             return IMG_GLOBAL_L16;
         case 17:
             return IMG_GLOBAL_L17;
         case 18:
             return IMG_GLOBAL_L18;
         case 19:
             return IMG_GLOBAL_L19;
         case 20:
             return IMG_GLOBAL_L20;
         case 21:
             return IMG_GLOBAL_L21;
         case 22:
             return IMG_GLOBAL_L22;
         case 23:
             return IMG_GLOBAL_L23;
         case 24:
             return IMG_GLOBAL_L24;
         case 25:
             return IMG_GLOBAL_L25;
         case 26:
             return IMG_GLOBAL_L26;
         case 27:
             return IMG_GLOBAL_L27;
         case 28:
             return IMG_GLOBAL_L28;
         case 29:
             return IMG_GLOBAL_L29;
         case 30:
             return IMG_GLOBAL_L30;
         default:
             return IMG_GLOBAL_QUESTION;
     }
 }
 else if(GetThemes() == 2)
 {
     switch (imageId + 1)
     {
         case 1:
             return IMG_GLOBAL_L1_F;
         case 2:
             return IMG_GLOBAL_L2_F;
         case 3:
             return IMG_GLOBAL_L3_F;
         case 4:
             return IMG_GLOBAL_L4_F;
         case 5:
             return IMG_GLOBAL_L5_F;
         case 6:
             return IMG_GLOBAL_L6_F;
         case 7:
             return IMG_GLOBAL_L7_F;
         case 8:
             return IMG_GLOBAL_L8_F;
         case 9:
             return IMG_GLOBAL_L9_F;
         case 10:
             return IMG_GLOBAL_L10_F;
         case 11:
             return IMG_GLOBAL_L11_F;
         case 12:
             return IMG_GLOBAL_L12_F;
         case 13:
             return IMG_GLOBAL_L13_F;
         case 14:
             return IMG_GLOBAL_L14_F;
         case 15:
             return IMG_GLOBAL_L15_F;
         case 16:
             return IMG_GLOBAL_L16_F;
         case 17:
             return IMG_GLOBAL_L17_F;
         case 18:
             return IMG_GLOBAL_L18_F;
         case 19:
             return IMG_GLOBAL_L19_F;
         case 20:
             return IMG_GLOBAL_L20_F;
         case 21:
             return IMG_GLOBAL_L21_F;
         case 22:
             return IMG_GLOBAL_L22_F;
         case 23:
             return IMG_GLOBAL_L23_F;
         case 24:
             return IMG_GLOBAL_L24_F;
         case 25:
             return IMG_GLOBAL_L25_F;
         case 26:
             return IMG_GLOBAL_L26_F;
         case 27:
             return IMG_GLOBAL_L27_F;
         case 28:
             return IMG_GLOBAL_L28_F;
         case 29:
             return IMG_GLOBAL_L29_F;
         case 30:
             return IMG_GLOBAL_L30_F;
         default:
             return IMG_GLOBAL_QUESTION;
     }
 }
 else if(GetThemes() == 3)
 {
     switch (imageId + 1)
     {
         case 1:
             return IMG_GLOBAL_L1_O;
         case 2:
             return IMG_GLOBAL_L2_O;
         case 3:
             return IMG_GLOBAL_L3_O;
         case 4:
             return IMG_GLOBAL_L4_O;
         case 5:
             return IMG_GLOBAL_L5_O;
         case 6:
             return IMG_GLOBAL_L6_O;
         case 7:
             return IMG_GLOBAL_L7_O;
         case 8:
             return IMG_GLOBAL_L8_O;
         case 9:
             return IMG_GLOBAL_L9_O;
         case 10:
             return IMG_GLOBAL_L10_O;
         case 11:
             return IMG_GLOBAL_L11_O;
         case 12:
             return IMG_GLOBAL_L12_O;
         case 13:
             return IMG_GLOBAL_L13_O;
         case 14:
             return IMG_GLOBAL_L14_O;
         case 15:
             return IMG_GLOBAL_L15_O;
         case 16:
             return IMG_GLOBAL_L16_O;
         case 17:
             return IMG_GLOBAL_L17_O;
         case 18:
             return IMG_GLOBAL_L18_O;
         case 19:
             return IMG_GLOBAL_L19_O;
         case 20:
             return IMG_GLOBAL_L20_O;
         case 21:
             return IMG_GLOBAL_L21_O;
         case 22:
             return IMG_GLOBAL_L22_O;
         case 23:
             return IMG_GLOBAL_L23_O;
         case 24:
             return IMG_GLOBAL_L24_O;
         case 25:
             return IMG_GLOBAL_L25_O;
         case 26:
             return IMG_GLOBAL_L26_O;
         case 27:
             return IMG_GLOBAL_L27_O;
         case 28:
             return IMG_GLOBAL_L28_O;
         case 29:
             return IMG_GLOBAL_L29_O;
         case 30:
             return IMG_GLOBAL_L30_O;
         default:
             return IMG_GLOBAL_QUESTION;
     }
 }
 else
 {
     switch (imageId + 1)
     {
         case 1:
             return IMG_GLOBAL_L1;
         case 2:
             return IMG_GLOBAL_L2;
         case 3:
             return IMG_GLOBAL_L3;
         case 4:
             return IMG_GLOBAL_L4;
         case 5:
             return IMG_GLOBAL_L5;
         case 6:
             return IMG_GLOBAL_L6;
         case 7:
             return IMG_GLOBAL_L7;
         case 8:
             return IMG_GLOBAL_L8;
         case 9:
             return IMG_GLOBAL_L9;
         case 10:
             return IMG_GLOBAL_L10;
         case 11:
             return IMG_GLOBAL_L11;
         case 12:
             return IMG_GLOBAL_L12;
         case 13:
             return IMG_GLOBAL_L13;
         case 14:
             return IMG_GLOBAL_L14;
         case 15:
             return IMG_GLOBAL_L15;
         case 16:
             return IMG_GLOBAL_L16;
         case 17:
             return IMG_GLOBAL_L17;
         case 18:
             return IMG_GLOBAL_L18;
         case 19:
             return IMG_GLOBAL_L19;
         case 20:
             return IMG_GLOBAL_L20;
         case 21:
             return IMG_GLOBAL_L21;
         case 22:
             return IMG_GLOBAL_L22;
         case 23:
             return IMG_GLOBAL_L23;
         case 24:
             return IMG_GLOBAL_L24;
         case 25:
             return IMG_GLOBAL_L25;
         case 26:
             return IMG_GLOBAL_L26;
         case 27:
             return IMG_GLOBAL_L27;
         case 28:
             return IMG_GLOBAL_L28;
         case 29:
             return IMG_GLOBAL_L29;
         case 30:
             return IMG_GLOBAL_L30;
         default:
             return IMG_GLOBAL_QUESTION;
     }
 }
#else
    switch (imageId + 1)
    {
        case 1:
            return IMG_GLOBAL_L1;
        case 2:
            return IMG_GLOBAL_L2;
        case 3:
            return IMG_GLOBAL_L3;
        case 4:
            return IMG_GLOBAL_L4;
        case 5:
            return IMG_GLOBAL_L5;
        case 6:
            return IMG_GLOBAL_L6;
        case 7:
            return IMG_GLOBAL_L7;
        case 8:
            return IMG_GLOBAL_L8;
        case 9:
            return IMG_GLOBAL_L9;
        case 10:
            return IMG_GLOBAL_L10;
        case 11:
            return IMG_GLOBAL_L11;
        case 12:
            return IMG_GLOBAL_L12;
        case 13:
            return IMG_GLOBAL_L13;
        case 14:
            return IMG_GLOBAL_L14;
        case 15:
            return IMG_GLOBAL_L15;
        case 16:
            return IMG_GLOBAL_L16;
        case 17:
            return IMG_GLOBAL_L17;
        case 18:
            return IMG_GLOBAL_L18;
        case 19:
            return IMG_GLOBAL_L19;
        case 20:
            return IMG_GLOBAL_L20;
        case 21:
            return IMG_GLOBAL_L21;
        case 22:
            return IMG_GLOBAL_L22;
        case 23:
            return IMG_GLOBAL_L23;
        case 24:
            return IMG_GLOBAL_L24;
        case 25:
            return IMG_GLOBAL_L25;
        case 26:
            return IMG_GLOBAL_L26;
        case 27:
            return IMG_GLOBAL_L27;
        case 28:
            return IMG_GLOBAL_L28;
        case 29:
            return IMG_GLOBAL_L29;
        case 30:
            return IMG_GLOBAL_L30;
        default:
            return IMG_GLOBAL_QUESTION;
    }
#endif

}

/**************************************************/
/*          General Functions                     */
/**************************************************/


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_preview_play_color_id
 * DESCRIPTION
 *  preview color id
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_preview_play_color_id(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    glastColorID = gcurrentColorId;
    PlayPatternCallerGroup(gcurrentColorId);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_preview_stop_color_id
 * DESCRIPTION
 *  stop color id
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_preview_stop_color_id(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    StopTimer(TIMER_PROFILES_TONE_PLAY);
    if (glastColorID)
    {
        StopPatternCallerGroup(glastColorID);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_get_dynamic_tone_ids
 * DESCRIPTION
 *  get dynamic tone ids
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_get_dynamic_tone_ids(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    GetRingToneRange((PU8) & gstartRingId, (PU8) & gtotalRingId);
    GetMidiRange((PU8) & gstartMidiId, (PU8) & gtotalMidiId);
    GetToneRange((PU8) & gstartGeneralToneId, (PU8) & gtotalGeneralToneId);
    GetMiscToneRange((PU8) & gstartMiscToneId, (PU8) & gtotalMiscToneId);
   
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    PmgGetExtMelodyRange(&gstartExtMelodyId, &gtotalExtMelodyId);
#endif

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_query_popup
 * DESCRIPTION
 *  General Pop Up function for Query screens of profiles
 * PARAMETERS
 *  fn_lsk      [IN]       
 *  fn_rsk      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_query_popup(void (*fn_lsk) (void), void (*fn_rsk) (void))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gfnprofilelsk = fn_lsk;
    gfnprofilersk = fn_rsk;
    mmi_profiles_entry_query_popup();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_query_popup
 * DESCRIPTION
 *  entry function of query screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_query_popup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_display_popup_confirm(
        (UI_string_type) GetString(STR_GLOBAL_YES),
        (U8*) GetImage(IMG_GLOBAL_YES),
        (UI_string_type) GetString(STR_GLOBAL_NO),
        (U8*) GetImage(IMG_GLOBAL_NO),
        (UI_string_type) GetString(STR_GLOBAL_SAVE_ASK),
        MMI_EVENT_QUERY);

    SetLeftSoftkeyFunction(gfnprofilelsk, KEY_EVENT_UP);
    SetRightSoftkeyFunction(gfnprofilersk, KEY_EVENT_UP);

}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_melody_list_highlight_hdlr
 * DESCRIPTION
 *  Getting Current Screen Handler
 * PARAMETERS
 *  item_index          [IN]       
 *  index_index(?)      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_melody_list_highlight_hdlr(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_BOOL play_it = MMI_TRUE;
    U16 numOfItem = gtotalRingId + gtotalMidiId;
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)   
    MMI_BOOL option_lsk = MMI_FALSE;
#endif
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_profiles_melody_list_index = (U16) item_index;

    mmi_profiles_preview_stop_tone();

    if (g_profiles_melody_list_index < gtotalRingId)
    {
        gcurrentaudioId = g_profiles_melody_list_index + gstartRingId;
    }
    else if (g_profiles_melody_list_index < numOfItem)
    {
        gcurrentaudioId = g_profiles_melody_list_index + gstartMidiId - gtotalRingId;
    }
#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    else if (g_profiles_melody_list_index < numOfItem + MAXIMUM_EXT_MELODY_NUM)
    {
        g_ext_melody_idx = (U8) (g_profiles_melody_list_index - numOfItem);
        gcurrentaudioId = (U16) g_ext_melody_idx + PMG_EXT_MELODY_BEGIN;
        option_lsk = MMI_TRUE;
    }
#endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    else
    {
    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        numOfItem += MAXIMUM_EXT_MELODY_NUM;
    #endif
    #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
        if (g_profiles_melody_list_index == numOfItem)
        {
            DYNAUDIOINFO *download_theme_tones;

            if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
            {
                gcurrentaudioId = (U16) download_theme_tones[0].AudioId;
                if (AudioFileDeletedFromFmgr(gcurrentaudioId))
                {
                    play_it = MMI_FALSE;
                }
            }
            else
            {
                ASSERT(0);
            }
        }
    #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
    }

#if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
    if(!option_lsk)
    {
        ChangeLeftSoftkey(STR_GLOBAL_OK,0);
    }
    else
    {
        ChangeLeftSoftkey(STR_GLOBAL_OPTIONS,0);
    }
#endif

    if (play_it)
    {
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}

/*****************************************************************************
 * FUNCTION
 *  GetCurrScreenHandler
 * DESCRIPTION
 *  Getting Current Screen Handler
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void GetCurrScreenHandler(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = item_index;
}


/*****************************************************************************
 * FUNCTION
 *  GetCurrScreenHandlerfour
 * DESCRIPTION
 *  Getting Current Screen Handler
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void GetCurrScreenHandlerfour(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = item_index;
    mmi_profiles_preview_stop_color_id();
    if (gcurrHiliteIndexOne)
    {
        gcurrentColorId = (MMI_LEDLIGHT_STATUS_ENUM) gcurrHiliteIndexOne;
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_color_id);
    }
}


/*****************************************************************************
 * FUNCTION
 *  GetCurrScreenHandlerfive
 * DESCRIPTION
 *  Getting Current Screen Handler
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void GetCurrScreenHandlerfive(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = item_index;

    if (glastaudioId > 0)
    {
        mmi_profiles_preview_stop_tone();
    }

    if (gcurrHiliteIndexOne == 0)
    {
        gcurrentaudioId = 0;
        glastaudioId = gcurrentaudioId;
        /* MTK Brian added for stop timer in case of 0-->0, 2003/11/18 */
        StopTimer(TIMER_PROFILES_TONE_PLAY);
    }
    else
    {
        gcurrentaudioId = gcurrHiliteIndexOne + gstartGeneralToneId - 1;
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}

/* MTK Brian added for playing message tone, 2003/11/7 */


/*****************************************************************************
 * FUNCTION
 *  GetCurrScreenHandlersix
 * DESCRIPTION
 *  Getting Current Screen Handler
 * PARAMETERS
 *  item_index      [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void GetCurrScreenHandlersix(S32 item_index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = item_index;

    if (glastaudioId > 0)
    {
        mmi_profiles_preview_stop_tone();
    }

    if (gcurrHiliteIndexOne == 0)
    {
        gcurrentaudioId = 0;
        glastaudioId = gcurrentaudioId;
        /* MTK Brian added for stop timer in case of 0-->0, 2003/11/18 */
        StopTimer(TIMER_PROFILES_TONE_PLAY);
    }
    else
    {
        gcurrentaudioId = gcurrHiliteIndexOne + gstartMiscToneId - 1;
        StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, mmi_profiles_preview_play_tone);
    }
}

/* MTK end */

#if defined(__MMI_INTELLIGENT_CALL_ALERT__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_entry_intelligent_call_alert
 * DESCRIPTION
 *  entry function for intelligent call alert
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_entry_intelligent_call_alert(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
    U16 nNumofItem;                     /* Stores no of children in the submenu */
    U8 *guiBuffer;                      /* Buffer holding history data */
    S8 i = 0;

    /* U8* PopUpList[MAX_SUB_MENUS]; */
    U8 data = 0;
    U16 ProfileMenuID[] = {MENU_INTELLIGENT_CALL_ALERT_OFF, MENU_INTELLIGENT_CALL_ALERT_ON};

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Call Exit Handler */
    EntryNewScreen(SCR_PROFILES_INTELLIGENT_CALL_ALERT, NULL, mmi_profiles_entry_intelligent_call_alert, NULL);

    /* 2 Get current screen to gui buffer  for history purposes */
    guiBuffer = GetCurrGuiBuffer(SCR_PROFILES_INTELLIGENT_CALL_ALERT);

    /* 3. Retrieve no of child of menu item to be displayed */
    nNumofItem = GetNumOfChild(MENU_INTELLIGENT_CALL_ALERT);

    /* 5. Retrieve string ids in sequence of given menu item to be displayed */
    GetSequenceStringIds(MENU_INTELLIGENT_CALL_ALERT, nStrItemList);

    /* 6 Set current parent id */
    SetParentHandler(MENU_INTELLIGENT_CALL_ALERT);

    /* 7 Register highlight handler to be called in menu screen */
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    i = gprofiles[gprofileId].intelligentCallAlert;
    data = GetIndexOfStringId(MENU_INTELLIGENT_CALL_ALERT, ProfileMenuID[i]);

    /* 8 Display Category Screen */
    ShowCategory11Screen(
        STR_PROFILES_INTELLIGENT_CALL_ALERT,
        GetRootTitleIcon(MAIN_MENU_PROFILES_MENUID),//IMG_PROFILES_TITLEE,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (U16) data,
        guiBuffer);
}
#endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */

/*********************************************************
*
*
*           For Hint Handlers
*
*
**********************************************************/


/*****************************************************************************
 * FUNCTION
 *  HandleMelodyHintFunc
 * DESCRIPTION
 *  Hint handlers for Incoming call / Alarm tone
 * PARAMETERS
 *  ToneID      [IN]       
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void HandleMelodyHintFunc(U16 ToneID, U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 data = 0;

#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyStruct;
#endif

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (ToneID >= gstartRingId && ToneID < gstartRingId + gtotalRingId)
    {
        mmi_ucs2cpy((S8*) hintData[index], GetString((U16) (STR_PROFILES_RING_1 + ToneID - gstartRingId)));
    }
    else if (ToneID >= gstartMidiId && ToneID < gstartMidiId + gtotalMidiId)
    {
        mmi_ucs2cpy((S8*) hintData[index], GetString((U16) (STR_PROFILES_MIDI_1 + ToneID - gstartMidiId)));
    }
    else
    {
        BOOL selected = FALSE;

    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        PmgGetExtMelodyInfo(&ExtMelodyStruct);
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if (PmgIsEmptySlot(data) == MMI_FALSE && ToneID == ExtMelodyStruct->info[data].id)
            {
                if (IS_EXTMELODY_SHORTNAME(ExtMelodyStruct->info[data].filepath))
                {
                    mmi_chset_mixed_text_to_ucs2_str(
                        hintData[(index)],
                        (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                        (U8*) ExtMelodyStruct->info[data].filename,
                        g_chset_text_encoding);
                }
                else
                {
                    mmi_ucs2cpy((PS8) hintData[(index)], (PS8) (ExtMelodyStruct->info[data].filename));
                }
            #if (!defined(__MMI_SHOW_FILE_EXT__))
                PmgRemoveFileExt((S8*) hintData[(index)]);
            #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
                PmgRemoveFileDAFExt((S8*) hintData[(index)]);
            #endif
                selected = TRUE;
                break;
            }
        }
    #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
    #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
        if (!selected)
        {
            DYNAUDIOINFO *download_theme_tones;

            if (GetThemeV2TonesInfo(&download_theme_tones) != 0 && mmi_tm_get_current_theme_ringtone())
            {
                if (ToneID == (U16) download_theme_tones[0].AudioId)
                {
                    mmi_ucs2cpy((PS8) hintData[(index)], GetString((U16) STR_PROFILES_CURR_THEME));
                    selected = TRUE;
                }
            }
        }
    #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
    if(!selected)
    {
        /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
        gprofiles[gprofileId].toneSetup.ringTone = gstartMidiId ;
        gprofiles[gprofileId].toneSetup.alarmTone = gstartMidiId ;
        mmi_ucs2cpy((S8*) hintData[index], GetString((U16) (STR_PROFILES_MIDI_1)));
    }
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_incoming_call
 * DESCRIPTION
 *  Hint handlers for incoming call tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_incoming_call(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    HandleMelodyHintFunc(gprofiles[gprofileId].toneSetup.ringTone, index);
}

#ifdef __MMI_DUAL_PROFILE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_card2_incoming_call
 * DESCRIPTION
 *  Hint handlers for card2 incoming call tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_card2_incoming_call(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    HandleMelodyHintFunc(gprofiles[gprofileId].toneSetup.card2_ringTone, index);
}
#endif

#ifdef __MMI_VIDEO_TELEPHONY__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_video_call
 * DESCRIPTION
 *  Hint handlers for video call tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_video_call(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    HandleMelodyHintFunc(gprofiles[gprofileId].toneSetup.videoCallTone, index);
}
#endif

#ifndef __MMI_ALM_CUSTOMIZE_TONE__

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_alarm_tone
 * DESCRIPTION
 *  Hint handler for alarm tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_alarm_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    HandleMelodyHintFunc(gprofiles[gprofileId].toneSetup.alarmTone, index);
}

#endif /* __MMI_ALM_CUSTOMIZE_TONE__ */

#ifndef __MMI_POWER_ON_OFF_MUTE__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_power_on_tone
 * DESCRIPTION
 *  Hint handler for power on tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_power_on_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.powerOnTone) != POWERON_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.powerOnTone) - (gstartGeneralToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_power_off_tone
 * DESCRIPTION
 *  Hint handler for power off tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_power_off_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.powerOffTone) != POWEROFF_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.powerOffTone) - (gstartGeneralToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}
#endif /*__MMI_POWER_ON_OFF_MUTE__*/


#ifdef __MMI_CLAMSHELL__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_cover_open_tone
 * DESCRIPTION
 *  Hint handler for cover open tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_cover_open_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.coverOpenTone) != COVER_OPEN_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.coverOpenTone) - (gstartGeneralToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_cover_close_tone
 * DESCRIPTION
 *  Hint handler for cover close
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_cover_close_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.coverCloseTone) != COVER_CLOSE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.coverCloseTone) - (gstartGeneralToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}
#endif /* __MMI_CLAMSHELL__ */

#ifndef __MMI_PROF_SPLIT_MSG_TONES__
#if defined(__CKT_EXTMEM_MSGTONE__)
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_message_tone
 * DESCRIPTION
 *  Hint handler for message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_message_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyStruct;
#endif
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);

    if (gprofiles[gprofileId].toneSetup.messageTone == MESSAGE_SILENT)
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
    else if ((gprofiles[gprofileId].toneSetup.messageTone >= gstartMiscToneId)
        && (gprofiles[gprofileId].toneSetup.messageTone <= gstartMiscToneId + gtotalMiscToneId))
    {
        data = ((gprofiles[gprofileId].toneSetup.messageTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        BOOL selected = FALSE;

    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        PmgGetExtMelodyInfo(&ExtMelodyStruct);
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if ((PmgIsEmptySlot(data) == MMI_FALSE)
                && (gprofiles[gprofileId].toneSetup.messageTone == ExtMelodyStruct->info[data].id))
            {
                if (IS_EXTMELODY_SHORTNAME(ExtMelodyStruct->info[data].filepath))
                {
                    mmi_chset_mixed_text_to_ucs2_str(
                        hintData[(index)],
                        (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                        (U8*) ExtMelodyStruct->info[data].filename,
                        g_chset_text_encoding);
                }
                else
                {
                    mmi_ucs2cpy((PS8) hintData[(index)], (PS8) (ExtMelodyStruct->info[data].filename));
                }
            #if (!defined(__MMI_SHOW_FILE_EXT__))
                PmgRemoveFileExt((S8*) hintData[(index)]);
            #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
                PmgRemoveFileDAFExt((S8*) hintData[(index)]);
            #endif
                selected = TRUE;
                break;
            }
        }
    #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
   
    if(!selected)
    {      
        /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
        gprofiles[gprofileId].toneSetup.messageTone = gstartMiscToneId;

        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " 1");
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    }
}
#else /* __CKT_EXTMEM_MSGTONE__ */
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_message_tone
 * DESCRIPTION
 *  Hint handler for message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_message_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.messageTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.messageTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}
#endif /* __CKT_EXTMEM_MSGTONE__ */
#else
#ifdef MMS_SUPPORT
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_mms_tone
 * DESCRIPTION
 *  Hint handler for mms message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_mms_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.mmsTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.mmsTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}
#endif /*MMS_SUPPORT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_sms_tone
 * DESCRIPTION
 *  Hint handler for sms message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_sms_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.smsTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.smsTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}

#ifdef __MMI_EMAIL__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_email_tone
 * DESCRIPTION
 *  Hint handler for email message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_email_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.emailTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.emailTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}
#endif /*__MMI_EMAIL__*/

#ifdef __MMI_OP11_MMS_SUPPORT_AUDIO_MSG__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /*__MMI_OP11_MMS_SUPPORT_AUDIO_MSG__*/

#endif /*__MMI_PROF_SPLIT_MSG_TONES__*/

#ifdef __MMI_DUAL_PROFILE_SUPPORT__
#if defined(__CKT_EXTMEM_MSGTONE__)
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_message_tone
 * DESCRIPTION
 *  Hint handler for message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_card2_message_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#ifdef __MMI_PROFILE_EXTMELODY_SUPPORT__
    DYNEXTMELODYINFO *ExtMelodyStruct;
#endif
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);

    if (gprofiles[gprofileId].toneSetup.card2_messageTone == MESSAGE_SILENT)
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
    else if ((gprofiles[gprofileId].toneSetup.card2_messageTone >= gstartMiscToneId)
        && (gprofiles[gprofileId].toneSetup.card2_messageTone <= gstartMiscToneId + gtotalMiscToneId))
    {
        data = ((gprofiles[gprofileId].toneSetup.card2_messageTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        BOOL selected = FALSE;

    #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
        PmgGetExtMelodyInfo(&ExtMelodyStruct);
        for (data = 0; data < MAXIMUM_EXT_MELODY_NUM; data++)
        {
            if ((PmgIsEmptySlot(data) == MMI_FALSE)
                && (gprofiles[gprofileId].toneSetup.card2_messageTone == ExtMelodyStruct->info[data].id))
            {
                if (IS_EXTMELODY_SHORTNAME(ExtMelodyStruct->info[data].filepath))
                {
                    mmi_chset_mixed_text_to_ucs2_str(
                        hintData[(index)],
                        (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
                        (U8*) ExtMelodyStruct->info[data].filename,
                        g_chset_text_encoding);
                }
                else
                {
                    mmi_ucs2cpy((PS8) hintData[(index)], (PS8) (ExtMelodyStruct->info[data].filename));
                }
            #if (!defined(__MMI_SHOW_FILE_EXT__))
                PmgRemoveFileExt((S8*) hintData[(index)]);
            #elif (!defined(__MMI_SHOW_DAF_FILE_EXT__))
                PmgRemoveFileDAFExt((S8*) hintData[(index)]);
            #endif
                selected = TRUE;
                break;
            }
        }
    #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
   
    if(!selected)
    {      
        /*when there is no mapping selected item, assgin midi1 to both ring tone and alarm tone*/
        gprofiles[gprofileId].toneSetup.card2_messageTone = gstartMiscToneId;

        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " 1");
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    }
}
#else /* __CKT_EXTMEM_MSGTONE__ */
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_card2_message_tone
 * DESCRIPTION
 *  Hint handler for card2 message tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_card2_message_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MTPNP_UINT8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    MTPNP_UINT8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    MTPNP_UINT8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
   
    if ((gprofiles[gprofileId].toneSetup.card2_messageTone) != MESSAGE_SILENT)
    {
        MTPNP_INT32 len = 0;
        data = ((gprofiles[gprofileId].toneSetup.card2_messageTone) - (gstartMiscToneId));
        sprintf((MTPNP_CHAR *) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((MTPNP_CHAR *) UnicodenStrItemList, (MTPNP_CHAR *) AsciinStrItemList);
        len = mmi_ucs2strlen((MTPNP_CHAR *) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((MTPNP_CHAR *) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((MTPNP_CHAR *) hintData[(index)], (MTPNP_CHAR *) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((MTPNP_CHAR *) hintData[(index)], (MTPNP_CHAR *) GetString(STR_PROFILES_SILENT),
                    MAX_SUBMENU_CHARACTERS);
    }
}
#endif
#endif

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_key_pad_tone
 * DESCRIPTION
 *  Hint handler for keypad tone
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_key_pad_tone(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    switch (gprofiles[gprofileId].toneSetup.keypadTone)
    {
        case KEYPAD_SILENT:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_SILENT), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_CLICK:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CLICK), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_TONE), MAX_SUBMENU_CHARACTERS);
            break;
    #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
        case KEYPAD_TONE_HUMAN_VOICE_1:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_1),
                MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_HUMAN_VOICE_2:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_2),
                MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_HUMAN_VOICE_3:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_3),
                MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_HUMAN_VOICE_4:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_4),
                MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_HUMAN_VOICE_5:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_5),
                MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_HUMAN_VOICE_6:
            mmi_ucs2ncpy(
                (PS8) hintData[(index)],
                GetString(STR_KEYPAD_TONE_HUMAN_VOICE_6),
                MAX_SUBMENU_CHARACTERS);
            break;
    #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
    #if defined(__MMI_CUST_KEYPAD_TONE__)
        case KEYPAD_TONE_CUST_1:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_1), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_CUST_2:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_2), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_CUST_3:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_3), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_CUST_4:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_4), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_CUST_5:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_5), MAX_SUBMENU_CHARACTERS);
            break;
        case KEYPAD_TONE_CUST_6:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_KEYPAD_TONE_CUST_6), MAX_SUBMENU_CHARACTERS);
            break;
    #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_alert_type
 * DESCRIPTION
 *  Hint handler for alert type
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_alert_type(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if (gprofiles[gprofileId].mtCallAlertTypeEnum == MMI_RING)
    {
        mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_RING), MAX_SUBMENU_CHARACTERS);
    }
    else if (gprofiles[gprofileId].mtCallAlertTypeEnum == MMI_VIBRATION_ONLY)
    {
        mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_VIBRATION_ONLY), MAX_SUBMENU_CHARACTERS);
    }
    else if (gprofiles[gprofileId].mtCallAlertTypeEnum == MMI_VIBRATION_AND_RING)
    {
        mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_VIBRATION_AND_RING), MAX_SUBMENU_CHARACTERS);
    }
    else if (gprofiles[gprofileId].mtCallAlertTypeEnum == MMI_VIBRATION_THEN_RING)
    {
        mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_VIBRATION_THEN_RING), MAX_SUBMENU_CHARACTERS);
    }
    else
    {
        mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_ring_type
 * DESCRIPTION
 *  Hint handler for ring type
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_ring_type(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    switch (gprofiles[gprofileId].ringTypeEnum)
    {
        case SINGLE:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_RING_TYPE_SINGLE), MAX_SUBMENU_CHARACTERS);
            break;
        case REPEAT:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_RING_TYPE_REPEAT), MAX_SUBMENU_CHARACTERS);
            break;
        case ASCENDING:
            mmi_ucs2ncpy((PS8) hintData[(index)], GetString(STR_RING_TYPE_ASCENDNG), MAX_SUBMENU_CHARACTERS);
            break;
    }
}

#ifdef __MMI_CONNECT_NOTICE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_connect_notice
 * DESCRIPTION
 *  Hint handler for connect notice
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_connect_notice(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    mmi_ucs2ncpy(
        (PS8) hintData[(index)],
        GetString(STR_NOTICE_NONE + gprofiles[gprofileId].extraTone.connectTone),
        MAX_SUBMENU_CHARACTERS);
}
#endif /* __MMI_CONNECT_NOTICE__ */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_ring_tone_volume
 * DESCRIPTION
 *  Hint handler for ring volume
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_ring_tone_volume(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 value[MAX_SUB_MENU_HINT_SIZE];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    sprintf((S8*) value, "%d", (gprofiles[gprofileId].ringVolumeLevel + 1));
#ifdef __UCS2_ENCODING
    mmi_asc_to_ucs2((PS8) hintData[(index)], (PS8) value);
#else
    mmi_ucs2cpy((S8*) hintData[index], (S8*) value);
#endif
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_key_tone_volume
 * DESCRIPTION
 *  Hint handler for key tone volume
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_key_tone_volume(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 value[MAX_SUB_MENU_HINT_SIZE];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    sprintf((S8*) value, "%d", (gprofiles[gprofileId].keypadVolumeLevel + 1));
#ifdef __UCS2_ENCODING
    mmi_asc_to_ucs2((PS8) hintData[(index)], (PS8) value);
#else
    mmi_ucs2cpy((S8*) hintData[index], (S8*) value);
#endif
}


/*****************************************************************************
 * FUNCTION
 *  HintHandlerLCDBacklight
 * DESCRIPTION
 *  Hint handlers for LCD BackLight
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void HintHandlerLCDBacklight(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 value[MAX_SUB_MENU_HINT_SIZE];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    sprintf((S8*) value, "%d", gprofiles[gprofileId].light.timer.setsec);
#ifdef __UCS2_ENCODING
    mmi_asc_to_ucs2((PS8) hintData[(index)], (PS8) value);
#else
    mmi_ucs2cpy((S8*) hintData[index], (S8*) value);
#endif
}

#if !defined(HARDWARE_LED_NOT_SUPPORT)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_status_LED
 * DESCRIPTION
 *  Hint handler for status LED
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_status_LED(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);

    switch (gprofiles[gprofileId].light.status)
    {

        case NO_COLOR:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_NONE), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN1:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR1), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN2:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR2), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN3:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR3), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN4:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR4), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN5:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR5), MAX_SUBMENU_CHARACTERS);
            break;
        case COLOR_PATTERN6:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_LIGHT_STATUS_COLOR6), MAX_SUBMENU_CHARACTERS);
            break;
    }
}
#endif /* HARDWARE_LED_NOT_SUPPORT */

#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_IMPS_status
 * DESCRIPTION
 *  Hint handlers for IMPS status
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_IMPS_status(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);

    switch (gprofiles[gprofileId].impsStatus)
    {
        case IMPS_PHB_PA_USER_OFFLINE:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_IMPS_STATUS_OFFLINE), MAX_SUBMENU_CHARACTERS);
            break;
        case IMPS_PHB_PA_USER_AVAILABLE:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_IMPS_STATUS_AVAILABLE), MAX_SUBMENU_CHARACTERS);
            break;
        case IMPS_PHB_PA_USER_DISCREET:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_IMPS_STATUS_DISCREET), MAX_SUBMENU_CHARACTERS);
            break;
        case IMPS_PHB_PA_USER_NOT_AVAILABLE:
            mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_IMPS_STATUS_NOT_AVAILABLE), MAX_SUBMENU_CHARACTERS);
            break;
    }
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_IMPS_tone_contact_online
 * DESCRIPTION
 *  Hint handlers for IMPS tone : contact online
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_IMPS_tone_contact_online(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.IMPSContactOnlineTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.IMPSContactOnlineTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }   
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_IMPS_tone_new_message
 * DESCRIPTION
 *  Hint handlers for IMPS tone : new message
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_IMPS_tone_new_message(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.IMPSNewMessageTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.IMPSNewMessageTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }       
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_IMPS_tone_new_invitation
 * DESCRIPTION
 *  Hint handlers for IMPS tone : new invitation
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_IMPS_tone_new_invitation(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.IMPSNewInvitationTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.IMPSNewInvitationTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_IMPS_tone_chatroom_notificatoin
 * DESCRIPTION
 *  Hint handlers for IMPS tone : chatroom notification
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_IMPS_tone_chatroom_notificatoin(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 UnicodenStrItemList[10]; /* Stores the strings id of submenus returned */
    U8 AsciinStrItemList[4];    /* Stores the strings id of submenus returned */
    U8 data = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if ((gprofiles[gprofileId].toneSetup.IMPSChatroomNotificationTone) != MESSAGE_SILENT)
    {
        S32 len = 0;

        data = ((gprofiles[gprofileId].toneSetup.IMPSChatroomNotificationTone) - (gstartMiscToneId));
        memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
        sprintf((PS8) AsciinStrItemList, " %d", data + 1);
        mmi_asc_to_ucs2((PS8) UnicodenStrItemList, (PS8) AsciinStrItemList);
        len = mmi_ucs2strlen((PS8) UnicodenStrItemList);
        len = MAX_SUBMENU_CHARACTERS - len;
        mmi_ucs2ncpy((S8*) hintData[(index)], GetString(STR_PROFILES_TONE), MAX_SUBMENU_CHARACTERS);
        mmi_ucs2cat((S8*) hintData[(index)], (PS8) UnicodenStrItemList);
    }
    else
    {
        mmi_ucs2ncpy((S8*) hintData[(index)], (S8*) GetString(STR_PROFILES_SILENT), MAX_SUBMENU_CHARACTERS);
    }   
}

#endif /* __MMI_IMPS__ && IMPS_WV13_ENHANCEMENT */


/************************************HighLight Handlers***************************/


/*****************************************************************************
 * FUNCTION
 *  HighlightProfiles
 * DESCRIPTION
 *  Highlight profile menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightProfiles(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_main_screen, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_main_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_general_mode
 * DESCRIPTION
 *  Highlight handler for general mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_general_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_GENERAL;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_meeting_mode
 * DESCRIPTION
 *  Highlight handler for meeting mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_meeting_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_MEETING;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_outdoor_mode
 * DESCRIPTION
 *  Highlight handler for outdoor mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_outdoor_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_OUTDOOR;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_indoor_mode
 * DESCRIPTION
 *  Highlight handler for indoor mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_indoor_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_INDOOR;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_silent_mode
 * DESCRIPTION
 *  Highlight handler for silent mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_silent_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_SILENT;

    /* Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_headset_mode
 * DESCRIPTION
 *  Highlight handler for headset mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_headset_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_HEADSET;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}

#ifdef __MMI_BT_PROFILE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_bt_mode
 * DESCRIPTION
 *  Highlight handler for bt mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_bt_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gcurrHiliteIndexOne = MMI_PROFILE_BT;

    /* Register function for left soft key */
#ifdef __MMI_PROF_MENU_ACTIVE_SHRINK__
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#else /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
    SetLeftSoftkeyFunction(mmi_profiles_entry_options, KEY_EVENT_UP);
    SetKeyHandler(mmi_profiles_entry_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
#endif /* __MMI_PROF_MENU_ACTIVE_SHRINK__ */
}
#endif /* __MMI_BT_PROFILE__ */ /* MMI_BT_PROFILE__ */


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_options
 * DESCRIPTION
 *  Highlight handler for options
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_options(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_activate
 * DESCRIPTION
 *  Highlight handler for activate
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_activate(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_activate_profile, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    /* MTK added, Max: to clear key handler 1221 */
    ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    /* MTK end */

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_customize
 * DESCRIPTION
 *  Highlight handler for customize
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_customize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_customize, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_customize, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_volume
 * DESCRIPTION
 *  Highlight handler for volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_volume(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_volume_type, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_volume_type, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type
 * DESCRIPTION
 *  Highlight handler for alert type
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_alert_type, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_alert_type, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_type
 * DESCRIPTION
 *  Highlight handler for ring type
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_type(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_ring_type, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_ring_type, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_answering_mode
 * DESCRIPTION
 *  Highlight handler for answering mode
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_answering_mode(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_answering_mode, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_answering_mode, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


#if !defined(HARDWARE_LED_NOT_SUPPORT)

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_status_LED
 * DESCRIPTION
 *  Highlight handler for status LED
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_status_LED(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_status_LED, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_status_LED, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif /* HARDWARE_LED_NOT_SUPPORT */

#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)
/*****************************************************************************
 * FUNCTION
 *  HilightProfilesIMPSStatus
 * DESCRIPTION
 *  Highlight profile IMPS Status menu item
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HilightProfilesIMPSStatus(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(EntryScrIMPSStatus, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(EntryScrIMPSStatus, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_tone_setup
 * DESCRIPTION
 *  Highlight handler for tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_tone_setup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_tone_setup, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_tone_setup, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_tone
 * DESCRIPTION
 *  Highlight handler for ring tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_ring_tone_list, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_ring_tone_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

#ifdef __MMI_DUAL_PROFILE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_card2_ring_tone
 * DESCRIPTION
 *  Highlight handler for card2 ring tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_card2_ring_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /*1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /*2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /*3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_card2_ring_tone_list, KEY_EVENT_UP);

    /*4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_card2_ring_tone_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif

#ifdef __MMI_VIDEO_TELEPHONY__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hldr_video_call_tone
 * DESCRIPTION
 *   Highlight handler for video call ring tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hldr_video_call_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_video_call_ring_tone_list, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_video_call_ring_tone_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif

#ifndef __MMI_POWER_ON_OFF_MUTE__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_power_on_tone
 * DESCRIPTION
 *  Highlight handler for power on tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_power_on_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_power_on_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_power_on_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_power_off_tone
 * DESCRIPTION
 *  Highlight handler for power off tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_power_off_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_power_off_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_power_off_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif /*__MMI_POWER_ON_OFF_MUTE__*/

#ifndef __MMI_PROF_SPLIT_MSG_TONES__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_message_tone
 * DESCRIPTION
 *  Highlight handler for message tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_message_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_message_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_message_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

#else
#ifdef MMS_SUPPORT
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_mms_tone
 * DESCRIPTION
 *  Highlight handler for mms message tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_mms_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_mms_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_mms_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif /*MMS_SUPPORT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_sms_tone
 * DESCRIPTION
 *  Highlight handler for sms message tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_sms_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_sms_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_sms_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

#ifdef __MMI_EMAIL__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_email_tone
 * DESCRIPTION
 *  Highlight handler for email message tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_email_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_email_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_email_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif /*__MMI_EMAIL__*/

#ifdef __MMI_OP11_MMS_SUPPORT_AUDIO_MSG__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /*__MMI_OP11_MMS_SUPPORT_AUDIO_MSG__*/

#endif /* __MMI_PROF_SPLIT_MSG_TONES__*/

#ifdef __MMI_DUAL_PROFILE_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_card2_message_tone
 * DESCRIPTION
 *  Highlight handler for card2 message tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_card2_message_tone(void)
{
    /*1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /*2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /*3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_card2_message_tone, KEY_EVENT_UP);

    /*4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_card2_message_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_tone_setup
 * DESCRIPTION
 *  Highlight handler for keypad tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_tone_setup(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_keypad_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_keypad_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

#ifndef __MMI_ALM_CUSTOMIZE_TONE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alarm_tone
 * DESCRIPTION
 *  Highlight handler for alarm tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alarm_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_alarm_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_alarm_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
#endif /* __MMI_ALM_CUSTOMIZE_TONE__ */


#if defined(__MMI_IMPS__) && defined(IMPS_WV13_ENHANCEMENT)

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_IMPS_tone
 * DESCRIPTION
 *  Highlight handler for IMPS tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_IMPS_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_IMPS_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_IMPS_tone_contact_online
 * DESCRIPTION
 *  Highlight handler for IMPS tone : contact online
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_IMPS_tone_contact_online(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_contact_online, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_IMPS_tone_contact_online, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_IMPS_tone_new_message
 * DESCRIPTION
 *  Highlight handler for IMPS tone : new message
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_IMPS_tone_new_message(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_new_message, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_IMPS_tone_new_message, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_IMPS_tone_new_invitation
 * DESCRIPTION
 *  Highlight handler for IMPS tone : new invitation
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_IMPS_tone_new_invitation(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_new_invitation, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_IMPS_tone_new_invitation, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_IMPS_tone_chatroom_notification
 * DESCRIPTION
 *  Highlight handler for IMPS tone : chatroom notification
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_IMPS_tone_chatroom_notification(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_IMPS_tone_chatroom_notification, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_IMPS_tone_chatroom_notification, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


#endif /*__MMI_IMPS__ && IMPS_WV13_ENHANCEMENT*/

/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_extra_tone
 * DESCRIPTION
 *  Highlight handler for extra tone setup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_extra_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_extra_tone, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_extra_tone, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_tone_volume
 * DESCRIPTION
 *  Highlight handler ring tone volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_tone_volume(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* PMT SUKRIT START 20051226 */
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    if (!is_level_select_menuitem_displayed_in_volume_screen)
    {
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
        /* 1 Change left soft key icon and label */
        ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

        /* 2 Change right soft key icon and label */
        ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

        /* 3 Register function for left soft key */
        SetLeftSoftkeyFunction(EntryScrProfilesCommonVolumeLevel1, KEY_EVENT_UP);

        /* 4 Register function for right soft key */
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

        SetKeyHandler(EntryScrProfilesCommonVolumeLevel1, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
        gcommonvolumehandler = 0;
    #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    }
    else
    {
        ChangeLeftSoftkey(0, 0);
        SetRingerVolume(default_value_ring_volume);
        mdi_audio_stop_all();   /* use stop all because it might be play file or play id */
        AudioPlayToneWithCallBackVolPath(
            gstartMidiId,
            REPEAT,
            INCOMING_CALL_TONE,
            (U8) default_value_ring_volume,
            MDI_DEVICE_SPEAKER2);
        mmi_profiles_set_ring_tone_playing(TRUE);
        /* MTK Brian added for play ring tone after MT message, 2003/11/10 */
        SetProtocolEventHandler(ContinueRingTone_TwoLine, PRT_EQ_PLAY_AUDIO_FINISH_IND);
        SetLeftSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    }
    #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
    /* PMT SUKRIT START 20051226 */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_tone_volume
 * DESCRIPTION
 *  Highlight handler ring tone volume
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_tone_volume(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* PMT SUKRIT START 20051226 */
#ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    if (!is_level_select_menuitem_displayed_in_volume_screen)
    {
#endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
        /* 1 Change left soft key icon and label */
        ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

        /* 2 Change right soft key icon and label */
        ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

        /* 3 Register function for left soft key */
        SetLeftSoftkeyFunction(EntryScrProfilesCommonVolumeLevel1, KEY_EVENT_UP);

        /* 4 Register function for right soft key */
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

        SetKeyHandler(EntryScrProfilesCommonVolumeLevel1, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
        gcommonvolumehandler = 1;
    #ifdef __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__
    }
    else
    {
        ChangeLeftSoftkey(0, 0);
        SetKeyPadVolume(default_value_keypad_volume);
        AudioStopReq((U16) gprofiles[gprofileId].toneSetup.keypadTone);
        SetLeftSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    }
    #endif /* __MMI_PROFILES_TWO_LINE_MENUITEM_DISPLAY__ */
    /* PMT SUKRIT END 20051226 */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type_ring
 * DESCRIPTION
 *  Hightlight handler for alert type ring
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type_ring(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_alert_type_ring_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type_vib_only
 * DESCRIPTION
 *  Hightlight handler for alert type vibration only
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type_vib_only(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_alert_type_vib_only_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type_vib_and_ring
 * DESCRIPTION
 *  Hightlight handler for alert type vibration and ring
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type_vib_and_ring(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_alert_type_vib_and_ring_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type_vib_then_ring
 * DESCRIPTION
 *  Hightlight handler for alert type vibration then ring
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type_vib_then_ring(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_alert_type_vib_then_ring_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_alert_type_light_only
 * DESCRIPTION
 *  Hightlight handler for alert type light only
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_alert_type_light_only(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_alert_type_light_only_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_type_single
 * DESCRIPTION
 *  Highlight handler for ring type single
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_type_single(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_ring_type_single_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_type_repeat
 * DESCRIPTION
 *  Highlight handler for ring type repeat
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_type_repeat(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_ring_type_repeat_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_ring_type_ascending
 * DESCRIPTION
 *  Highlight handler for ring type ascending
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_ring_type_ascending(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetLeftSoftkeyFunction(mmi_profiles_set_ring_type_ascending_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_silent
 * DESCRIPTION
 *  Highlight handler for keypad tone silent
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_silent(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_silent_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_click
 * DESCRIPTION
 *  Highlight handler keypad tone click
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_click(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_click_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_tone
 * DESCRIPTION
 *  Highlight handler keypad tone tone
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_tone(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_tone_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}

#if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human1
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 1
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human1(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human1_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human2
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 2
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human2(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human2_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human3
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 3
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human3(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human3_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human4
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 4
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human4(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human4_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human5
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 5
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human5(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human5_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_human6
 * DESCRIPTION
 *  Highlight handler keypad tone human voice 6
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_human6(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_human6_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
#endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */

#if defined(__MMI_CUST_KEYPAD_TONE__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust1
 * DESCRIPTION
 *  Highlight handler keypad tone cust 1
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust1(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust1_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust2
 * DESCRIPTION
 *  Highlight handler keypad tone cust 2
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust2(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust2_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust3
 * DESCRIPTION
 *  Highlight handler keypad tone cust 3
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust3(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust3_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust4
 * DESCRIPTION
 *  Highlight handler keypad tone cust 4
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust4(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust4_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust5
 * DESCRIPTION
 *  Highlight handler keypad tone cust 5
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust5(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust5_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_key_pad_cust6
 * DESCRIPTION
 *  Highlight handler keypad tone cust 6
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_key_pad_cust6(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_key_pad_tone_cust6_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}
#endif /* defined(__MMI_CUST_KEYPAD_TONE__) */

#ifdef __MMI_CONNECT_NOTICE__


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_connect_notice
 * DESCRIPTION
 *  Highlight handler for connect notice
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_connect_notice(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 3 Register function for left soft key */
    SetLeftSoftkeyFunction(mmi_profiles_entry_connect_notice, KEY_EVENT_UP);

    /* 4 Register function for right soft key */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

    SetKeyHandler(mmi_profiles_entry_connect_notice, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_connect_notice_none
 * DESCRIPTION
 *  Highlight handler for connect notice none
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_connect_notice_none(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_connect_notice_none_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_connect_notice_tone_only
 * DESCRIPTION
 *  Highlight handler for connect notice tone only
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_connect_notice_tone_only(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_connect_notice_tone_only_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_connect_notice_vib_only
 * DESCRIPTION
 *  Highlight handler for connect notice vibration only
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_connect_notice_vib_only(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_connect_notice_vib_only_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_connect_notice_tone_and_vib
 * DESCRIPTION
 *  Highlight handler for connect notice tone and vibration
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_connect_notice_tone_and_vib(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* 1 Change left soft key icon and label */
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);

    /* 2 Change right soft key icon and label */
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);

    /* 9.Register function with right softkey */
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    /* 10.Register function with Left softkey */
    SetLeftSoftkeyFunction(mmi_profiles_set_connect_notice_tone_and_vib_hdlr, KEY_EVENT_UP);

    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}
#endif /* __MMI_CONNECT_NOTICE__ */

#if defined(__MMI_INTELLIGENT_CALL_ALERT__)


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_intelligent_call_alert
 * DESCRIPTION
 *  Highlight handler for intelligent call alert
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_intelligent_call_alert(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_entry_intelligent_call_alert, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    SetKeyHandler(mmi_profiles_entry_intelligent_call_alert, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hint_hdlr_intelligent_call_alert
 * DESCRIPTION
 *  Hint handler for intelligent call alert
 * PARAMETERS
 *  index       [IN]       
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hint_hdlr_intelligent_call_alert(U16 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 str_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    memset((S8*) hintData[(index)], 0, MAX_SUB_MENU_SIZE);
    if (gprofiles[gprofileId].intelligentCallAlert == MMI_INTELLIGENT_CALL_ALERT_ON)
    {
        str_id = STR_GLOBAL_ON;
    }
    else
    {
        str_id = STR_GLOBAL_OFF;
    }
    mmi_ucs2cpy((S8*) hintData[(index)], GetString(str_id));
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_intelligent_call_alert_on
 * DESCRIPTION
 *  Hightlight handler for intelligent call alert on
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_intelligent_call_alert_on(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_set_intelligent_call_alert_on_hdlr, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_hilite_hdlr_intelligent_call_alert_off
 * DESCRIPTION
 *  Highlight handler for intelligent call alert off
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_hilite_hdlr_intelligent_call_alert_off(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
    ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetLeftSoftkeyFunction(mmi_profiles_set_intelligent_call_alert_off_hdlr, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_intelligent_call_alert_on_hdlr
 * DESCRIPTION
 *  set intelligent call alert on
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_intelligent_call_alert_on_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetIntelligentCallAert(MMI_INTELLIGENT_CALL_ALERT_ON);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_INTELLIGENT_CALL_ALERT);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_profiles_set_intelligent_call_alert_off_hdlr
 * DESCRIPTION
 *  set intelligent call alert off
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_profiles_set_intelligent_call_alert_off_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetIntelligentCallAert(MMI_INTELLIGENT_CALL_ALERT_OFF);
    mmi_display_popup((UI_string_type)GetString(STR_GLOBAL_DONE),MMI_EVENT_SUCCESS);
    DeleteScreenIfPresent(SCR_PROFILES_INTELLIGENT_CALL_ALERT);
}
#endif /* defined(__MMI_INTELLIGENT_CALL_ALERT__) */

/*********************End (Hilite HAndlers)*********************************************/

 

原创粉丝点击