MMIThemes.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:135k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * MMIthemes.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file implements Theme application.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************//**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : MMIThemes.c
- PURPOSE : Theme application
- REMARKS : nil
- AUTHOR : Restructured by manju
- DATE : Restructured on May-24-2003
- **************************************************************/
- #ifndef _MMI_THEME_C
- #define _MMI_THEME_C
- /* Include: MMI header file */
- #include "MMI_features.h"
- #ifdef __MMI_THEMES_APPLICATION__
- #include "PixtelDataTypes.h"
- #include "FunAndGamesDefs.h" /* application */
- #include "FunAndGamesProts.h"
- #include "Unicodexdcl.h"
- #include "TimerEvents.h" /* timer */
- #include "NVRAMType.h" /* NVRAM read/write */
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "EventsGprot.h" /* screen, history, and resource */
- #include "historyGprot.h"
- #include "CustMenuRes.h"
- #include "wgui_categories.h"
- #include "MainMenuDef.h"
- #include "GlobalDefs.h"
- #include "CommonScreens.h"
- /* MAUI_00019098_Patch_01 Start */
- #include "SettingDefs.h"
- #include "WallpaperDefs.h"
- /* MAUI_00019098_Patch_01 End */
- #include "HelpProt.h"
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00221092 */
- #include "SimDetectionGexdcl.h"
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00221092 */
- #include "AlarmFrameworkProt.h"
- #include "DateTimeGprot.h"
- #include "DebugInitDef.h" /* debug */
- #include "GlobalScrEnum.h"
- #include "SubLCDHistoryGprot.h"
- /* Leo add for DLT */
- #include "PhoneBookDef.h"
- #include "MMIThemes.h"
- #include "wgui_categories_inputsenum.h"
- #include "wgui_categories_inputs.h"
- #include "Wgui_status_icons.h"
- #ifdef MMI_ON_HARDWARE_P
- #include "wap_ps_struct.h"
- #include "wapadp.h"
- #endif /* MMI_ON_HARDWARE_P */
- #include "mmiapi.h"
- #include "FileManagerGProt.h"
- #include "FileManagerDef.h"
- /* Leo end */
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- #include "SimDetectionGprot.h"
- #else
- #include "Wgui_categories_util.h"
- #endif
- #include "JavaAgencyDef.h"
- /*
- * Define
- */
- #define NO_OF_THEME_OPTION_MENUITEMS_IN_USB_MODE 2
- /*
- * Typedef
- */
- /*
- * Local Variable
- */
- /*
- * Local Function
- */
- /*
- * Global Variable
- */
- thm_contex_struct g_thm_cntx;
- extern wgui_inline_item wgui_inline_items[]; /* shall be move to header file later */
- const U8 g_themes_freq_set[THMEM_FREQ_NUM] =
- {ALM_FREQ_OFF, ALM_FREQ_HOURLY, ALM_FREQ_EVERYDAY, ALM_FREQ_WEEKLY, ALM_FREQ_MONTHLY, ALM_FREQ_SEASONALLY};
- #ifdef __MMI_THEMES_V2_SUPPORT__
- tm_theme_list_struct *thm_details;
- U16 delete_flag = 1;
- U32 setorderIDList[TOTAL_THEMES_COUNT]; /* it is only for stub testing); */
- U8 g_temp_thm_index;
- S16 currorderindex; /* this is only for set order list */
- /* U8 thm_file_check=0; */
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /* Leo add for DLT */
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- #define MAX_URL_LIST_ENTRIES 7
- /* S8 g_thm_recent_url[MAX_URL_ENTRIES][MAX_ENTER_ADDRESS_SIZE]; */
- thm_nvram_download_list recent_url_list;
- S8 g_thm_download_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
- S16 g_total_recent_list;
- U16 g_recent_item_index;
- U8 dontSaveURLinHistory;
- static U8 is_exit_from_browser;
- void Add_To_URL_List(void);
- void HighlightThmDownloadOption(int index);
- void Edit_URL_address(void);
- void theme_goto_url(void);
- void theme_connect_wap(void);
- void preEntryThmDownload(void);
- void edit_url_address(void);
- void exit_url_address(void);
- void thm_add_to_URL_List(void);
- void entry_url_done_input_option(void);
- void exit_url_done_input_option(void);
- void EntryInputMethodScreen(void);
- void Download2GoBackHistory(void);
- extern void mmi_frm_highlight_input_method_generic(void);
- #ifdef MMI_ON_HARDWARE_P
- #ifdef OBIGO_SUPPORT
- extern void wap_entry_widget_not_ready(void);
- #elif defined JATAAYU_SUPPORT
- extern void mmi_brw_entry_wap_not_ready(void);
- #endif
- extern S32 wap_browser_is_open(void);
- #endif /* MMI_ON_HARDWARE_P */
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /* Leo end */
- #ifdef __J2ME__
- extern void jvm_pause_dummy_screen(void);
- extern void jvm_resume_dummy_screen(void);
- #endif /* __J2ME__ */
- /*
- * Global Function
- */
- extern void UpdateUITheme(void);
- extern const S8 *gDefaultDLT_URL;
- #ifdef __MMI_UI_TAB_PANE__
- extern void check_and_set_title_theme_changed(void);
- #endif
- /* Leo add for DLT */
- #ifdef MMI_ON_HARDWARE_P
- extern int wap_is_ready(void);
- #endif
- /* Leo end */
- #define __MMI_THEME_AUTO_UPDATE__
- #ifdef __MMI_THEMES_V2_SUPPORT__
- static S8 *mmi_thm_ValidSchemeList [THEME_TOTAL_VALID_SCHEME] = {"file","http","https"} ;
- #endif
- /*****************************************************************************
- * FUNCTION
- * InitThemes
- * DESCRIPTION
- * Initialize themes
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitThemes(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetHiliteHandler(MENU3101_THEMES, HighlightThmMenu);
- /* Leo add for DLT */
- #ifdef __MMI_THEMES_V2_SUPPORT__ /* ritesh */
- ConstructThemeList();
- /* ConstructThemeOrderList(); */
- mmi_tm_activate_theme_at_bootup();
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- SetThemes(g_thm_cntx.CurrTheme);
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- FillThemesList();
- MMI_apply_current_theme();
- #endif /* __MMI_THEMES_V2_SUPPORT__ */ /* ritesh */
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- g_total_recent_list = 0;
- #endif
- /* Leo end */
- }
- /*****************************************************************************
- * FUNCTION
- * ThemesFCBInit
- * DESCRIPTION
- * Set calback function of alarm framework
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThemesFCBInit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_alm_set_start_index(ALM_TYPE_THEME, ALM_THM_START);
- AlmSetExpiryTimeCB(ALM_TYPE_THEME, ThemesExpiryTimeCBH);
- AlmSetExpiryHandlerCB(ALM_TYPE_THEME, ThemeAlarmCallBack);
- #ifdef __MMI_THEMES_V2_SUPPORT__
- AlmSetInitHandlerCB(ALM_TYPE_THEME, ConstructThemeOrderList, ThemesReInitQueueCBH);
- #else
- AlmSetInitHandlerCB(ALM_TYPE_THEME, ReadThemesFromNVRAM, ThemesReInitQueueCBH);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * ThemesExpiryTimeCBH
- * DESCRIPTION
- * Callback handler to get information of theme expiry setting.
- * PARAMETERS
- * index [IN]
- * alarmTime [?]
- * Freq [?]
- * WeekDays [?]
- * MYTIME(?) [IN/OUT] Expiry time set by user
- * U8(?) [IN/OUT] Expiry days of week
- * RETURNS
- * void
- *****************************************************************************/
- void ThemesExpiryTimeCBH(U8 index, MYTIME *alarmTime, U8 *Freq, U8 *WeekDays, MYTIME* preReminder)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *Freq = g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod];
- *WeekDays = 1;
- }
- /*****************************************************************************
- * FUNCTION
- * ThemesReInitQueueCBH
- * DESCRIPTION
- * Reinit themes to alarm queue
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThemesReInitQueueCBH(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
- {
- AlmInsertIntoQueue(ALM_THM_START, FALSE);
- }
- }
- extern void ExecSubLCDCurrExitHandler(void);
- extern void GoBackSubLCDHistory(void);
- /*****************************************************************************
- * FUNCTION
- * SetBothLCDThemes
- * DESCRIPTION
- * Set themes of both main and sub lcd
- * PARAMETERS
- * index [IN] Index of theme
- * RETURNS
- * void
- *****************************************************************************/
- void SetBothLCDThemes(U8 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- ExecSubLCDCurrExitHandler();
- GoBackSubLCDHistory();
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- SetThemes(index);
- UpdateUITheme();
- /* PMT NEERAJ START 20050616 */
- #ifdef __MMI_UI_TAB_PANE__
- check_and_set_title_theme_changed();
- #endif
- //PMT NEERAJ END 20050616
- //MTK Leo add, fix theme update issue
- // SUBLCD_RedrawCategoryFunction();
- ExecSubLCDCurrExitHandler();
- GoBackSubLCDHistory();
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * ConstructThemeList
- * DESCRIPTION
- * Get the themes and construct set order list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- void ConstructThemeList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* U8 i,j; */
- U8 no_of_setorder_themes, themecount;
- U32 *p;
- U8 set_flag = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- no_of_setorder_themes = GetIDList(&p, &g_thm_cntx.CurrOrderIndex);
- g_thm_cntx.TotalTheme = mmi_tm_get_total_themes_count();
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- SetThemes(g_thm_cntx.CurrTheme);
- switch (no_of_setorder_themes)
- {
- case 0:
- for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
- {
- g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
- g_thm_cntx.SetOrderIDList[no_of_setorder_themes] = p[no_of_setorder_themes];
- }
- break;
- default:
- for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
- {
- g_thm_cntx.SetOrderIDList[no_of_setorder_themes] = p[no_of_setorder_themes];
- for (themecount = 0; themecount < g_thm_cntx.TotalTheme; themecount++)
- {
- if (g_thm_cntx.SetOrderIDList[no_of_setorder_themes] == 0)
- {
- g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
- set_flag = 1;
- break;
- }
- else if (g_thm_cntx.SetOrderIDList[no_of_setorder_themes] == thm_details[themecount].theme_id)
- {
- g_thm_cntx.TmpOrderList[no_of_setorder_themes] = themecount;
- set_flag = 1;
- break;
- }
- }
- if (set_flag == 0)
- {
- g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
- }
- set_flag = 0;
- }
- }
- for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
- {
- g_thm_cntx.ThemeName[no_of_setorder_themes] = thm_details[no_of_setorder_themes].theme_name;
- }
- g_thm_cntx.ThemeName[g_thm_cntx.TotalTheme] = (PU8) GetString(STR_THEME_NONE);
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * FillThemesList
- * DESCRIPTION
- * Fill inline item selection items
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void FillThemesList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 index = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.TmpOrderList[0] = (S32) g_thm_cntx.CurrOrderList[0];
- g_thm_cntx.TmpOrderList[1] = (S32) g_thm_cntx.CurrOrderList[1];
- g_thm_cntx.TmpOrderList[2] = (S32) g_thm_cntx.CurrOrderList[2];
- g_thm_cntx.TmpOrderList[3] = (S32) g_thm_cntx.CurrOrderList[3];
- for (index = 0; index < g_thm_cntx.TotalTheme; index++)
- {
- g_thm_cntx.ThemeName[index] = (PU8) GetString((U16) (STR_THEME_DEFAULT + index));
- }
- g_thm_cntx.ThemeName[index] = (PU8) GetString(STR_THEME_NONE);
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * SaveOrderThemes
- * DESCRIPTION
- * set order themes and save in NVRAM
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void SaveOrderThemes()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 index;
- U8 flag = 0;
- /* Leo add for DLT */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- U32 TempID;
- U8 count = 0;
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Leo end */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- for (index = 0; index < g_thm_cntx.TotalTheme; index++)
- {
- TempID = thm_details[g_thm_cntx.TmpOrderList[index]].theme_id;
- if (g_thm_cntx.SetOrderIDList[index] != TempID)
- {
- flag = 1;
- break;
- }
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- for (index = 0; index < NO_OF_ORDERS; index++)
- {
- if (g_thm_cntx.CurrOrderList[index] != (U8) g_thm_cntx.TmpOrderList[index])
- {
- flag = 1;
- break;
- }
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- if (flag) /* order changed */
- {
- g_thm_cntx.CurrOrderIndex = -1;
- /* Leo add for DLT */
- g_thm_cntx.IsOrderChanged = 1;
- /* Leo end */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- for (index = 0; index < g_thm_cntx.TotalTheme; index++)
- {
- if (g_thm_cntx.TmpOrderList[index] == TOTAL_THEMES_COUNT)
- {
- g_thm_cntx.SetOrderIDList[index] = 0;
- }
- else
- {
- g_thm_cntx.SetOrderIDList[index] = thm_details[g_thm_cntx.TmpOrderList[index]].theme_id;
- }
- if (g_thm_cntx.SetOrderIDList[index] != 0)
- {
- count++;
- }
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- g_thm_cntx.CurrOrderList[0] = (S8) g_thm_cntx.TmpOrderList[0];
- g_thm_cntx.CurrOrderList[1] = (S8) g_thm_cntx.TmpOrderList[1];
- g_thm_cntx.CurrOrderList[2] = (S8) g_thm_cntx.TmpOrderList[2];
- g_thm_cntx.CurrOrderList[3] = (S8) g_thm_cntx.TmpOrderList[3];
- g_thm_cntx.IsOrderChanged = 1;
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- SetStartPositionofCurIndex();
- WriteThemesToNVRAM();
- #ifdef __MMI_THEMES_V2_SUPPORT__
- SetOrderIDList(g_thm_cntx.SetOrderIDList, count, g_thm_cntx.CurrOrderIndex);
- #endif
- }
- 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;
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightThmSetOrder
- * DESCRIPTION
- * Set LSK of set order list
- * PARAMETERS
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightThmSetOrder(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK); /* Force LSK label to "Ok" each time */
- SetCategory57LeftSoftkeyFunction(SaveOrderThemes);
- }
- /*****************************************************************************
- * FUNCTION
- * EntryThmSetOrder
- * DESCRIPTION
- * Entry function of set order screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryThmSetOrder()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U8 *inputBuffer; /* added for inline edit history */
- U16 inputBufferSize; /* added for inline edit history */
- /* Leo add for DLT */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- S16 i;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Leo end */
- EntryNewScreen(SCR_ID_THM_SET_ORDER, ExitThmSetOrder, NULL, NULL);
- /* Leo add for DLT */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- g_thm_cntx.IsInThmApp = 1;
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- #else
- g_thm_cntx.IsInThmApp = 2;
- #endif
- /* Leo end */
- InitializeCategory57Screen();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_SET_ORDER);
- /* PMT DLT_FIXES - TK 20060306 START */
- #ifndef __MMI_THEMES_V2_SUPPORT__
- if (guiBuffer == NULL)
- {
- g_thm_cntx.TmpOrderList[0] = (S32) g_thm_cntx.CurrOrderList[0];
- g_thm_cntx.TmpOrderList[1] = (S32) g_thm_cntx.CurrOrderList[1];
- g_thm_cntx.TmpOrderList[2] = (S32) g_thm_cntx.CurrOrderList[2];
- g_thm_cntx.TmpOrderList[3] = (S32) g_thm_cntx.CurrOrderList[3];
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /* PMT DLT_FIXES - TK 20060306 END */
- inputBuffer = GetCurrNInputBuffer(SCR_ID_THM_SET_ORDER, &inputBufferSize); /* added for inline edit history */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- if (!guiBuffer)
- {
- ConstructThemeList();
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- #ifdef __MMI_THEMES_V2_SUPPORT__
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- SetInlineItemActivation(&wgui_inline_items[i], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- }
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- SetInlineItemSelect(
- &wgui_inline_items[i],
- (g_thm_cntx.TotalTheme + 1),
- g_thm_cntx.ThemeName,
- (PS32) (&g_thm_cntx.TmpOrderList[i]));
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemActivation(&wgui_inline_items[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
- SetInlineItemSelect(
- &wgui_inline_items[0],
- (g_thm_cntx.TotalTheme + 1),
- g_thm_cntx.ThemeName,
- (PS32) (&g_thm_cntx.TmpOrderList[0]));
- SetInlineItemSelect(
- &wgui_inline_items[1],
- (g_thm_cntx.TotalTheme + 1),
- g_thm_cntx.ThemeName,
- (PS32) & g_thm_cntx.TmpOrderList[1]);
- SetInlineItemSelect(
- &wgui_inline_items[2],
- (g_thm_cntx.TotalTheme + 1),
- g_thm_cntx.ThemeName,
- (PS32) & g_thm_cntx.TmpOrderList[2]);
- SetInlineItemSelect(
- &wgui_inline_items[3],
- (g_thm_cntx.TotalTheme + 1),
- g_thm_cntx.ThemeName,
- (PS32) & g_thm_cntx.TmpOrderList[3]);
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- RegisterHighlightHandler(HighlightThmSetOrder);
- #ifdef __MMI_THEMES_V2_SUPPORT__
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, TOTAL_THEMES_COUNT + 1, inputBuffer);
- }
- ShowCategory57Screen(
- STR_SCR3004_SET_ORDER_CAPTION,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_thm_cntx.TotalTheme,
- (PU16) gIndexIconsImageList,
- wgui_inline_items,
- 0,
- guiBuffer);
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- if (inputBuffer != NULL)
- {
- SetCategory57Data(wgui_inline_items, NO_OF_ORDERS, inputBuffer);
- }
- ShowCategory57Screen(
- STR_SCR3004_SET_ORDER_CAPTION,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- 4,
- (PU16) gIndexIconsImageList,
- wgui_inline_items,
- 0,
- guiBuffer);
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- DisableCategory57ScreenDone();
- SetCategory57RightSoftkeyFunctions(SaveOrderThemes, GoBackHistory);
- }
- /*****************************************************************************
- * FUNCTION
- * ExitThmSetOrder
- * DESCRIPTION
- * Exit function of set order screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitThmSetOrder(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- U16 inputBufferSize; /* added for inline edit history */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- g_thm_cntx.IsInThmApp = 0;
- #endif
- h.scrnID = SCR_ID_THM_SET_ORDER;
- CloseCategory57Screen();
- h.entryFuncPtr = EntryThmSetOrder;
- GetCategoryHistory(h.guiBuffer);
- inputBufferSize = (U16) GetCategory57DataSize(); /* added for inline edit history */
- GetCategory57Data((U8*) h.inputBuffer); /* added for inline edit history */
- AddNHistory(h, inputBufferSize); /* added for inline edit history */
- }
- #ifdef __MMI_THEMES_V2_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * ActivateDefaultTheme
- * DESCRIPTION
- * function to activate default theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ActivateDefaultTheme(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_tm_activate_theme(DefaultThmID);
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- SetThemes(g_thm_cntx.CurrTheme);
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * preEntryThmDownload
- * DESCRIPTION
- * It download a theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void preEntryThmDownload(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ReadRecord(
- NVRAM_EF_THEME_DOWNLOAD_LIST_LID,
- 1,
- &recent_url_list, /* sizeof(thm_nvram_download_list) */
- NVRAM_THEMES_DOWNLOAD_SIZE,
- &error);
- EntryThmDownload();
- }
- /*****************************************************************************
- * FUNCTION
- * EntryThmDownload
- * DESCRIPTION
- * It displays URL list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryThmDownload(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int number_of_items = 0, i;
- U8 *guiBuffer;
- S8 temp_list_unicode_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* U16 max_sub_menu_length= (MAX_SUB_MENU_SIZE-ENCODING_LENGTH)/ENCODING_LENGTH; */
- EntryNewScreen(SCR_ID_DOWNLOAD_ENTER_ADDRESS, NULL, EntryThmDownload, NULL);
- RegisterHighlightHandler(HighlightThmDownloadOption);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_ENTER_ADDRESS);
- memset(subMenuData, 0, sizeof(subMenuData));
- pfnUnicodeStrcpy((PS8) subMenuData[number_of_items], (PS8) get_string(STR_DOWNLOAD_ENTER_ADDRESS));
- number_of_items++;
- AnsiiNToUnicodeString((PS8) subMenuData[number_of_items], (PS8) gDefaultDLT_URL, MAX_SUBMENU_CHARACTERS);
- number_of_items++;
- for (i = 0; number_of_items < (MAX_URL_ENTRIES + 2) && i < recent_url_list.total_entries; number_of_items++, i++)
- {
- AnsiiToUnicodeString((S8*)temp_list_unicode_address,(S8*)recent_url_list.g_thm_recent_url[i]);
- pfnUnicodeStrncpy(
- (PS8) subMenuData[number_of_items],
- (PS8) temp_list_unicode_address,
- MAX_SUB_MENU_SIZE - ENCODING_LENGTH);
- }
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191533 */
- ShowCategory353Screen(
- (U8*) GetString(STR_DOWNLOAD_ENTER_ADDRESS),
- GetRootTitleIcon(MAIN_MENU_FUNANDGAMES_MENUID),
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- number_of_items,
- (U8 **) subMenuDataPtrs,
- (U16*) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191533 */
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- AnsiiToUnicodeString((PS8) g_thm_download_address, (PS8) "http://");
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_thm_highlight_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * int(?)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_thm_highlight_handler(int index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (index == 0)
- {
- SetLeftSoftkeyFunction(thm_add_to_URL_List, KEY_EVENT_UP);
- }
- else
- {
- SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
- RegisterInputMethodScreenCloseFunction(Download2GoBackHistory);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightThmDownloadOption
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * int(?)
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightThmDownloadOption(int index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_recent_item_index = index;
- switch (index)
- {
- case 0:
- SetLeftSoftkeyFunction(edit_url_address, KEY_EVENT_UP);
- break;
- default:
- SetLeftSoftkeyFunction(theme_goto_url, KEY_EVENT_UP);
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * edit_url_address
- * DESCRIPTION
- * It download a theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void edit_url_address(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221134 */
- /* PMT SHARIQ DLT_PATCH 20060814 START */
- S16 required_input_modes[] = {
- INPUT_MODE_MULTITAP_LOWERCASE_ABC,
- INPUT_MODE_123,
- #ifndef __MMI_TOUCH_SCREEN__
- INPUT_MODE_SMART_UPPERCASE_ABC,
- INPUT_MODE_SMART_LOWERCASE_ABC,
- #endif
- INPUT_MODE_MULTITAP_UPPERCASE_ABC,
- -1
- };
- /* PMT SHARIQ DLT_PATCH 20060814 END */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221134 */
- is_exit_from_browser = 0;
- EntryNewScreen(SCR_ID_DOWNLOAD_EDIT_ADDRESS, exit_url_address, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_EDIT_ADDRESS);
- /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221134 */
- ShowCategory5Screen_ext(
- STR_DOWNLOAD_ENTER_ADDRESS,
- /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191533 */ GetRootTitleIcon(MAIN_MENU_FUNANDGAMES_MENUID),
- /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191533 */ STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- (S16) (INPUT_TYPE_ALPHANUMERIC_SENTENCECASE), /* Added by shariq 20060814 */
- (PU8) g_thm_download_address,
- MAX_ENTER_ADDRESS_SIZE + 1,
- guiBuffer,
- 0,
- required_input_modes,
- NULL);
- SetLeftSoftkeyFunction(thm_add_to_URL_List, KEY_EVENT_UP);
- /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221134 */
- SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * exit_url_address
- * DESCRIPTION
- * Exit function to edit url address screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void exit_url_address(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history currHistory;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(!is_exit_from_browser)
- {
- currHistory.scrnID = SCR_ID_DOWNLOAD_EDIT_ADDRESS;
- currHistory.entryFuncPtr = edit_url_address;
- pfnUnicodeStrcpy((S8*) currHistory.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(currHistory.guiBuffer);
- AddHistory(currHistory);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * Download2GoBackHistory
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void Download2GoBackHistory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GoBacknHistory(1);
- }
- /*****************************************************************************
- * FUNCTION
- * entry_url_done_input_option
- * DESCRIPTION
- * Entry function to download theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void entry_url_done_input_option(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 nStrItemList[10];
- U16 numItems;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- dontSaveURLinHistory = 0;
- EntryNewScreen(SCR_ID_DOWNLOAD_DONE_OPTION, exit_url_done_input_option, NULL, NULL);
- guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_DONE_OPTION);
- SetParentHandler(MENU_THM_DOWNLOAD_INPUT_METHOD_AND_DONE_OPTION_ID);
- RegisterHighlightHandler(mmi_frm_thm_highlight_handler);
- numItems = GetNumOfChild(MENU_THM_DOWNLOAD_INPUT_METHOD_AND_DONE_OPTION_ID);
- GetSequenceStringIds(MENU_INPUT_METHOD_AND_DONE_OPTION_ID, nStrItemList);
- ShowCategory52Screen(
- STR_GLOBAL_OPTIONS,
- 0,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- numItems,
- nStrItemList,
- (PU16) gIndexIconsImageList,
- NULL,
- 0,
- 0,
- guiBuffer);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * exit_url_done_input_option
- * DESCRIPTION
- * Exit function to download theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void exit_url_done_input_option()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history currHistory;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currHistory.scrnID = SCR_ID_DOWNLOAD_DONE_OPTION;
- currHistory.entryFuncPtr = entry_url_done_input_option;
- GetCategoryHistory(currHistory.guiBuffer);
- if (dontSaveURLinHistory != 1)
- {
- AddHistory(currHistory);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * thm_add_to_URL_List
- * DESCRIPTION
- * Function to add url in history
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void thm_add_to_URL_List(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error = 0;
- signed char index = 0;
- S8 temp_thm_download_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
- pBOOL isValid = FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UnicodeToAnsii((S8*)temp_thm_download_address, (S8*)g_thm_download_address);
- dontSaveURLinHistory = 1;
- if (g_thm_download_address != NULL)
- {
- isValid = mmi_thm_isValidUrl(temp_thm_download_address);
- if(isValid)
- {
- is_exit_from_browser = 1;
- if (recent_url_list.total_entries == MAX_URL_ENTRIES)
- {
- recent_url_list.total_entries--;
- }
- if (recent_url_list.total_entries > 0)
- {
- for (index = recent_url_list.total_entries - 1; index >= 0; index--)
- {
- strcpy(
- (PS8) recent_url_list.g_thm_recent_url[index + 1],
- (PS8) recent_url_list.g_thm_recent_url[index]);
- }
- }
- strcpy((PS8) recent_url_list.g_thm_recent_url[0], (PS8) temp_thm_download_address);
- recent_url_list.total_entries++;
- /*
- * current_index=MAX_URL_ENTRIES-1;
- * if(g_thm_download_address!=NULL)
- * {
- * if(recent_url_list.total_entries<MAX_URL_ENTRIES)
- * recent_url_list.total_entries++;
- * current_index=recent_url_list.total_entries-1;
- * while(current_index>0)
- * {
- * pfnUnicodeStrcpy((PS8)recent_url_list.g_thm_recent_url[current_index],(PS8)recent_url_list.g_thm_recent_url[current_index-1]);
- * current_index--;
- * }
- *
- * pfnUnicodeStrcpy((PS8)recent_url_list.g_thm_recent_url[current_index],(PS8)g_thm_download_address);
- */
- WriteRecord(
- NVRAM_EF_THEME_DOWNLOAD_LIST_LID,
- 1,
- &recent_url_list,
- NVRAM_THEMES_DOWNLOAD_SIZE /* sizeof(thm_nvram_download_list) */ ,
- &error);
- g_recent_item_index = 0;
- theme_goto_url();
- }
- else
- {
- DisplayPopup((PU8) get_string(STR_THEME_INVALID_URL), IMG_GLOBAL_ERROR, 1, 1000, WARNING_TONE);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * theme_goto_url
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void theme_goto_url(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!wap_is_ready())
- {
- /* WGUI_CTX->not_ready_for_MMS = 0; */
- #ifdef OBIGO_SUPPORT
- wap_entry_widget_not_ready();
- #elif defined JATAAYU_SUPPORT
- mmi_brw_entry_wap_not_ready();
- #endif
- }
- else
- {
- theme_connect_wap();
- }
- #endif /* MMI_ON_HARDWARE_P */
- DeleteUptoScrID(SCR_ID_DOWNLOAD_ENTER_ADDRESS);
- #ifndef MMI_ON_HARDWARE_P
- GoBackHistory();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * theme_connect_wap
- * DESCRIPTION
- * Function to connect through wap
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void theme_connect_wap(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #ifdef MMI_ON_HARDWARE_P
- struct ilm_struct *ilm_ptr = NULL;
- wap_browser_startup_req_struct *p =
- (wap_browser_startup_req_struct*) construct_local_para(
- (kal_uint16) (sizeof(wap_browser_startup_req_struct)),
- 0);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearInputEventHandler(MMI_DEVICE_ALL);
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- if (wap_browser_is_open())
- {
- DisplayPopup(
- (PU8) GetString(STR_THEME_ERROR_WAP_ALREADY_ACTIVE),
- IMG_GLOBAL_ERROR,
- TRUE,
- UI_POPUP_NOTIFYDURATION_TIME,
- ERROR_TONE);
- return;
- /* Abnormal case. BRA should already terminate its UI. */
- }
- p->type = 2;
- if (g_recent_item_index == 0)
- {
- strcpy((PS8) p->url, (PS8) recent_url_list.g_thm_recent_url[g_recent_item_index]);
- }
- else if (g_recent_item_index == 1)
- {
- strcpy((char*)p->url, (char*)gDefaultDLT_URL);
- }
- else
- {
- strcpy((PS8) p->url, (PS8) recent_url_list.g_thm_recent_url[g_recent_item_index - 2]);
- }
- ilm_ptr = allocate_ilm(MOD_MMI);
- ilm_ptr->local_para_ptr = (local_para_struct*) p;
- ilm_ptr->msg_id = MSG_ID_WAP_BROWSER_STARTUP_REQ;
- ilm_ptr->peer_buff_ptr = NULL;
- MMI_SEND_ILM_EXT(MOD_MMI, MOD_WAP, WAP_MMI_SAP, ilm_ptr);
- #endif /* MMI_ON_HARDWARE_P */
- }
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * HighlightThmMenu
- * DESCRIPTION
- * Hilite function of main themes menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightThmMenu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetLeftSoftkeyFunction(EntryThmMenu, KEY_EVENT_UP);
- SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
- SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(EntryThmMenu, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightThmUpdatePeriod
- * DESCRIPTION
- * Hilite function of pupdate period
- * PARAMETERS
- * nIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightThmUpdatePeriod(S32 nIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* set IsSetFromMenu flag */
- g_thm_cntx.IsSetFromMenu = 1;
- g_thm_cntx.CurrHiliteItem = (U8) nIndex;
- if (nIndex > 0) /* update theme */
- {
- SetLeftSoftkeyFunction(UpdateThemePeriod, KEY_EVENT_UP);
- }
- else /* OFF */
- {
- SetLeftSoftkeyFunction(UpdateThemeOff, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightThmItems
- * DESCRIPTION
- * Highlight handler of Theme menu,
- * function show the current selected theme
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void HighlightThmItems(S32 index)
- {
- #ifdef __MMI_THEMES_V2_SUPPORT__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_thm_cntx.CurrHiliteTheme = thm_details[index].theme_id;
- g_temp_thm_index = index;
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- g_thm_cntx.CurrHiliteTheme = (U8) index;
- SetBothLCDThemes(g_thm_cntx.CurrHiliteTheme);
- /* PMT VIKAS START 20050707 */
- #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
- gOnFullScreen |= MMI_LEAVE_FULL_SCREEN; /* for showing the updated status bar on Theme menu. */
- #endif
- /* PMT VIKAS END 20050707 */
- RedrawCategoryFunction();
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * ThmHandleRSK
- * DESCRIPTION
- * Change theme to original one and go back history.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThmHandleRSK(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
- {
- SetBothLCDThemes(g_thm_cntx.CurrTheme);
- }
- g_thm_cntx.IsInThmApp = 0;
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * ThmRedrawTheme
- * DESCRIPTION
- * Redraw current hilite theme in option menu to make the user preceive current
- * selecting theme
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThmRedrawTheme(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
- {
- SetBothLCDThemes(g_thm_cntx.CurrHiliteTheme);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ExitThmMenu
- * DESCRIPTION
- * Exit function for theme menu, restore theme after exit theme screen.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitThmMenu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
- /* PMT VIKAS START 20050707 */
- #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
- {
- gOnFullScreen |= MMI_LEAVE_FULL_SCREEN; /* for showing the updated status bar on Theme menu. */
- #endif /* (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__) */
- SetBothLCDThemes(g_thm_cntx.CurrTheme);
- #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
- }
- #endif
- /* PMT VIKAS END 20050707 */
- }
- /*****************************************************************************
- * FUNCTION
- * EntryThmMenuDuringUSB
- * DESCRIPTION
- * Show a lsit of themes
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- void EntryThmMenuDuringUSB(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 i = 0;
- U16 list_icons1[MAX_SUB_MENUS];
- U16 list_icons2[MAX_SUB_MENUS];
- U8 *temp_name;
- U8 nSystemThemeCount;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
- nSystemThemeCount = (U8) GetThemesNames((U8 ***) & temp_name);
- if (nSystemThemeCount > MAX_SYSTEM_THEMES)
- {
- nSystemThemeCount = MAX_SYSTEM_THEMES;
- }
- for (i = 0; i < nSystemThemeCount; i++)
- {
- if (thm_details[i].theme_type == THEME_TYPE_SYSTEM)
- {
- list_icons2[i] = IMAGE_SYSTEM_THEME;
- }
- else
- {
- list_icons2[i] = 0;
- }
- if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
- {
- g_thm_cntx.CurrThemeIndex = i;
- list_icons1[i] = IMG_VICON;
- }
- else
- {
- list_icons1[i] = IMAGE_NOIMAGE_THEME;
- }
- }
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
- RegisterHighlightHandler(HighlightThmItems);
- ShowCategory73Screen(
- STR_MENU3101_THEMES,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nSystemThemeCount,
- (U8 **) g_thm_cntx.ThemeName,
- list_icons1,
- list_icons2,
- (U16) g_thm_cntx.CurrThemeIndex,
- guiBuffer,
- 1);
- SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
- SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
- SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- }
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * EntryThmMenu
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void EntryThmMenu(void)
- {
- #ifdef __MMI_THEMES_V2_SUPPORT__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- U8 thm_file_check = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (mmi_tm_get_usb_mode() == MMI_TRUE)
- {
- EntryThmMenuDuringUSB();
- return;
- }
- EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
- ConstructThemeList();
- g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
- {
- thm_file_check = 1;
- }
- }
- if (thm_file_check == 0)
- {
- ActivateDefaultTheme();
- /* PMT DLT_FIXES - TK 20060321 START */
- /* PMT DLT_FIXES - TK 20060321 END */
- reset_title_status_icon();
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- ShowCategory7Screen(
- STR_SCR3001_THEMES_CAPTION,
- 0,
- STR_GLOBAL_OK,
- IMG_GLOBAL_OK,
- 0,
- 0,
- (U8*) GetString(STR_DEFAULT_THEME_ACTIVATION),
- NULL);
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- SetLeftSoftkeyFunction(ShowThemeList, KEY_EVENT_UP);
- SetKeyHandler(ShowThemeList, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- else
- {
- ShowThemeList();
- }
- #else /* __MMI_THEMES_V2_SUPPORT__ */
- U16 nItems;
- U8 *guiBuffer;
- U16 i = 0;
- U16 *list_icons1 = NULL;
- U16 *list_icons2 = NULL;
- g_thm_cntx.IsInThmApp = 1;
- EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
- FillThemesList();
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
- nItems = (U16) g_thm_cntx.TotalTheme;
- list_icons1 = (U16*) OslMalloc(nItems * sizeof(PU16));
- list_icons2 = (U16*) OslMalloc(nItems * sizeof(PU16));
- for (i = 0; i < nItems; i++)
- {
- if (i == g_thm_cntx.CurrTheme)
- {
- list_icons1[i] = IMG_VICON;
- }
- else
- {
- list_icons1[i] = IMAGE_NOIMAGE_THEME;
- }
- }
- for (i = 0; i < nItems; i++)
- {
- list_icons2[i] = IMAGE_NOIMAGE_THEME;
- }
- RegisterHighlightHandler(HighlightThmItems);
- ShowCategory73Screen(
- STR_MENU3101_THEMES,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- nItems,
- (U8 **) g_thm_cntx.ThemeName,
- list_icons1,
- list_icons2,
- (U16) g_thm_cntx.CurrTheme,
- guiBuffer,
- 0);
- SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
- SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
- SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- if (list_icons1)
- {
- OslMfree(list_icons1);
- }
- if (list_icons2)
- {
- OslMfree(list_icons2);
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * ShowThemeList
- * DESCRIPTION
- * Function to show theme list from theme application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_THEMES_V2_SUPPORT__
- void ShowThemeList(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- U16 i = 0;
- U16 list_icons1[MAX_SUB_MENUS];
- U16 list_icons2[MAX_SUB_MENUS];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- if (thm_details[i].theme_type == THEME_TYPE_SYSTEM)
- {
- list_icons2[i] = IMAGE_SYSTEM_THEME;
- }
- else if (thm_details[i].theme_type == THEME_TYPE_DOWNLOADED_PHONE)
- {
- list_icons2[i] = IMAGE_PHONE_THEME;
- }
- else if (thm_details[i].theme_type == THEME_TYPE_DOWNLOADED_CARD)
- {
- list_icons2[i] = IMAGE_CARD_THEME;
- }
- }
- for (i = 0; i < g_thm_cntx.TotalTheme; i++)
- {
- list_icons1[i] = IMAGE_NOIMAGE_THEME;
- if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
- {
- g_thm_cntx.CurrThemeIndex = i;
- list_icons1[i] = IMG_VICON;
- }
- }
- guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
- RegisterHighlightHandler(HighlightThmItems);
- ShowCategory73Screen(
- STR_MENU3101_THEMES,
- MAIN_MENU_TITLE_FUNANDGAMES_ICON,
- STR_GLOBAL_OPTIONS,
- IMG_GLOBAL_OPTIONS,
- STR_GLOBAL_BACK,
- IMG_GLOBAL_BACK,
- g_thm_cntx.TotalTheme,
- (U8 **) g_thm_cntx.ThemeName,
- list_icons1,
- list_icons2,
- (U16) g_thm_cntx.CurrThemeIndex,
- guiBuffer,
- 1);
- SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
- SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
- SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
- }
- #endif /* __MMI_THEMES_V2_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * ThmHandleEndKey
- * DESCRIPTION
- * Function handle end key
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ThmHandleEndKey(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
- {
- SetBothLCDThemes(g_thm_cntx.CurrTheme);
- }
- g_thm_cntx.IsInThmApp = 0;
- DisplayIdleScreen();
- }
- /*****************************************************************************
- * FUNCTION
- * HighlightThmOption
- * DESCRIPTION
- * Highlight handler of theme menu
- * PARAMETERS
- * nIndex [IN]
- * RETURNS