MMIThemes.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:135k
源码类别:
MTK
开发平台:
C/C++
- * void
- *****************************************************************************/
- void HighlightThmOption(S32 nIndex)
- {
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((mmi_tm_get_usb_mode() || mmi_bootup_is_sim_removed()
- #ifdef __FLIGHT_MODE_SUPPORT__
- || mmi_bootup_get_active_flight_mode()
- #endif
- ) && nIndex == 3)
- {
- nIndex++;
- }
- switch (nIndex)
- {
- case 0:
- SetLeftSoftkeyFunction(ActivateTheme, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 1:
- SetLeftSoftkeyFunction(EntryThmUpdatePeriod, KEY_EVENT_UP);
- SetKeyHandler(EntryThmUpdatePeriod, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 2:
- SetLeftSoftkeyFunction(EntryThmSetOrder, KEY_EVENT_UP);
- SetKeyHandler(EntryThmSetOrder, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 3:
- SetLeftSoftkeyFunction(preEntryThmDownload, KEY_EVENT_UP);
- SetKeyHandler(EntryThmDownload, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 4:
- SetLeftSoftkeyFunction(ThemeDeleteConfirmation, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- }
- #else /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- switch (nIndex)
- {
- case 0:
- SetLeftSoftkeyFunction(ActivateTheme, KEY_EVENT_UP);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 1:
- SetLeftSoftkeyFunction(EntryThmUpdatePeriod, KEY_EVENT_UP);
- SetKeyHandler(EntryThmUpdatePeriod, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- case 2:
- SetLeftSoftkeyFunction(EntryThmSetOrder, KEY_EVENT_UP);
- SetKeyHandler(EntryThmSetOrder, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- break;
- }
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * EntryThmOptions
- * DESCRIPTION
- * Entry func of themes option menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryThmOptions(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 ItemList[16];
- U16 nItems;
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- /* PMT DLT_FIXES - TK 20060321 START */
- U8 *temp_name;
- U8 nSystemThemeCount;
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT DLT_FIXES - TK 20060321 END */
- EntryNewScreen(SCR_ID_THM_OPTIONS, NULL, EntryThmOptions, NULL);
- ThmRedrawTheme();
- #ifndef __MMI_THEMES_V2_SUPPORT__
- g_thm_cntx.IsInThmApp = 2;
- #endif
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- if (g_thm_cntx.CurrHiliteTheme == g_thm_cntx.CurrTheme)
- {
- /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221092 */
- if (mmi_bootup_is_sim_removed()
- #ifdef __FLIGHT_MODE_SUPPORT__
- || mmi_bootup_get_active_flight_mode()
- #endif
- )
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST_1_FLIGHTMODE);
- GetSequenceStringIds(MENU3001_THEMES_LIST_1_FLIGHTMODE, ItemList);
- }
- else
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST_1);
- GetSequenceStringIds(MENU3001_THEMES_LIST_1, ItemList);
- }
- /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221092 */
- }
- else
- {
- /* PMT DLT_FIXES - TK 20060321 START */
- nSystemThemeCount = (U8) GetThemesNames((U8 ***) & temp_name);
- if (nSystemThemeCount > MAX_SYSTEM_THEMES)
- {
- nSystemThemeCount = MAX_SYSTEM_THEMES;
- }
- if (g_temp_thm_index < nSystemThemeCount)
- /* PMT DLT_FIXES - TK 20060321 START */
- {
- /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221092 */
- if (mmi_bootup_is_sim_removed()
- #ifdef __FLIGHT_MODE_SUPPORT__
- || mmi_bootup_get_active_flight_mode()
- #endif
- )
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST_1_FLIGHTMODE);
- GetSequenceStringIds(MENU3001_THEMES_LIST_1_FLIGHTMODE, ItemList);
- }
- else
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST_1);
- GetSequenceStringIds(MENU3001_THEMES_LIST_1, ItemList);
- }
- /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221092 */
- }
- else
- {
- /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221092 */
- if (mmi_bootup_is_sim_removed()
- #ifdef __FLIGHT_MODE_SUPPORT__
- || mmi_bootup_get_active_flight_mode()
- #endif
- )
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST_FLIGHTMODE);
- GetSequenceStringIds(MENU3001_THEMES_LIST_FLIGHTMODE, ItemList);
- }
- else
- {
- nItems = GetNumOfChild(MENU3001_THEMES_LIST);
- GetSequenceStringIds(MENU3001_THEMES_LIST, ItemList);
- }
- /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221092 */
- }
- }
- if (mmi_tm_get_usb_mode() == MMI_TRUE)
- {
- nItems = NO_OF_THEME_OPTION_MENUITEMS_IN_USB_MODE; /* First Menuitem active, Second Update Period no other menu items */
- }
- #else /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- nItems = GetNumOfChild(MENU3001_THEMES_LIST);
- GetSequenceStringIds(MENU3001_THEMES_LIST, ItemList);
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- SetParentHandler(MENU3001_THEMES_LIST);
- RegisterHighlightHandler(HighlightThmOption);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_OPTIONS);
- RegisterHighlightHandler(HighlightThmOption);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nItems,
- ItemList,
- (PU16) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_create_freq_table
- * DESCRIPTION
- * This fuction builds the display information of the selected alarm, and then enter
- * alarm screen.
- * PARAMETERS
- * None.
- * RETURNS
- * None.
- * GLOBALS AFFECTED
- * None
- *****************************************************************************/
- /* void mmi_thm_create_freq_table(void)
- {
- g_themes_freq_set.AlmFreqSet[0] = OFF;
- g_themes_freq_set.AlmFreqSet[1] = HOURLY ;
- g_themes_freq_set.AlmFreqSet[2] = EVERYDAY;
- g_themes_freq_set.AlmFreqSet[3] = WEEKLY;
- g_themes_freq_set.AlmFreqSet[4] = MONTHLY;
- g_themes_freq_set.AlmFreqSet[5] = SEASONALLY;
- } */
- /*****************************************************************************
- * FUNCTION
- * EntryThmUpdatePeriod
- * DESCRIPTION
- * entry func of themes update period menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryThmUpdatePeriod(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 ItemList[16];
- U16 nItems;
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_THM_UPDATE_PERIOD, ExitThmUpdatePeriod, NULL, NULL);
- #ifdef __MMI_THEMES_V2_SUPPORT__
- g_thm_cntx.IsInThmApp = 1;
- #else
- g_thm_cntx.IsInThmApp = 2;
- #endif
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_UPDATE_PERIOD);
- nItems = GetNumOfChild(MENU3201_UPDATE_PERIOD);
- GetSequenceStringIds(MENU3201_UPDATE_PERIOD, ItemList);
- SetParentHandler(MENU3201_UPDATE_PERIOD);
- RegisterHighlightHandler(HighlightThmUpdatePeriod);
- ShowCategory11Screen(
- STR_SCR3003_UPDATE_PERIOD_CAPTION,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nItems,
- ItemList,
- (U16) g_thm_cntx.CurrUpdatePeriod,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * ExitThmUpdatePeriod
- * DESCRIPTION
- * Exit func of themes update period menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitThmUpdatePeriod(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* reset IsSetFromMenu flag */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- g_thm_cntx.IsInThmApp = 0;
- #endif
- g_thm_cntx.IsSetFromMenu = 0;
- h.scrnID = SCR_ID_THM_UPDATE_PERIOD;
- h.entryFuncPtr = EntryThmUpdatePeriod;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- }
- /*****************************************************************************
- * FUNCTION
- * ActivateTheme
- * DESCRIPTION
- * Activate theme select bu yser and write to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ActivateTheme()
- {
- #ifdef __MMI_THEMES_V2_SUPPORT__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(0, NULL, NULL, NULL);
- ShowCategory66Screen(
- STR_SCR3001_THEMES_CAPTION,
- 0,
- 0,
- 0,
- 0,
- 0,
- (PU8) GetString(STR_ID_DLT_THM_PROGRESS),
- IMG_THEME_ACTIVATION,
- NULL);
- result = mmi_tm_activate_theme(g_thm_cntx.CurrHiliteTheme);
- switch (result)
- {
- case THEME_ERROR_SUCCESS:
- g_thm_cntx.CurrTheme = g_thm_cntx.CurrHiliteTheme;
- g_thm_cntx.CurrThemeIndex = g_temp_thm_index;
- SetThemes(g_thm_cntx.CurrTheme);
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- SetStartPositionofCurIndex();
- }
- SetCurrOrderIndex(g_thm_cntx.CurrOrderIndex);
- arrange_status_icons();
- DisplayPopup(
- (PU8) GetString(STR_THEME_ACTIVATE_SUCCESS),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_THM_MENU);
- break;
- case THEME_ERROR_ALREADY_ACTIVATED:
- DisplayPopup(
- (PU8) GetString(STR_ID_FMGR_ALREADY_ACTIVE),
- IMG_GLOBAL_INFO,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- case THEME_ERROR_THEME_NOT_AVAILABLE:
- DisplayPopup(
- (PU8) GetString(STR_THEME_NOT_AVAILABLE),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case THEME_ERROR_FILE_FORMAT_BAD:
- DisplayPopup(
- (PU8) GetString(STR_THEME_FORMAT_NOT_SUPPORTED),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case THEME_ERROR_FAILURE:
- DisplayPopup(
- (PU8) GetString(STR_THEME_UNKNOWN_ERROR),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- break;
- case THEME_ERROR_VERSION_FAILURE:
- DisplayPopup(
- (PU8) GetString(STR_DOWNLOAD_THEME_UNSUPPORTED),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- case THEME_ERROR_PROCESS_QUEUE_SUCESS:
- DisplayPopup(NULL, IMG_PROCESSING_PHONEBOOK, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
- break;
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00192708 */
- case THEME_ERROR_LCD_SIZE_MISMATCH:
- DisplayPopup(
- (PU8) GetString(STR_LCD_SIZE_MISMATCH),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- //PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00192708
- //PMT DNLD FIXES 20060513: SUKRIT START MAUI_00221313
- case THEME_ERROR_FILENAME_INCORRECT:
- DisplayPopup(
- (PU8) GetString(STR_THEME_ERROR_FILENAME_INCORRECT),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- /* PMT DNLD FIXES 20060513: SUKRIT END MAUI_00221313 */
- case THEME_ERROR_PHONE_MODEL_MISMATCH:
- DisplayPopup(
- (PU8) GetString(STR_THEME_ERROR_PHONE_MODEL_MISMATCH),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- break;
- default:
- DisplayPopup(
- (PU8) GetString(STR_THEME_UNKNOWN_ERROR),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- break;
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- }
- g_thm_cntx.IsInThmApp = 0;
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
- {
- SetBothLCDThemes(g_thm_cntx.CurrHiliteTheme);
- g_thm_cntx.CurrTheme = g_thm_cntx.CurrHiliteTheme;
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- SetStartPositionofCurIndex();
- }
- WriteThemesToNVRAM();
- }
- DisplayPopup(
- (PU8) GetString(STR_THEME_ACTIVATE_SUCCESS),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- 0);
- DeleteUptoScrID(SCR_ID_THM_MENU);
- g_thm_cntx.IsInThmApp = 0;
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- }
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * ThemeDeleteConfirmation
- * DESCRIPTION
- * Function for theme delete confirmation
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThemeDeleteConfirmation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- S8 str[100];
- pfnUnicodeStrcpy((PS8) str, (PS8) get_string(STR_GLOBAL_DELETE));
- pfnUnicodeStrcat((PS8) str, (PS8) L" ");
- pfnUnicodeStrcat((PS8) str, (PS8) g_thm_cntx.ThemeName[g_temp_thm_index]);
- DisplayConfirm(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- (UI_string_type) str,
- IMG_GLOBAL_QUESTION,
- WARNING_TONE);
- SetLeftSoftkeyFunction(DeleteTheme, KEY_EVENT_UP);
- SetKeyHandler(DeleteTheme, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * DeleteTheme
- * DESCRIPTION
- * Function to delete a theme from theme application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DeleteTheme()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- tm_theme_error_enum result;
- S32 error_type;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- result = mmi_tm_delete_theme(g_thm_cntx.CurrHiliteTheme, &error_type);
- switch (result)
- {
- case THEME_ERROR_THEME_NOT_AVAILABLE:
- DisplayPopup(
- (PU8) GetString(STR_THEME_NOT_AVAILABLE),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- break;
- case THEME_ERROR_SUCCESS:
- UpdateOrder(g_thm_cntx.CurrHiliteTheme);
- /* DisplayPopup((PU8) GetString(STR_THEME_DELETE_SUCCESS),IMG_GLOBAL_ACTIVATED, TRUE, UI_POPUP_NOTIFYDURATION_TIME,0); */
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- break;
- case THEME_ERROR_FAILURE:
- DisplayPopup(
- (PU8) GetString(GetFileSystemErrorString(error_type)),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- break;
- }
- DeleteUptoScrID(SCR_ID_THM_MENU);
- }
- /*****************************************************************************
- * FUNCTION
- * UpdateOrder
- * DESCRIPTION
- * Function to update set order during deletion
- * PARAMETERS
- * thm_del_ID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void UpdateOrder(U32 thm_del_ID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i = 0;
- U8 count = 0;
- U16 tmpidlist[TOTAL_THEMES_COUNT];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.TotalTheme = mmi_tm_get_total_themes_count();
- if (g_thm_cntx.CurrTheme == thm_del_ID)
- {
- g_thm_cntx.CurrTheme = DefaultThmID;
- g_thm_cntx.CurrThemeIndex = DefaultThmIndex;
- }
- for (i = 0; i <= g_thm_cntx.CurrOrderIndex; i++)
- {
- if (thm_del_ID == g_thm_cntx.SetOrderIDList[i])
- {
- count++;
- }
- }
- if (g_thm_cntx.CurrOrderIndex >= count)
- {
- g_thm_cntx.CurrOrderIndex = g_thm_cntx.CurrOrderIndex - count;
- }
- count = 0;
- for (i = 0; i < g_thm_cntx.TotalTheme + 1; i++)
- {
- if (thm_del_ID != g_thm_cntx.SetOrderIDList[i])
- {
- tmpidlist[count] = g_thm_cntx.SetOrderIDList[i];
- count++;
- }
- }
- for (i = 0; i <= count; i++)
- {
- g_thm_cntx.SetOrderIDList[i] = tmpidlist[i];
- }
- for (i = count; i < g_thm_cntx.TotalTheme; i++)
- {
- g_thm_cntx.SetOrderIDList[i] = 0;
- }
- SetOrderIDList(g_thm_cntx.SetOrderIDList, count, g_thm_cntx.CurrOrderIndex);
- WriteThemesToNVRAM();
- }
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * UpdateThemeOff
- * DESCRIPTION
- * Cancel the update alarm set by user and write to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UpdateThemeOff(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.CurrOrderIndex = -1;
- g_thm_cntx.IsOrderChanged = 0;
- /* if previous setting is not off, some theme-alarm is set before, cancel the alarm */
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- AlmCancelAlarm(ALM_THM_START);
- }
- g_thm_cntx.CurrUpdatePeriod = mmi_alm_get_freq_order(THMEM_FREQ_NUM, g_themes_freq_set, ALM_FREQ_OFF);
- WriteThemesToNVRAM();
- DisplayPopup(
- (PU8) GetString(STR_THEME_OFF_UPADTE_SUCCESS),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- 0);
- DeleteUptoScrID(SCR_ID_THM_OPTIONS);
- g_thm_cntx.IsInThmApp = 0;
- }
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191466 */
- /*****************************************************************************
- * FUNCTION
- * AlarmExpireUpdateThemeOff
- * DESCRIPTION
- * Sets the update theme alarm to off when no theme is present in set order list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void AlarmExpireUpdateThemeOff(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.CurrOrderIndex = -1;
- g_thm_cntx.IsOrderChanged = 0;
- /* if previous setting is not off, some theme-alarm is set before, cancel the alarm */
- if (g_thm_cntx.CurrUpdatePeriod > 0)
- {
- AlmCancelAlarm(ALM_THM_START);
- }
- g_thm_cntx.CurrUpdatePeriod = ALM_FREQ_OFF;
- WriteThemesToNVRAM();
- g_thm_cntx.IsInThmApp = 0;
- }
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191466 */
- /*****************************************************************************
- * FUNCTION
- * UpdateThemePeriod
- * DESCRIPTION
- * Set update period and write to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UpdateThemePeriod(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Leo add for DLT */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- if (g_thm_cntx.IsSetFromMenu == 1 && g_thm_cntx.CurrHiliteItem != g_thm_cntx.CurrUpdatePeriod)
- {
- g_thm_cntx.CurrUpdatePeriod = g_thm_cntx.CurrHiliteItem;
- g_thm_cntx.IsOrderChanged = 1;
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- if (g_thm_cntx.IsSetFromMenu == 1)
- {
- g_thm_cntx.CurrUpdatePeriod = g_thm_cntx.CurrHiliteItem;
- g_thm_cntx.IsOrderChanged = 1;
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- SetStartPositionofCurIndex();
- WriteThemesToNVRAM();
- AlmSetAlarm(ALM_THM_START);
- if (g_thm_cntx.IsSetFromMenu == 1) /* not OFF */
- {
- DisplayPopup(
- (PU8) GetString(STR_THEME_OFF_UPADTE_SUCCESS),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_THM_OPTIONS);
- g_thm_cntx.IsInThmApp = 0;
- }
- }
- /* PMT NEERAJ START 20050804 */
- #ifdef __MMI_UI_TAB_PANE__
- S32 theme_alarm_update_ui_theme = 0;
- /*****************************************************************************
- * FUNCTION
- * SetThemeAlarmCallBackUpdateUITheme
- * DESCRIPTION
- * Sets Theme Ui Update to TRUE. This is required so that UI theme is updated
- * on screen exit
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SetThemeAlarmCallBackUpdateUITheme(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- theme_alarm_update_ui_theme = 1;
- }
- /*****************************************************************************
- * FUNCTION
- * ThemeAlarmCallBackUpdateUITheme
- * DESCRIPTION
- * The function updates the UI Theme on common screen exit
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThemeAlarmCallBackUpdateUITheme(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (theme_alarm_update_ui_theme)
- {
- theme_alarm_update_ui_theme = 0;
- check_and_set_title_theme_changed();
- }
- }
- #endif /* __MMI_UI_TAB_PANE__ */
- /* PMT NEERAJ END 20050804 */
- /*****************************************************************************
- * FUNCTION
- * ThemeAlarmCallBack
- * DESCRIPTION
- * Call back function when theme alarm expires
- * PARAMETERS
- * index [IN]
- * period [?]
- * power_on [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 ThemeAlarmCallBack(U8 index, U16 *period, BOOL power_on)
- {
- #ifdef __J2ME__
- U8 IsJavaPlaying = FALSE;
- #endif
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- U8 no_of_times, result=THEME_ERROR_FAILURE;
- U16 order_theme_id, count, Index;
- U32 *p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00221092 */
- if (mmi_tm_get_usb_mode() == MMI_TRUE)
- {
- mmi_tm_set_was_theme_alarm_cb();
- *period = ALM_WITHOUD_EXPIRY_PERIOD;
- return ALM_HAS_NO_IND;
- }
- count = GetIDList(&p, &g_thm_cntx.CurrOrderIndex);
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- g_thm_cntx.TotalTheme = mmi_tm_get_total_themes_count();
- for (no_of_times = 0; no_of_times < g_thm_cntx.TotalTheme; no_of_times++)
- {
- g_thm_cntx.SetOrderIDList[no_of_times] = p[no_of_times];
- }
- Index = g_thm_cntx.CurrOrderIndex;
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191466 */
- if (count == 0)
- {
- AlarmExpireUpdateThemeOff();
- }
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191466 */
- else
- /* Fix for dodge ball game */
- {
- //PMT DNLD FIXES 20060513: SUKRIT START MAUI_00192671
- #ifdef __J2ME__
- if (GetActiveScreenId() == SCR_JAVA_APP)
- {
- EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
- ShowCategory66Screen(
- STR_SCR3001_THEMES_CAPTION,
- 0,
- 0,
- 0,
- 0,
- 0,
- (PU8) GetString(STR_ID_DLT_THM_PROGRESS),
- IMG_THEME_ACTIVATION,
- NULL);
- IsJavaPlaying = TRUE;
- }
- #endif /* __J2ME__ */
- //PMT DNLD FIXES 20060513: SUKRIT END MAUI_00192671
- for (no_of_times = 0; no_of_times < g_thm_cntx.TotalTheme; no_of_times++)
- {
- if ((g_thm_cntx.CurrOrderIndex == (g_thm_cntx.TotalTheme) - 1) ||
- g_thm_cntx.CurrOrderIndex >= g_thm_cntx.TotalTheme)
- {
- g_thm_cntx.CurrOrderIndex = 0;
- }
- else
- {
- g_thm_cntx.CurrOrderIndex++;
- }
- if (g_thm_cntx.CurrOrderIndex == Index)
- {
- break;
- }
- order_theme_id = g_thm_cntx.SetOrderIDList[g_thm_cntx.CurrOrderIndex];
- if (order_theme_id != g_thm_cntx.CurrTheme)
- {
- if (!g_alm_frm_cntx.IsPwronAlarm)
- {
- if (g_thm_cntx.IsInThmApp == 0) /* is not in theme menu */
- {
- /* To exit previous screen, error case: multimedia screen will allocate lots of memory, and then the cache wallpaper will fail */
- /* 2006/12/31 */
- EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
- result = mmi_tm_activate_theme(order_theme_id); /* PMT TM Coding Conventions - MOHD SHARIQ 20060406 */
- if (result == THEME_ERROR_SUCCESS)
- {
- g_thm_cntx.CurrTheme = order_theme_id;
- SetThemes(g_thm_cntx.CurrTheme);
- DisplayPopup(
- (PU8) GetString(STR_THEMES_ALARM_ACTIVATION),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- /* MAUI_00019098_Patch_01 Start */
- if( GetCurrScrnId() == SCR_WALLPAPER_VIEW )
- {
- DeleteUptoScrID(SCR_IDLE_SCR_DISP);
- }
- /* MAUI_00019098_Patch_01 End */
- SetCurrOrderIndex(g_thm_cntx.CurrOrderIndex);
- break;
- }
- else
- {
- /* Go back to previous screen if the theme updation is failed */
- /* 2006/12/31 */
- GoBackHistory();
- }
- }
- }
- else
- {
- result=mmi_tm_activate_theme(order_theme_id);
- //PMT SUKRIT START PMTSW00006364
- if (result == THEME_ERROR_SUCCESS)
- {
- g_thm_cntx.CurrTheme = order_theme_id;
- //PMT SUKRIT END PMTSW00006364
- SetThemes(g_thm_cntx.CurrTheme);
- SetCurrOrderIndex(g_thm_cntx.CurrOrderIndex);
- break;
- //PMT SUKRIT START PMTSW00006364
- }
- //PMT SUKRIT END PMTSW00006364
- }
- }
- }
- //PMT DNLD FIXES 20060513: SUKRIT START MAUI_00192671
- #ifdef __J2ME__
- if(IsJavaPlaying == TRUE)
- {
- if(result != THEME_ERROR_SUCCESS)
- {
- DisplayPopup(
- (PU8) GetString(STR_THEME_UNKNOWN_ERROR),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- }
- DeleteUptoScrID(SCR_JAVA_APP);
- }
- #endif
- //PMT DNLD FIXES 20060513: SUKRIT START MAUI_00192671
- }
- /* Leo add for DLT */
- WriteThemesToNVRAM();
- /* Leo end */
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- U8 no_of_times;
- U8 order_theme;
- /* find the next index of theme to be updated */
- for (no_of_times = 0; no_of_times < NO_OF_ORDERS; no_of_times++)
- {
- /* move order to next one */
- if (g_thm_cntx.CurrOrderIndex == (NO_OF_ORDERS) - 1)
- {
- g_thm_cntx.CurrOrderIndex = 0;
- }
- else
- {
- g_thm_cntx.CurrOrderIndex++;
- }
- order_theme = g_thm_cntx.CurrOrderList[g_thm_cntx.CurrOrderIndex];
- /* if found theme different to current one, found the first one */
- if (order_theme != g_thm_cntx.CurrTheme && order_theme < g_thm_cntx.TotalTheme)
- {
- break;
- }
- }
- #ifdef __J2ME__
- if (GetActiveScreenId() == SCR_JAVA_APP)
- {
- IsJavaPlaying = TRUE;
- jvm_pause_dummy_screen();
- }
- #endif /* __J2ME__ */
- if (no_of_times < NO_OF_ORDERS)
- {
- g_thm_cntx.CurrTheme = order_theme;
- WriteThemesToNVRAM();
- if (!g_alm_frm_cntx.IsPwronAlarm)
- {
- if (g_thm_cntx.IsInThmApp == 0) /* is not in theme menu */
- {
- SetThemes(g_thm_cntx.CurrTheme);
- /* PMT NEERAJ START 20050804 */
- #ifdef __MMI_UI_TAB_PANE__
- SetThemeAlarmCallBackUpdateUITheme();
- #endif
- //PMT NEERAJ END 20050804
- //MTK Leo add, fix theme update issue
- // EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
- // GoBackHistory();
- }
- else if (g_thm_cntx.IsInThmApp == 1)
- {
- /* SetExitHandler(SCR_ID_THM_MENU, NULL); */
- ClearExitHandler();
- EntryThmMenu();
- }
- order_theme++;
- }
- else
- {
- SetThemes(g_thm_cntx.CurrTheme);
- }
- }
- #ifdef __J2ME__
- if (IsJavaPlaying == TRUE)
- {
- jvm_resume_dummy_screen();
- }
- #endif /* __J2ME__ */
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /* Leo add for DLT */
- /* WriteThemesToNVRAM(); */
- /* Leo end */
- *period = ALM_WITHOUD_EXPIRY_PERIOD;
- return ALM_HAS_NO_IND;
- }
- /*****************************************************************************
- * FUNCTION
- * ReadThemesFromNVRAM
- * DESCRIPTION
- * Read theme settings from NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ReadThemesFromNVRAM(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* Leo add for DLT */
- #ifndef __MMI_THEMES_V2_SUPPORT__
- S16 error = 0;
- U8 index = 0;
- U8 *temp_name;
- thm_nvram_struct nvram_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* initialize global contex */
- memset(&g_thm_cntx, 0, sizeof(g_thm_cntx));
- g_thm_cntx.TotalTheme = (U8) GetThemesNames((U8 ***) & temp_name);
- ReadRecord(NVRAM_EF_THEMES_VALUES, 1, &nvram_theme, 8, &error);
- /* to present abonromal case of NVRAM default value */
- if (nvram_theme.freq_type > ALM_FREQ_SEASONALLY)
- {
- g_thm_cntx.CurrUpdatePeriod = ALM_FREQ_OFF;
- }
- else
- {
- g_thm_cntx.CurrUpdatePeriod = (U8) (nvram_theme.freq_type);
- }
- g_thm_cntx.CurrTheme = nvram_theme.current_theme_index;
- /* set order list */
- if (nvram_theme.set_order_flag >= -1) /* order has be set before */
- {
- g_thm_cntx.IsOrderChanged = 1;
- g_thm_cntx.CurrOrderIndex = nvram_theme.set_order_flag;
- for (index = 0; index < NO_OF_ORDERS; index++)
- {
- g_thm_cntx.CurrOrderList[index] = nvram_theme.themes_order[index];
- }
- }
- else
- {
- g_thm_cntx.IsOrderChanged = 0;
- g_thm_cntx.CurrOrderIndex = 0;
- for (index = 0; index < NO_OF_ORDERS; index++)
- {
- g_thm_cntx.CurrOrderList[index] = index;
- }
- }
- /* set and apply current theme */
- if (g_thm_cntx.CurrTheme >= g_thm_cntx.TotalTheme)
- {
- g_thm_cntx.CurrOrderIndex = 0;
- g_thm_cntx.CurrTheme = 0;
- }
- SetThemes(g_thm_cntx.CurrTheme);
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /* Leo end */
- }
- /*****************************************************************************
- * FUNCTION
- * ConstructThemeOrderList
- * DESCRIPTION
- * function to construct themes order list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- void ConstructThemeOrderList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- U8 index = 0;
- thm_nvram_struct nvram_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* initialize global contex */
- g_thm_cntx.TotalTheme = mmi_tm_get_total_themes_count();
- #if (defined(__MMI_THEMES_V2_SUPPORT__) || defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)) /* ritesh */
- ReadRecord(NVRAM_EF_THEMES_VALUES, 1, &nvram_theme, 96, &error);
- #endif
- g_thm_cntx.CurrUpdatePeriod = (U8) (nvram_theme.freq_type);
- /* set order list */
- if (nvram_theme.set_order_flag >= -1) /* order has be set before */
- {
- g_thm_cntx.IsOrderChanged = 1;
- g_thm_cntx.CurrOrderIndex = nvram_theme.set_order_flag;
- currorderindex = (U8) nvram_theme.set_order_flag;
- for (index = 0; index < TOTAL_THEMES_COUNT; index++) /* ritesh */
- {
- /* g_thm_cntx.CurrOrderList[index] = nvram_theme.themes_order[index]; */
- setorderIDList[index] = nvram_theme.themes_order[index];
- }
- }
- else
- {
- g_thm_cntx.IsOrderChanged = 0;
- }
- /* set and apply current theme */
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * WriteThemesToNVRAM
- * DESCRIPTION
- * write theme settings to NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void WriteThemesToNVRAM()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 index = 0;
- S16 error = 0;
- thm_nvram_struct nvram_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- nvram_theme.freq_type = g_thm_cntx.CurrUpdatePeriod;
- #else
- nvram_theme.freq_type = g_thm_cntx.CurrUpdatePeriod;
- #endif
- if (g_thm_cntx.IsOrderChanged == 1)
- #ifdef __MMI_THEMES_V2_SUPPORT__
- nvram_theme.set_order_flag = currorderindex; /* changes made on saturday 09/04/05 */
- #else
- nvram_theme.set_order_flag = g_thm_cntx.CurrOrderIndex;
- #endif
- if (g_thm_cntx.IsOrderChanged == 0)
- {
- nvram_theme.set_order_flag = -1;
- }
- #ifndef __MMI_THEMES_V2_SUPPORT__
- if (g_thm_cntx.CurrTheme < g_thm_cntx.TotalTheme)
- {
- nvram_theme.current_theme_index = (U8) g_thm_cntx.CurrTheme;
- }
- else
- {
- g_thm_cntx.CurrTheme = nvram_theme.current_theme_index = 0;
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- for (index = 0; index < TOTAL_THEMES_COUNT; index++) /* ritesh */
- {
- nvram_theme.themes_order[index] = setorderIDList[index];
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- for (index = 0; index < NO_OF_ORDERS; index++)
- {
- nvram_theme.themes_order[index] = g_thm_cntx.CurrOrderList[index];
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- #if (defined(__MMI_THEMES_V2_SUPPORT__) || defined(__MMI_DOWNLOADABLE_THEMES_SUPPORT__)) /* ritesh */
- WriteRecord(NVRAM_EF_THEMES_VALUES, 1, &nvram_theme, 96, &error);
- #else
- WriteRecord(NVRAM_EF_THEMES_VALUES, 1, &nvram_theme, 8, &error);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * UpdateThemeAlarm
- * DESCRIPTION
- * Call by settings application when time/date change
- * and set the alam of update theme according to current time/date
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UpdateThemeAlarm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.IsSetFromMenu = 0;
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF) /* not OFF */
- {
- UpdateThemePeriod();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetStartPositionofCurIndex
- * DESCRIPTION
- * set the starting position of update order index
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SetStartPositionofCurIndex(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 index = 0, flag = 0;
- U8 curr_order;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- if (g_thm_cntx.CurrOrderIndex < 0 || g_thm_cntx.CurrOrderIndex >= TOTAL_THEMES_COUNT)
- #else
- if (g_thm_cntx.CurrOrderIndex < 0)
- #endif
- curr_order = 0;
- else
- {
- curr_order = (U8) g_thm_cntx.CurrOrderIndex;
- }
- /* find the position of current selected theme */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- for (index = 0; index < g_thm_cntx.TotalTheme; index++) /* ritesh */
- {
- if (g_thm_cntx.SetOrderIDList[curr_order] == g_thm_cntx.CurrTheme)
- {
- flag = 1;
- break;
- }
- if (curr_order == (g_thm_cntx.TotalTheme) - 1)
- {
- curr_order = 0;
- }
- else
- {
- curr_order++;
- }
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- for (index = 0; index < NO_OF_ORDERS; index++)
- {
- if (g_thm_cntx.CurrOrderList[curr_order] == g_thm_cntx.CurrTheme)
- {
- flag = 1;
- break;
- }
- if (curr_order == (NO_OF_ORDERS) - 1)
- {
- curr_order = 0;
- }
- else
- {
- curr_order++;
- }
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- if (flag == 1) /* it's in the list */
- {
- g_thm_cntx.CurrOrderIndex = curr_order;
- g_thm_cntx.IsOrderChanged = 1;
- }
- else
- {
- g_thm_cntx.CurrOrderIndex = -1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ATSetTheme
- * DESCRIPTION
- * To change theme setting from AT command
- * PARAMETERS
- * index [IN] Index of theme to be set
- * RETURNS
- * void
- *****************************************************************************/
- BOOL ATSetTheme(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* added by ritesh for V2 support */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- U16 result;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_thm_cntx.IsInThmApp == 0)
- {
- mmi_tm_get_themes(&thm_details);
- result = mmi_tm_activate_theme(thm_details[index].theme_id); /* PMT TM Coding Conventions - MOHD SHARIQ 20060406 */
- SetThemes(g_thm_cntx.CurrTheme);
- switch (result)
- {
- case THEME_ERROR_SUCCESS:
- g_thm_cntx.CurrTheme = thm_details[index].theme_id;
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- SetStartPositionofCurIndex();
- }
- SetCurrOrderIndex(g_thm_cntx.CurrOrderIndex);
- DisplayPopup(
- (PU8) GetString(STR_THEME_ACTIVATE_SUCCESS),
- IMG_GLOBAL_ACTIVATED,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_THM_MENU);
- return MMI_TRUE;
- /* break; */
- case THEME_ERROR_ALREADY_ACTIVATED:
- DisplayPopup(
- (PU8) GetString(STR_ID_FMGR_ALREADY_ACTIVE),
- IMG_GLOBAL_INFO,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- return MMI_FALSE;
- /* break; */
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- case THEME_ERROR_THEME_NOT_AVAILABLE:
- DisplayPopup(
- (PU8) GetString(STR_THEME_NOT_AVAILABLE),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- /* break; */
- case THEME_ERROR_FILE_FORMAT_BAD:
- DisplayPopup(
- (PU8) GetString(STR_THEME_FORMAT_NOT_SUPPORTED),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- /* break; */
- case THEME_ERROR_FAILURE:
- DisplayPopup(
- (PU8) GetString(STR_THEME_UNKNOWN_ERROR),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- return MMI_FALSE;
- /* break; */
- case THEME_ERROR_VERSION_FAILURE:
- DisplayPopup(
- (PU8) GetString(STR_DOWNLOAD_THEME_UNSUPPORTED),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- /* break; */
- case THEME_ERROR_PROCESS_QUEUE_SUCESS:
- DisplayPopup(NULL, IMG_PROCESSING_PHONEBOOK, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
- return MMI_FALSE;
- /* break; */
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00192708 */
- case THEME_ERROR_LCD_SIZE_MISMATCH:
- DisplayPopup(
- (PU8) GetString(STR_LCD_SIZE_MISMATCH),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- //PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00192708
- //PMT DNLD FIXES 20060513: SUKRIT START MAUI_00221313
- case THEME_ERROR_FILENAME_INCORRECT:
- DisplayPopup(
- (PU8) GetString(STR_THEME_ERROR_FILENAME_INCORRECT),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- /* PMT DNLD FIXES 20060513: SUKRIT END MAUI_00221313 */
- case THEME_ERROR_PHONE_MODEL_MISMATCH:
- DisplayPopup(
- (PU8) GetString(STR_THEME_ERROR_PHONE_MODEL_MISMATCH),
- IMG_GLOBAL_WARNING,
- 0,
- UI_POPUP_NOTIFYDURATION_TIME,
- WARNING_TONE);
- return MMI_FALSE;
- default:
- DisplayPopup(
- (PU8) GetString(STR_THEME_UNKNOWN_ERROR),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- return MMI_FALSE;
- /* break; */
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- }
- WriteThemesToNVRAM();
- }
- else
- {
- return MMI_FALSE;
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- /* index exceeds boundary or theme is not changed */
- if (index >= g_thm_cntx.TotalTheme || index == g_thm_cntx.CurrTheme)
- {
- return MMI_FALSE;
- }
- g_thm_cntx.CurrTheme = index;
- /* reset postion index of update period */
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- SetStartPositionofCurIndex();
- }
- /* write change to NVRAM */
- WriteThemesToNVRAM();
- /* change theme */
- if (g_thm_cntx.IsInThmApp == 0) /* is not in theme menu */
- {
- SetBothLCDThemes(index);
- /* MTK Leo add, fix theme update issue */
- EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL);
- GoBackHistory();
- }
- else if (g_thm_cntx.IsInThmApp == 1)
- {
- /* SetExitHandler(SCR_ID_THM_MENU, NULL); */
- ClearExitHandler();
- EntryThmMenu();
- }
- return MMI_TRUE;
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- }
- #ifdef __MMI_THEMES_V2_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * SetOrderIDList
- * DESCRIPTION
- * To construct set order ID list
- * PARAMETERS
- * IDList [?]
- * SetNoOfThemes [IN]
- * index [IN] Of the activated theme
- * three:(?)
- * pointer to array of ID list(?)
- * total no of themes in set order list(?)
- * RETURNS
- * void
- *****************************************************************************/
- void SetOrderIDList(U32 IDList[], U8 SetNoOfThemes, S16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- setorderIDList[i] = IDList[i];
- }
- currorderindex = index;
- WriteThemesToNVRAM();
- }
- /*****************************************************************************
- * FUNCTION
- * GetIDList
- * DESCRIPTION
- * function to get set order ID List
- * PARAMETERS
- * GetIDList [IN]
- * index [?]
- * RETURNS
- * void
- *****************************************************************************/
- U8 GetIDList(U32 **GetIDList, S16 *index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- count = CheckForCorrectOrder();
- if (count == 0)
- {
- currorderindex = -1;
- }
- *GetIDList = setorderIDList;
- *index = currorderindex;
- WriteThemesToNVRAM();
- return count;
- }
- /*****************************************************************************
- * FUNCTION
- * CheckForCorrectOrder
- * DESCRIPTION
- * function to check for correct order in set order list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U8 CheckForCorrectOrder(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i, j = 0, set_flag = 0;
- U8 count = 0, totaltheme;
- U32 tempIDList[TOTAL_THEMES_COUNT];
- /* MAUI_00019288_Patch_01 Start */
- U16 actual_count = 0;
- /* MAUI_00019288_Patch_01 End */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- totaltheme = mmi_tm_get_themes(&thm_details);
- ConstructThemeOrderList();
- for (i = 0; i < TOTAL_THEMES_COUNT; i++)
- {
- while (j != totaltheme)
- {
- if (setorderIDList[i] == 0)
- {
- tempIDList[i] = setorderIDList[i];
- set_flag = 1;
- /* MAUI_00019288_Patch_01 Start */
- actual_count++;
- /* MAUI_00019288_Patch_01 End */
- break;
- }
- if (setorderIDList[i] == thm_details[j].theme_id)
- {
- tempIDList[i] = setorderIDList[i];
- count++;
- /* MAUI_00019288_Patch_01 Start */
- actual_count++;
- /* MAUI_00019288_Patch_01 End */
- set_flag = 1;
- break;
- }
- j++;
- }
- if (set_flag == 0)
- {
- tempIDList[i] = -1;
- if (currorderindex >= i)
- {
- currorderindex--;
- }
- }
- set_flag = 0;
- j = 0;
- }
- /* if(j==g_thm_cntx.TotalTheme-1 && setorderIDList[i]!=thm_details[j].theme_id )
- {
- if(currorderindex>0 && i<currorderindex)
- currorderindex=currorderindex-1;
- break;
- } */
- for (i = 0; i < TOTAL_THEMES_COUNT; i++)
- {
- if (tempIDList[i] != -1)
- {
- setorderIDList[set_flag++] = tempIDList[i];
- }
- }
- /* MAUI_00019288_Patch_01 Start */
- for (i = actual_count; i < TOTAL_THEMES_COUNT; i++)
- /* MAUI_00019288_Patch_01 End */
- {
- setorderIDList[i] = -1;
- }
- return count;
- }
- /*****************************************************************************
- * FUNCTION
- * SetCurrOrderIndex
- * DESCRIPTION
- * function to set current order index
- * PARAMETERS
- * index [IN] Of current theme in set order list
- * RETURNS
- * void
- *****************************************************************************/
- void SetCurrOrderIndex(S16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currorderindex = index;
- WriteThemesToNVRAM();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_isValidUrl
- * DESCRIPTION
- * function to check valid url.
- * PARAMETERS
- * pucURLText [IN]
- * RETURNS
- * pBOOL
- *****************************************************************************/
- pBOOL mmi_thm_isValidUrl(S8 *pucURLText)
- {
- S32 iLength ;
- S32 iQueryIndex ;
- S32 iSchemeIndex ;
- S32 iHostIndex ;
- S32 iHostEndIndex ;
- S32 iPortIndex ;
- S32 iPasswordIndex ;
- S32 iPathIndex ;
- S32 iAtIndex ;
- S32 iHashIndex ;
- S32 index ;
- pBOOL bisValid = TRUE ;
- pBOOL bIsFileScheme = FALSE ;
- iQueryIndex = iSchemeIndex = iHostIndex = iPortIndex = iAtIndex = iPathIndex = iPasswordIndex = iHashIndex = -1 ;
- iHostEndIndex = 0 ;
- iLength = strlen ((const char *) pucURLText) ;
- for (index = 0; index < iLength; index++)
- {
- switch (pucURLText[index])
- {
- case '@':
- if (iPasswordIndex > 0)
- {
- iHostIndex = index + 1 ;
- iAtIndex = index ;
- }
- break ;
- case '?':
- iQueryIndex = index + 1 ;
- break ;
- case ':':
- if (iQueryIndex < 0)
- {
- if (pucURLText [index + 1] == '/' && pucURLText [index + 2] == '/')
- {
- iSchemeIndex = index ;
- index += 2 ;
- }
- else if (pucURLText [index + 1] == '/')
- {
- iSchemeIndex = index ;
- }
- else
- {
- if (iPasswordIndex < 0)
- {
- iPasswordIndex = index + 1 ;
- }
- else
- {
- iPortIndex = index + 1 ;
- }
- }
- }
- break ;
- case '#':
- iHashIndex = index ;
- break ;
- case '/':
- if (iQueryIndex < 0 && iPathIndex < 0 && pucURLText [index + 1] != '/'
- && pucURLText [index - 1] != '/')
- {
- iPathIndex = index ;
- }
- break ;
- default:
- break ;
- }
- if (iQueryIndex > 0)
- {
- break ;
- }
- }
- if (iPortIndex < 0)
- {
- if (iPasswordIndex > 0 && iAtIndex < 0)
- {
- iPortIndex = iPasswordIndex ;
- }
- }
- if (iHostIndex < 0)
- {
- if (iSchemeIndex > 0)
- {
- iHostIndex = iSchemeIndex + 3 ;
- }
- else
- {
- iHostIndex = 0 ;
- }
- }
- if (iPathIndex < 0)
- {
- if (iQueryIndex > 0)
- {
- iLength = iQueryIndex - 1 ;
- }
- else if (iHashIndex > 0)
- {
- iLength = iHashIndex ;
- }
- iPathIndex = iLength ;
- iHostEndIndex = iLength - 1 ;
- }
- else
- {
- iHostEndIndex = iPathIndex - 1 ;
- }
- if (FALSE == bIsFileScheme)
- {
- if (mmi_thm_checkValidScheme (pucURLText, iSchemeIndex) == 0)
- {
- bisValid = FALSE ;
- }
- if (iPortIndex > 0)
- {
- if (mmi_thm_checkValidPort (pucURLText, iPortIndex, iPathIndex - 1) == 0)
- {
- bisValid = FALSE ;
- }
- }
- if (iPortIndex < 0)
- {
- if (mmi_thm_checkValidHostname (pucURLText, iHostIndex, iHostEndIndex) == 0)
- {
- bisValid = FALSE ;
- }
- }
- else
- {
- if (mmi_thm_checkValidHostname (pucURLText, iHostIndex, iPortIndex - 2) == 0)
- {
- bisValid = FALSE ;
- }
- }
- }
- return bisValid;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_checkValidIpaddress
- * DESCRIPTION
- * function to check valid Ip Address.
- * PARAMETERS
- * psUrl_value [IN]
- * iStart_index [IN]
- * iEnd_index [IN]
- * RETURNS
- * pBOOL
- *****************************************************************************/
- pBOOL mmi_thm_checkValidIpaddress (S8 *psUrl_value, S32 iStart_index, S32 iEnd_index)
- {
- S32 index ;
- S8 numeric_value [THEME_IPADDRESS_NUMERIC_LENGTH] ;
- S32 iIndex ;
- S32 iDots_count = 0 ;
- S32 iActual_value ;
- iIndex = 0 ;
- memset (numeric_value, 0, THEME_IPADDRESS_NUMERIC_LENGTH) ;
- for (index = iStart_index; index <= iEnd_index; index++)
- {
- if ((psUrl_value [index] == '.') || (' ' == psUrl_value [index]))
- {
- if ('.' == psUrl_value [index])
- {
- iDots_count++ ;
- }
- iActual_value = atoi ((S8 *) numeric_value) ;
- if (iActual_value > 255 || iActual_value < 0)
- {
- return FALSE ;
- }
- if (iDots_count == 1)
- {
- if (iActual_value == 0)
- {
- return FALSE ;
- }
- }
- memset (numeric_value, 0, THEME_IPADDRESS_NUMERIC_LENGTH) ;
- iIndex = 0 ;
- }
- else if ((psUrl_value [index] >= THEME_NUMERIC_BEGIN && psUrl_value [index] <= THEME_NUMERIC_END))
- {
- if (iIndex == THEME_IPADDRESS_NUMERIC_LENGTH)
- {
- return FALSE ;
- }
- numeric_value [iIndex++] = (S8) psUrl_value [index] ;
- }
- else if ((psUrl_value [index] != THEME_NUMERIC_BEGIN && psUrl_value [index] != THEME_NUMERIC_END))
- {
- return FALSE ;
- }
- }
- if (iDots_count != 3)
- {
- return FALSE ;
- }
- return TRUE ;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_checkValidScheme
- * DESCRIPTION
- * function to check valid Scheme.
- * PARAMETERS
- * pucURLText [IN]
- * iSchemeIndex [IN]
- * RETURNS
- * pBOOL
- *****************************************************************************/
- pBOOL mmi_thm_checkValidScheme (S8 *pucURLText, S32 iSchemeIndex)
- {
- S32 index ;
- pBOOL bValid = TRUE ;
- if (iSchemeIndex > 0)
- {
- if (iSchemeIndex < 4)
- {
- bValid = FALSE ;
- }
- else
- {
- bValid = FALSE ;
- for (index = 0; index < THEME_TOTAL_VALID_SCHEME; index++)
- {
- if (0 == strncmp ((S8 *) pucURLText, mmi_thm_ValidSchemeList[index], iSchemeIndex))
- {
- bValid = TRUE ;
- index = THEME_TOTAL_VALID_SCHEME ;
- }
- }
- index = iSchemeIndex++ ;
- if (pucURLText [index] != ':' && pucURLText [++index] != '/' && pucURLText [++index] != '/')
- {
- bValid = FALSE ;
- }
- }
- }
- else
- {
- bValid = TRUE ;
- }
- return bValid ;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_checkValidPort
- * DESCRIPTION
- * function to check valid Port.
- * PARAMETERS
- * pucURLText [IN]
- * iStartIndex [IN]
- * iEndIndex [IN]
- * RETURNS
- * pBOOL
- *****************************************************************************/
- pBOOL mmi_thm_checkValidPort (S8 *pucURLText, S32 iStartIndex, S32 iEndIndex)
- {
- S32 index = 0 ;
- pBOOL bIsValid = TRUE ;
- if (iStartIndex > 0 && iEndIndex > 0)
- {
- for (index = iStartIndex; index <= iEndIndex; index++)
- {
- if (! (pucURLText [index] >= THEME_NUMERIC_BEGIN && pucURLText [index] <= THEME_NUMERIC_END))
- {
- bIsValid = FALSE ;
- }
- }
- }
- return bIsValid ;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_thm_checkValidHostname
- * DESCRIPTION
- * function to check Host Name.
- * PARAMETERS
- * pucURLText [IN]
- * iStartIndex [IN]
- * iEndIndex [IN]
- * RETURNS
- * pBOOL
- *****************************************************************************/
- pBOOL mmi_thm_checkValidHostname (S8 *pucURLText, S32 iStartIndex, S32 iEndIndex)
- {
- S16 isIpAddress ;
- S32 iDotsCount ;
- pBOOL bIsValid = TRUE ;
- S32 index ;
- if (iStartIndex >= 0 && iEndIndex > 0)
- {
- isIpAddress = 1 ;
- iDotsCount = 0 ;
- if (pucURLText [iStartIndex] == '.' || pucURLText [iStartIndex] == '-')
- {
- bIsValid = FALSE ;
- }
- if (pucURLText [iEndIndex] == '.' || pucURLText [iEndIndex] == '-')
- {
- bIsValid = TRUE ;
- }
- if (TRUE == bIsValid)
- {
- for (index = iStartIndex; index <= iEndIndex; index++)
- {
- if (pucURLText [index] != '.' && pucURLText [index] != '-' && pucURLText [index] != '_')
- {
- if (! (pucURLText [index] >= THEME_NUMERIC_BEGIN && pucURLText [index] <= THEME_NUMERIC_END))
- {
- isIpAddress = 0 ;
- if (! ((pucURLText [index] >= THEME_LOWER_CASE_ALPHA_BEGIN && pucURLText [index] <=
- THEME_LOWER_CASE_ALPHA_END) || (pucURLText [index] >= THEME_UPPER_CASE_ALPHA_BEGIN && pucURLText [index] <= THEME_UPPER_CASE_ALPHA_END)))
- {
- bIsValid = FALSE ;
- }
- }
- }
- else
- {
- if (pucURLText [index] == '.')
- {
- iDotsCount++ ;
- }
- if (pucURLText [index + 1] == '.' || pucURLText [index + 1] == '-')
- {
- bIsValid = FALSE ;
- }
- }
- }
- if (isIpAddress == 1)
- {
- if (iDotsCount == 3)
- {
- bIsValid = mmi_thm_checkValidIpaddress (pucURLText, iStartIndex, iEndIndex) ;
- }
- else
- {
- bIsValid = FALSE ;
- }
- }
- }
- }
- else
- {
- bIsValid = FALSE ;
- }
- return bIsValid ;
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- #endif /* __MMI_THEMES_APPLICATION__ */
- #endif /* _MMI_THEME_C */