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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * MMIthemes.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements Theme application.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  * removed!
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * removed!
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * removed!
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * removed!
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * removed!
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * removed!
  195.  *
  196.  * removed!
  197.  * removed!
  198.  * removed!
  199.  *
  200.  * removed!
  201.  * removed!
  202.  * removed!
  203.  *
  204.  * removed!
  205.  * removed!
  206.  * removed!
  207.  *
  208.  * removed!
  209.  * removed!
  210.  * removed!
  211.  *
  212.  * removed!
  213.  * removed!
  214.  * removed!
  215.  *
  216.  * removed!
  217.  * removed!
  218.  * removed!
  219.  *
  220.  * removed!
  221.  * removed!
  222.  * removed!
  223.  *
  224.  * removed!
  225.  * removed!
  226.  * removed!
  227.  *
  228.  * removed!
  229.  * removed!
  230.  * removed!
  231.  *
  232.  * removed!
  233.  * removed!
  234.  * removed!
  235.  *
  236.  * removed!
  237.  * removed!
  238.  * removed!
  239.  *
  240.  * removed!
  241.  * removed!
  242.  * removed!
  243.  *
  244.  * removed!
  245.  * removed!
  246.  * removed!
  247.  *
  248.  * removed!
  249.  * removed!
  250.  * removed!
  251.  *
  252.  * removed!
  253.  * removed!
  254.  * removed!
  255.  *
  256.  * removed!
  257.  * removed!
  258.  * removed!
  259.  *
  260.  * removed!
  261.  * removed!
  262.  * removed!
  263.  *
  264.  * removed!
  265.  * removed!
  266.  * removed!
  267.  *
  268.  * removed!
  269.  * removed!
  270.  * removed!
  271.  *
  272.  * removed!
  273.  * removed!
  274.  * removed!
  275.  *
  276.  * removed!
  277.  * removed!
  278.  * removed!
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  * removed!
  283.  * removed!
  284.  * removed!
  285.  * removed!
  286.  *
  287.  * removed!
  288.  * removed!
  289.  * removed!
  290.  *
  291.  * removed!
  292.  * removed!
  293.  * removed!
  294.  *
  295.  * removed!
  296.  * removed!
  297.  * removed!
  298.  *
  299.  * removed!
  300.  * removed!
  301.  * removed!
  302.  *
  303.  * removed!
  304.  * removed!
  305.  * removed!
  306.  *
  307.  *------------------------------------------------------------------------------
  308.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  309.  *============================================================================
  310.                                                                                ****************************************************************************//**
  311.  * Copyright Notice
  312.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  313.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  314.  *  (It is illegal to remove this copyright notice from this software or any
  315.  *  portion of it)
  316.  */
  317. /**************************************************************
  318.    FILENAME : MMIThemes.c
  319.    PURPOSE     : Theme application
  320.    REMARKS     : nil
  321.    AUTHOR      : Restructured by manju
  322.    DATE     : Restructured on May-24-2003
  323. **************************************************************/
  324. #ifndef _MMI_THEME_C
  325. #define _MMI_THEME_C
  326. /*  Include: MMI header file */
  327. #include "MMI_features.h"
  328. #ifdef __MMI_THEMES_APPLICATION__
  329. #include "PixtelDataTypes.h"
  330. #include "FunAndGamesDefs.h"    /* application */
  331. #include "FunAndGamesProts.h"
  332. #include "Unicodexdcl.h"
  333. #include "TimerEvents.h"        /* timer */
  334. #include "NVRAMType.h"  /* NVRAM read/write */
  335. #include "NVRAMProt.h"
  336. #include "NVRAMEnum.h"
  337. #include "EventsGprot.h"        /* screen, history, and resource */
  338. #include "historyGprot.h"
  339. #include "CustMenuRes.h"
  340. #include "wgui_categories.h"
  341. #include "MainMenuDef.h"
  342. #include "GlobalDefs.h"
  343. #include "CommonScreens.h"
  344. /* MAUI_00019098_Patch_01 Start */
  345. #include "SettingDefs.h"
  346. #include "WallpaperDefs.h"
  347. /* MAUI_00019098_Patch_01 End */
  348. #include "HelpProt.h"
  349. /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00221092 */
  350. #include "SimDetectionGexdcl.h"
  351. /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00221092 */
  352. #include "AlarmFrameworkProt.h"
  353. #include "DateTimeGprot.h"
  354. #include "DebugInitDef.h"       /* debug */
  355. #include "GlobalScrEnum.h"
  356. #include "SubLCDHistoryGprot.h"
  357. /* Leo add for DLT */
  358. #include "PhoneBookDef.h"
  359. #include "MMIThemes.h"
  360. #include "wgui_categories_inputsenum.h"
  361. #include "wgui_categories_inputs.h"
  362. #include "Wgui_status_icons.h"
  363. #ifdef MMI_ON_HARDWARE_P
  364. #include "wap_ps_struct.h"
  365. #include "wapadp.h"
  366. #endif /* MMI_ON_HARDWARE_P */ 
  367. #include "mmiapi.h"
  368. #include "FileManagerGProt.h"
  369. #include "FileManagerDef.h"
  370. /* Leo end */
  371. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  372. #include "SimDetectionGprot.h"
  373. #else
  374. #include "Wgui_categories_util.h"
  375. #endif 
  376. #include "JavaAgencyDef.h"
  377. /* 
  378.  * Define
  379.  */
  380. #define NO_OF_THEME_OPTION_MENUITEMS_IN_USB_MODE 2
  381. /* 
  382.  * Typedef 
  383.  */
  384. /* 
  385.  * Local Variable
  386.  */
  387. /* 
  388.  * Local Function
  389.  */
  390. /* 
  391.  * Global Variable
  392.  */
  393. thm_contex_struct g_thm_cntx;
  394. extern wgui_inline_item wgui_inline_items[];    /* shall be move to header file later */
  395. const U8 g_themes_freq_set[THMEM_FREQ_NUM] =
  396.     {ALM_FREQ_OFF, ALM_FREQ_HOURLY, ALM_FREQ_EVERYDAY, ALM_FREQ_WEEKLY, ALM_FREQ_MONTHLY, ALM_FREQ_SEASONALLY};
  397. #ifdef __MMI_THEMES_V2_SUPPORT__
  398. tm_theme_list_struct *thm_details;
  399. U16 delete_flag = 1;
  400. U32 setorderIDList[TOTAL_THEMES_COUNT]; /* it is only for stub testing); */
  401. U8 g_temp_thm_index;
  402. S16 currorderindex;                     /* this is only for set order list */
  403. /* U8 thm_file_check=0; */
  404. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  405. /* Leo add for DLT */
  406. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  407. #define MAX_URL_LIST_ENTRIES 7
  408. /* S8 g_thm_recent_url[MAX_URL_ENTRIES][MAX_ENTER_ADDRESS_SIZE]; */
  409. thm_nvram_download_list recent_url_list;
  410. S8 g_thm_download_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
  411. S16 g_total_recent_list;
  412. U16 g_recent_item_index;
  413. U8 dontSaveURLinHistory;
  414. static U8 is_exit_from_browser;
  415. void Add_To_URL_List(void);
  416. void HighlightThmDownloadOption(int index);
  417. void Edit_URL_address(void);
  418. void theme_goto_url(void);
  419. void theme_connect_wap(void);
  420. void preEntryThmDownload(void);
  421. void edit_url_address(void);
  422. void exit_url_address(void);
  423. void thm_add_to_URL_List(void);
  424. void entry_url_done_input_option(void);
  425. void exit_url_done_input_option(void);
  426. void EntryInputMethodScreen(void);
  427. void Download2GoBackHistory(void);
  428. extern void mmi_frm_highlight_input_method_generic(void);
  429. #ifdef MMI_ON_HARDWARE_P
  430. #ifdef OBIGO_SUPPORT
  431. extern void wap_entry_widget_not_ready(void);
  432. #elif defined JATAAYU_SUPPORT
  433. extern void mmi_brw_entry_wap_not_ready(void);
  434. #endif 
  435. extern S32 wap_browser_is_open(void);
  436. #endif /* MMI_ON_HARDWARE_P */ 
  437. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  438. /* Leo end */
  439. #ifdef __J2ME__
  440. extern void jvm_pause_dummy_screen(void);
  441. extern void jvm_resume_dummy_screen(void);
  442. #endif /* __J2ME__ */ 
  443. /* 
  444.  * Global Function
  445.  */
  446. extern void UpdateUITheme(void);
  447. extern const S8 *gDefaultDLT_URL;
  448. #ifdef __MMI_UI_TAB_PANE__
  449. extern void check_and_set_title_theme_changed(void);
  450. #endif 
  451. /* Leo add for DLT */
  452. #ifdef MMI_ON_HARDWARE_P
  453. extern int wap_is_ready(void);
  454. #endif 
  455. /* Leo end */
  456. #define __MMI_THEME_AUTO_UPDATE__
  457. #ifdef __MMI_THEMES_V2_SUPPORT__
  458. static S8 *mmi_thm_ValidSchemeList [THEME_TOTAL_VALID_SCHEME] = {"file","http","https"} ;
  459. #endif
  460. /*****************************************************************************
  461.  * FUNCTION
  462.  *  InitThemes
  463.  * DESCRIPTION
  464.  *  Initialize themes
  465.  * PARAMETERS
  466.  *  void
  467.  * RETURNS
  468.  *  void
  469.  *****************************************************************************/
  470. void InitThemes(void)
  471. {
  472.     /*----------------------------------------------------------------*/
  473.     /* Local Variables                                                */
  474.     /*----------------------------------------------------------------*/
  475.     /*----------------------------------------------------------------*/
  476.     /* Code Body                                                      */
  477.     /*----------------------------------------------------------------*/
  478.     SetHiliteHandler(MENU3101_THEMES, HighlightThmMenu);
  479.     /* Leo add for DLT */
  480. #ifdef __MMI_THEMES_V2_SUPPORT__        /* ritesh */
  481.     ConstructThemeList();
  482.     /* ConstructThemeOrderList(); */
  483.     mmi_tm_activate_theme_at_bootup();
  484.     g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
  485.     SetThemes(g_thm_cntx.CurrTheme);
  486. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  487.     FillThemesList();
  488.     MMI_apply_current_theme();
  489. #endif /* __MMI_THEMES_V2_SUPPORT__ */ /* ritesh */
  490. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  491.     g_total_recent_list = 0;
  492. #endif 
  493.     /* Leo end */
  494. }
  495. /*****************************************************************************
  496.  * FUNCTION
  497.  *  ThemesFCBInit
  498.  * DESCRIPTION
  499.  *  Set calback function of alarm framework
  500.  * PARAMETERS
  501.  *  void
  502.  * RETURNS
  503.  *  void
  504.  *****************************************************************************/
  505. void ThemesFCBInit(void)
  506. {
  507.     /*----------------------------------------------------------------*/
  508.     /* Local Variables                                                */
  509.     /*----------------------------------------------------------------*/
  510.     /*----------------------------------------------------------------*/
  511.     /* Code Body                                                      */
  512.     /*----------------------------------------------------------------*/
  513.     mmi_alm_set_start_index(ALM_TYPE_THEME, ALM_THM_START);
  514.     AlmSetExpiryTimeCB(ALM_TYPE_THEME, ThemesExpiryTimeCBH);
  515.     AlmSetExpiryHandlerCB(ALM_TYPE_THEME, ThemeAlarmCallBack);
  516. #ifdef __MMI_THEMES_V2_SUPPORT__
  517.     AlmSetInitHandlerCB(ALM_TYPE_THEME, ConstructThemeOrderList, ThemesReInitQueueCBH);
  518. #else
  519. AlmSetInitHandlerCB(ALM_TYPE_THEME, ReadThemesFromNVRAM, ThemesReInitQueueCBH);
  520. #endif
  521. }
  522. /*****************************************************************************
  523.  * FUNCTION
  524.  *  ThemesExpiryTimeCBH
  525.  * DESCRIPTION
  526.  *  Callback handler to get information of theme expiry setting.
  527.  * PARAMETERS
  528.  *  index           [IN]            
  529.  *  alarmTime       [?]             
  530.  *  Freq            [?]             
  531.  *  WeekDays        [?]             
  532.  *  MYTIME(?)       [IN/OUT]        Expiry time set by user
  533.  *  U8(?)           [IN/OUT]        Expiry days of week
  534.  * RETURNS
  535.  *  void
  536.  *****************************************************************************/
  537. void ThemesExpiryTimeCBH(U8 index, MYTIME *alarmTime, U8 *Freq, U8 *WeekDays, MYTIME* preReminder)
  538. {
  539.     /*----------------------------------------------------------------*/
  540.     /* Local Variables                                                */
  541.     /*----------------------------------------------------------------*/
  542.     /*----------------------------------------------------------------*/
  543.     /* Code Body                                                      */
  544.     /*----------------------------------------------------------------*/
  545.     *Freq = g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod];
  546.     *WeekDays = 1;
  547. }
  548. /*****************************************************************************
  549.  * FUNCTION
  550.  *  ThemesReInitQueueCBH
  551.  * DESCRIPTION
  552.  *  Reinit themes to alarm queue
  553.  * PARAMETERS
  554.  *  void
  555.  * RETURNS
  556.  *  void
  557.  *****************************************************************************/
  558. void ThemesReInitQueueCBH(void)
  559. {
  560.     /*----------------------------------------------------------------*/
  561.     /* Local Variables                                                */
  562.     /*----------------------------------------------------------------*/
  563.     /*----------------------------------------------------------------*/
  564.     /* Code Body                                                      */
  565.     /*----------------------------------------------------------------*/
  566.     if (g_themes_freq_set[g_thm_cntx.CurrUpdatePeriod] != ALM_FREQ_OFF)
  567.     {
  568.         AlmInsertIntoQueue(ALM_THM_START, FALSE);
  569.     }
  570. }
  571. extern void ExecSubLCDCurrExitHandler(void);
  572. extern void GoBackSubLCDHistory(void);
  573. /*****************************************************************************
  574.  * FUNCTION
  575.  *  SetBothLCDThemes
  576.  * DESCRIPTION
  577.  *  Set themes of both main and sub lcd
  578.  * PARAMETERS
  579.  *  index       [IN]        Index of theme
  580.  * RETURNS
  581.  *  void
  582.  *****************************************************************************/
  583. void SetBothLCDThemes(U8 index)
  584. {
  585.     /*----------------------------------------------------------------*/
  586.     /* Local Variables                                                */
  587.     /*----------------------------------------------------------------*/
  588.     /*----------------------------------------------------------------*/
  589.     /* Code Body                                                      */
  590.     /*----------------------------------------------------------------*/
  591. #ifdef __MMI_THEMES_V2_SUPPORT__
  592.     ExecSubLCDCurrExitHandler();
  593.     GoBackSubLCDHistory();
  594. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  595.     SetThemes(index);
  596.     UpdateUITheme();
  597.     /* PMT NEERAJ START 20050616 */
  598. #ifdef __MMI_UI_TAB_PANE__
  599.     check_and_set_title_theme_changed();
  600. #endif 
  601.     //PMT NEERAJ END 20050616
  602.     //MTK Leo add, fix theme update issue
  603.     //      SUBLCD_RedrawCategoryFunction();
  604.     ExecSubLCDCurrExitHandler();
  605.     GoBackSubLCDHistory();
  606. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  607. }
  608. /*****************************************************************************
  609.  * FUNCTION
  610.  *  ConstructThemeList
  611.  * DESCRIPTION
  612.  *  Get the themes and construct set order list
  613.  * PARAMETERS
  614.  *  void
  615.  * RETURNS
  616.  *  void
  617.  *****************************************************************************/
  618. #ifdef __MMI_THEMES_V2_SUPPORT__
  619. void ConstructThemeList(void)
  620. {
  621.     /*----------------------------------------------------------------*/
  622.     /* Local Variables                                                */
  623.     /*----------------------------------------------------------------*/
  624.     /* U8 i,j; */
  625.     U8 no_of_setorder_themes, themecount;
  626.     U32 *p;
  627.     U8 set_flag = 0;
  628.     /*----------------------------------------------------------------*/
  629.     /* Code Body                                                      */
  630.     /*----------------------------------------------------------------*/
  631.     no_of_setorder_themes = GetIDList(&p, &g_thm_cntx.CurrOrderIndex);
  632.     g_thm_cntx.TotalTheme = mmi_tm_get_total_themes_count();
  633.     
  634.     g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();    
  635.     SetThemes(g_thm_cntx.CurrTheme);
  636.     switch (no_of_setorder_themes)
  637.     {
  638.         case 0:
  639.             for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
  640.             {
  641.                 g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
  642.                 g_thm_cntx.SetOrderIDList[no_of_setorder_themes] = p[no_of_setorder_themes];
  643.             }
  644.             break;
  645.         default:
  646.             for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
  647.             {
  648.                 g_thm_cntx.SetOrderIDList[no_of_setorder_themes] = p[no_of_setorder_themes];
  649.                 for (themecount = 0; themecount < g_thm_cntx.TotalTheme; themecount++)
  650.                 {
  651.                     if (g_thm_cntx.SetOrderIDList[no_of_setorder_themes] == 0)
  652.                     {
  653.                         g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
  654.                         set_flag = 1;
  655.                         break;
  656.                     }
  657.                     else if (g_thm_cntx.SetOrderIDList[no_of_setorder_themes] == thm_details[themecount].theme_id)
  658.                     {
  659.                         g_thm_cntx.TmpOrderList[no_of_setorder_themes] = themecount;
  660.                         set_flag = 1;
  661.                         break;
  662.                     }
  663.                 }
  664.                 if (set_flag == 0)
  665.                 {
  666.                     g_thm_cntx.TmpOrderList[no_of_setorder_themes] = g_thm_cntx.TotalTheme;
  667.                 }
  668.                 set_flag = 0;
  669.             }
  670.     }
  671.     for (no_of_setorder_themes = 0; no_of_setorder_themes < g_thm_cntx.TotalTheme; no_of_setorder_themes++)
  672.     {
  673.         g_thm_cntx.ThemeName[no_of_setorder_themes] = thm_details[no_of_setorder_themes].theme_name;
  674.     }
  675.     g_thm_cntx.ThemeName[g_thm_cntx.TotalTheme] = (PU8) GetString(STR_THEME_NONE);
  676. }
  677. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  678. /*****************************************************************************
  679.  * FUNCTION
  680.  *  FillThemesList
  681.  * DESCRIPTION
  682.  *  Fill inline item selection items
  683.  * PARAMETERS
  684.  *  void
  685.  * RETURNS
  686.  *  void
  687.  *****************************************************************************/
  688. void FillThemesList(void)
  689. {
  690.     /*----------------------------------------------------------------*/
  691.     /* Local Variables                                                */
  692.     /*----------------------------------------------------------------*/
  693.     U8 index = 0;
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     g_thm_cntx.TmpOrderList[0] = (S32) g_thm_cntx.CurrOrderList[0];
  698.     g_thm_cntx.TmpOrderList[1] = (S32) g_thm_cntx.CurrOrderList[1];
  699.     g_thm_cntx.TmpOrderList[2] = (S32) g_thm_cntx.CurrOrderList[2];
  700.     g_thm_cntx.TmpOrderList[3] = (S32) g_thm_cntx.CurrOrderList[3];
  701.     for (index = 0; index < g_thm_cntx.TotalTheme; index++)
  702.     {
  703.         g_thm_cntx.ThemeName[index] = (PU8) GetString((U16) (STR_THEME_DEFAULT + index));
  704.     }
  705.     g_thm_cntx.ThemeName[index] = (PU8) GetString(STR_THEME_NONE);
  706. }
  707. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  708. /*****************************************************************************
  709.  * FUNCTION
  710.  *  SaveOrderThemes
  711.  * DESCRIPTION
  712.  *  set order themes and save in NVRAM
  713.  * PARAMETERS
  714.  *  void
  715.  * RETURNS
  716.  *  void
  717.  *****************************************************************************/
  718. void SaveOrderThemes()
  719. {
  720.     /*----------------------------------------------------------------*/
  721.     /* Local Variables                                                */
  722.     /*----------------------------------------------------------------*/
  723.     U8 index;
  724.     U8 flag = 0;
  725.     /* Leo add for DLT */
  726. #ifdef __MMI_THEMES_V2_SUPPORT__
  727.     U32 TempID;
  728.     U8 count = 0;
  729. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  730.     /*----------------------------------------------------------------*/
  731.     /* Code Body                                                      */
  732.     /*----------------------------------------------------------------*/
  733.     /* Leo end */
  734. #ifdef __MMI_THEMES_V2_SUPPORT__
  735.     for (index = 0; index < g_thm_cntx.TotalTheme; index++)
  736.     {
  737.         TempID = thm_details[g_thm_cntx.TmpOrderList[index]].theme_id;
  738.         if (g_thm_cntx.SetOrderIDList[index] != TempID)
  739.         {
  740.             flag = 1;
  741.             break;
  742.         }
  743.     }
  744. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  745.     for (index = 0; index < NO_OF_ORDERS; index++)
  746.     {
  747.         if (g_thm_cntx.CurrOrderList[index] != (U8) g_thm_cntx.TmpOrderList[index])
  748.         {
  749.             flag = 1;
  750.             break;
  751.         }
  752.     }
  753. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  754.     if (flag)   /* order changed */
  755.     {
  756.         g_thm_cntx.CurrOrderIndex = -1;
  757.         /* Leo add for DLT */
  758.         g_thm_cntx.IsOrderChanged = 1;
  759.         /* Leo end */
  760.     #ifdef __MMI_THEMES_V2_SUPPORT__
  761.         for (index = 0; index < g_thm_cntx.TotalTheme; index++)
  762.         {
  763.             if (g_thm_cntx.TmpOrderList[index] == TOTAL_THEMES_COUNT)
  764.             {
  765.                 g_thm_cntx.SetOrderIDList[index] = 0;
  766.             }
  767.             else
  768.             {
  769.                 g_thm_cntx.SetOrderIDList[index] = thm_details[g_thm_cntx.TmpOrderList[index]].theme_id;
  770.             }
  771.             if (g_thm_cntx.SetOrderIDList[index] != 0)
  772.             {
  773.                 count++;
  774.             }
  775.         }
  776.     #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  777.         g_thm_cntx.CurrOrderList[0] = (S8) g_thm_cntx.TmpOrderList[0];
  778.         g_thm_cntx.CurrOrderList[1] = (S8) g_thm_cntx.TmpOrderList[1];
  779.         g_thm_cntx.CurrOrderList[2] = (S8) g_thm_cntx.TmpOrderList[2];
  780.         g_thm_cntx.CurrOrderList[3] = (S8) g_thm_cntx.TmpOrderList[3];
  781.         g_thm_cntx.IsOrderChanged = 1;
  782.     #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  783.         SetStartPositionofCurIndex();
  784.         WriteThemesToNVRAM();
  785.     #ifdef __MMI_THEMES_V2_SUPPORT__
  786.         SetOrderIDList(g_thm_cntx.SetOrderIDList, count, g_thm_cntx.CurrOrderIndex);
  787.     #endif 
  788.     }
  789.     DisplayPopup(
  790.         (PU8) GetString(STR_THEME_OFF_UPADTE_SUCCESS),
  791.         IMG_GLOBAL_ACTIVATED,
  792.         TRUE,
  793.         UI_POPUP_NOTIFYDURATION_TIME,
  794.         0);
  795.     DeleteUptoScrID(SCR_ID_THM_OPTIONS);
  796.     g_thm_cntx.IsInThmApp = 0;
  797. }
  798. /*****************************************************************************
  799.  * FUNCTION
  800.  *  HighlightThmSetOrder
  801.  * DESCRIPTION
  802.  *  Set LSK of set order list
  803.  * PARAMETERS
  804.  *  nIndex      [IN]        
  805.  * RETURNS
  806.  *  void
  807.  *****************************************************************************/
  808. void HighlightThmSetOrder(S32 nIndex)
  809. {
  810.     /*----------------------------------------------------------------*/
  811.     /* Local Variables                                                */
  812.     /*----------------------------------------------------------------*/
  813.     /*----------------------------------------------------------------*/
  814.     /* Code Body                                                      */
  815.     /*----------------------------------------------------------------*/
  816.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);    /* Force LSK label to "Ok" each time */
  817.     SetCategory57LeftSoftkeyFunction(SaveOrderThemes);
  818. }
  819. /*****************************************************************************
  820.  * FUNCTION
  821.  *  EntryThmSetOrder
  822.  * DESCRIPTION
  823.  *  Entry function of set order screen
  824.  * PARAMETERS
  825.  *  void
  826.  * RETURNS
  827.  *  void
  828.  *****************************************************************************/
  829. void EntryThmSetOrder()
  830. {
  831.     /*----------------------------------------------------------------*/
  832.     /* Local Variables                                                */
  833.     /*----------------------------------------------------------------*/
  834.     U8 *guiBuffer;
  835.     U8 *inputBuffer;        /* added for inline edit history */
  836.     U16 inputBufferSize;    /* added for inline edit history */
  837.     /* Leo add for DLT */
  838. #ifdef __MMI_THEMES_V2_SUPPORT__
  839.     S16 i;
  840. #endif 
  841.     /*----------------------------------------------------------------*/
  842.     /* Code Body                                                      */
  843.     /*----------------------------------------------------------------*/
  844.     /* Leo end */
  845.     EntryNewScreen(SCR_ID_THM_SET_ORDER, ExitThmSetOrder, NULL, NULL);
  846.     /* Leo add for DLT */
  847. #ifdef __MMI_THEMES_V2_SUPPORT__
  848.     g_thm_cntx.IsInThmApp = 1;
  849.     g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
  850. #else 
  851.     g_thm_cntx.IsInThmApp = 2;
  852. #endif 
  853.     /* Leo end */
  854.     
  855.     InitializeCategory57Screen();
  856.     guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_SET_ORDER);
  857.     /* PMT DLT_FIXES - TK 20060306 START */
  858. #ifndef __MMI_THEMES_V2_SUPPORT__
  859.     if (guiBuffer == NULL)
  860.     {
  861.         g_thm_cntx.TmpOrderList[0] = (S32) g_thm_cntx.CurrOrderList[0];
  862.         g_thm_cntx.TmpOrderList[1] = (S32) g_thm_cntx.CurrOrderList[1];
  863.         g_thm_cntx.TmpOrderList[2] = (S32) g_thm_cntx.CurrOrderList[2];
  864.         g_thm_cntx.TmpOrderList[3] = (S32) g_thm_cntx.CurrOrderList[3];
  865.     }
  866. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  867.     /* PMT DLT_FIXES - TK 20060306 END */
  868.     inputBuffer = GetCurrNInputBuffer(SCR_ID_THM_SET_ORDER, &inputBufferSize);  /* added for inline edit history */
  869. #ifdef __MMI_THEMES_V2_SUPPORT__
  870.     if (!guiBuffer)
  871.     {
  872.         ConstructThemeList();
  873.     }
  874. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  875. #ifdef __MMI_THEMES_V2_SUPPORT__
  876.     for (i = 0; i < g_thm_cntx.TotalTheme; i++)
  877.     {
  878.         SetInlineItemActivation(&wgui_inline_items[i], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  879.     }
  880.     for (i = 0; i < g_thm_cntx.TotalTheme; i++)
  881.     {
  882.         SetInlineItemSelect(
  883.             &wgui_inline_items[i],
  884.             (g_thm_cntx.TotalTheme + 1),
  885.             g_thm_cntx.ThemeName,
  886.             (PS32) (&g_thm_cntx.TmpOrderList[i]));
  887.     }
  888. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  889.     SetInlineItemActivation(&wgui_inline_items[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  890.     SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  891.     SetInlineItemActivation(&wgui_inline_items[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  892.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  893.     SetInlineItemSelect(
  894.         &wgui_inline_items[0],
  895.         (g_thm_cntx.TotalTheme + 1),
  896.         g_thm_cntx.ThemeName,
  897.         (PS32) (&g_thm_cntx.TmpOrderList[0]));
  898.     SetInlineItemSelect(
  899.         &wgui_inline_items[1],
  900.         (g_thm_cntx.TotalTheme + 1),
  901.         g_thm_cntx.ThemeName,
  902.         (PS32) & g_thm_cntx.TmpOrderList[1]);
  903.     SetInlineItemSelect(
  904.         &wgui_inline_items[2],
  905.         (g_thm_cntx.TotalTheme + 1),
  906.         g_thm_cntx.ThemeName,
  907.         (PS32) & g_thm_cntx.TmpOrderList[2]);
  908.     SetInlineItemSelect(
  909.         &wgui_inline_items[3],
  910.         (g_thm_cntx.TotalTheme + 1),
  911.         g_thm_cntx.ThemeName,
  912.         (PS32) & g_thm_cntx.TmpOrderList[3]);
  913. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  914.     RegisterHighlightHandler(HighlightThmSetOrder);
  915. #ifdef __MMI_THEMES_V2_SUPPORT__
  916.     if (inputBuffer != NULL)
  917.     {
  918.         SetCategory57Data(wgui_inline_items, TOTAL_THEMES_COUNT + 1, inputBuffer);
  919.     }
  920.     ShowCategory57Screen(
  921.         STR_SCR3004_SET_ORDER_CAPTION,
  922.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  923.         STR_GLOBAL_OK,
  924.         IMG_GLOBAL_OK,
  925.         STR_GLOBAL_BACK,
  926.         IMG_GLOBAL_BACK,
  927.         g_thm_cntx.TotalTheme,
  928.         (PU16) gIndexIconsImageList,
  929.         wgui_inline_items,
  930.         0,
  931.         guiBuffer);
  932. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  933.     if (inputBuffer != NULL)
  934.     {
  935.         SetCategory57Data(wgui_inline_items, NO_OF_ORDERS, inputBuffer);
  936.     }
  937.     ShowCategory57Screen(
  938.         STR_SCR3004_SET_ORDER_CAPTION,
  939.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  940.         STR_GLOBAL_OK,
  941.         IMG_GLOBAL_OK,
  942.         STR_GLOBAL_BACK,
  943.         IMG_GLOBAL_BACK,
  944.         4,
  945.         (PU16) gIndexIconsImageList,
  946.         wgui_inline_items,
  947.         0,
  948.         guiBuffer);
  949. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  950.     SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
  951.     DisableCategory57ScreenDone();
  952.     SetCategory57RightSoftkeyFunctions(SaveOrderThemes, GoBackHistory);
  953. }
  954. /*****************************************************************************
  955.  * FUNCTION
  956.  *  ExitThmSetOrder
  957.  * DESCRIPTION
  958.  *  Exit function of set order screen
  959.  * PARAMETERS
  960.  *  void
  961.  * RETURNS
  962.  *  void
  963.  *****************************************************************************/
  964. void ExitThmSetOrder(void)
  965. {
  966.     /*----------------------------------------------------------------*/
  967.     /* Local Variables                                                */
  968.     /*----------------------------------------------------------------*/
  969.     history h;
  970.     U16 inputBufferSize;    /* added for inline edit history */
  971.     /*----------------------------------------------------------------*/
  972.     /* Code Body                                                      */
  973.     /*----------------------------------------------------------------*/
  974. #ifdef __MMI_THEMES_V2_SUPPORT__
  975.     g_thm_cntx.IsInThmApp = 0;
  976. #endif 
  977.     h.scrnID = SCR_ID_THM_SET_ORDER;
  978.     CloseCategory57Screen();
  979.     h.entryFuncPtr = EntryThmSetOrder;
  980.     GetCategoryHistory(h.guiBuffer);
  981.     inputBufferSize = (U16) GetCategory57DataSize();    /* added for inline edit history */
  982.     GetCategory57Data((U8*) h.inputBuffer);             /* added for inline edit history */
  983.     AddNHistory(h, inputBufferSize);                    /* added for inline edit history */
  984. }
  985. #ifdef __MMI_THEMES_V2_SUPPORT__
  986. /*****************************************************************************
  987.  * FUNCTION
  988.  *  ActivateDefaultTheme
  989.  * DESCRIPTION
  990.  *  function to activate default theme
  991.  * PARAMETERS
  992.  *  void
  993.  * RETURNS
  994.  *  void
  995.  *****************************************************************************/
  996. void ActivateDefaultTheme(void)
  997. {
  998.     /*----------------------------------------------------------------*/
  999.     /* Local Variables                                                */
  1000.     /*----------------------------------------------------------------*/
  1001.     /*----------------------------------------------------------------*/
  1002.     /* Code Body                                                      */
  1003.     /*----------------------------------------------------------------*/
  1004.     mmi_tm_activate_theme(DefaultThmID);
  1005.     g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
  1006.     SetThemes(g_thm_cntx.CurrTheme);
  1007. }
  1008. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  1009. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1010. /*****************************************************************************
  1011.  * FUNCTION
  1012.  *  preEntryThmDownload
  1013.  * DESCRIPTION
  1014.  *  It download a theme
  1015.  * PARAMETERS
  1016.  *  void
  1017.  * RETURNS
  1018.  *  void
  1019.  *****************************************************************************/
  1020. void preEntryThmDownload(void)
  1021. {
  1022.     /*----------------------------------------------------------------*/
  1023.     /* Local Variables                                                */
  1024.     /*----------------------------------------------------------------*/
  1025.     S16 error = 0;
  1026.     /*----------------------------------------------------------------*/
  1027.     /* Code Body                                                      */
  1028.     /*----------------------------------------------------------------*/
  1029.     ReadRecord(
  1030.         NVRAM_EF_THEME_DOWNLOAD_LIST_LID,
  1031.         1,
  1032.         &recent_url_list,   /* sizeof(thm_nvram_download_list) */
  1033.         NVRAM_THEMES_DOWNLOAD_SIZE,
  1034.         &error);
  1035.     EntryThmDownload();
  1036. }
  1037. /*****************************************************************************
  1038.  * FUNCTION
  1039.  *  EntryThmDownload
  1040.  * DESCRIPTION
  1041.  *  It displays URL list
  1042.  * PARAMETERS
  1043.  *  void
  1044.  * RETURNS
  1045.  *  void
  1046.  *****************************************************************************/
  1047. void EntryThmDownload(void)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     int number_of_items = 0, i;
  1053.     U8 *guiBuffer;
  1054. S8 temp_list_unicode_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
  1055.     /*----------------------------------------------------------------*/
  1056.     /* Code Body                                                      */
  1057.     /*----------------------------------------------------------------*/
  1058.     /* U16 max_sub_menu_length= (MAX_SUB_MENU_SIZE-ENCODING_LENGTH)/ENCODING_LENGTH; */
  1059.     EntryNewScreen(SCR_ID_DOWNLOAD_ENTER_ADDRESS, NULL, EntryThmDownload, NULL);
  1060.     RegisterHighlightHandler(HighlightThmDownloadOption);
  1061.     guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_ENTER_ADDRESS);
  1062.     memset(subMenuData, 0, sizeof(subMenuData));
  1063.     pfnUnicodeStrcpy((PS8) subMenuData[number_of_items], (PS8) get_string(STR_DOWNLOAD_ENTER_ADDRESS));
  1064.     number_of_items++;
  1065.     AnsiiNToUnicodeString((PS8) subMenuData[number_of_items], (PS8) gDefaultDLT_URL, MAX_SUBMENU_CHARACTERS);
  1066.     number_of_items++;
  1067.     for (i = 0; number_of_items < (MAX_URL_ENTRIES + 2) && i < recent_url_list.total_entries; number_of_items++, i++)
  1068.     {
  1069.             AnsiiToUnicodeString((S8*)temp_list_unicode_address,(S8*)recent_url_list.g_thm_recent_url[i]);
  1070.      pfnUnicodeStrncpy(
  1071.             (PS8) subMenuData[number_of_items],
  1072.             (PS8) temp_list_unicode_address,
  1073.             MAX_SUB_MENU_SIZE - ENCODING_LENGTH);
  1074.     }
  1075.     /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191533 */
  1076.     ShowCategory353Screen(
  1077.         (U8*) GetString(STR_DOWNLOAD_ENTER_ADDRESS),
  1078.         GetRootTitleIcon(MAIN_MENU_FUNANDGAMES_MENUID),
  1079.         STR_GLOBAL_OK,
  1080.         IMG_GLOBAL_OK,
  1081.         STR_GLOBAL_BACK,
  1082.         IMG_GLOBAL_BACK,
  1083.         number_of_items,
  1084.         (U8 **) subMenuDataPtrs,
  1085.         (U16*) gIndexIconsImageList,
  1086.         NULL,
  1087.         0,
  1088.         0,
  1089.         guiBuffer);
  1090.     /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191533 */
  1091.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1092.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1093.     AnsiiToUnicodeString((PS8) g_thm_download_address, (PS8) "http://");
  1094. }
  1095. /*****************************************************************************
  1096.  * FUNCTION
  1097.  *  mmi_frm_thm_highlight_handler
  1098.  * DESCRIPTION
  1099.  *  
  1100.  * PARAMETERS
  1101.  *  index       [IN]        
  1102.  *  int(?)
  1103.  * RETURNS
  1104.  *  void
  1105.  *****************************************************************************/
  1106. void mmi_frm_thm_highlight_handler(int index)
  1107. {
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Local Variables                                                */
  1110.     /*----------------------------------------------------------------*/
  1111.     /*----------------------------------------------------------------*/
  1112.     /* Code Body                                                      */
  1113.     /*----------------------------------------------------------------*/
  1114.     if (index == 0)
  1115.     {
  1116.         SetLeftSoftkeyFunction(thm_add_to_URL_List, KEY_EVENT_UP);
  1117.     }
  1118.     else
  1119.     {
  1120.         SetLeftSoftkeyFunction(EntryInputMethodScreen, KEY_EVENT_UP);
  1121.         RegisterInputMethodScreenCloseFunction(Download2GoBackHistory);
  1122.     }
  1123. }
  1124. /*****************************************************************************
  1125.  * FUNCTION
  1126.  *  HighlightThmDownloadOption
  1127.  * DESCRIPTION
  1128.  *  
  1129.  * PARAMETERS
  1130.  *  index       [IN]        
  1131.  *  int(?)
  1132.  * RETURNS
  1133.  *  void
  1134.  *****************************************************************************/
  1135. void HighlightThmDownloadOption(int index)
  1136. {
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Local Variables                                                */
  1139.     /*----------------------------------------------------------------*/
  1140.     /*----------------------------------------------------------------*/
  1141.     /* Code Body                                                      */
  1142.     /*----------------------------------------------------------------*/
  1143.     g_recent_item_index = index;
  1144.     switch (index)
  1145.     {
  1146.         case 0:
  1147.             SetLeftSoftkeyFunction(edit_url_address, KEY_EVENT_UP);
  1148.             break;
  1149.         default:
  1150.             SetLeftSoftkeyFunction(theme_goto_url, KEY_EVENT_UP);
  1151.             break;
  1152.     }
  1153. }
  1154. /*****************************************************************************
  1155.  * FUNCTION
  1156.  *  edit_url_address
  1157.  * DESCRIPTION
  1158.  *  It download a theme
  1159.  * PARAMETERS
  1160.  *  void
  1161.  * RETURNS
  1162.  *  void
  1163.  *****************************************************************************/
  1164. void edit_url_address(void)
  1165. {
  1166.     /*----------------------------------------------------------------*/
  1167.     /* Local Variables                                                */
  1168.     /*----------------------------------------------------------------*/
  1169.     U8 *guiBuffer;
  1170.     /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221134 */
  1171.     /* PMT SHARIQ DLT_PATCH 20060814 START */
  1172.     S16 required_input_modes[] = {
  1173. INPUT_MODE_MULTITAP_LOWERCASE_ABC,
  1174. INPUT_MODE_123,                
  1175. #ifndef __MMI_TOUCH_SCREEN__
  1176.         INPUT_MODE_SMART_UPPERCASE_ABC, 
  1177.         INPUT_MODE_SMART_LOWERCASE_ABC,
  1178. #endif
  1179. INPUT_MODE_MULTITAP_UPPERCASE_ABC,         
  1180.         -1
  1181.     };
  1182.     /* PMT SHARIQ DLT_PATCH 20060814 END */
  1183.     /*----------------------------------------------------------------*/
  1184.     /* Code Body                                                      */
  1185.     /*----------------------------------------------------------------*/
  1186.     /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221134 */
  1187. is_exit_from_browser = 0;
  1188. EntryNewScreen(SCR_ID_DOWNLOAD_EDIT_ADDRESS, exit_url_address, NULL, NULL);
  1189.     guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_EDIT_ADDRESS);
  1190.     /* PMT DNLD_THEME_FIXES: SUKRIT START BUG# MAUI_00221134 */
  1191.     ShowCategory5Screen_ext(
  1192.         STR_DOWNLOAD_ENTER_ADDRESS,
  1193.         /* PMT DNLD_THEME_FIXES: SHARIQ START BUG# MAUI_00191533 */ GetRootTitleIcon(MAIN_MENU_FUNANDGAMES_MENUID),
  1194.         /* PMT DNLD_THEME_FIXES: SHARIQ END BUG# MAUI_00191533 */ STR_GLOBAL_OK,
  1195.         IMG_GLOBAL_OK,
  1196.         STR_GLOBAL_BACK,
  1197.         IMG_GLOBAL_BACK,
  1198.         (S16) (INPUT_TYPE_ALPHANUMERIC_SENTENCECASE),   /* Added by shariq 20060814 */
  1199.         (PU8) g_thm_download_address,
  1200.         MAX_ENTER_ADDRESS_SIZE + 1,
  1201.         guiBuffer,
  1202.         0,
  1203.         required_input_modes,
  1204.         NULL);
  1205.     SetLeftSoftkeyFunction(thm_add_to_URL_List, KEY_EVENT_UP);
  1206.     /* PMT DNLD_THEME_FIXES: SUKRIT END BUG# MAUI_00221134 */
  1207.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1208. }
  1209. /*****************************************************************************
  1210.  * FUNCTION
  1211.  *  exit_url_address
  1212.  * DESCRIPTION
  1213.  *  Exit function to edit url address screen
  1214.  * PARAMETERS
  1215.  *  void
  1216.  * RETURNS
  1217.  *  void
  1218.  *****************************************************************************/
  1219. void exit_url_address(void)
  1220. {
  1221.     /*----------------------------------------------------------------*/
  1222.     /* Local Variables                                                */
  1223.     /*----------------------------------------------------------------*/
  1224.     history currHistory;
  1225. S16 nHistory = 0;
  1226.     /*----------------------------------------------------------------*/
  1227.     /* Code Body                                                      */
  1228.     /*----------------------------------------------------------------*/    
  1229. if(!is_exit_from_browser)
  1230. {
  1231. currHistory.scrnID = SCR_ID_DOWNLOAD_EDIT_ADDRESS;
  1232. currHistory.entryFuncPtr = edit_url_address;
  1233. pfnUnicodeStrcpy((S8*) currHistory.inputBuffer, (S8*) & nHistory);
  1234. GetCategoryHistory(currHistory.guiBuffer);
  1235. AddHistory(currHistory);
  1236. }
  1237. }
  1238. /*****************************************************************************
  1239.  * FUNCTION
  1240.  *  Download2GoBackHistory
  1241.  * DESCRIPTION
  1242.  *  
  1243.  * PARAMETERS
  1244.  *  void
  1245.  * RETURNS
  1246.  *  void
  1247.  *****************************************************************************/
  1248. void Download2GoBackHistory(void)
  1249. {
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Local Variables                                                */
  1252.     /*----------------------------------------------------------------*/
  1253.     /*----------------------------------------------------------------*/
  1254.     /* Code Body                                                      */
  1255.     /*----------------------------------------------------------------*/
  1256.     GoBacknHistory(1);
  1257. }
  1258. /*****************************************************************************
  1259.  * FUNCTION
  1260.  *  entry_url_done_input_option
  1261.  * DESCRIPTION
  1262.  *  Entry function to download theme
  1263.  * PARAMETERS
  1264.  *  void
  1265.  * RETURNS
  1266.  *  void
  1267.  *****************************************************************************/
  1268. void entry_url_done_input_option(void)
  1269. {
  1270.     /*----------------------------------------------------------------*/
  1271.     /* Local Variables                                                */
  1272.     /*----------------------------------------------------------------*/
  1273.     U8 *guiBuffer;
  1274.     U16 nStrItemList[10];
  1275.     U16 numItems;
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Code Body                                                      */
  1278.     /*----------------------------------------------------------------*/
  1279.     dontSaveURLinHistory = 0;
  1280.     EntryNewScreen(SCR_ID_DOWNLOAD_DONE_OPTION, exit_url_done_input_option, NULL, NULL);
  1281.     guiBuffer = GetCurrGuiBuffer(SCR_ID_DOWNLOAD_DONE_OPTION);
  1282.     SetParentHandler(MENU_THM_DOWNLOAD_INPUT_METHOD_AND_DONE_OPTION_ID);
  1283.     RegisterHighlightHandler(mmi_frm_thm_highlight_handler);
  1284.     numItems = GetNumOfChild(MENU_THM_DOWNLOAD_INPUT_METHOD_AND_DONE_OPTION_ID);
  1285.     GetSequenceStringIds(MENU_INPUT_METHOD_AND_DONE_OPTION_ID, nStrItemList);
  1286.     ShowCategory52Screen(
  1287.         STR_GLOBAL_OPTIONS,
  1288.         0,
  1289.         STR_GLOBAL_OK,
  1290.         IMG_GLOBAL_OK,
  1291.         STR_GLOBAL_BACK,
  1292.         IMG_GLOBAL_BACK,
  1293.         numItems,
  1294.         nStrItemList,
  1295.         (PU16) gIndexIconsImageList,
  1296.         NULL,
  1297.         0,
  1298.         0,
  1299.         guiBuffer);
  1300.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1301. }
  1302. /*****************************************************************************
  1303.  * FUNCTION
  1304.  *  exit_url_done_input_option
  1305.  * DESCRIPTION
  1306.  *  Exit function to download theme
  1307.  * PARAMETERS
  1308.  *  void
  1309.  * RETURNS
  1310.  *  void
  1311.  *****************************************************************************/
  1312. void exit_url_done_input_option()
  1313. {
  1314.     /*----------------------------------------------------------------*/
  1315.     /* Local Variables                                                */
  1316.     /*----------------------------------------------------------------*/
  1317.     history currHistory;
  1318.     /*----------------------------------------------------------------*/
  1319.     /* Code Body                                                      */
  1320.     /*----------------------------------------------------------------*/
  1321.     currHistory.scrnID = SCR_ID_DOWNLOAD_DONE_OPTION;
  1322.     currHistory.entryFuncPtr = entry_url_done_input_option;
  1323.     GetCategoryHistory(currHistory.guiBuffer);
  1324.     if (dontSaveURLinHistory != 1)
  1325.     {
  1326.         AddHistory(currHistory);
  1327.     }
  1328. }
  1329. /*****************************************************************************
  1330.  * FUNCTION
  1331.  *  thm_add_to_URL_List
  1332.  * DESCRIPTION
  1333.  *  Function to add url in history
  1334.  * PARAMETERS
  1335.  *  void
  1336.  * RETURNS
  1337.  *  void
  1338.  *****************************************************************************/
  1339. void thm_add_to_URL_List(void)
  1340. {
  1341.     /*----------------------------------------------------------------*/
  1342.     /* Local Variables                                                */
  1343.     /*----------------------------------------------------------------*/
  1344.     S16 error = 0;
  1345.     signed char index = 0;
  1346. S8 temp_thm_download_address[MAX_ENTER_ADDRESS_SIZE * ENCODING_LENGTH + ENCODING_LENGTH];
  1347. pBOOL isValid = FALSE;
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Code Body                                                      */
  1350.     /*----------------------------------------------------------------*/
  1351. UnicodeToAnsii((S8*)temp_thm_download_address, (S8*)g_thm_download_address);
  1352.     dontSaveURLinHistory = 1;
  1353.     if (g_thm_download_address != NULL)
  1354.     {
  1355. isValid = mmi_thm_isValidUrl(temp_thm_download_address);
  1356. if(isValid)
  1357. {
  1358. is_exit_from_browser = 1;
  1359.         if (recent_url_list.total_entries == MAX_URL_ENTRIES)
  1360.         {
  1361.             recent_url_list.total_entries--;
  1362.         }
  1363.         if (recent_url_list.total_entries > 0)
  1364.         {
  1365.             for (index = recent_url_list.total_entries - 1; index >= 0; index--)
  1366.             {
  1367.                 strcpy(
  1368.                         (PS8) recent_url_list.g_thm_recent_url[index + 1],
  1369. (PS8) recent_url_list.g_thm_recent_url[index]);
  1370.             }
  1371.         }
  1372.             strcpy((PS8) recent_url_list.g_thm_recent_url[0], (PS8) temp_thm_download_address);
  1373.         recent_url_list.total_entries++;
  1374.     /*
  1375.      * current_index=MAX_URL_ENTRIES-1;
  1376.      * if(g_thm_download_address!=NULL)
  1377.      * {
  1378.      * if(recent_url_list.total_entries<MAX_URL_ENTRIES)
  1379.      * recent_url_list.total_entries++;
  1380.      * current_index=recent_url_list.total_entries-1;
  1381.      * while(current_index>0)
  1382.      * {
  1383.      * pfnUnicodeStrcpy((PS8)recent_url_list.g_thm_recent_url[current_index],(PS8)recent_url_list.g_thm_recent_url[current_index-1]);
  1384.      * current_index--;
  1385.      * }
  1386.      * 
  1387.      * pfnUnicodeStrcpy((PS8)recent_url_list.g_thm_recent_url[current_index],(PS8)g_thm_download_address);
  1388.      */
  1389.     WriteRecord(
  1390.         NVRAM_EF_THEME_DOWNLOAD_LIST_LID,
  1391.         1,
  1392.         &recent_url_list,
  1393.         NVRAM_THEMES_DOWNLOAD_SIZE /* sizeof(thm_nvram_download_list) */ ,
  1394.         &error);
  1395.     g_recent_item_index = 0;
  1396.     theme_goto_url();
  1397. }
  1398. else
  1399. {
  1400. DisplayPopup((PU8) get_string(STR_THEME_INVALID_URL), IMG_GLOBAL_ERROR, 1, 1000, WARNING_TONE);
  1401. }
  1402. }
  1403. }
  1404. /*****************************************************************************
  1405.  * FUNCTION
  1406.  *  theme_goto_url
  1407.  * DESCRIPTION
  1408.  *  
  1409.  * PARAMETERS
  1410.  *  void
  1411.  * RETURNS
  1412.  *  void
  1413.  *****************************************************************************/
  1414. void theme_goto_url(void)
  1415. {
  1416. #ifdef MMI_ON_HARDWARE_P
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Local Variables                                                */
  1419.     /*----------------------------------------------------------------*/
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Code Body                                                      */
  1422.     /*----------------------------------------------------------------*/
  1423.     if (!wap_is_ready())
  1424.     {
  1425.         /* WGUI_CTX->not_ready_for_MMS = 0; */
  1426.     #ifdef OBIGO_SUPPORT
  1427.         wap_entry_widget_not_ready();
  1428.     #elif defined JATAAYU_SUPPORT
  1429.         mmi_brw_entry_wap_not_ready();
  1430.     #endif 
  1431.     }
  1432.     else
  1433.     {
  1434.         theme_connect_wap();
  1435.     }
  1436. #endif /* MMI_ON_HARDWARE_P */ 
  1437.     DeleteUptoScrID(SCR_ID_DOWNLOAD_ENTER_ADDRESS);
  1438. #ifndef MMI_ON_HARDWARE_P
  1439.     GoBackHistory();
  1440. #endif 
  1441. }
  1442. /*****************************************************************************
  1443.  * FUNCTION
  1444.  *  theme_connect_wap
  1445.  * DESCRIPTION
  1446.  *  Function to connect through wap
  1447.  * PARAMETERS
  1448.  *  void
  1449.  * RETURNS
  1450.  *  void
  1451.  *****************************************************************************/
  1452. void theme_connect_wap(void)
  1453. {
  1454.     /*----------------------------------------------------------------*/
  1455.     /* Local Variables                                                */
  1456.     /*----------------------------------------------------------------*/
  1457. #ifdef MMI_ON_HARDWARE_P
  1458.     struct ilm_struct *ilm_ptr = NULL;
  1459.     wap_browser_startup_req_struct *p =
  1460.         (wap_browser_startup_req_struct*) construct_local_para(
  1461.                                             (kal_uint16) (sizeof(wap_browser_startup_req_struct)),
  1462.                                             0);
  1463.     /*----------------------------------------------------------------*/
  1464.     /* Code Body                                                      */
  1465.     /*----------------------------------------------------------------*/
  1466.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1467.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1468.     if (wap_browser_is_open())
  1469.     {
  1470.         DisplayPopup(
  1471.             (PU8) GetString(STR_THEME_ERROR_WAP_ALREADY_ACTIVE),
  1472.             IMG_GLOBAL_ERROR,
  1473.             TRUE,
  1474.             UI_POPUP_NOTIFYDURATION_TIME,
  1475.             ERROR_TONE);
  1476.         return;
  1477.         /* Abnormal case. BRA should already terminate its UI. */
  1478.     }
  1479.     p->type = 2;
  1480.     if (g_recent_item_index == 0)
  1481.     {
  1482. strcpy((PS8) p->url, (PS8) recent_url_list.g_thm_recent_url[g_recent_item_index]);
  1483.     }
  1484.     else if (g_recent_item_index == 1)
  1485.     {
  1486.         strcpy((char*)p->url, (char*)gDefaultDLT_URL);
  1487.     }
  1488.     else
  1489.     {
  1490. strcpy((PS8) p->url, (PS8) recent_url_list.g_thm_recent_url[g_recent_item_index - 2]);
  1491.     }
  1492.     ilm_ptr = allocate_ilm(MOD_MMI);
  1493.     ilm_ptr->local_para_ptr = (local_para_struct*) p;
  1494.     ilm_ptr->msg_id = MSG_ID_WAP_BROWSER_STARTUP_REQ;
  1495.     ilm_ptr->peer_buff_ptr = NULL;
  1496.     MMI_SEND_ILM_EXT(MOD_MMI, MOD_WAP, WAP_MMI_SAP, ilm_ptr);
  1497. #endif /* MMI_ON_HARDWARE_P */ 
  1498. }
  1499. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  1500. /*****************************************************************************
  1501.  * FUNCTION
  1502.  *  HighlightThmMenu
  1503.  * DESCRIPTION
  1504.  *  Hilite function of main themes menu
  1505.  * PARAMETERS
  1506.  *  void
  1507.  * RETURNS
  1508.  *  void
  1509.  *****************************************************************************/
  1510. void HighlightThmMenu(void)
  1511. {
  1512.     /*----------------------------------------------------------------*/
  1513.     /* Local Variables                                                */
  1514.     /*----------------------------------------------------------------*/
  1515.     /*----------------------------------------------------------------*/
  1516.     /* Code Body                                                      */
  1517.     /*----------------------------------------------------------------*/
  1518.     SetLeftSoftkeyFunction(EntryThmMenu, KEY_EVENT_UP);
  1519.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1520.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1521.     SetKeyHandler(EntryThmMenu, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1522. }
  1523. /*****************************************************************************
  1524.  * FUNCTION
  1525.  *  HighlightThmUpdatePeriod
  1526.  * DESCRIPTION
  1527.  *  Hilite function of pupdate period
  1528.  * PARAMETERS
  1529.  *  nIndex      [IN]        
  1530.  * RETURNS
  1531.  *  void
  1532.  *****************************************************************************/
  1533. void HighlightThmUpdatePeriod(S32 nIndex)
  1534. {
  1535.     /*----------------------------------------------------------------*/
  1536.     /* Local Variables                                                */
  1537.     /*----------------------------------------------------------------*/
  1538.     /*----------------------------------------------------------------*/
  1539.     /* Code Body                                                      */
  1540.     /*----------------------------------------------------------------*/
  1541.     /* set IsSetFromMenu flag */
  1542.     g_thm_cntx.IsSetFromMenu = 1;
  1543.     g_thm_cntx.CurrHiliteItem = (U8) nIndex;
  1544.     if (nIndex > 0) /* update theme */
  1545.     {
  1546.         SetLeftSoftkeyFunction(UpdateThemePeriod, KEY_EVENT_UP);
  1547.     }
  1548.     else    /* OFF */
  1549.     {
  1550.         SetLeftSoftkeyFunction(UpdateThemeOff, KEY_EVENT_UP);
  1551.     }
  1552. }
  1553. /*****************************************************************************
  1554.  * FUNCTION
  1555.  *  HighlightThmItems
  1556.  * DESCRIPTION
  1557.  *  Highlight handler of Theme menu,
  1558.  *  function show the current selected theme
  1559.  * PARAMETERS
  1560.  *  index       [IN]        
  1561.  * RETURNS
  1562.  *  void
  1563.  *****************************************************************************/
  1564. void HighlightThmItems(S32 index)
  1565. {
  1566. #ifdef __MMI_THEMES_V2_SUPPORT__
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Local Variables                                                */
  1569.     /*----------------------------------------------------------------*/
  1570.     /*----------------------------------------------------------------*/
  1571.     /* Code Body                                                      */
  1572.     /*----------------------------------------------------------------*/
  1573.     g_thm_cntx.CurrHiliteTheme = thm_details[index].theme_id;
  1574.     g_temp_thm_index = index;
  1575. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  1576.     g_thm_cntx.CurrHiliteTheme = (U8) index;
  1577.     SetBothLCDThemes(g_thm_cntx.CurrHiliteTheme);
  1578.     /* PMT VIKAS START 20050707 */
  1579. #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
  1580.     gOnFullScreen |= MMI_LEAVE_FULL_SCREEN; /* for showing the updated status bar on Theme menu. */
  1581. #endif 
  1582.     /* PMT VIKAS END 20050707 */
  1583.     RedrawCategoryFunction();
  1584. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  1585. }
  1586. /*****************************************************************************
  1587.  * FUNCTION
  1588.  *  ThmHandleRSK
  1589.  * DESCRIPTION
  1590.  *  Change theme to original one and go back history.
  1591.  * PARAMETERS
  1592.  *  void
  1593.  * RETURNS
  1594.  *  void
  1595.  *****************************************************************************/
  1596. void ThmHandleRSK(void)
  1597. {
  1598.     /*----------------------------------------------------------------*/
  1599.     /* Local Variables                                                */
  1600.     /*----------------------------------------------------------------*/
  1601.     /*----------------------------------------------------------------*/
  1602.     /* Code Body                                                      */
  1603.     /*----------------------------------------------------------------*/
  1604.     if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
  1605.     {
  1606.         SetBothLCDThemes(g_thm_cntx.CurrTheme);
  1607.     }
  1608.     g_thm_cntx.IsInThmApp = 0;
  1609.     GoBackHistory();
  1610. }
  1611. /*****************************************************************************
  1612.  * FUNCTION
  1613.  *  ThmRedrawTheme
  1614.  * DESCRIPTION
  1615.  *  Redraw current hilite theme in option menu to make the user preceive current
  1616.  *  selecting theme
  1617.  * PARAMETERS
  1618.  *  void
  1619.  * RETURNS
  1620.  *  void
  1621.  *****************************************************************************/
  1622. void ThmRedrawTheme(void)
  1623. {
  1624.     /*----------------------------------------------------------------*/
  1625.     /* Local Variables                                                */
  1626.     /*----------------------------------------------------------------*/
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Code Body                                                      */
  1629.     /*----------------------------------------------------------------*/
  1630.     if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
  1631.     {
  1632.         SetBothLCDThemes(g_thm_cntx.CurrHiliteTheme);
  1633.     }
  1634. }
  1635. /*****************************************************************************
  1636.  * FUNCTION
  1637.  *  ExitThmMenu
  1638.  * DESCRIPTION
  1639.  *  Exit function for theme menu, restore theme after exit theme screen.
  1640.  * PARAMETERS
  1641.  *  void
  1642.  * RETURNS
  1643.  *  void
  1644.  *****************************************************************************/
  1645. void ExitThmMenu(void)
  1646. {
  1647.     /*----------------------------------------------------------------*/
  1648.     /* Local Variables                                                */
  1649.     /*----------------------------------------------------------------*/
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
  1654.         /* PMT VIKAS START 20050707 */
  1655. #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
  1656.     {
  1657.         gOnFullScreen |= MMI_LEAVE_FULL_SCREEN; /* for showing the updated status bar on Theme menu. */
  1658. #endif /* (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__) */ 
  1659.         SetBothLCDThemes(g_thm_cntx.CurrTheme);
  1660.     #if (defined __MMI_MAINLCD_176X220__) && (defined __MMI_UI_DALMATIAN_STATUSBAR__)
  1661.     }
  1662.     #endif 
  1663.     /* PMT VIKAS END 20050707 */
  1664. }
  1665. /*****************************************************************************
  1666.  * FUNCTION
  1667.  *  EntryThmMenuDuringUSB
  1668.  * DESCRIPTION
  1669.  *  Show a lsit of themes
  1670.  * PARAMETERS
  1671.  *  void
  1672.  * RETURNS
  1673.  *  void
  1674.  *****************************************************************************/
  1675. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1676. void EntryThmMenuDuringUSB(void)
  1677. {
  1678.     /*----------------------------------------------------------------*/
  1679.     /* Local Variables                                                */
  1680.     /*----------------------------------------------------------------*/
  1681.     U8 *guiBuffer;
  1682.     U16 i = 0;
  1683.     U16 list_icons1[MAX_SUB_MENUS];
  1684.     U16 list_icons2[MAX_SUB_MENUS];
  1685.     U8 *temp_name;
  1686.     U8 nSystemThemeCount;
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Code Body                                                      */
  1689.     /*----------------------------------------------------------------*/
  1690.     EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
  1691.     nSystemThemeCount = (U8) GetThemesNames((U8 ***) & temp_name);
  1692.     if (nSystemThemeCount > MAX_SYSTEM_THEMES)
  1693.     {
  1694.         nSystemThemeCount = MAX_SYSTEM_THEMES;
  1695.     }
  1696.     for (i = 0; i < nSystemThemeCount; i++)
  1697.     {
  1698.         if (thm_details[i].theme_type == THEME_TYPE_SYSTEM)
  1699.         {
  1700.             list_icons2[i] = IMAGE_SYSTEM_THEME;
  1701.         }
  1702.         else
  1703.         {
  1704.             list_icons2[i] = 0;
  1705.         }
  1706.         if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
  1707.         {
  1708.             g_thm_cntx.CurrThemeIndex = i;
  1709.             list_icons1[i] = IMG_VICON;
  1710.         }
  1711.         else
  1712.         {
  1713.             list_icons1[i] = IMAGE_NOIMAGE_THEME;
  1714.         }
  1715.     }
  1716.     guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
  1717.     RegisterHighlightHandler(HighlightThmItems);
  1718.     ShowCategory73Screen(
  1719.         STR_MENU3101_THEMES,
  1720.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1721.         STR_GLOBAL_OPTIONS,
  1722.         IMG_GLOBAL_OPTIONS,
  1723.         STR_GLOBAL_BACK,
  1724.         IMG_GLOBAL_BACK,
  1725.         nSystemThemeCount,
  1726.         (U8 **) g_thm_cntx.ThemeName,
  1727.         list_icons1,
  1728.         list_icons2,
  1729.         (U16) g_thm_cntx.CurrThemeIndex,
  1730.         guiBuffer,
  1731.         1);
  1732.     SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
  1733.     SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1734.     SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
  1735.     SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1736.     SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
  1737. }
  1738. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
  1739. /*****************************************************************************
  1740.  * FUNCTION
  1741.  *  EntryThmMenu
  1742.  * DESCRIPTION
  1743.  *  
  1744.  * PARAMETERS
  1745.  *  void
  1746.  * RETURNS
  1747.  *  void
  1748.  *****************************************************************************/
  1749. void EntryThmMenu(void)
  1750. {
  1751. #ifdef __MMI_THEMES_V2_SUPPORT__
  1752.     /*----------------------------------------------------------------*/
  1753.     /* Local Variables                                                */
  1754.     /*----------------------------------------------------------------*/
  1755.     U8 i = 0;
  1756.     U8 thm_file_check = 0;
  1757.     /*----------------------------------------------------------------*/
  1758.     /* Code Body                                                      */
  1759.     /*----------------------------------------------------------------*/
  1760.     if (mmi_tm_get_usb_mode() == MMI_TRUE)
  1761.     {
  1762.         EntryThmMenuDuringUSB();
  1763.         return;
  1764.     }
  1765.     EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
  1766.     ConstructThemeList();
  1767.     g_thm_cntx.CurrTheme = mmi_tm_get_current_theme_id();
  1768.     for (i = 0; i < g_thm_cntx.TotalTheme; i++)
  1769.     {
  1770.         if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
  1771.         {
  1772.             thm_file_check = 1;
  1773.         }
  1774.     }
  1775.     if (thm_file_check == 0)
  1776.     {
  1777.         ActivateDefaultTheme();
  1778.         /* PMT DLT_FIXES - TK 20060321 START */
  1779.         /* PMT DLT_FIXES - TK 20060321 END */
  1780.         reset_title_status_icon();
  1781.     #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1782.         ShowCategory7Screen(
  1783.             STR_SCR3001_THEMES_CAPTION,
  1784.             0,
  1785.             STR_GLOBAL_OK,
  1786.             IMG_GLOBAL_OK,
  1787.             0,
  1788.             0,
  1789.             (U8*) GetString(STR_DEFAULT_THEME_ACTIVATION),
  1790.             NULL);
  1791.     #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  1792.         SetLeftSoftkeyFunction(ShowThemeList, KEY_EVENT_UP);
  1793.         SetKeyHandler(ShowThemeList, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1794.     }
  1795.     else
  1796.     {
  1797.         ShowThemeList();
  1798.     }
  1799. #else /* __MMI_THEMES_V2_SUPPORT__ */ 
  1800.     U16 nItems;
  1801.     U8 *guiBuffer;
  1802.     U16 i = 0;
  1803.     U16 *list_icons1 = NULL;
  1804.     U16 *list_icons2 = NULL;
  1805.     g_thm_cntx.IsInThmApp = 1;
  1806.     EntryNewScreen(SCR_ID_THM_MENU, ExitThmMenu, EntryThmMenu, NULL);
  1807.     FillThemesList();
  1808.     guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
  1809.     nItems = (U16) g_thm_cntx.TotalTheme;
  1810.     list_icons1 = (U16*) OslMalloc(nItems * sizeof(PU16));
  1811.     list_icons2 = (U16*) OslMalloc(nItems * sizeof(PU16));
  1812.     for (i = 0; i < nItems; i++)
  1813.     {
  1814.         if (i == g_thm_cntx.CurrTheme)
  1815.         {
  1816.             list_icons1[i] = IMG_VICON;
  1817.         }
  1818.         else
  1819.         {
  1820.             list_icons1[i] = IMAGE_NOIMAGE_THEME;
  1821.         }
  1822.     }
  1823.     for (i = 0; i < nItems; i++)
  1824.     {
  1825.         list_icons2[i] = IMAGE_NOIMAGE_THEME;
  1826.     }
  1827.     RegisterHighlightHandler(HighlightThmItems);
  1828.     ShowCategory73Screen(
  1829.         STR_MENU3101_THEMES,
  1830.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1831.         STR_GLOBAL_OPTIONS,
  1832.         IMG_GLOBAL_OPTIONS,
  1833.         STR_GLOBAL_BACK,
  1834.         IMG_GLOBAL_BACK,
  1835.         nItems,
  1836.         (U8 **) g_thm_cntx.ThemeName,
  1837.         list_icons1,
  1838.         list_icons2,
  1839.         (U16) g_thm_cntx.CurrTheme,
  1840.         guiBuffer,
  1841.         0);
  1842.     SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
  1843.     SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1844.     SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
  1845.     SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1846.     SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
  1847.     if (list_icons1)
  1848.     {
  1849.         OslMfree(list_icons1);
  1850.     }
  1851.     if (list_icons2)
  1852.     {
  1853.         OslMfree(list_icons2);
  1854.     }
  1855. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  1856. }
  1857. /*****************************************************************************
  1858.  * FUNCTION
  1859.  *  ShowThemeList
  1860.  * DESCRIPTION
  1861.  *  Function to show theme list from theme application
  1862.  * PARAMETERS
  1863.  *  void
  1864.  * RETURNS
  1865.  *  void
  1866.  *****************************************************************************/
  1867. #ifdef __MMI_THEMES_V2_SUPPORT__
  1868. void ShowThemeList(void)
  1869. {
  1870.     /*----------------------------------------------------------------*/
  1871.     /* Local Variables                                                */
  1872.     /*----------------------------------------------------------------*/
  1873.     U8 *guiBuffer;
  1874.     U16 i = 0;
  1875.     U16 list_icons1[MAX_SUB_MENUS];
  1876.     U16 list_icons2[MAX_SUB_MENUS];
  1877.     /*----------------------------------------------------------------*/
  1878.     /* Code Body                                                      */
  1879.     /*----------------------------------------------------------------*/
  1880.     for (i = 0; i < g_thm_cntx.TotalTheme; i++)
  1881.     {
  1882.         if (thm_details[i].theme_type == THEME_TYPE_SYSTEM)
  1883.         {
  1884.             list_icons2[i] = IMAGE_SYSTEM_THEME;
  1885.         }
  1886.         else if (thm_details[i].theme_type == THEME_TYPE_DOWNLOADED_PHONE)
  1887.         {
  1888.             list_icons2[i] = IMAGE_PHONE_THEME;
  1889.         }
  1890.         else if (thm_details[i].theme_type == THEME_TYPE_DOWNLOADED_CARD)
  1891.         {
  1892.             list_icons2[i] = IMAGE_CARD_THEME;
  1893.         }
  1894.     }
  1895.     for (i = 0; i < g_thm_cntx.TotalTheme; i++)
  1896.     {
  1897.         list_icons1[i] = IMAGE_NOIMAGE_THEME;
  1898.         if (g_thm_cntx.CurrTheme == thm_details[i].theme_id)
  1899.         {
  1900.             g_thm_cntx.CurrThemeIndex = i;
  1901.             list_icons1[i] = IMG_VICON;
  1902.         }
  1903.     }
  1904.     guiBuffer = GetCurrGuiBuffer(SCR_ID_THM_MENU);
  1905.     RegisterHighlightHandler(HighlightThmItems);
  1906.     ShowCategory73Screen(
  1907.         STR_MENU3101_THEMES,
  1908.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1909.         STR_GLOBAL_OPTIONS,
  1910.         IMG_GLOBAL_OPTIONS,
  1911.         STR_GLOBAL_BACK,
  1912.         IMG_GLOBAL_BACK,
  1913.         g_thm_cntx.TotalTheme,
  1914.         (U8 **) g_thm_cntx.ThemeName,
  1915.         list_icons1,
  1916.         list_icons2,
  1917.         (U16) g_thm_cntx.CurrThemeIndex,
  1918.         guiBuffer,
  1919.         1);
  1920.     SetLeftSoftkeyFunction(EntryThmOptions, KEY_EVENT_UP);
  1921.     SetKeyHandler(EntryThmOptions, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1922.     SetRightSoftkeyFunction(ThmHandleRSK, KEY_EVENT_UP);
  1923.     SetKeyHandler(ThmHandleRSK, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1924.     SetKeyHandler(ThmHandleEndKey, KEY_END, KEY_EVENT_DOWN);
  1925. }
  1926. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  1927. /*****************************************************************************
  1928.  * FUNCTION
  1929.  *  ThmHandleEndKey
  1930.  * DESCRIPTION
  1931.  *  Function handle end key
  1932.  * PARAMETERS
  1933.  *  void
  1934.  * RETURNS
  1935.  *  void
  1936.  *****************************************************************************/
  1937. void ThmHandleEndKey(void)
  1938. {
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Local Variables                                                */
  1941.     /*----------------------------------------------------------------*/
  1942.     /*----------------------------------------------------------------*/
  1943.     /* Code Body                                                      */
  1944.     /*----------------------------------------------------------------*/
  1945.     if (g_thm_cntx.CurrHiliteTheme != g_thm_cntx.CurrTheme)
  1946.     {
  1947.         SetBothLCDThemes(g_thm_cntx.CurrTheme);
  1948.     }
  1949.     g_thm_cntx.IsInThmApp = 0;
  1950.     DisplayIdleScreen();
  1951. }
  1952. /*****************************************************************************
  1953.  * FUNCTION
  1954.  *  HighlightThmOption
  1955.  * DESCRIPTION
  1956.  *  Highlight handler of theme menu
  1957.  * PARAMETERS
  1958.  *  nIndex      [IN]        
  1959.  * RETURNS