Alarm.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:158k
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- return;
- }
- }
- }
- else if (idx == PRF_MENU_EXTMLD_DEL)
- {
- if (PmgDelExtMelodyById((U16) (PMG_EXT_MELODY_BEGIN + g_ext_melody_idx)) == MMI_TRUE)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- return;
- }
- }
- else if (idx == PRF_MENU_EXTMLD_ADD)
- {
- mmi_alm_entry_tone_setup_ext_melody_drv();
- return;
- }
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_tone_setup_convert_empty_slot_menu_list
- * DESCRIPTION
- *
- * PARAMETERS
- * idx [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 mmi_alm_tone_setup_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 */
- }
- #ifdef MMI_ON_HARDWARE_P
- else
- {
- MMI_ASSERT(MMI_FALSE);
- }
- #endif /* MMI_ON_HARDWARE_P */
- }
- return PRF_MENU_EXTMLD_MAX;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_tone_setup_ext_melody_drv
- * DESCRIPTION
- * Fucntion for handling the selection of replace option of external melodies.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_tone_setup_ext_melody_drv(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *nStrItemList[PRF_MENU_EXTMLD_DRV_MAX];
- U8 nNumofItem = (U8) PRF_MENU_EXTMLD_DRV_MAX;
- U8 *guiBuffer;
- S16 CardDrv = -1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_FILE_MANAGER__)
- CardDrv = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
- #endif /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__) ) */
- if (CardDrv > 0) /* Card Storage is present */
- {
- nStrItemList[PRF_MENU_EXTMLD_DRV_PHONE] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_PHONE);
- nStrItemList[PRF_MENU_EXTMLD_DRV_CARD] = (U8*) GetString(STR_PROFILES_RING_TONE_SETUP_DRV_CARD);
- EntryNewScreen(SCR_ID_ALM_TONE_SETUP_EXT_MELODY_DRV, NULL, mmi_alm_entry_tone_setup_ext_melody_drv, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_ALM_TONE_SETUP_EXT_MELODY_DRV);
- RegisterHighlightHandler(mmi_alm_tone_setup_ext_melody_hilight_hdlr);
- ShowCategory56Screen(
- STR_ALARM_TONE_CAPTION,
- IMG_PROFILES_TITLEE,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nNumofItem,
- nStrItemList,
- NULL,
- 0,
- guiBuffer);
- SetLeftSoftkeyFunction(mmi_alm_tone_setup_ext_melody_drv_select, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- else /* Card Storage not present */
- {
- extMldHlitItem = PRF_MENU_EXTMLD_DRV_PHONE;
- mmi_alm_tone_setup_ext_melody_drv_select();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_tone_setup_ext_melody_drv_select
- * DESCRIPTION
- * For displaying the the screen showing the drives.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_tone_setup_ext_melody_drv_select(void)
- {
- #if defined(__MMI_FILE_MANAGER__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 phoneDrvLetter, cardDrvLetter;
- S8 temp[3];
- UI_character_type dir_phone_root[4];
- UI_character_type dir_card_root[4];
- 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);
- phoneDrvLetter = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_I_SYSTEM | FS_DRIVE_V_NORMAL);
- cardDrvLetter = FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE);
- sprintf(temp, "%c:\", (S8) phoneDrvLetter);
- AnsiiToUnicodeString((S8*) dir_phone_root, temp);
- sprintf(temp, "%c:\", (S8) cardDrvLetter);
- AnsiiToUnicodeString((S8*) dir_card_root, temp);
- if (extMldHlitItem == PRF_MENU_EXTMLD_DRV_CARD)
- {
- mmi_fmgr_select_path_and_enter(
- APP_PROFILES,
- FMGR_SELECT_FILE,
- filter,
- (PS8) dir_card_root,
- mmi_alm_tone_setup_ext_melody_drv_select_callback);
- }
- else /* if( extMldHlitItem == PRF_MENU_EXTMLD_DRV_PHONE) */
- {
- mmi_fmgr_select_path_and_enter(
- APP_PROFILES,
- FMGR_SELECT_FILE,
- filter,
- (PS8) dir_phone_root,
- mmi_alm_tone_setup_ext_melody_drv_select_callback);
- }
- #endif /* defined(__MMI_FILE_MANAGER__) */ /* (defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_tone_setup_ext_melody_drv_select_callback
- * DESCRIPTION
- * The call back function called when the user selects some file for replacing an external melody.
- * PARAMETERS
- * path [?]
- * is_short [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_tone_setup_ext_melody_drv_select_callback(void *path, int is_short)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 *filepath = (S8*) path;
- PMG_ADDFILE_ERRNO err = PMG_ADDFILE_ERR_UNKNOWN;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (filepath)
- {
- 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);
- }
- }
- switch (err)
- {
- case PMG_ADDFILE_ERR_SUCCESS:
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- break;
- case PMG_ADDFILE_ERR_STR_TOO_LONG:
- case PMG_ADDFILE_ERR_STRFILE_TOO_LONG:
- case PMG_ADDFILE_ERR_STRPATH_TOO_LONG:
- DisplayPopup(
- (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_NAMETOOLONG),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case PMG_ADDFILE_ERR_SLOT_FULL:
- DisplayPopup(
- (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_LISTFULL),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case PMG_ADDFILE_ERR_FILE_TOO_LARGE:
- DisplayPopup(
- (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_FILETOOLARGE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case PMG_ADDFILE_ERR_DUPLICATED:
- DisplayPopup(
- (PU8) GetString(STR_PROFILES_RING_TONE_SETUP_DUPLICATED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- default:
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- }
- DeleteUptoScrID(SCR_ID_ALM_TONE_SETUP_EXT_MELODY);
- DeleteScreenIfPresent(SCR_ID_ALM_TONE_SETUP_EXT_MELODY);
- }
- else
- {
- /* DisplayPopup((PU8)GetString(STR_GLOBAL_EMPTY),
- IMG_GLOBAL_EMPTY, 1,UI_POPUP_NOTIFYDURATION_TIME,WARNING_TONE); */
- GoBackToHistory(SCR_ID_ALM_TONE_SETUP_EXT_MELODY);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_tone_setup_delete_ext_melody
- * DESCRIPTION
- * When the external file is deleted, Profile will call the function to update ring tone id.
- * PARAMETERS
- * ToneId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_tone_setup_delete_ext_melody(U16 ToneId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- BOOL dirty_flag = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check if external melody ID is deleted */
- for (i = 0; i < NUM_OF_ALM; i++)
- {
- /* If the external ID saved in the alarm NVRAM */
- if ((g_alm_cntx.AlmList[i].AudioOption == ALM_AUDIO_OPTIONS_TONE) &&
- (g_alm_cntx.AlmList[i].AudioOptionValue == ToneId))
- {
- g_alm_cntx.AlmList[i].AudioOptionValue = (U16) (gstartMidiId + 1);
- dirty_flag = TRUE;
- }
- /* If current highlight on the alarm */
- if ((g_alm_cntx.CurrHiliteAlarm == i) &&
- (g_alm_cntx.CurrHiliteAudioOption == ALM_AUDIO_OPTIONS_TONE) &&
- (g_alm_cntx.CurrHiliteAudioOptionValue == ToneId))
- {
- g_alm_cntx.CurrHiliteAudioOptionValue = (U16) (gstartMidiId + 1);
- }
- }
- /* Write result back to NVRAM */
- if (dirty_flag)
- {
- AlmWriteToNvram();
- }
- }
- #endif /* __MMI_PROFILE_EXTMELODY_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_tone_setup_hilite_hdlr
- * DESCRIPTION
- * Highlight handler for the tone list screen
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_tone_setup_hilite_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 tempval1 = 0;
- U16 tempval2 = gtotalRingId;
- S32 data;
- BOOL play_it = TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_alm_tone_index = (U16) index;
- StopToneAudio();
- if ((g_alm_tone_index >= tempval1) && (g_alm_tone_index < tempval2))
- {
- gcurrentaudioId = g_alm_tone_index + gstartRingId;
- }
- tempval1 = tempval2;
- tempval2 = gtotalMidiId + gtotalRingId;
- if ((g_alm_tone_index >= tempval1) && (g_alm_tone_index < tempval2))
- {
- gcurrentaudioId = g_alm_tone_index + gstartMidiId - gtotalRingId;
- }
- #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- tempval1 = tempval2;
- tempval2 = gtotalMidiId + gtotalRingId + MAXIMUM_EXT_MELODY_NUM;
- if ((g_alm_tone_index >= tempval1) && (g_alm_tone_index < tempval2))
- {
- data = g_alm_tone_index - (gtotalMidiId + gtotalRingId);
- gcurrentaudioId = PMG_EXT_MELODY_BEGIN + (U16) data;
- }
- #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
- #if defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- if (g_alm_tone_index == tempval2)
- {
- 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 = FALSE;
- }
- }
- else
- {
- ASSERT(0);
- }
- }
- #endif /* defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- if (play_it)
- {
- StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, PlayToneAudio);
- }
- }
- #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_aud_opt_fmrdo
- * DESCRIPTION
- * The entry function for the screen displaying options for fmradio audio option.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_aud_opt_fmrdo(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *gui_buffer;
- U16 item_count;
- U16 item_texts[10];
- U8 *item_popups[10];
- S32 i;
- U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_ALM_AUDIO_OPT_FMRADIO, NULL, mmi_alm_entry_aud_opt_fmrdo, NULL);
- gui_buffer = GetCurrGuiBuffer(SCR_ID_ALM_AUDIO_OPT_FMRADIO);
- item_count = GetNumOfChild(MENU_ID_ALM_AUDIO_OPT_FMRADIO);
- GetSequenceStringIds(MENU_ID_ALM_AUDIO_OPT_FMRADIO, item_texts);
- SetParentHandler(MENU_ID_ALM_AUDIO_OPT_FMRADIO);
- RegisterHighlightHandler(mmi_alm_aud_opt_fmrdo_highlight_hdlr);
- for (i = 0; i < item_count; i++)
- {
- item_popups[i] = NULL;
- }
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0 /* MAIN_MENU_TITLE_MULTIMEDIA_ICON */ ,
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- item_count,
- item_texts,
- item_icons,
- (U8 **) item_popups,
- 0,
- 0,
- gui_buffer);
- /* Set the right & left arrow key handlers. */
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- /* Set the LSK and RSK handlers. */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_aud_opt_fmrdo_highlight_hdlr
- * DESCRIPTION
- * Highlight handler of Alarm Audio Options FM Radio options screen.
- * PARAMETERS
- * index [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_aud_opt_fmrdo_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index == 0)
- {
- SetLeftSoftkeyFunction(mmi_alm_entry_aud_opt_fmrdo_channel_list, KEY_EVENT_UP);
- SetKeyHandler(mmi_alm_entry_aud_opt_fmrdo_channel_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else if (index == 1)
- {
- SetLeftSoftkeyFunction(mmi_alm_entry_fmrdo_manual_input, KEY_EVENT_UP);
- SetKeyHandler(mmi_alm_entry_fmrdo_manual_input, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_aud_opt_fmrdo_channel_list
- * DESCRIPTION
- * The entry function for the screen displaying the FM channels.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_aud_opt_fmrdo_channel_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *gui_buffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_ALM_AUDIO_OPT_FMRADIO_CHANNEL_LIST, NULL, mmi_alm_entry_aud_opt_fmrdo_channel_list, NULL);
- /* register highlight handler */
- RegisterHighlightHandler(mmi_alm_aud_opt_fmrdo_channel_list_highlight_hdlr);
- gui_buffer = GetCurrGuiBuffer(SCR_ID_ALM_AUDIO_OPT_FMRADIO_CHANNEL_LIST);
- if (gui_buffer == NULL)
- {
- if (g_alm_cntx.CurrHiliteAudioOptionValue > 0)
- {
- g_alm_aud_opt_fmrdo_channel_index = g_alm_cntx.CurrHiliteAudioOptionValue - 1;
- }
- else
- {
- g_alm_aud_opt_fmrdo_channel_index = 0;
- }
- }
- ShowCategory184Screen(
- STR_ID_ALM_AUDIO_OPTIONS_FMRADIO_CHANNELLIST,
- 0,
- 0,
- 0,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- FM_RADIO_CHANNEL_NUM,
- mmi_fmrdo_channel_list_item,
- mmi_fmrdo_channel_list_item_hint,
- g_alm_aud_opt_fmrdo_channel_index,
- gui_buffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_aud_opt_fmrdo_channel_list_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the FM Channels Screen.
- * PARAMETERS
- * index [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_aud_opt_fmrdo_channel_list_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_alm_aud_opt_fmrdo_channel_index = index;
- if (g_fmrdo.channel_list.freq[g_alm_aud_opt_fmrdo_channel_index] == 0)
- {
- ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- ChangeLeftSoftkey(0, 0);
- }
- else
- {
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- SetLeftSoftkeyFunction(mmi_alm_entry_aud_opt_fmrdo_channel_options, KEY_EVENT_UP);
- SetKeyHandler(mmi_alm_entry_aud_opt_fmrdo_channel_options, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_aud_opt_fmrdo_channel_options
- * DESCRIPTION
- * The entry function for the channel options screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_aud_opt_fmrdo_channel_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *gui_buffer_p;
- U16 item_texts[] = {STR_GLOBAL_SELECT, STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV};
- U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2};
- U8 *item_popups[] = {NULL, NULL};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_ALM_AUDIO_OPT_FMRDO_CHANNEL_OPT, NULL, mmi_alm_entry_aud_opt_fmrdo_channel_options, NULL);
- gui_buffer_p = GetCurrGuiBuffer(SCR_ID_ALM_AUDIO_OPT_FMRDO_CHANNEL_OPT);
- RegisterHighlightHandler(mmi_alm_fmrdo_channel_opt_highlight_hdlr);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- 2,
- item_texts,
- item_icons,
- (U8 **) item_popups,
- 0,
- 0,
- gui_buffer_p);
- SetLeftSoftkeyFunction(mmi_alm_aud_opt_fmrdo_channel_opt_lsk_hdlr, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- /* Set Key handlers */
- SetKeyHandler(mmi_alm_aud_opt_fmrdo_channel_opt_lsk_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_fmrdo_channel_opt_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the FM Radio channel options screen
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_fmrdo_channel_opt_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 item_texts[] = {STR_GLOBAL_SELECT, STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_alm_aud_opt_fmrdo_channel_opt_index = item_texts[index];
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_aud_opt_fmrdo_channel_opt_lsk_hdlr
- * DESCRIPTION
- * LSK function for the FM Radio channel options screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_aud_opt_fmrdo_channel_opt_lsk_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (g_alm_aud_opt_fmrdo_channel_opt_index)
- {
- case STR_GLOBAL_SELECT: /* for selecting a particular FM channel for alarm. */
- g_alm_cntx.CurrHiliteAudioOption = ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL;
- g_alm_cntx.CurrHiliteAudioOptionValue = g_alm_aud_opt_fmrdo_channel_index + 1;
- g_alm_aud_opt_selected = TRUE;
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_ALM_EDITOR);
- break;
- case STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV:
- g_alm_fmrdo_prev_freq = g_fmrdo.channel_list.freq[g_alm_aud_opt_fmrdo_channel_index];
- #ifdef __MMI_FM_RADIO_BIND_EARPHONE__
- if (!isEarphonePlugged)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_ALM_FMRDO_PLEASE_PLUG_IN_EARPHONE),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- }
- else
- #endif /* __MMI_FM_RADIO_BIND_EARPHONE__ */
- mmi_alm_entry_fmrdo_prev_channel();
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_fmrdo_manual_input
- * DESCRIPTION
- * The entry function for the manual input screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_fmrdo_manual_input(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_ALM_FMRDO_MANUAL_INPUT, mmi_alm_exit_fmrdo_manual_input, NULL, NULL);
- InitializeCategory57Screen();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_ALM_FMRDO_MANUAL_INPUT);
- inputBuffer = GetCurrNInputBuffer(SCR_ID_ALM_FMRDO_MANUAL_INPUT, &inputBufferSize);
- RegisterHighlightHandler(mmi_alm_fmrdo_manual_input_highlight_hdlr);
- if (guiBuffer == NULL)
- {
- if (g_alm_cntx.CurrHiliteAudioOption != ALM_AUDIO_OPTIONS_FMRADIO_MANUAL)
- {
- memset(channel_manual_input_buffer, 0, 2);
- }
- else
- {
- kal_wsprintf(
- channel_manual_input_buffer,
- "%d.%d",
- g_alm_cntx.CurrHiliteAudioOptionValue / 10,
- g_alm_cntx.CurrHiliteAudioOptionValue % 10);
- }
- }
- SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemTextEdit(
- &wgui_inline_items[0],
- (U8*) channel_manual_input_buffer,
- MAX_MANUAL_INPUT_LEN,
- INPUT_TYPE_DECIMAL_NUMERIC);
- LeftJustifyInlineItem(&wgui_inline_items[0]);
- SetInlineItemFullWidth(&wgui_inline_items[0]);
- EnableInlineItemBoundary(&wgui_inline_items[0]);
- DisableCategory57ScreenDone();
- /* show category screen */
- ShowCategory57Screen(
- STR_ID_ALM_AUDIO_OPTIONS_FMRADIO_MAN_INPUT,
- MAIN_MENU_TITLE_MULTIMEDIA_ICON, /* title text and icon */
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS, /* LSK text and icon */
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK, /* RSK text and icon */
- 1,
- 0,
- wgui_inline_items,
- 0,
- guiBuffer);
- SetCategory57LeftSoftkeyFunction(mmi_alm_fmrdo_manual_input_options);
- SetCategory57RightSoftkeyFunctions(GoBackHistory, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_exit_fmrdo_manual_input
- * DESCRIPTION
- * The exit function for the manual input screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_exit_fmrdo_manual_input(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- h.scrnID = SCR_ID_ALM_FMRDO_MANUAL_INPUT;
- h.entryFuncPtr = mmi_alm_entry_fmrdo_manual_input;
- GetCategoryHistory(h.guiBuffer);
- inputBufferSize = (U16) GetCategory57DataSize();
- GetCategory57Data((U8*) h.inputBuffer);
- AddNHistory(h, inputBufferSize);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_fmrdo_manual_input_highlight_hdlr
- * DESCRIPTION
- * The highlight handler function for the manual input screen
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_fmrdo_manual_input_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_fmrdo_manual_input_options
- * DESCRIPTION
- * The LSK function for manual input screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_fmrdo_manual_input_options()
- { /* calculate frequency number */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 freq = mmi_fmrdo_get_freq_from_str(channel_manual_input_buffer);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check frequency input */
- if (freq == 0xffff) /* invalid decimal digit */
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_FMRDO_VALID_FM_DECIMAL),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- (U8) WARNING_TONE);
- }
- else if (freq < MIN_FM_FREQUENCY || freq > MAX_FM_FREQUENCY) /* warning invalid frequency */
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_ALM_FMRDO_VALID_FM_BANDWIDTH),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- (U8) WARNING_TONE);
- }
- else
- {
- mmi_alm_entry_fmrdo_manual_input_options();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_fmrdo_manual_input_options
- * DESCRIPTION
- * Entry function for the manual input options screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_fmrdo_manual_input_options(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *gui_buffer_p;
- U16 item_texts[] = {STR_GLOBAL_DONE, STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV};
- U16 item_icons[] = {IMG_GLOBAL_L1, IMG_GLOBAL_L2};
- U8 *item_popups[] = {NULL, NULL};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_ALM_FMRDO_MANUAL_INPUT_OPT, NULL, mmi_alm_entry_fmrdo_manual_input_options, NULL);
- gui_buffer_p = GetCurrGuiBuffer(SCR_ID_ALM_FMRDO_MANUAL_INPUT_OPT);
- RegisterHighlightHandler(mmi_alm_fmrdo_manual_input_opt_highlight_hdlr);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_OK,
- 0,
- STR_GLOBAL_BACK,
- 0,
- 2,
- item_texts,
- item_icons,
- (U8 **) item_popups,
- 0,
- 0,
- gui_buffer_p);
- SetLeftSoftkeyFunction(mmi_alm_fmrdo_manual_input_opt_lsk_hdlr, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_fmrdo_manual_input_opt_lsk_hdlr
- * DESCRIPTION
- * LSK handler for the manual input options screen
- * PARAMETERS
- * void
- * index(?) [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_fmrdo_manual_input_opt_lsk_hdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 freq = mmi_fmrdo_get_freq_from_str(channel_manual_input_buffer);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (g_alm_fmrdo_man_inp_opt_index)
- {
- case STR_GLOBAL_DONE:
- g_alm_cntx.CurrHiliteAudioOptionValue = freq;
- g_alm_cntx.CurrHiliteAudioOption = ALM_AUDIO_OPTIONS_FMRADIO_MANUAL;
- g_alm_aud_opt_selected = TRUE;
- GoBackToHistory(SCR_ID_ALM_EDITOR);
- break;
- case STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV:
- g_alm_fmrdo_prev_freq = freq;
- #ifdef __MMI_FM_RADIO_BIND_EARPHONE__
- if (!isEarphonePlugged)
- {
- /* DisplayPopupCallBack( (PU8)GetString( STR_ID_ALM_FMRDO_PLEASE_PLUG_IN_EARPHONE ), IMG_GLOBAL_WARNING, 1, 2000, (U8)WARNING_TONE,mmi_alm_entry_fmrdo_prev_channel ); */
- DisplayPopup(
- (U8*) GetString(STR_ID_ALM_FMRDO_PLEASE_PLUG_IN_EARPHONE),
- IMG_GLOBAL_WARNING,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME_2000,
- WARNING_TONE);
- }
- else
- #endif /* __MMI_FM_RADIO_BIND_EARPHONE__ */
- mmi_alm_entry_fmrdo_prev_channel();
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_entry_fmrdo_prev_channel
- * DESCRIPTION
- * Entry function for the preview screen
- * PARAMETERS
- * void
- * index(?) [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_entry_fmrdo_prev_channel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 str[32];
- U8 vol;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- kal_wsprintf(str, "FM %d.%d", g_alm_fmrdo_prev_freq / 10, g_alm_fmrdo_prev_freq % 10);
- /* mdi function calls */
- vol = mmi_fmrdo_get_volume();
- mdi_audio_stop_fmr();
- mdi_audio_set_volume(AUD_VOLUME_FMR, vol);
- mdi_fmr_power_on_with_path(MDI_DEVICE_SPEAKER2, NULL);
- mdi_fmr_set_freq(g_alm_fmrdo_prev_freq);
- EntryNewScreen(SCR_ID_ALM_FMRDO_PREV, mmi_alm_exit_fmrdo_prev_channel, NULL, NULL);
- /* clear End key */
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
- /* Show searching screen */
- ShowCategory66Screen(
- STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV,
- 0,
- 0,
- 0,
- STR_GLOBAL_BACK,
- 0,
- (U8*) str,
- IMG_GLOBAL_PROGRESS,
- NULL);
- /* Set RSK to abort searching */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_exit_fmrdo_prev_channel
- * DESCRIPTION
- * The interface for calling the mdi function for stopping the FM Radio.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_exit_fmrdo_prev_channel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mdi_audio_stop_fmr();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_fmrdo_manual_input_opt_highlight_hdlr
- * DESCRIPTION
- * Highlight handler for the manual input options screen
- * PARAMETERS
- * index [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_fmrdo_manual_input_opt_highlight_hdlr(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 item_texts[] = {STR_GLOBAL_DONE, STR_ID_ALM_AUDIO_OPT_FMRDO_OPT_PREV};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_alm_fmrdo_man_inp_opt_index = item_texts[index];
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightAlmInlineAudioOptions
- * DESCRIPTION
- * Highlight handler of Alarm Audio Options inline selection item in editor screen.
- * PARAMETERS
- * index [IN] Index of inline selection
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightAlmInlineAudioOptions(S32 index)
- {
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- DYNAUDIOINFO *download_theme_tones = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_tm_get_current_theme_ringtone())
- {
- GetThemeV2TonesInfo(&download_theme_tones);
- }
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- /* If selection item changed */
- if (!((g_alm_cntx.CurrHiliteAudioOption && index) || (!g_alm_cntx.CurrHiliteAudioOption && !index)))
- {
- g_alm_cntx.CurrHiliteAudioOptionValue = 0;
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index, (U8*) GetString(STR_GLOBAL_EMPTY_LIST));
- #ifndef __MMI_ALM_CUSTOMIZE_TONE__
- if (!index)
- {
- U16 sel_tone = gcurrentprofile.toneSetup.alarmTone;
- U8 tone_index;
- g_alm_cntx.CurrHiliteAudioOptionValue = gcurrentprofile.toneSetup.alarmTone;
- if ((sel_tone >= gstartRingId) && (sel_tone <= (gstartRingId + gtotalRingId - 1)))
- {
- tone_index = sel_tone - gstartRingId;
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- else if ((sel_tone) >= gstartMidiId && (sel_tone) <= (gstartMidiId + gtotalMidiId - 1))
- {
- tone_index = (sel_tone - (gstartMidiId) + gtotalRingId);
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- else if (sel_tone >= PMG_EXT_MELODY_BEGIN && sel_tone <= PMG_EXT_MELODY_END)
- {
- DYNEXTMELODYINFO *ExtMelodyInfo;
- tone_index = sel_tone - PMG_EXT_MELODY_BEGIN;
- PmgGetExtMelodyInfo(&ExtMelodyInfo);
- if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[tone_index].filepath) &&
- g_alm_ext_melody_short_name_ptr != NULL)
- {
- mmi_chset_mixed_text_to_ucs2_str(
- g_alm_ext_melody_short_name_ptr,
- (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
- (U8*) ExtMelodyInfo->info[tone_index].filename,
- g_chset_text_encoding);
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index, g_alm_ext_melody_short_name_ptr);
- }
- else
- {
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index,(ExtMelodyInfo->info[tone_index]).filename);
- }
- }
- #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- else if (download_theme_tones != NULL && sel_tone == download_theme_tones[0].AudioId)
- {
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString(STR_PROFILES_CURR_THEME));
- }
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- }
- #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */
- }
- else /* if the user has selected the same audio option which is the CurrHiliteAudioOption */
- {
- if (g_alm_cntx.CurrHiliteAudioOption == ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL)
- {
- U16 index = g_alm_cntx.CurrHiliteAudioOptionValue - 1;
- if (g_fmrdo.channel_list.freq[index] < MIN_FM_FREQUENCY ||
- g_fmrdo.channel_list.freq[index] > MAX_FM_FREQUENCY)
- {
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_GLOBAL_EMPTY_LIST)));
- }
- else
- {
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index, (U8*) g_alm_audio_options_curselitem);
- }
- }
- else if (g_alm_cntx.CurrHiliteAudioOption == ALM_AUDIO_OPTIONS_FMRADIO_MANUAL)
- {
- if (g_alm_cntx.CurrHiliteAudioOptionValue < MIN_FM_FREQUENCY ||
- g_alm_cntx.CurrHiliteAudioOptionValue > MAX_FM_FREQUENCY)
- {
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_GLOBAL_EMPTY_LIST)));
- }
- else
- {
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index, (U8*) g_alm_audio_options_curselitem);
- }
- }
- else
- {
- #ifdef __MMI_ALM_CUSTOMIZE_TONE__
- U16 sel_tone = g_alm_cntx.CurrHiliteAudioOptionValue;
- #else
- U16 sel_tone = gcurrentprofile.toneSetup.alarmTone;
- #endif
- U8 tone_index;
- if ((sel_tone >= gstartRingId) && (sel_tone <= (gstartRingId + gtotalRingId - 1)))
- {
- tone_index = sel_tone - gstartRingId;
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- else if ((sel_tone >= gstartMidiId) && (sel_tone <= (gstartMidiId + gtotalMidiId - 1)))
- {
- tone_index = (sel_tone - gstartMidiId + gtotalRingId);
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- else if (sel_tone >= PMG_EXT_MELODY_BEGIN && sel_tone <= PMG_EXT_MELODY_END)
- {
- DYNEXTMELODYINFO *ExtMelodyInfo;
- tone_index = sel_tone - PMG_EXT_MELODY_BEGIN;
- PmgGetExtMelodyInfo(&ExtMelodyInfo);
- if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[tone_index].filepath) &&
- g_alm_ext_melody_short_name_ptr != NULL)
- {
- mmi_chset_mixed_text_to_ucs2_str(
- g_alm_ext_melody_short_name_ptr,
- (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
- (U8*) ExtMelodyInfo->info[tone_index].filename,
- g_chset_text_encoding);
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index, g_alm_ext_melody_short_name_ptr);
- }
- else
- {
- Category57ChangeItemText(g_alm_aud_opt_curselitem_inline_index,(ExtMelodyInfo->info[tone_index]).filename);
- }
- }
- #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- else if (download_theme_tones != NULL && sel_tone == download_theme_tones[0].AudioId)
- {
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString(STR_PROFILES_CURR_THEME));
- }
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- else
- {
- g_alm_cntx.CurrHiliteAudioOptionValue = 0;
- Category57ChangeItemText(
- g_alm_aud_opt_curselitem_inline_index,
- (U8*) GetString((U16) (STR_GLOBAL_EMPTY_LIST)));
- }
- }
- }
- RedrawCategory57Screen();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_aud_fmrdo_init_channe_list
- * DESCRIPTION
- * This function is to check if the channel in FM radio initialized.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_aud_fmrdo_init_channe_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_fmrdo.is_ready && !g_alm_fmrdo_read_channel_name)
- {
- ReadRecord(NVRAM_EF_FM_RADIO_LID, 1, (void*)&g_fmrdo.channel_list, NVRAM_EF_FM_RADIO_SIZE, &error);
- if(g_fmrdo.channel_list.name[0][0] == 0xFFFF)
- {
- memset(&g_fmrdo.channel_list, 0, sizeof(mmi_fmrdo_channel_list_struct));
- }
- g_alm_fmrdo_read_channel_name = TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_aud_fmrdo_play_alarm
- * DESCRIPTION
- * This function is to play the FM radio when alarm expired.
- * PARAMETERS
- * alarm_index [IN]
- * volume [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_aud_fmrdo_play_alarm(U8 alarm_index, U8 volume)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 freq = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if FM Radio freqency set */
- if (g_alm_cntx.AlmList[alarm_index].AudioOption == ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL)
- {
- mmi_alm_aud_fmrdo_init_channe_list();
- if ((g_alm_cntx.AlmList[alarm_index].AudioOptionValue > 0) &&
- (g_alm_cntx.AlmList[alarm_index].AudioOptionValue <= FM_RADIO_CHANNEL_NUM))
- {
- freq = g_fmrdo.channel_list.freq[g_alm_cntx.AlmList[alarm_index].AudioOptionValue - 1];
- }
- }
- else if (g_alm_cntx.AlmList[alarm_index].AudioOption == ALM_AUDIO_OPTIONS_FMRADIO_MANUAL)
- {
- freq = g_alm_cntx.AlmList[alarm_index].AudioOptionValue;
- }
- if ((freq >= MIN_FM_FREQUENCY) && (freq <= MAX_FM_FREQUENCY))
- {
- mdi_audio_stop_fmr();
- mdi_audio_set_volume(MDI_VOLUME_FMR, volume);
- mdi_fmr_power_on_with_path(MDI_DEVICE_SPEAKER_BOTH, NULL);
- mdi_fmr_set_freq(freq);
- }
- /* Play default ring tone and restore alarm to default value */
- else
- {
- g_alm_cntx.AlmList[alarm_index].AudioOption = ALM_AUDIO_OPTIONS_TONE;
- g_alm_cntx.AlmList[alarm_index].AudioOptionValue = (U16) (gstartMidiId + 1);
- AlmWriteToNvram();
- playRequestedTone(ALARM_TONE);
- }
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- /*****************************************************************************
- * FUNCTION
- * AlmIsInlineEditorChanged
- * DESCRIPTION
- * To check if alarm is changed in inline editor screen.
- * PARAMETERS
- * index [IN] Index of inline selection
- * RETURNS
- * TURE if alarm is changed; otherwise, FLASE.
- *****************************************************************************/
- BOOL AlmIsInlineEditorChanged(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tmpHour = (g_alm_cntx.HourBuf[0] - '0') * 10 + (g_alm_cntx.HourBuf[ENCODING_LENGTH] - '0');
- U8 tmpMin = (g_alm_cntx.MinBuf[0] - '0') * 10 + (g_alm_cntx.MinBuf[ENCODING_LENGTH] - '0');
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (
- #ifdef __MMI_ALM_CUST_VOLUME__
- (g_alm_cntx.AlmList[index].Volume != g_alm_cntx.CurrHiliteVol) ||
- #endif
- (g_alm_cntx.AlmList[index].State != g_alm_cntx.CurrHiliteState) ||
- (g_alm_cntx.AlmList[index].Freq != (U8) g_alm_cntx.CurrHiliteFreq) ||
- (g_alm_cntx.AlmList[index].Hour != tmpHour) || (g_alm_cntx.AlmList[index].Min != tmpMin))
- {
- return TRUE;
- }
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- else if ((g_alm_cntx.AlmList[index].AudioOption != g_alm_cntx.CurrHiliteAudioOption))
- {
- return TRUE;
- }
- else if (g_alm_cntx.AlmList[index].AudioOptionValue != g_alm_cntx.CurrHiliteAudioOptionValue)
- {
- return TRUE;
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- else if (g_alm_freq_set[g_alm_cntx.AlmList[index].Freq] == ALM_FREQ_DAYS)
- {
- return TRUE;
- }
- #ifdef __MMI_ALM_SNOOZE_SETTING__
- else if (g_alm_cntx.AlmList[index].SnoozeInterval != (U8) g_alm_cntx.CurrHilightSnoozeInterval)
- {
- return TRUE;
- }
- #endif /* __MMI_ALM_SNOOZE_SETTING__ */
- #ifdef __MMI_ALM_ALERT_TYPE__
- else if (g_alm_cntx.AlmList[index].AlertType != (U8) g_alm_cntx.CurrHilightAlertType)
- {
- return TRUE;
- }
- #endif /* __MMI_ALM_ALERT_TYPE__ */
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * AlmInlineEditHighlightHdlr
- * DESCRIPTION
- * Alarm editor highlight handler
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void AlmInlineEditHighlightHdlr(S32 index)
- {
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index == g_alm_aud_opt_curselitem_inline_index)
- {
- ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);
- if (g_alm_audio_option_previndex == ALM_AUDIO_OPTIONS_TONE)
- {
- #ifdef __MMI_ALM_CUSTOMIZE_TONE__
- SetLeftSoftkeyFunction(mmi_alm_entry_aud_opt_tone, KEY_EVENT_UP);
- #else /* __MMI_ALM_CUSTOMIZE_TONE__ */
- ChangeLeftSoftkey(0, 0);
- ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
- #endif /* __MMI_ALM_CUSTOMIZE_TONE__ */
- }
- else
- {
- SetLeftSoftkeyFunction(mmi_alm_entry_aud_opt_fmrdo, KEY_EVENT_UP);
- }
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- }
- /*****************************************************************************
- * FUNCTION
- * EntryAlmEditScreen
- * DESCRIPTION
- * Display inline editor screen of alarm.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryAlmEditScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer; /* added for inline edit history */
- U16 inputBufferSize; /* added for inline edit history */
- U8 nMenuItems;
- U16 alarm_icon_list[] = {IMG_STATUS, IMG_TIME, IMG_REPEAT, 0, 0
- #ifdef __MMI_ALM_CUST_VOLUME__
- , ALARM_VOLUME_IMAGEID, 0
- #endif
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- , IMG_ALM_AUD_OPT, 0, 0
- #endif
- #ifdef __MMI_ALM_SNOOZE_SETTING__
- , ALARMS_SET_SNOOZE_PERIOD_IMAGEID, 0
- #endif
- #ifdef __MMI_ALM_ALERT_TYPE__
- , ALARMS_SET_ALERT_TYPE_IMAGEID, 0
- #endif
- };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- nMenuItems = sizeof(alarm_icon_list) / sizeof(U16);
- EntryNewScreen(SCR_ID_ALM_EDITOR, ExitAlmEditScreen, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_ALM_EDITOR);
- InitializeCategory57Screen();
- RegisterHighlightHandler(AlmInlineEditHighlightHdlr);
- /* Use screen base memory to display short name of external melody*/
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- g_alm_ext_melody_short_name_ptr =
- (U8*) mmi_frm_scrmem_alloc((FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH);
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
- AlmFillInlineEditStruct();
- inputBuffer = GetCurrNInputBuffer(SCR_ID_ALM_EDITOR, &inputBufferSize); /* added for inline edit history */
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, nMenuItems, inputBuffer);
- }
-
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- if(guiBuffer == NULL)
- {
- g_alm_aud_opt_selected = FALSE;
- }
- else if (g_alm_aud_opt_selected)
- {
- SetInlineDoneFlag(guiBuffer);
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- ShowCategory57Screen(
- ALARM_EDIT_TITLE_STRINGID,
- GetRootTitleIcon(ORGANIZER_ALARM_MENU),
- ALARM_STR_DONE,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nMenuItems,
- alarm_icon_list,
- wgui_inline_items,
- /* currItemAlarmEdit */ 0,
- guiBuffer);
- SetCategory57RightSoftkeyFunctions(EntryAlmSaveConfirmation, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * ExitAlmEditScreen
- * DESCRIPTION
- * Exit function for inline editor screen of alarm.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitAlmEditScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history Scr;
- S16 nHistory = 0;
- U16 inputBufferSize; /* added for inline edit history */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Scr.scrnID = SCR_ID_ALM_EDITOR;
- CloseCategory57Screen();
- Scr.entryFuncPtr = EntryAlmEditScreen;
- pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
- GetCategory57History(Scr.guiBuffer);
- inputBufferSize = (U16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) Scr.inputBuffer); /* added for inline edit history */
- AddNHistory(Scr, inputBufferSize); /* added for inline edit history */
- /* Free screen memory*/
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- mmi_frm_scrmem_free((void*)g_alm_ext_melody_short_name_ptr);
- g_alm_ext_melody_short_name_ptr = NULL;
- #endif /*defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)*/
- }
- /*****************************************************************************
- * FUNCTION
- * AlmTimeEditorCallBack
- * DESCRIPTION
- * Callback function for inline time editor.
- * PARAMETERS
- * string_buffer [IN/OUT] Buffer to store the result of time
- * hours_buffer [IN] Buffer to store hour string
- * min_buffer [IN] Buffer to store minute string
- * AM_PM_flag [IN] Flag to indicate the time format of time string
- * RETURNS
- * void
- *****************************************************************************/
- void AlmTimeEditorCallBack(U8 *string_buffer, U8 *hours_buffer, U8 *min_buffer, U8 *AM_PM_flag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pfnUnicodeStrcpy((S8*) string_buffer, (S8*) hours_buffer);
- pfnUnicodeStrcat((S8*) string_buffer, (S8*) ":");
- pfnUnicodeStrcat((S8*) string_buffer, (S8*) min_buffer);
- }
- /*****************************************************************************
- * FUNCTION
- * AlmFillInlineEditStruct
- * DESCRIPTION
- * Initialize inline structure of input screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void AlmFillInlineEditStruct()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 inline_item_index = 0, j;
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- DYNEXTMELODYINFO *ExtMelodyInfo;
- #endif
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- DYNAUDIOINFO *download_theme_tones = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_tm_get_current_theme_ringtone())
- {
- GetThemeV2TonesInfo(&download_theme_tones);
- }
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- #ifdef __MMI_ALM_CUST_VOLUME__
- gAlmVolumeList[0] = (S8*) gAlmVolumeString[0];
- gAlmVolumeList[1] = (S8*) gAlmVolumeString[1];
- gAlmVolumeList[2] = (S8*) gAlmVolumeString[2];
- gAlmVolumeList[3] = (S8*) gAlmVolumeString[3];
- gAlmVolumeList[4] = (S8*) gAlmVolumeString[4];
- gAlmVolumeList[5] = (S8*) gAlmVolumeString[5];
- gAlmVolumeList[6] = (S8*) gAlmVolumeString[6];
- #endif /* __MMI_ALM_CUST_VOLUME__ */
- #ifdef __MMI_ALM_SNOOZE_SETTING__
- gAlmSettingSnooze[0] = GetString((U16) STR_ID_ALM_DEFAULT);
- gAlmSettingSnooze[1] = GetString((U16) STR_GLOBAL_1);
- gAlmSettingSnooze[2] = GetString((U16) STR_GLOBAL_2);
- gAlmSettingSnooze[3] = GetString((U16) STR_GLOBAL_3);
- gAlmSettingSnooze[4] = GetString((U16) STR_GLOBAL_4);
- gAlmSettingSnooze[5] = GetString((U16) STR_GLOBAL_5);
- gAlmSettingSnooze[6] = GetString((U16) STR_GLOBAL_6);
- gAlmSettingSnooze[7] = GetString((U16) STR_GLOBAL_7);
- gAlmSettingSnooze[8] = GetString((U16) STR_GLOBAL_8);
- gAlmSettingSnooze[9] = GetString((U16) STR_GLOBAL_9);
- gAlmSettingSnooze[10] = GetString((U16) STR_GLOBAL_10);
- #endif /* __MMI_ALM_SNOOZE_SETTING__ */
- #ifdef __MMI_ALM_ALERT_TYPE__
- gAlmSettingAlertType[ALM_ALERT_VIBRATION_AND_RING] = GetString((U16) STR_VIBRATION_AND_RING);
- gAlmSettingAlertType[ALM_ALERT_RING] = GetString((U16) STR_RING);
- gAlmSettingAlertType[ALM_ALERT_VIBRATION] = GetString((U16) STR_VIBRATION_ONLY);
- #endif /* __MMI_ALM_ALERT_TYPE__ */
- for (j = 0; j < ALARM_FREQ_NUM; j++)
- {
- gAlmFreqList[j] = GetString((U16) (g_alm_freq_set[j] + ALARM_REPEAT_OFF_INDEX));
- }
- /* ON/OFF */
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(
- &(wgui_inline_items[inline_item_index]),
- NUM_STATE_FOR_ALM,
- (U8 **) gAlmOnOffString,
- &g_alm_cntx.CurrHiliteState /* (gAlmCurrHiliteState[g_alm_cntx.CurrHiliteAlarm]) */ );
- DisableInlineItemHighlight(&(wgui_inline_items[inline_item_index]));
- /* time */
- inline_item_index++;
- SetInlineItemActivation(
- &(wgui_inline_items[inline_item_index]),
- INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,
- KEY_EVENT_UP);
- SetInlineItemTime(
- &(wgui_inline_items[inline_item_index]),
- (U8*) g_alm_cntx.HourBuf,
- (U8*) g_alm_cntx.MinBuf,
- NULL,
- AlmTimeEditorCallBack);
- DisableInlineItemHighlight(&(wgui_inline_items[inline_item_index]));
- /* repeat caption */
- inline_item_index++;
- SetInlineItemCaption(&(wgui_inline_items[inline_item_index]), (U8*) GetString(ALARM_REPEAT_STRING));
- /* repeat */
- inline_item_index++;
- SetInlineItemSelect(&(wgui_inline_items[inline_item_index]), ALARM_FREQ_NUM, (U8 **) gAlmFreqList, &g_alm_cntx.CurrHiliteFreq); /* -2 forweekdays and monthly */
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- RegisterInlineSelectHighlightHandler(&wgui_inline_items[inline_item_index], HighlightAlmInlineRepeat);
- /* day of week */
- if (g_alm_freq_set[g_alm_cntx.CurrHiliteFreq] != ALM_FREQ_DAYS) /* not Days */
- {
- memset(gAlmDaysStates, 0, 7);
- }
- inline_item_index++;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemDOWSelect(&(wgui_inline_items[inline_item_index]), inline_item_index, gAlmDaysStates);
- /* day of week */
- if (g_alm_freq_set[g_alm_cntx.CurrHiliteFreq] != ALM_FREQ_DAYS) /* not Days */
- {
- DisableInlineItem(&wgui_inline_items[inline_item_index], 4); /* multi select days */
- }
- #ifdef __MMI_ALM_CUST_VOLUME__
- /* volume */
- inline_item_index++;
- SetInlineItemCaption(&(wgui_inline_items[inline_item_index]), (U8*) GetString(ALARMS_VOLUME));
- inline_item_index++;
- SetInlineItemSelect(&(wgui_inline_items[inline_item_index]), (LEVEL7 + 1), (U8 **) gAlmVolumeList, &g_alm_cntx.CurrHiliteVol); /* -2 forweekdays and monthly */
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- #endif /* __MMI_ALM_CUST_VOLUME__ */
- /* Customize Ring Tone and FM alarm */
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- /* Ring Tone Caption */
- inline_item_index++;
- SetInlineItemCaption(&(wgui_inline_items[inline_item_index]), (U8*) GetString(STR_ID_ALM_AUDIO_OPTIONS));
- g_alm_audio_option_previndex =
- (g_alm_cntx.CurrHiliteAudioOption >
- ALM_AUDIO_OPTIONS_TONE) ? ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL : ALM_AUDIO_OPTIONS_TONE;
- inline_item_index++;
- /* Ring Tone Inline Selectt */
- SetInlineItemSelect(
- &(wgui_inline_items[inline_item_index]),
- NUM_AUDIO_OPTIONS,
- (U8 **) g_alm_audio_options_string,
- &g_alm_audio_option_previndex);
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- RegisterInlineSelectHighlightHandler(&wgui_inline_items[inline_item_index], HighlightAlmInlineAudioOptions);
- inline_item_index++;
- g_alm_aud_opt_curselitem_inline_index = inline_item_index;
- if (g_alm_cntx.CurrHiliteAudioOption == ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL)
- {
- if ((g_alm_cntx.CurrHiliteAudioOptionValue > 0) &&
- (g_alm_cntx.CurrHiliteAudioOptionValue <= FM_RADIO_CHANNEL_NUM))
- {
- U8 list_index = g_alm_cntx.CurrHiliteAudioOptionValue - 1;
- if (pfnUnicodeStrlen((S8*) g_fmrdo.channel_list.name[list_index]))
- {
- pfnUnicodeStrcpy((S8*) g_alm_audio_options_curselitem, (S8*) g_fmrdo.channel_list.name[list_index]);
- }
- else
- {
- kal_wsprintf(
- g_alm_audio_options_curselitem,
- "FM %d.%d",
- g_fmrdo.channel_list.freq[list_index] / 10,
- g_fmrdo.channel_list.freq[list_index] % 10);
- }
- }
- else
- {
- pfnUnicodeStrcpy((S8*) g_alm_audio_options_curselitem, GetString(STR_GLOBAL_EMPTY_LIST));
- }
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]), (U8*) g_alm_audio_options_curselitem);
- }
- else if (g_alm_cntx.CurrHiliteAudioOption == ALM_AUDIO_OPTIONS_FMRADIO_MANUAL)
- {
- if (g_alm_cntx.CurrHiliteAudioOptionValue > 0)
- {
- kal_wsprintf(
- g_alm_audio_options_curselitem,
- "FM %d.%d",
- g_alm_cntx.CurrHiliteAudioOptionValue / 10,
- g_alm_cntx.CurrHiliteAudioOptionValue % 10);
- }
- else
- {
- pfnUnicodeStrcpy((S8*) g_alm_audio_options_curselitem, GetString(STR_GLOBAL_EMPTY_LIST));
- }
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]), (U8*) g_alm_audio_options_curselitem);
- }
- else
- {
- #ifdef __MMI_ALM_CUSTOMIZE_TONE__
- U16 sel_tone = g_alm_cntx.CurrHiliteAudioOptionValue;
- #else
- U16 sel_tone = gcurrentprofile.toneSetup.alarmTone;
- #endif
- U8 tone_index;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- /* Ring Tone as Alarm */
- if ((sel_tone >= gstartRingId) && (sel_tone <= (gstartRingId + gtotalRingId - 1)))
- {
- tone_index = sel_tone - gstartRingId;
- SetInlineItemDisplayOnly(
- &(wgui_inline_items[inline_item_index]),
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- /* Midi Tone as Alarm */
- else if ((sel_tone >= gstartMidiId) && (sel_tone <= (gstartMidiId + gtotalMidiId - 1)))
- {
- tone_index = (sel_tone - gstartMidiId + gtotalRingId);
- SetInlineItemDisplayOnly(
- &(wgui_inline_items[inline_item_index]),
- (U8*) GetString((U16) (STR_PROFILES_RING_1 + tone_index)));
- }
- /* External Resource as Alarm */
- #if defined(__MMI_PROFILE_EXTMELODY_SUPPORT__)
- else if (sel_tone >= PMG_EXT_MELODY_BEGIN && sel_tone <= PMG_EXT_MELODY_END)
- {
- tone_index = sel_tone - PMG_EXT_MELODY_BEGIN;
- PmgGetExtMelodyInfo(&ExtMelodyInfo);
- if (IS_EXTMELODY_SHORTNAME(ExtMelodyInfo->info[tone_index].filepath) &&
- g_alm_ext_melody_short_name_ptr != NULL)
- {
- mmi_chset_mixed_text_to_ucs2_str(
- g_alm_ext_melody_short_name_ptr,
- (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
- (U8*) ExtMelodyInfo->info[tone_index].filename,
- g_chset_text_encoding);
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]),g_alm_ext_melody_short_name_ptr);
- }
- else
- {
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]),(ExtMelodyInfo->info[tone_index]).filename);
- }
- }
- #endif /* defined(__MMI_PROFILE_EXTMELODY_SUPPORT__) */
- #if defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)
- else if (download_theme_tones != NULL && sel_tone == download_theme_tones[0].AudioId)
- {
- pfnUnicodeStrcpy((S8*) g_alm_audio_options_curselitem, GetString(STR_PROFILES_CURR_THEME));
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]), (U8*) g_alm_audio_options_curselitem);
- }
- #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) && defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__) */
- /* Ring tone range incorrect or not initialized */
- else
- {
- pfnUnicodeStrcpy((S8*) g_alm_audio_options_curselitem, GetString(STR_GLOBAL_EMPTY_LIST));
- SetInlineItemDisplayOnly(&(wgui_inline_items[inline_item_index]), (U8*) g_alm_audio_options_curselitem);
- }
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */ // #ifdef __MMI_ALM_AUDIO_OPTIONS__
- #ifdef __MMI_ALM_SNOOZE_SETTING__
- inline_item_index++;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(
- &(wgui_inline_items[inline_item_index]),
- (U8*) GetString((U16) ALARMS_SETTING_SNOOZE_INTERVAL));
- inline_item_index++;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(
- &(wgui_inline_items[inline_item_index]),
- (S32) ALM_SNOOZE_INTERVAL_SETTING_NUM,
- (U8 **) gAlmSettingSnooze,
- &(g_alm_cntx.CurrHilightSnoozeInterval));
- /* RegisterInlineSelectHighlightHandler(&wgui_inline_items[SNOOZE_INTERVAL],mmi_hightlight_snooze_selection); */
- #endif /* __MMI_ALM_SNOOZE_SETTING__ */
- #ifdef __MMI_ALM_ALERT_TYPE__
- inline_item_index++;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemCaption(&(wgui_inline_items[inline_item_index]), (U8*) GetString((U16) STR_MT_CALL_ALERT_TYPE));
- inline_item_index++;
- SetInlineItemActivation(&(wgui_inline_items[inline_item_index]), INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(
- &(wgui_inline_items[inline_item_index]),
- (S32) ALM_ALERT_TYPE_SETTING_NUM,
- (U8 **) gAlmSettingAlertType,
- &(g_alm_cntx.CurrHilightAlertType));
- #endif /* __MMI_ALM_ALERT_TYPE__ */
- }
- /*****************************************************************************
- * FUNCTION
- * AlmSaveInlineEdit
- * DESCRIPTION
- * Save alarm to nvram and set/cancel alarm to driver accordingly.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void AlmSaveInlineEdit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (AlmIsInlineEditorChanged(g_alm_cntx.CurrHiliteAlarm))
- {
- S32 i, j;
- i = g_alm_cntx.CurrHiliteAlarm;
- g_alm_cntx.AlmList[i].Freq = (U8) g_alm_cntx.CurrHiliteFreq;
- g_alm_cntx.AlmList[i].Days = 0;
- if (g_alm_freq_set[g_alm_cntx.AlmList[i].Freq] == ALM_FREQ_DAYS)
- {
- for (j = 0; j < NUM_DAYS; j++)
- {
- g_alm_cntx.AlmList[i].Days |= (gAlmDaysStates[j] << j);
- }
- if (g_alm_cntx.AlmList[i].Days == 0)
- {
- g_alm_cntx.AlmList[i].Freq = mmi_alm_get_freq_order(ALARM_FREQ_NUM, g_alm_freq_set, ALM_FREQ_ONCE);
- }
- }
- g_alm_cntx.AlmList[i].State = (U8) g_alm_cntx.CurrHiliteState;
- g_alm_cntx.AlmList[i].Hour = (g_alm_cntx.HourBuf[0] - '0') * 10 + (g_alm_cntx.HourBuf[ENCODING_LENGTH] - '0');
- g_alm_cntx.AlmList[i].Min = (g_alm_cntx.MinBuf[0] - '0') * 10 + (g_alm_cntx.MinBuf[ENCODING_LENGTH] - '0');
- g_alm_cntx.AlmList[i].Snooze = 0;
- #ifdef __MMI_ALM_CUST_VOLUME__
- g_alm_cntx.AlmList[i].Volume = (U8) g_alm_cntx.CurrHiliteVol;
- #endif
- /* Alarm Audio Setting */
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- if (g_alm_cntx.CurrHiliteAudioOptionValue != 0)
- {
- g_alm_cntx.AlmList[i].AudioOption = (U8) g_alm_cntx.CurrHiliteAudioOption;
- g_alm_cntx.AlmList[i].AudioOptionValue = g_alm_cntx.CurrHiliteAudioOptionValue;
- }
- else /* Should not enter here because it already check before save */
- {
- g_alm_cntx.AlmList[i].AudioOption = ALM_AUDIO_OPTIONS_TONE;
- #ifdef __MMI_ALM_CUSTOMIZE_TONE__
- g_alm_cntx.AlmList[i].AudioOptionValue = (U16) (gstartMidiId + 1);
- #else
- g_alm_cntx.AlmList[i].AudioOptionValue = gcurrentprofile.toneSetup.alarmTone;
- #endif
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- #ifdef __MMI_ALM_SNOOZE_SETTING__
- g_alm_cntx.AlmList[i].SnoozeInterval = (U8) g_alm_cntx.CurrHilightSnoozeInterval;
- #endif
- #ifdef __MMI_ALM_ALERT_TYPE__
- g_alm_cntx.AlmList[i].AlertType = (U8) g_alm_cntx.CurrHilightAlertType;
- #endif
- AlmWriteToNvram();
- if (g_alm_cntx.CurrHiliteState == SET_STATE)
- {
- AlmSetAlarm((U8) (i + ALM_ALM_START));
- AlmActivateIndicator();
- }
- else
- {
- AlmCancelAlarm((U8) (i + ALM_ALM_START));
- if (!(AlmIsAnyAlarmActivated()))
- {
- AlmDeactivateIndicator();
- }
- }
- }
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- if ((g_alm_cntx.AlmList[g_alm_cntx.CurrHiliteAlarm].AudioOption == ALM_AUDIO_OPTIONS_FMRADIO_CHANNEL) ||
- (g_alm_cntx.AlmList[g_alm_cntx.CurrHiliteAlarm].AudioOption == ALM_AUDIO_OPTIONS_FMRADIO_MANUAL))
- {
- DisplayConfirm(
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- 0,
- 0,
- get_string(STR_ID_ALM_FMRDO_HEADFONE_REMINDER),
- 0,
- WARNING_TONE);
- SetLeftSoftkeyFunction(mmi_alm_display_popup, KEY_EVENT_UP);
- }
- else
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- {
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_ALM_LIST);
- }
- }
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- /*****************************************************************************
- * FUNCTION
- * mmi_alm_display_popup
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_alm_display_popup(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DisplayPopup(
- (U8*) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_ALM_LIST);
- }
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- /*****************************************************************************
- * FUNCTION
- * AlmCancelAlarmFromAT
- * DESCRIPTION
- * Handler to cancel alarm from AT command.
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void AlmCancelAlarmFromAT(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_alm_cntx.AlmList[index].State == 1) /* alarm is currently on */
- {
- AlmCancelAlarm((U8) (index + ALM_ALM_START));
- }
- if (g_alm_frm_cntx.CurrAlmIndex == (U8) (index + ALM_ALM_START))
- {
- AlmStopHandler();
- }
- memset(&g_alm_cntx.AlmList[index], 0, sizeof(alm_nvram_struct));
- AlmWriteToNvram();
- if (!(AlmIsAnyAlarmActivated()))
- {
- AlmDeactivateIndicator();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * AlmSetAlarmFromAT
- * DESCRIPTION
- * Handler to process alarm request from AT command
- * PARAMETERS
- * index [IN]
- * mytime [IN]
- * weekdays [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void AlmSetAlarmFromAT(U8 index, MYTIME mytime, U8 weekdays)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_alm_cntx.AlmList[index].Hour = mytime.nHour;
- g_alm_cntx.AlmList[index].Min = mytime.nMin;
- g_alm_cntx.AlmList[index].Snooze = 0;
- g_alm_cntx.AlmList[index].State = 1;
- if (weekdays == 0)
- {
- g_alm_cntx.AlmList[index].Freq = mmi_alm_get_freq_order(ALARM_FREQ_NUM, g_alm_freq_set, ALM_FREQ_ONCE);
- }
- else if (weekdays == 0x7F)
- {
- g_alm_cntx.AlmList[index].Freq = mmi_alm_get_freq_order(ALARM_FREQ_NUM, g_alm_freq_set, ALM_FREQ_EVERYDAY);
- }
- else
- {
- g_alm_cntx.AlmList[index].Freq = mmi_alm_get_freq_order(ALARM_FREQ_NUM, g_alm_freq_set, ALM_FREQ_DAYS);
- g_alm_cntx.AlmList[index].Days = weekdays;
- }
- #ifdef __MMI_ALM_AUDIO_OPTIONS__
- g_alm_cntx.AlmList[index].AudioOption = ALM_AUDIO_OPTIONS_TONE;
- g_alm_cntx.AlmList[index].AudioOptionValue = gcurrentprofile.toneSetup.alarmTone;
- #endif /* __MMI_ALM_AUDIO_OPTIONS__ */
- AlmWriteToNvram();
- AlmSetAlarm((U8) (index + ALM_ALM_START));
- AlmActivateIndicator();
- }
- /*****************************************************************************
- * FUNCTION
- * AlmQueryAlarmFromAT
- * DESCRIPTION
- * Handler to process query alarm request from AT command
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void AlmQueryAlarmFromAT(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_at_alarm_query_res_req_struct *rsp;
- MYQUEUE Message;
- S32 i, j;
- MYTIME almTime;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- Message.oslSrcId = MOD_MMI;
- Message.oslDestId = MOD_L4C;
- Message.oslMsgId = MSG_ID_MMI_AT_ALARM_QUERY_RES_REQ;
- rsp = (mmi_at_alarm_query_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_alarm_query_res_req_struct));
- rsp->totalAlarm = NUM_OF_ALM;
- rsp->alarmList = NULL;
- rsp->activeAlarm = 0;
- for (i = 0; i < NUM_OF_ALM; i++)
- if (g_alm_cntx.AlmList[i].State == SET_STATE)
- {
- rsp->activeAlarm++;
- }
- if (rsp->activeAlarm)
- {
- rsp->alarmList = (mmi_at_alarm_info_struct*)
- OslConstructDataPtr(sizeof(mmi_at_alarm_info_struct) * rsp->activeAlarm);
- for (i = 0, j = 0; i < NUM_OF_ALM; i++)
- {
- if (g_alm_cntx.AlmList[i].State == SET_STATE)
- {
- rsp->alarmList[j].alarm_index = i;
- almTime = AlmGetAlarmTime((kal_uint8) (i + ALM_ALM_START));
- rsp->alarmList[j].date_time.rtc_year = almTime.nYear - YEARFORMATE;
- rsp->alarmList[j].date_time.rtc_wday = almTime.DayIndex;
- rsp->alarmList[j].date_time.rtc_mon = almTime.nMonth;
- rsp->alarmList[j].date_time.rtc_day = almTime.nDay;
- rsp->alarmList[j].date_time.rtc_hour = almTime.nHour;
- rsp->alarmList[j].date_time.rtc_min = almTime.nMin;
- rsp->alarmList[j].date_time.rtc_sec = almTime.nSec;
- if (g_alm_freq_set[g_alm_cntx.AlmList[i].Freq] == ALM_FREQ_ONCE)
- {
- rsp->alarmList[j].recurr = 0;
- }
- else if (g_alm_freq_set[g_alm_cntx.AlmList[i].Freq] == ALM_FREQ_EVERYDAY)
- {
- rsp->alarmList[j].recurr = ALM_ALL_DAYS;
- }
- else
- {
- rsp->alarmList[j].recurr = g_alm_cntx.AlmList[i].Days;
- }
- j++;
- }
- }
- }
- Message.oslDataPtr = (oslParaType*) rsp;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- #endif /* MMI_ON_HARDWARE_P */
- }
- #endif /* _MMI_ALARM_C */ // #ifndef _MMI_ALARM_C