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

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.  * Wallpaper.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for wallpaper
  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.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  *
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  * removed!
  248.  * removed!
  249.  * removed!
  250.  *
  251.  * removed!
  252.  * removed!
  253.  * removed!
  254.  *
  255.  * removed!
  256.  * removed!
  257.  * removed!
  258.  *
  259.  * removed!
  260.  * removed!
  261.  * removed!
  262.  *
  263.  * removed!
  264.  * removed!
  265.  * removed!
  266.  *
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  *
  271.  * removed!
  272.  * removed!
  273.  * removed!
  274.  *
  275.  * removed!
  276.  * removed!
  277.  * removed!
  278.  *
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  *
  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.  * removed!
  308.  * removed!
  309.  * removed!
  310.  *
  311.  * removed!
  312.  * removed!
  313.  * removed!
  314.  *
  315.  * removed!
  316.  * removed!
  317.  * removed!
  318.  *
  319.  * removed!
  320.  * removed!
  321.  * removed!
  322.  *
  323.  * removed!
  324.  * removed!
  325.  * removed!
  326.  *
  327.  * removed!
  328.  * removed!
  329.  * removed!
  330.  *
  331.  * removed!
  332.  * removed!
  333.  * removed!
  334.  *
  335.  * removed!
  336.  * removed!
  337.  * removed!
  338.  *
  339.  * removed!
  340.  * removed!
  341.  * removed!
  342.  *
  343.  * removed!
  344.  * removed!
  345.  * removed!
  346.  *
  347.  * removed!
  348.  * removed!
  349.  * removed!
  350.  *
  351.  * removed!
  352.  * removed!
  353.  * removed!
  354.  *
  355.  * removed!
  356.  * removed!
  357.  * removed!
  358.  *
  359.  * removed!
  360.  * removed!
  361.  * removed!
  362.  *
  363.  * removed!
  364.  * removed!
  365.  * removed!
  366.  *
  367.  * removed!
  368.  * removed!
  369.  * removed!
  370.  *
  371.  * removed!
  372.  * removed!
  373.  * removed!
  374.  *
  375.  * removed!
  376.  * removed!
  377.  * removed!
  378.  *
  379.  * removed!
  380.  * removed!
  381.  * removed!
  382.  *
  383.  * removed!
  384.  * removed!
  385.  * removed!
  386.  *
  387.  * removed!
  388.  * removed!
  389.  * removed!
  390.  *
  391.  * removed!
  392.  * removed!
  393.  * removed!
  394.  *
  395.  * removed!
  396.  * removed!
  397.  * removed!
  398.  *
  399.  * removed!
  400.  * removed!
  401.  * removed!
  402.  *
  403.  *------------------------------------------------------------------------------
  404.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  405.  *============================================================================
  406.  ****************************************************************************/
  407. /***************************************************************************** 
  408. * Include
  409. *****************************************************************************/
  410. /*  Include: MMI header file */
  411. #include "MMI_features.h"
  412. #include "stdC.h"
  413. #include "L4Dr1.h"
  414. #include "PixtelDataTypes.h"
  415. #include "Unicodexdcl.h"
  416. #include "NVRAMType.h"
  417. #include "NVRAMProt.h"
  418. #include "NVRAMEnum.h"
  419. #include "DownloadProtos.h"
  420. #include "CommonScreens.h"
  421. #include "EventsGprot.h"
  422. #include "historyGprot.h"
  423. #include "ProtocolEvents.h"
  424. #include "MainMenuDef.h"
  425. #include "TimerEvents.h"
  426. #include "GlobalDefs.h"
  427. #include "SettingProt.h"
  428. #include "wgui_inline_edit.h"
  429. #include "DebugInitDef.h"
  430. #include "HistoryGprot.h"
  431. #include "WPSSProtos.h"
  432. #include "SettingGprots.h"
  433. #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  434. /* MUST be allocated before WallpaperDefs.h */
  435. #include "PowerOnOffDisplayDefs.h"
  436. #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  437. #include "ScreenSaverDefs.h"
  438. #include "WallpaperDefs.h"
  439. #include "SettingDefs.h"
  440. #include "SettingProfile.h"
  441. #include "DownloadDefs.h"
  442. #include "DownloadProtos.h"
  443. #include "PhoneSetup.h"
  444. #include "FileManagerGProt.h"
  445. #ifdef __MMI_THEMES_V2_SUPPORT__
  446. #include "ThemeManager.h"
  447. #endif 
  448. #include "gdi_include.h"
  449. #ifdef __MMI_FILE_MANAGER__
  450. #include "FileMgr.h"
  451. #endif 
  452. #include "Conversions.h"
  453. #include "SimDetectionGprot.h"
  454. #include "IdleAppDef.h"
  455. #include "wgui_categories.h"
  456. #include "wgui_categories_idlescreen.h"
  457. #include "wgui_categories_sublcd.h"
  458. #include "wgui_categories_multimedia.h" /* ShowCategory222Screen() */
  459. /***************************************************************************** 
  460. * External Function
  461. *****************************************************************************/
  462. /***************************************************************************** 
  463. * Local Variable
  464. *****************************************************************************/
  465. /* Store END key handler function pointer */
  466. /* When previewing the user define wallpaper & Screen saver */
  467. /* Press END key shall to release file path buffer and execute stored END key handler */
  468. FuncPtr phnset_wpfp = NULL;
  469. static PS8 error_str_ptr;
  470. static U8 wp_item_amount;
  471. static FuncPtr CallbackWpSsLSK = NULL;
  472. /***************************************************************************** 
  473. * Global Variable
  474. *****************************************************************************/
  475. MMI_ID_TYPE idle_screen_wallpaper_ID;
  476. MMI_ID_TYPE idle_screen_cache_id;
  477. #ifndef __MMI_FILE_MANAGER__
  478. S8 *idle_screen_wallpaper_name_original;
  479. S8 *idle_screen_screensaver_name;
  480. S8 *idle_screen_wallpaper_name;
  481. S8 *idle_screen_cache_name;
  482. #else /* __MMI_FILE_MANAGER__ */
  483. PHNSET_WPSS_FILENAME_STRUCT phnset_wpss_filename;
  484. const U16 PHNSET_PREDEFINED_WP_PATH_JPG[] = L"Z:\@USER\UserWP.JPG";
  485. const U16 PHNSET_PREDEFINED_WP_PATH_PBM[] = L"Z:\@USER\UserWP.PBM";
  486. /* store the image id of wallpaper */
  487. S8 *idle_screen_wallpaper_name_original = (S8 *) phnset_wpss_filename.wallpaper;
  488. S8 *idle_screen_screensaver_name = (S8 *) phnset_wpss_filename.screensave;
  489. S8 *idle_screen_wallpaper_name;
  490. S8 *idle_screen_cache_name;
  491. /* Dynamic alloc memory for file path buffer */
  492. S8 *phnset_dispchar_strp = NULL;
  493. U8 phnset_dispchar_temp[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH];
  494. #ifdef __MMI_SUB_WALLPAPER__
  495. PHNSET_WPSS_FILENAME_STRUCT phnset_wpss_sub_filename;
  496. S8 *idle_screen_wallpaper_sub_name = (S8 *) phnset_wpss_sub_filename.wallpaper; /* diamond, 2005/05/09 for sub-LCD wallpaper */
  497. #endif /* __MMI_SUB_WALLPAPER__ */ 
  498. #endif /* __MMI_FILE_MANAGER__ */
  499. /***************************************************************************** 
  500. * Global Function
  501. *****************************************************************************/
  502. void PhnsetWpUsrDefPreView(void);
  503. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  504. void wgui_set_wallpaper_change(void);
  505. #endif 
  506. /***************************************************************************** 
  507. * Extern Function
  508. *****************************************************************************/
  509. extern U8 PhnsetGetDefEncodingType(void);
  510. /***************************************************************************** 
  511. * Local Function
  512. *****************************************************************************/
  513. static U8 PhnsetConstSysWallpaperList(U8 **pSysWallpaperStrList, U16 *pSysWallpaperImgIDList, U16 *HighliteItem);
  514. static void DispIdleScrWPBadFilePopup(void);
  515. /*****************************************************************************
  516.  * FUNCTION
  517.  *  HighlightPhnsetWallpaper
  518.  * DESCRIPTION
  519.  *  This function is highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper.
  520.  *  Following Functions:   EntryPhnsetWallpaperFixRotate
  521.  *  EntryPhnsetWallpaperSel
  522.  *  EntryPhnsetWallpaperSys
  523.  * PARAMETERS
  524.  *  void
  525.  *  a(?)        [IN/OUT]        Void
  526.  *  b(?)        [IN]            Void
  527.  * RETURNS
  528.  *  void
  529.  *****************************************************************************/
  530. void HighlightPhnsetWallpaper(void)
  531. {
  532.     /*----------------------------------------------------------------*/
  533.     /* Local Variables                                                */
  534.     /*----------------------------------------------------------------*/
  535.     /*----------------------------------------------------------------*/
  536.     /* Code Body                                                      */
  537.     /*----------------------------------------------------------------*/
  538.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  539.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  540. #if (defined (__DAILY_WALLPAPER__) )
  541.     /* Go to menu with 2 items: Fix, Rotate */
  542.     SetKeyHandler(EntryPhnsetWallpaperFixRotate, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  543.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperFixRotate, KEY_EVENT_UP);
  544. #elif (defined(__MMI_FILE_MANAGER__) && !defined(__MMI_FILE_MANAGER_HIDE_MENU__) )
  545.     /* Direct enter system wallpaper list menu */
  546.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSys, KEY_EVENT_UP);
  547.     SetKeyHandler(EntryPhnsetWallpaperSys, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  548.     g_phnset_cntx_p->ScrAnchor = SCR_IDLE_SCR_DISP; /* SCR_WALLPAPER_SYSTEM_LIST; */
  549.     /* Go to menu with 2 items: System, Download */
  550.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSel, KEY_EVENT_UP);
  551.     SetKeyHandler(EntryPhnsetWallpaperSel, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  552.     g_phnset_cntx_p->ScrAnchor = SCR_MAIN_WALLPAPER;
  553. #else 
  554.     /* Direct enter system wallpaper list menu */
  555.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSys, KEY_EVENT_UP);
  556.     SetKeyHandler(EntryPhnsetWallpaperSys, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  557.     g_phnset_cntx_p->ScrAnchor = SCR_WALLPAPER_SYSTEM_LIST;
  558. #endif 
  559.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  560.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  561. }
  562. /*****************************************************************************
  563.  * FUNCTION
  564.  *  HighlightPhnsetMainWallpaper
  565.  * DESCRIPTION
  566.  *  This function is highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper.
  567.  * PARAMETERS
  568.  *  void
  569.  *  a(?)        [IN/OUT]        Void
  570.  *  b(?)        [IN]            Void
  571.  * RETURNS
  572.  *  void
  573.  *****************************************************************************/
  574. void HighlightPhnsetMainWallpaper(void)
  575. {
  576.     /*----------------------------------------------------------------*/
  577.     /* Local Variables                                                */
  578.     /*----------------------------------------------------------------*/
  579.     /*----------------------------------------------------------------*/
  580.     /* Code Body                                                      */
  581.     /*----------------------------------------------------------------*/
  582.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  583.     HighlightPhnsetWallpaper();
  584. }
  585. #ifdef __MMI_SUB_WALLPAPER__
  586. /*****************************************************************************
  587.  * FUNCTION
  588.  *  HighlightPhnsetSubWallpaper
  589.  * DESCRIPTION
  590.  *  This function is highlight handler for Setting->Phonesetup->IdleScreenDisplay->sublcd Wallpaper.
  591.  * PARAMETERS
  592.  *  void
  593.  *  a(?)        [IN/OUT]        Void
  594.  *  b(?)        [IN]            Void
  595.  * RETURNS
  596.  *  void
  597.  *****************************************************************************/
  598. void HighlightPhnsetSubWallpaper(void)
  599. {
  600.     /*----------------------------------------------------------------*/
  601.     /* Local Variables                                                */
  602.     /*----------------------------------------------------------------*/
  603.     /*----------------------------------------------------------------*/
  604.     /* Code Body                                                      */
  605.     /*----------------------------------------------------------------*/
  606.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_SUB_WP;
  607.     HighlightPhnsetWallpaper();
  608. }
  609. #endif /* __MMI_SUB_WALLPAPER__ */ 
  610. #ifdef __DAILY_WALLPAPER__
  611. /*****************************************************************************
  612.  * FUNCTION
  613.  *  HighlightPhnsetWallpaperFix
  614.  * DESCRIPTION
  615.  *  This function is highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper->Fix
  616.  *  Following Functions:   EntryPhnsetWallpaperSel
  617.  *  EntryPhnsetWallpaperSys
  618.  * PARAMETERS
  619.  *  void
  620.  *  a(?)        [IN/OUT]        Void
  621.  *  b(?)        [IN]            Void
  622.  * RETURNS
  623.  *  void
  624.  *****************************************************************************/
  625. void HighlightPhnsetWallpaperFix(void)
  626. {
  627.     /*----------------------------------------------------------------*/
  628.     /* Local Variables                                                */
  629.     /*----------------------------------------------------------------*/
  630.     /*----------------------------------------------------------------*/
  631.     /* Code Body                                                      */
  632.     /*----------------------------------------------------------------*/
  633.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  634.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  635. #if defined(__MMI_FILE_MANAGER__)
  636.     /* Go to menu with 2 items: System, Download */
  637.     SetKeyHandler(EntryPhnsetWallpaperSel, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  638.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSel, KEY_EVENT_UP);
  639.     g_phnset_cntx_p->ScrAnchor = SCR_MAIN_WALLPAPER_FIX;
  640. #else /* defined(__MMI_FILE_MANAGER__) */ 
  641.     /* Direct go to system wallpaper list */
  642.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  643.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSys, KEY_EVENT_UP);
  644.     g_phnset_cntx_p->ScrAnchor = SCR_WALLPAPER_SYSTEM_LIST;
  645. #endif /* defined(__MMI_FILE_MANAGER__) */ 
  646.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  647.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  648. }
  649. /*****************************************************************************
  650.  * FUNCTION
  651.  *  HighlightPhnsetWallpaperRotate
  652.  * DESCRIPTION
  653.  *  This function is highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper->Rotate
  654.  *  Following Functions:   PhnsetWallpaperRotateLSK
  655.  * PARAMETERS
  656.  *  void
  657.  *  a(?)        [IN/OUT]        Void
  658.  *  b(?)        [IN]            Void
  659.  * RETURNS
  660.  *  void
  661.  *****************************************************************************/
  662. void HighlightPhnsetWallpaperRotate(void)
  663. {
  664.     /*----------------------------------------------------------------*/
  665.     /* Local Variables                                                */
  666.     /*----------------------------------------------------------------*/
  667.     /*----------------------------------------------------------------*/
  668.     /* Code Body                                                      */
  669.     /*----------------------------------------------------------------*/
  670.     if (PhnsetGetWallpaperRotateStatus() == MMI_TRUE)
  671.     {
  672.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  673.     }
  674.     else
  675.     {
  676.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  677.     }
  678.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  679.     SetLeftSoftkeyFunction(PhnsetWallpaperRotateLSK, KEY_EVENT_UP);
  680.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  681.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  682. }
  683. /*****************************************************************************
  684.  * FUNCTION
  685.  *  PhnsetWallpaperRotateLSK
  686.  * DESCRIPTION
  687.  *  This function is Left softkey handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper->Rotate
  688.  *  Functionality: Toggle Rotate Status
  689.  * PARAMETERS
  690.  *  void
  691.  *  a(?)        [IN/OUT]        Void
  692.  *  b(?)        [IN]            Void
  693.  * RETURNS
  694.  *  void
  695.  *****************************************************************************/
  696. void PhnsetWallpaperRotateLSK(void)
  697. {
  698.     /*----------------------------------------------------------------*/
  699.     /* Local Variables                                                */
  700.     /*----------------------------------------------------------------*/
  701.     S16 error;
  702.     U8 status;
  703.     U16 index = GetCurrHiliteID();
  704.     /*----------------------------------------------------------------*/
  705.     /* Code Body                                                      */
  706.     /*----------------------------------------------------------------*/
  707.     if (PhnsetGetWallpaperRotateStatus() == MMI_TRUE)   /* Toggle */
  708.     {
  709.         status = MMI_FALSE;
  710.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  711.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  712.     }
  713.     else
  714.     {
  715.         status = MMI_TRUE;
  716.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  717.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  718.     }
  719.     WriteValue(NVRAM_WALLPAPER_ROTATE_STATUS, &status, DS_BYTE, &error);
  720.     Category52ChangeItemDescription(index, hintData[index]);
  721.     RedrawCategoryFunction();
  722. }
  723. /*****************************************************************************
  724.  * FUNCTION
  725.  *  HintPhnsetWallpaperRotate
  726.  * DESCRIPTION
  727.  *  This function is Hint handler for Wallpaper Rotate status
  728.  *  Functionality: Show hint for rotate status
  729.  * PARAMETERS
  730.  *  index       [IN]            
  731.  *  a(?)        [IN/OUT]        Void
  732.  *  b(?)        [IN]            Void
  733.  * RETURNS
  734.  *  void
  735.  *****************************************************************************/
  736. void HintPhnsetWallpaperRotate(U16 index)
  737. {
  738.     /*----------------------------------------------------------------*/
  739.     /* Local Variables                                                */
  740.     /*----------------------------------------------------------------*/
  741.     /*----------------------------------------------------------------*/
  742.     /* Code Body                                                      */
  743.     /*----------------------------------------------------------------*/
  744.     if (PhnsetGetWallpaperRotateStatus() == MMI_TRUE)
  745.     {
  746.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  747.     }
  748.     else
  749.     {
  750.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  751.     }
  752. }
  753. /*****************************************************************************
  754.  * FUNCTION
  755.  *  PhnsetGetWallpaperRotateStatus
  756.  * DESCRIPTION
  757.  *  This function is to query rotate status
  758.  * PARAMETERS
  759.  *  void
  760.  *  a(?)        [IN/OUT]        Void
  761.  *  b(?)        [IN]            Void
  762.  * RETURNS
  763.  *  T/F
  764.  *****************************************************************************/
  765. BOOL PhnsetGetWallpaperRotateStatus(void)
  766. {
  767.     /*----------------------------------------------------------------*/
  768.     /* Local Variables                                                */
  769.     /*----------------------------------------------------------------*/
  770.     U8 status = 0x0;
  771.     S16 error;
  772.     /*----------------------------------------------------------------*/
  773.     /* Code Body                                                      */
  774.     /*----------------------------------------------------------------*/
  775.     ReadValue(NVRAM_WALLPAPER_ROTATE_STATUS, (void*)&status, DS_BYTE, &error);
  776.     if (status == 0x0 || error != NVRAM_READ_SUCCESS)
  777.     {
  778.         return MMI_FALSE;
  779.     }
  780.     else
  781.     {
  782.         return MMI_TRUE;
  783.     }
  784. }
  785. /*****************************************************************************
  786.  * FUNCTION
  787.  *  EntryPhnsetWallpaperFixRotate
  788.  * DESCRIPTION
  789.  *  This function is Entry function for Setting->Phonesetup->IdleScreenDisplay->Wallpaper
  790.  *  when __DAILY_WALLPAPER__ is ON
  791.  *  Functionality: Display "Fix/Rotate" Screen
  792.  * PARAMETERS
  793.  *  void
  794.  *  a(?)        [IN/OUT]        Void
  795.  *  b(?)        [IN]            Void
  796.  * RETURNS
  797.  *  void
  798.  *****************************************************************************/
  799. void EntryPhnsetWallpaperFixRotate(void)
  800. {
  801.     /*----------------------------------------------------------------*/
  802.     /* Local Variables                                                */
  803.     /*----------------------------------------------------------------*/
  804.     U8 *guiBuffer;
  805.     U16 nNumofItem;
  806.     U16 nDispAttribute;                     /* Stores display attribue */
  807.     U8 *IdleScrDispType[MAX_SUB_MENUS];
  808.     U16 WallpaperSelectList[MAX_SUB_MENUS]; /* = { STR_WALLPAPER_SYSTEM, STR_WALLPAPER_DOWNLOAD }; */
  809.     /*----------------------------------------------------------------*/
  810.     /* Code Body                                                      */
  811.     /*----------------------------------------------------------------*/
  812.     EntryNewScreen(SCR_MAIN_WALLPAPER_FIX, NULL, EntryPhnsetWallpaperFixRotate, NULL);
  813.     SetHiliteHandler(MENU_SETTING_WALLPAPER_FIX, HighlightPhnsetWallpaperFix);
  814.     SetHiliteHandler(MENU_SETTING_WALLPAPER_ROTATE, HighlightPhnsetWallpaperRotate);
  815.     guiBuffer = GetCurrGuiBuffer(SCR_MAIN_WALLPAPER_FIX);
  816.     nNumofItem = GetNumOfChild(MENU_SETTING_WALLPAPER);
  817.     nDispAttribute = GetDispAttributeOfItem(MENU_SETTING_WALLPAPER);
  818.     GetSequenceStringIds(MENU_SETTING_WALLPAPER, WallpaperSelectList);
  819.     SetParentHandler(MENU_SETTING_WALLPAPER);
  820.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  821.     ConstructHintsList(MENU_SETTING_WALLPAPER, IdleScrDispType);
  822.     ShowCategory52Screen(
  823.         STR_WALLPAPER_CAPTION,
  824.         IMG_SCR_SETTING_CAPTION,
  825.         STR_GLOBAL_OK,
  826.         IMG_GLOBAL_OK,
  827.         STR_GLOBAL_BACK,
  828.         IMG_GLOBAL_BACK,
  829.         nNumofItem,
  830.         WallpaperSelectList,
  831.         (PU16) gIndexIconsImageList,
  832.         IdleScrDispType,
  833.         1,
  834.         0,
  835.         guiBuffer);
  836.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  837.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  838. }
  839. /*****************************************************************************
  840.  * FUNCTION
  841.  *  PhnsetWallPaperDailyChange
  842.  * DESCRIPTION
  843.  *  This function is to change wallpaper to next one in system folder
  844.  *  Functionality: ex: Referenced by DateTimerIndication
  845.  * PARAMETERS
  846.  *  void
  847.  *  a(?)        [IN/OUT]        
  848.  *  b(?)        [IN]            
  849.  * RETURNS
  850.  *  void
  851.  *****************************************************************************/
  852. void PhnsetWallPaperDailyChange(void)
  853. {
  854.     /*----------------------------------------------------------------*/
  855.     /* Local Variables                                                */
  856.     /*----------------------------------------------------------------*/
  857.     U8 curWallpaperId;
  858.     /*----------------------------------------------------------------*/
  859.     /* Code Body                                                      */
  860.     /*----------------------------------------------------------------*/
  861.     curWallpaperId = PhnsetGetCurWallPaperIdx();
  862.     if (curWallpaperId == 0xFF)
  863.     {
  864.     #ifdef __MMI_SUB_WALLPAPER__
  865.         g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  866.     #endif 
  867.         PhnsetRstWallpaperDefault();
  868.         if (g_idle_context.IsOnIdleScreen)
  869.         {
  870.             EntryIdleScreen();
  871.         }
  872.         return;
  873.     }
  874.     if ((curWallpaperId + 1) > PhnsetGetWallpaperIdxBound())
  875.     {
  876.         curWallpaperId = 0;
  877.     }
  878.     else
  879.     {
  880.         curWallpaperId++;
  881.     }
  882.     PhnsetSetDisplayFromAT(curWallpaperId, MMI_PHNSET_TYPE_WP);
  883. }
  884. /*****************************************************************************
  885.  * FUNCTION
  886.  *  PhnsetGetCurWallPaperIdx
  887.  * DESCRIPTION
  888.  *  This function is to get the current wallpaper index in gSystemWallpaperList
  889.  *  Functionality: ex: Referenced by PhnsetWallPaperDailyChange
  890.  * PARAMETERS
  891.  *  void
  892.  *  a(?)        [IN/OUT]        
  893.  *  b(?)        [IN]            
  894.  * RETURNS
  895.  *  U8 index
  896.  *****************************************************************************/
  897. U8 PhnsetGetCurWallPaperIdx(void)
  898. {
  899.     /*----------------------------------------------------------------*/
  900.     /* Local Variables                                                */
  901.     /*----------------------------------------------------------------*/
  902.     U8 idx = 0;
  903.     U16 SysWpIDList[MAX_WALLPAPER_NUMBERS];
  904.     /*----------------------------------------------------------------*/
  905.     /* Code Body                                                      */
  906.     /*----------------------------------------------------------------*/
  907.     PhnsetConstSysWallpaperList(NULL, SysWpIDList, NULL);
  908.     for (idx = 0; idx < (MAX_SYSTEM_WALLPAPER + MAXIMUM_FULLSCREEN_FACTORY_IMAGES); idx++)
  909.     {
  910.         if (g_phnset_cntx_p->curtWpID == SysWpIDList[idx])
  911.         {
  912.             break;
  913.         }
  914.     }
  915.     if (idx >= (MAX_SYSTEM_WALLPAPER + MAXIMUM_FULLSCREEN_FACTORY_IMAGES))
  916.     {
  917.         idx = 0xFF; /* Not Found! */
  918.     }
  919.     return idx;
  920. }
  921. #else /* __DAILY_WALLPAPER__ */ 
  922. /*****************************************************************************
  923.  * FUNCTION
  924.  *  PhnsetGetCurWallPaperIdx
  925.  * DESCRIPTION
  926.  *  
  927.  * PARAMETERS
  928.  *  void
  929.  * RETURNS
  930.  *  
  931.  *****************************************************************************/
  932. U16 PhnsetGetCurWallPaperIdx(void)
  933. {
  934.     /*----------------------------------------------------------------*/
  935.     /* Local Variables                                                */
  936.     /*----------------------------------------------------------------*/
  937.     U16 idx;
  938.     /*----------------------------------------------------------------*/
  939.     /* Code Body                                                      */
  940.     /*----------------------------------------------------------------*/
  941.     mmi_dispchar_get_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(idx));
  942.     return idx;
  943. }
  944. #endif /* __DAILY_WALLPAPER__ */ 
  945. /*****************************************************************************
  946.  * FUNCTION
  947.  *  PhnsetConstSysWallpaperList
  948.  * DESCRIPTION
  949.  *  This function is to construct wallpaper system folder list,
  950.  *  for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) ->System
  951.  * PARAMETERS
  952.  *  pSysWallpaperStrList        [IN]            
  953.  *  pSysWallpaperImgIDList      [?]             
  954.  *  HighliteItem                [?]             
  955.  *  a(?)                        [IN/OUT]        Void
  956.  *  b(?)                        [IN]            Void
  957.  * RETURNS
  958.  *  void
  959.  *****************************************************************************/
  960. static U8 PhnsetConstSysWallpaperList(U8 **pSysWallpaperStrList, U16 *pSysWallpaperImgIDList, U16 *HighliteItem)
  961. {
  962.     /*----------------------------------------------------------------*/
  963.     /* Local Variables                                                */
  964.     /*----------------------------------------------------------------*/
  965.     DYNIMAGEINFO *Info;
  966.     U8 i, wp_max = 0;
  967.     U16 strID = 0, imgID = 0;
  968.     U8 index_other = 0;
  969. #ifdef __MMI_SWFLASH__
  970.     U8 index_swflash = 0;
  971. #endif
  972.     U8 index_img = 0;
  973.     
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     /*
  978.      * SYSTEM WALLPAPER
  979.      */
  980.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  981.     {
  982.         U8 max_wp_img = MAX_WALLPAPER_IMG - MAX_OTHER_WALLPAPER - MAX_DISPCHAR_SWFLASH;
  983.         U8 max_wp_other = MAX_OTHER_WALLPAPER;
  984.         U8 max_wp_swflash = MAX_DISPCHAR_SWFLASH;
  985.     #ifdef __MMI_THEMES_V2_SUPPORT__
  986.         if(!mmi_tm_get_current_theme_wallapaper())
  987.         {
  988.             max_wp_other -= 2;
  989.         }
  990.         else
  991.         {
  992.             max_wp_other --;            
  993.         }
  994.     #endif /* __MMI_THEMES_V2_SUPPORT__ */
  995.         
  996.         /* Layout
  997.          * 
  998.          *
  999.          * -- Normal Images --
  1000.          * -- Normal Images -- SVG
  1001.          * -- Normal Images -- M3D
  1002.          * -- Analog clock  --
  1003.          * -- Digital clock --
  1004.          * -- Theme         --
  1005.          * -- SWFLASH        --
  1006.          *
  1007.          * -- Factory images--
  1008.          * 
  1009.          */
  1010.          
  1011.         /* 
  1012.          * Build-in images
  1013.          */
  1014.         for (i = 0; i < (max_wp_img + max_wp_other + max_wp_swflash); i++)
  1015.         {
  1016.             if (i < max_wp_img)
  1017.             {
  1018.                 imgID = IMG_ID_PHNSET_WP_START + i;
  1019.             }
  1020.             else if (max_wp_other &&
  1021.                      i >= max_wp_img && 
  1022.                      i < (max_wp_img + max_wp_other))
  1023.             {
  1024.                 imgID = IMG_ID_DISPCHAR_OTHER_START + (i - max_wp_img) + 1;
  1025.             }
  1026.             else if(max_wp_swflash)
  1027.             {
  1028.                 imgID = IMG_ID_DISPCHAR_SWFLASH_START + (i - (max_wp_img + max_wp_other));
  1029.             }
  1030.             /* normal/SVG/M3D  images*/
  1031.             if (imgID >= IMG_ID_PHNSET_WP_START && imgID <= IMG_ID_PHNSET_WP_MAX)
  1032.             {
  1033.                 strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + index_img;
  1034.                 ++index_img;
  1035.             }
  1036.             else if ( imgID > IMG_ID_DISPCHAR_OTHER_START && imgID < IMG_ID_DISPCHAR_OTHER_MAX)
  1037.             {
  1038.             #if !defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  1039.             
  1040.             #ifdef __MMI_ANALOG_CLOCK__
  1041.                 /* Analog clock */
  1042.                 if (imgID == IMG_ID_DISPCHAR_ANALOG_CLK)
  1043.                 {
  1044.                     strID = STR_ID_PHNSET_DISPCHAR_ANALOG;
  1045.                 }
  1046.             #endif /* __MMI_ANALOG_CLOCK__ */ 
  1047.             
  1048.             #ifdef __MMI_DIGITAL_CLOCK__
  1049.                 /* Digital clock */
  1050.                 if (imgID == IMG_ID_DISPCHAR_DIGITAL_CLK)
  1051.                 {
  1052.                     strID = STR_ID_PHNSET_DISPCHAR_DIGITAL;
  1053.                 }
  1054.             #endif /* __MMI_DIGITAL_CLOCK__ */ 
  1055.             
  1056.             #endif /* !__MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  1057.             
  1058.             #ifdef __MMI_THEMES_V2_SUPPORT__
  1059.                 /* Theme */
  1060.                 if (mmi_tm_get_current_theme_wallapaper() && 
  1061.                     imgID == IMG_ID_DISPCHAR_THEME_WALLPAPER)
  1062.                 {
  1063.                     strID = STR_ID_DISPCHAR_THEME_WALLPAPER;
  1064.                 }
  1065.             #endif /* __MMI_THEMES_V2_SUPPORT__ */
  1066.                 ++index_other;
  1067.             }
  1068.         #ifdef __MMI_SWFLASH__
  1069.             else if (imgID >= IMG_ID_DISPCHAR_SWFLASH_START && imgID <= IMG_ID_DISPCHAR_SWFLASH_MAX)
  1070.             {
  1071.                     strID = STR_ID_DISPCHAR_SWFLASH_START + index_swflash;
  1072.                     ++index_swflash;
  1073.             }
  1074.         #endif /* __MMI_SWFLASH__*/
  1075.             if (pSysWallpaperImgIDList)
  1076.             {
  1077.                 pSysWallpaperImgIDList[i] = imgID;
  1078.             }
  1079.             if (pSysWallpaperStrList)
  1080.             {
  1081.                 pSysWallpaperStrList[i] = (PU8) GetString(strID);
  1082.             }
  1083.             if (HighliteItem && g_phnset_cntx_p->curtWpID == pSysWallpaperImgIDList[i])
  1084.             {
  1085.                 *HighliteItem = i;
  1086.                 g_phnset_cntx_p->curHightlightItem = i;
  1087.             }
  1088.         }
  1089.         wp_max = i;
  1090.         MMI_ASSERT(index_other == max_wp_other);
  1091. #ifdef __MMI_SWFLASH__        
  1092.         MMI_ASSERT(index_swflash == max_wp_swflash);
  1093. #endif
  1094.     
  1095.         /*
  1096.          * FACTORY WALLPAPER
  1097.          */
  1098.         g_phnset_cntx_p->WPFctyImgNum = GetFullScreenFactoryImagesInfo(&Info);
  1099.         for (i = 0; i < g_phnset_cntx_p->WPFctyImgNum; i++)
  1100.         {
  1101.             strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + index_img + i;
  1102.             if (pSysWallpaperImgIDList)
  1103.             {
  1104.                 pSysWallpaperImgIDList[wp_max + i] = Info[i].ImagesId;
  1105.             }
  1106.             if (pSysWallpaperStrList)
  1107.             {
  1108.                 pSysWallpaperStrList[wp_max + i] = (PU8) GetString(strID);
  1109.             }
  1110.             if (HighliteItem)
  1111.                 if (g_phnset_cntx_p->curtWpID == Info[i].ImagesId)
  1112.                 {
  1113.                     *HighliteItem = wp_max + i;
  1114.                     g_phnset_cntx_p->curHightlightItem = wp_max + i;
  1115.                 }
  1116.         }
  1117.         wp_max += i;
  1118.     }/* Main Wallpaper */
  1119. #ifdef __MMI_SUB_WALLPAPER__
  1120.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  1121.     {
  1122.         for (i = 0; i < MAX_SUB_WALLPAPER_IMG; i++)
  1123.         {
  1124.             strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + i;
  1125.             if (pSysWallpaperImgIDList)
  1126.             {
  1127.                 pSysWallpaperImgIDList[i] = IMG_ID_PHNSET_SUB_WP_START + i;
  1128.             }
  1129.             if (pSysWallpaperStrList)
  1130.             {
  1131.                 pSysWallpaperStrList[i] = (PU8) GetString(strID);
  1132.             }
  1133.             if (HighliteItem)
  1134.                 if (g_phnset_cntx_p->curtSubWpID == pSysWallpaperImgIDList[i])
  1135.                 {
  1136.                     *HighliteItem = i;
  1137.                     g_phnset_cntx_p->curHightlightItem = i;
  1138.                 }
  1139.         }
  1140.         wp_max = i;
  1141.     }
  1142. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1143.     else
  1144.     {
  1145.         MMI_ASSERT(0);
  1146.     }
  1147.     return (wp_max);
  1148. }
  1149. /*****************************************************************************
  1150.  * FUNCTION
  1151.  *  EntryPhnsetWallpaperSys
  1152.  * DESCRIPTION
  1153.  *  This function is to entry function for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) ->System
  1154.  *  Functionality: Display system wallpaper list
  1155.  * PARAMETERS
  1156.  *  void
  1157.  *  a(?)        [IN/OUT]        Void
  1158.  *  b(?)        [IN]            Void
  1159.  * RETURNS
  1160.  *  void
  1161.  *****************************************************************************/
  1162. void EntryPhnsetWallpaperSys(void)
  1163. {
  1164.     /*----------------------------------------------------------------*/
  1165.     /* Local Variables                                                */
  1166.     /*----------------------------------------------------------------*/
  1167.     U8 *guiBuffer;
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Code Body                                                      */
  1170.     /*----------------------------------------------------------------*/
  1171.     EntryNewScreen(SCR_WALLPAPER_SYSTEM_LIST, NULL, EntryPhnsetWallpaperSys, NULL);
  1172.     guiBuffer = GetCurrGuiBuffer(SCR_WALLPAPER_SYSTEM_LIST);
  1173.     RegisterHighlightHandler(PhnsetWallpaperSysHiliteHandler);
  1174.     wp_item_amount = PhnsetConstSysWallpaperList(
  1175.                         subMenuDataPtrs,
  1176.                         g_phnset_cntx_p->SysWPSSList,
  1177.                         (U16*) & (g_phnset_cntx_p->curHightlightItem));
  1178.     g_phnset_cntx_p->WPSSPreviewScrFlag = 1;
  1179.     if (g_phnset_cntx_p->curtWpID == 0)
  1180.         g_phnset_cntx_p->curHightlightItem = 0;
  1181.     
  1182.     ShowCategory36Screen(
  1183.         STR_WALLPAPER_SELECT_CAPTION,
  1184.         IMG_SCR_SETTING_CAPTION,
  1185.         STR_GLOBAL_VIEW,
  1186.         0,
  1187.         STR_GLOBAL_BACK,
  1188.         IMG_GLOBAL_BACK,
  1189.         wp_item_amount,
  1190.         subMenuDataPtrs,
  1191.         (U16) g_phnset_cntx_p->curHightlightItem,
  1192.         guiBuffer);
  1193.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSysView, KEY_EVENT_UP);
  1194.     SetKeyHandler(EntryPhnsetWallpaperSysView, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1195.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1196.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1197. }
  1198. /*****************************************************************************
  1199.  * FUNCTION
  1200.  *  PhnsetWallpaperSysHiliteHandler
  1201.  * DESCRIPTION
  1202.  *  This function is Highlight hanlder when scrolling at wallpaper list screen
  1203.  *  for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) ->System
  1204.  * PARAMETERS
  1205.  *  nIndex      [IN]            
  1206.  *  a(?)        [IN/OUT]        Void
  1207.  *  b(?)        [IN]            Void
  1208.  * RETURNS
  1209.  *  void
  1210.  *****************************************************************************/
  1211. void PhnsetWallpaperSysHiliteHandler(S32 nIndex)
  1212. {
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Local Variables                                                */
  1215.     /*----------------------------------------------------------------*/
  1216.     /*----------------------------------------------------------------*/
  1217.     /* Code Body                                                      */
  1218.     /*----------------------------------------------------------------*/
  1219.     g_phnset_cntx_p->curHightlightItem = (U16) nIndex;
  1220. }
  1221. /*****************************************************************************
  1222.  * FUNCTION
  1223.  *  EntryPhnsetWallpaperSysView
  1224.  * DESCRIPTION
  1225.  *  This function is Entry function to preview wallpaper
  1226.  *  for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) ->System/Download -> View
  1227.  *  Follow functions: PhnsetWallpaperSysViewPre
  1228.  *  PhnsetWallpaperSysViewNext
  1229.  *  PhnsetWallpaperSet
  1230.  * PARAMETERS
  1231.  *  void
  1232.  *  a(?)        [IN/OUT]        Void
  1233.  *  b(?)        [IN]            Void
  1234.  * RETURNS
  1235.  *  void
  1236.  *****************************************************************************/
  1237. void EntryPhnsetWallpaperSysView(void)
  1238. {
  1239.     /*----------------------------------------------------------------*/
  1240.     /* Local Variables                                                */
  1241.     /*----------------------------------------------------------------*/
  1242.     PU8 wallpaperName;
  1243.     U8 *guiBuffer;
  1244.     U16 wallpaperId = g_phnset_cntx_p->SysWPSSList[g_phnset_cntx_p->curHightlightItem];
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     guiBuffer = GetCurrGuiBuffer(SCR_WALLPAPER_VIEW);
  1249.     g_phnset_cntx_p->isCorrectSet = 0;
  1250.     if (g_phnset_cntx_p->WPSSPreviewScrFlag)
  1251.     {
  1252.         EntryNewScreen(SCR_WALLPAPER_VIEW, ExitPhnsetWallpaperSysView, EntryPhnsetWallpaperSysView, NULL);
  1253.     }
  1254.     wallpaperName = (PU8) PhnsetGetWallpaperNameById(wallpaperId);
  1255.     wgui_set_touch_title_bar_buttons(); /* enable the display of title bar buttons */
  1256. #if defined(__MMI_TOUCH_SCREEN__)
  1257.     register_touch_button_handlers(NULL, PhnsetWallpaperSysViewPre, NULL, PhnsetWallpaperSysViewNext);
  1258. #endif 
  1259. #if !defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  1260. #ifdef __MMI_ANALOG_CLOCK__
  1261.     /* Category 86 if to View the Analog Clock */
  1262.     if ((wallpaperId == IMG_ID_DISPCHAR_ANALOG_CLK))
  1263.     {
  1264.         ShowCategory86Screen(
  1265.             STR_ID_PHNSET_DISPCHAR_ANALOG,
  1266.             0,
  1267.             STR_GLOBAL_OK,
  1268.             IMG_GLOBAL_OK,
  1269.             STR_GLOBAL_BACK,
  1270.             IMG_GLOBAL_BACK,
  1271.             IMG_ID_DISPCHAR_ANALOG_CLK,
  1272.             NULL,
  1273.             guiBuffer,
  1274.             0);
  1275.     }
  1276.     else
  1277. #endif /* __MMI_ANALOG_CLOCK__ */ 
  1278. #ifdef __MMI_DIGITAL_CLOCK__
  1279.         /* Category 128 to view Digital Clock */
  1280.     if (wallpaperId == IMG_ID_DISPCHAR_DIGITAL_CLK)
  1281.     {
  1282.         ShowCategory128Screen(
  1283.             STR_ID_PHNSET_DISPCHAR_DIGITAL,
  1284.             0,
  1285.             STR_GLOBAL_OK,
  1286.             IMG_GLOBAL_OK,
  1287.             STR_GLOBAL_BACK,
  1288.             IMG_GLOBAL_BACK,
  1289.             IMG_ID_DISPCHAR_DIGITAL_CLK,
  1290.             1,
  1291.             1,
  1292.             1,
  1293.             guiBuffer,
  1294.             0);
  1295.     }
  1296.     else
  1297. #endif /* __MMI_DIGITAL_CLOCK__ */ 
  1298. #endif /* !__MMI_UI_TECHNO_IDLESCREEN_BAR__ */
  1299. #ifdef __MMI_SWFLASH__
  1300.     if (PhnsetGetDisplayType(wallpaperId) == PHNSET_TYPE_DISP_SWFLASH)
  1301.     {
  1302.         ShowCategory229Screen(
  1303.             wallpaperName,                      /* title_str */
  1304.             IMG_SCR_SETTING_CAPTION,            /* title_icon */
  1305.             STR_GLOBAL_OK,                      /* lsk_str */
  1306.             IMG_GLOBAL_OK,                      /* lsk_icon */
  1307.             STR_GLOBAL_BACK,                    /* rsk_str */
  1308.             IMG_GLOBAL_BACK,                    /* rsk_icon */
  1309.             wallpaperId,                        /* resource_id */
  1310.             NULL,                               /* resource_filename */
  1311.             1,                                  /* repeat_count */
  1312.             MMI_FALSE,                          /* is_play_audio */
  1313.             MMI_FALSE,                          /* is_vibrate_on */
  1314.             MMI_FALSE,                          /* is_interaction_on */
  1315.             MMI_TRUE,                           /* is_lcd_no_sleep */
  1316.             MMI_TRUE,                          /* is_full_screen */
  1317.             GDI_COLOR_WHITE,                    /* bg_color */
  1318.             PhnsetWpSsPlayCallBack,
  1319.             guiBuffer);
  1320.     }
  1321.     else
  1322. #endif
  1323.      /* For Normal Viewing */
  1324.     {
  1325.         ShowCategory129Screen(
  1326.             wallpaperName,
  1327.             0,
  1328.             STR_GLOBAL_OK,
  1329.             IMG_GLOBAL_OK,
  1330.             STR_GLOBAL_BACK,
  1331.             IMG_GLOBAL_BACK,
  1332.             wallpaperId,
  1333.             guiBuffer);
  1334.     }
  1335.     SetLeftSoftkeyFunction(PhnsetWallpaperSet, KEY_EVENT_UP);
  1336.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1337.     /* change the key handler for KEY UP event to KEY DOWN event. */
  1338.     SetKeyHandler(PhnsetWallpaperSysViewPre, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1339.     SetKeyHandler(PhnsetWallpaperSysViewNext, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1340. }
  1341. /*****************************************************************************
  1342.  * FUNCTION
  1343.  *  ExitPhnsetWallpaperSysView
  1344.  * DESCRIPTION
  1345.  *  This function is Exit function for preview wallpaper
  1346.  *  for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) ->System/Download -> View
  1347.  *  Functionality: Add to history
  1348.  * PARAMETERS
  1349.  *  void
  1350.  *  a(?)        [IN/OUT]        Void
  1351.  *  b(?)        [IN]            Void
  1352.  * RETURNS
  1353.  *  void
  1354.  *****************************************************************************/
  1355. void ExitPhnsetWallpaperSysView(void)
  1356. {
  1357.     /*----------------------------------------------------------------*/
  1358.     /* Local Variables                                                */
  1359.     /*----------------------------------------------------------------*/
  1360.     /*----------------------------------------------------------------*/
  1361.     /* Code Body                                                      */
  1362.     /*----------------------------------------------------------------*/
  1363.     if (g_phnset_cntx_p->isCorrectSet)
  1364.     {
  1365.         DeleteUptoScrID(g_phnset_cntx_p->ScrAnchor);
  1366.     }
  1367.     g_phnset_cntx_p->WPSSPreviewScrFlag = 1;
  1368. }
  1369. /*****************************************************************************
  1370.  * FUNCTION
  1371.  *  PhnsetWallpaperSysViewPre
  1372.  * DESCRIPTION
  1373.  *  This function is to view previous wallpaper
  1374.  * PARAMETERS
  1375.  *  void
  1376.  *  a(?)        [IN/OUT]        Void
  1377.  *  b(?)        [IN]            Void
  1378.  * RETURNS
  1379.  *  void
  1380.  *****************************************************************************/
  1381. void PhnsetWallpaperSysViewPre(void)
  1382. {
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Local Variables                                                */
  1385.     /*----------------------------------------------------------------*/
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Code Body                                                      */
  1388.     /*----------------------------------------------------------------*/
  1389.     ExitCategoryFunction();
  1390.     if (g_phnset_cntx_p->curHightlightItem <= 0)
  1391.     {
  1392.         if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  1393.         {
  1394.             g_phnset_cntx_p->curHightlightItem = wp_item_amount;
  1395.         }
  1396.     #ifdef __MMI_SUB_WALLPAPER__
  1397.         else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  1398.         {
  1399.             g_phnset_cntx_p->curHightlightItem = MAX_SUB_WALLPAPER_IMG;
  1400.         }
  1401.     #endif /* __MMI_SUB_WALLPAPER__ */ 
  1402.         else
  1403.         {
  1404.             MMI_ASSERT(MMI_FALSE);
  1405.         }
  1406.     }
  1407.     g_phnset_cntx_p->curHightlightItem--;
  1408.     g_phnset_cntx_p->WPSSPreviewScrFlag = 0;
  1409.     EntryPhnsetWallpaperSysView();
  1410. }
  1411. /*****************************************************************************
  1412.  * FUNCTION
  1413.  *  PhnsetWallpaperSysViewNext
  1414.  * DESCRIPTION
  1415.  *  This function is to view next wallpaper
  1416.  * PARAMETERS
  1417.  *  void
  1418.  *  a(?)        [IN/OUT]        Void
  1419.  *  b(?)        [IN]            Void
  1420.  * RETURNS
  1421.  *  void
  1422.  *****************************************************************************/
  1423. void PhnsetWallpaperSysViewNext(void)
  1424. {
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Local Variables                                                */
  1427.     /*----------------------------------------------------------------*/
  1428.     /*----------------------------------------------------------------*/
  1429.     /* Code Body                                                      */
  1430.     /*----------------------------------------------------------------*/
  1431.     ExitCategoryFunction();
  1432.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  1433.     {
  1434.         if (wp_item_amount && (g_phnset_cntx_p->curHightlightItem >= wp_item_amount - 1))
  1435.         {
  1436.             g_phnset_cntx_p->curHightlightItem = -1;
  1437.         }
  1438.     }
  1439. #ifdef __MMI_SUB_WALLPAPER__
  1440.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  1441.     {
  1442.         if (g_phnset_cntx_p->curHightlightItem >= MAX_SUB_WALLPAPER_IMG - 1)
  1443.         {
  1444.             g_phnset_cntx_p->curHightlightItem = -1;
  1445.         }
  1446.     }
  1447. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1448.     else
  1449.     {
  1450.         MMI_ASSERT(0);
  1451.     }
  1452.     g_phnset_cntx_p->curHightlightItem++;
  1453.     g_phnset_cntx_p->WPSSPreviewScrFlag = 0;
  1454.     EntryPhnsetWallpaperSysView();
  1455. }
  1456. /*****************************************************************************
  1457.  * FUNCTION
  1458.  *  PhnsetWallpaperSet
  1459.  * DESCRIPTION
  1460.  *  This function is Left softkey handler for set/preview wallpaper
  1461.  *  Functionality: Save to nvram, change globol variable gCurrentWallpaper
  1462.  * PARAMETERS
  1463.  *  void
  1464.  *  a(?)        [IN/OUT]        Void
  1465.  *  b(?)        [IN]            Void
  1466.  * RETURNS
  1467.  *  void
  1468.  *****************************************************************************/
  1469. void PhnsetWallpaperSet(void)
  1470. {
  1471.     /*----------------------------------------------------------------*/
  1472.     /* Local Variables                                                */
  1473.     /*----------------------------------------------------------------*/
  1474.     /*----------------------------------------------------------------*/
  1475.     /* Code Body                                                      */
  1476.     /*----------------------------------------------------------------*/
  1477.     PhnsetSetWallpaperByImgID(g_phnset_cntx_p->SysWPSSList[g_phnset_cntx_p->curHightlightItem]);
  1478.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  1479.     {
  1480.     #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1481.         wgui_set_wallpaper_change();    /* 012006 wallpaper Calvin */
  1482.     #endif 
  1483.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWallpaperSet:Set Main ID=%d n", g_phnset_cntx_p->curtWpID));
  1484.     }
  1485. #ifdef __MMI_SUB_WALLPAPER__
  1486.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  1487.     {
  1488.         SUBLCD_UpdateWallpaper();
  1489.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWallpaperSet:Set Sub ID=%d n", g_phnset_cntx_p->curtSubWpID));
  1490.     }
  1491. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1492.     else
  1493.     {
  1494.         MMI_ASSERT(0);
  1495.     }
  1496.     g_phnset_cntx_p->isCorrectSet = 1;
  1497.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1498. }
  1499. /*****************************************************************************
  1500.  * FUNCTION
  1501.  *  ThemeManagerSetWallpaper
  1502.  * DESCRIPTION
  1503.  *  ...
  1504.  *  * PARAMETERS
  1505.  *  a  IN/OUT      void
  1506.  *  b  IN       void
  1507.  * RETURNS
  1508.  *  void
  1509.  *****************************************************************************/
  1510. void ThemeManagerSetWallpaper(U16 nId)
  1511. {
  1512.     /*----------------------------------------------------------------*/
  1513.     /* Local Variables                                                */
  1514.     /*----------------------------------------------------------------*/
  1515. #ifdef __MMI_FILE_MANAGER__
  1516.     S16 error;
  1517. #endif
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Code Body                                                      */
  1520.     /*----------------------------------------------------------------*/
  1521.     g_phnset_cntx_p->curtWpID = nId;
  1522.     mmi_dispchar_set_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  1523. #ifdef __MMI_FILE_MANAGER__
  1524.     if (nId == 0)
  1525.     {
  1526.         ReadRecord(NVRAM_EF_WPSS_FILENAME_LID, 1, &phnset_wpss_filename, sizeof(phnset_wpss_filename), &error);
  1527.         g_phnset_cntx_p->isShort = phnset_wpss_filename.isWPShort;
  1528.         PhnsetSetWallpaperByFileName((S8*) phnset_wpss_filename.wallpaper);
  1529.     }
  1530.     else
  1531. #endif /* __MMI_FILE_MANAGER__ */
  1532.     {
  1533. /* MMI_TRUE for SetIdleScreenWallpaperID means create another layer for wallpaper 
  1534.  * while MMI_FALSE means use current layer
  1535.  */
  1536.         SetIdleScreenWallpaperID(nId, MMI_TRUE);
  1537.     }
  1538.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "ThemeManagerSetWallpaper:Set Main ID=%d n", g_phnset_cntx_p->curtWpID));
  1539. }
  1540. #if defined(__MMI_FILE_MANAGER__)
  1541. /*****************************************************************************
  1542.  * FUNCTION
  1543.  *  HighlightPhnsetWallpaperSys
  1544.  * DESCRIPTION
  1545.  *  This function is Highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper->System
  1546.  *  Following Function: EntryPhnsetWallpaperSys
  1547.  * PARAMETERS
  1548.  *  void
  1549.  *  a(?)        [IN/OUT]        Void
  1550.  *  b(?)        [IN]            Void
  1551.  * RETURNS
  1552.  *  void
  1553.  *****************************************************************************/
  1554. void HighlightPhnsetWallpaperSys(void)
  1555. {
  1556.     /*----------------------------------------------------------------*/
  1557.     /* Local Variables                                                */
  1558.     /*----------------------------------------------------------------*/
  1559.     /*----------------------------------------------------------------*/
  1560.     /* Code Body                                                      */
  1561.     /*----------------------------------------------------------------*/
  1562.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperSys, KEY_EVENT_UP);
  1563.     SetKeyHandler(EntryPhnsetWallpaperSys, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1564. }
  1565. /*****************************************************************************
  1566.  * FUNCTION
  1567.  *  EntryPhnsetWallpaperSel
  1568.  * DESCRIPTION
  1569.  *  This function is Entry function for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix)
  1570.  *  Following Function: Show (System/Download) Menu
  1571.  * PARAMETERS
  1572.  *  void
  1573.  *  a(?)        [IN/OUT]        Void
  1574.  *  b(?)        [IN]            Void
  1575.  * RETURNS
  1576.  *  void
  1577.  *****************************************************************************/
  1578. void EntryPhnsetWallpaperSel(void)
  1579. {
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Local Variables                                                */
  1582.     /*----------------------------------------------------------------*/
  1583.     U8 *guiBuffer;
  1584.     U16 nNumofItem;
  1585.     U16 WallpaperSelectList[MAX_SUB_MENUS]; /* = { STR_WALLPAPER_SYSTEM, STR_WALLPAPER_DOWNLOAD }; */
  1586.     U16 title = 0;
  1587.     /*----------------------------------------------------------------*/
  1588.     /* Code Body                                                      */
  1589.     /*----------------------------------------------------------------*/
  1590.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  1591.     {
  1592.         title = (U16) STR_SETTING_WALLPAPER;
  1593.     }
  1594. #ifdef __MMI_SUB_WALLPAPER__
  1595.     else
  1596.     {
  1597.         title = (U16) STR_SETTING_WALLPAPER_SUB;
  1598.     }
  1599. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1600.     EntryNewScreen(SCR_MAIN_WALLPAPER, NULL, EntryPhnsetWallpaperSel, NULL);
  1601.     g_phnset_cntx_p->ScrAnchor = SCR_MAIN_WALLPAPER;
  1602.     guiBuffer = GetCurrGuiBuffer(SCR_MAIN_WALLPAPER);
  1603. #ifdef __DAILY_WALLPAPER__
  1604.     nNumofItem = GetNumOfChild(MENU_SETTING_WALLPAPER_FIX);
  1605.     GetSequenceStringIds(MENU_SETTING_WALLPAPER_FIX, WallpaperSelectList);
  1606.     SetParentHandler(MENU_SETTING_WALLPAPER_FIX);
  1607. #else /* __DAILY_WALLPAPER__ */ 
  1608.     nNumofItem = GetNumOfChild(MENU_SETTING_WALLPAPER);
  1609.     GetSequenceStringIds(MENU_SETTING_WALLPAPER, WallpaperSelectList);
  1610.     SetParentHandler(MENU_SETTING_WALLPAPER);
  1611. #endif /* __DAILY_WALLPAPER__ */ 
  1612.     SetHiliteHandler(MENU_SETTING_WALLPAPER_SYSTEM, HighlightPhnsetWallpaperSys);
  1613. #if defined(__MMI_FILE_MANAGER__)
  1614.     SetHiliteHandler(MENU_SETTING_WALLPAPER_DOWNLOAD, HighlightPhnsetWallpaperFmgr);
  1615. #endif 
  1616.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1617.     ShowCategory15Screen(
  1618.         title,
  1619.         IMG_SCR_SETTING_CAPTION,
  1620.         STR_GLOBAL_OK,
  1621.         IMG_GLOBAL_OK,
  1622.         STR_GLOBAL_BACK,
  1623.         IMG_GLOBAL_BACK,
  1624.         nNumofItem,
  1625.         WallpaperSelectList,
  1626.         (PU16) gIndexIconsImageList,
  1627.         1,
  1628.         0,
  1629.         guiBuffer);
  1630.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1631.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1632. }
  1633. #endif /* defined(__MMI_FILE_MANAGER__) */ 
  1634. #ifdef __MMI_FILE_MANAGER__
  1635. /*****************************************************************************
  1636.  * FUNCTION
  1637.  *  HighlightPhnsetWallpaperFmgr
  1638.  * DESCRIPTION
  1639.  *  This function is Highlight handler for Setting->Phonesetup->IdleScreenDisplay->Wallpaper->User Define
  1640.  *  Following Function: EntryPhnsetWallpaperFmgr
  1641.  * PARAMETERS
  1642.  *  void
  1643.  *  a(?)        [IN/OUT]        Void
  1644.  *  b(?)        [IN]            Void
  1645.  * RETURNS
  1646.  *  void
  1647.  *****************************************************************************/
  1648. void HighlightPhnsetWallpaperFmgr(void)
  1649. {
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Local Variables                                                */
  1652.     /*----------------------------------------------------------------*/
  1653.     /*----------------------------------------------------------------*/
  1654.     /* Code Body                                                      */
  1655.     /*----------------------------------------------------------------*/
  1656.     SetLeftSoftkeyFunction(EntryPhnsetWallpaperFmgr, KEY_EVENT_UP);
  1657.     SetKeyHandler(EntryPhnsetWallpaperFmgr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1658. }
  1659. /*****************************************************************************
  1660.  * FUNCTION
  1661.  *  PhnsetWallpaperForwardFromFmgr
  1662.  * DESCRIPTION
  1663.  *  This function is call back function for file manager
  1664.  *  Following Function:
  1665.  * PARAMETERS
  1666.  *  path            [?]             
  1667.  *  is_short        [IN]            
  1668.  *  a(?)            [IN/OUT]        Void
  1669.  *  b(?)            [IN]            Void
  1670.  * RETURNS
  1671.  *  void
  1672.  *****************************************************************************/
  1673. void PhnsetWallpaperForwardFromFmgr(void *path, FMGR_FILTER *filter, int is_short)
  1674. {
  1675.     /*----------------------------------------------------------------*/
  1676.     /* Local Variables                                                */
  1677.     /*----------------------------------------------------------------*/
  1678.     /*----------------------------------------------------------------*/
  1679.     /* Code Body                                                      */
  1680.     /*----------------------------------------------------------------*/
  1681.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWallpaperForwardFromFmgr:path=%s, is_short=%d n", path, is_short));
  1682.     if (!FMGR_FILTER_IS_SET(filter, FMGR_TYPE_GIF) &&
  1683. #ifdef JPG_DECODE
  1684.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_JPG) &&
  1685.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_JPEG) &&
  1686. #endif /* JPG_DECODE */ 
  1687. #if defined(GDI_USING_PNG)
  1688.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_PNG) &&
  1689. #endif 
  1690. #ifdef M3D_MMI_SUPPORT
  1691.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_M3D) &&
  1692. #endif 
  1693. #ifdef SVG_SUPPORT
  1694.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_SVG) &&
  1695. #endif
  1696. #ifdef __MMI_SWFLASH__
  1697.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_CMP) &&
  1698. #endif
  1699.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_BMP))
  1700.     {
  1701.         DisplayPopup((PU8) GetString(STR_GLOBAL_UNSUPPORTED_FORMAT), IMG_GLOBAL_ERROR, 0, 1000, ERROR_TONE);
  1702.         return;
  1703.     }
  1704.     if (path)
  1705.     {
  1706.         /* Prevent memory leck, after buffer is free, set pointer to NULL */
  1707.         ASSERT(phnset_dispchar_strp == NULL);
  1708.         g_phnset_cntx_p->isShort = (S32) is_short;
  1709.         phnset_dispchar_strp = OslMalloc(FMGR_PATH_BUFFER_SIZE);
  1710.         if (phnset_dispchar_strp)
  1711.         {
  1712.             pfnUnicodeStrcpy((S8*) phnset_dispchar_strp, (S8*) path);
  1713.         }
  1714.         else
  1715.         {
  1716.             GoBackToHistory(SCR_IDLE_SCR_DISP);
  1717.             return;
  1718.         }
  1719.         if (mmi_fmgr_forwardable_path((PS8) phnset_dispchar_strp))
  1720.         {
  1721.             error_str_ptr = (PS8) GetString(STR_ID_PHNSET_DISPCHAR_INVALID_PATH);
  1722.             DispIdleScrWPBadFilePopup();
  1723.             PhnsetWpUsrDefFreeBuf();
  1724.             return;
  1725.         }
  1726.         /* file limitation check - limitation is define in file manager util */
  1727.         if (!mmi_fmgr_util_file_limit_check(FMGR_LIMIT_WALLPAPER, (PS8) phnset_dispchar_strp, &error_str_ptr))
  1728.         {
  1729.             DispIdleScrWPBadFilePopup();
  1730.             PhnsetWpUsrDefFreeBuf();
  1731.             return;
  1732.         }
  1733.         g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  1734.         g_phnset_cntx_p->ScrAnchor = GetCurrScrnId();
  1735.         PhnsetWpUsrDefPreView();
  1736.     }
  1737.     else
  1738.     {
  1739.         DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE);
  1740.     }
  1741. }
  1742. /*****************************************************************************
  1743.  * FUNCTION
  1744.  *  PhnsetSubWallpaperForwardFromFmgr
  1745.  * DESCRIPTION
  1746.  *  This function is call back function for file manager
  1747.  *  Following Function:
  1748.  * PARAMETERS
  1749.  *  path            [?]             
  1750.  *  is_short        [IN]            
  1751.  *  a(?)            [IN/OUT]        Void
  1752.  *  b(?)            [IN]            Void
  1753.  * RETURNS
  1754.  *  void
  1755.  *****************************************************************************/
  1756. #ifdef __MMI_SUB_WALLPAPER__
  1757. void PhnsetSubWallpaperForwardFromFmgr(void *path, FMGR_FILTER *filter, int is_short)
  1758. {
  1759.     /*----------------------------------------------------------------*/
  1760.     /* Local Variables                                                */
  1761.     /*----------------------------------------------------------------*/
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Code Body                                                      */
  1764.     /*----------------------------------------------------------------*/
  1765.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetSubWallpaperForwardFromFmgr:path=%s, is_short=%d n", path,
  1766.                          is_short));
  1767.     if (!FMGR_FILTER_IS_SET(filter, FMGR_TYPE_GIF) &&
  1768. #ifdef JPG_DECODE
  1769.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_JPG) &&
  1770.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_JPEG) &&
  1771. #endif /* JPG_DECODE */ 
  1772. #if defined(GDI_USING_PNG)
  1773.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_PNG) &&
  1774. #endif 
  1775.         !FMGR_FILTER_IS_SET(filter, FMGR_TYPE_BMP))
  1776.     {
  1777.         DisplayPopup((PU8) GetString(STR_GLOBAL_UNSUPPORTED_FORMAT), IMG_GLOBAL_ERROR, 0, 1000, ERROR_TONE);
  1778.         return;
  1779.     }
  1780.     g_phnset_cntx_p->isShort = (S32) is_short;
  1781.     if (path)
  1782.     {
  1783.         /* Prevent memory leck, after buffer is free, set pointer to NULL */
  1784.         ASSERT(phnset_dispchar_strp == NULL);
  1785.         phnset_dispchar_strp = OslMalloc(FMGR_PATH_BUFFER_SIZE);
  1786.         if (phnset_dispchar_strp)
  1787.         {
  1788.             pfnUnicodeStrcpy((S8*) phnset_dispchar_strp, (S8*) path);
  1789.         }
  1790.         else
  1791.         {
  1792.             GoBackToHistory(SCR_IDLE_SCR_DISP);
  1793.             return;
  1794.         }
  1795.         if (mmi_fmgr_forwardable_path((PS8) phnset_dispchar_strp))
  1796.         {
  1797.             error_str_ptr = (PS8) GetString(STR_ID_PHNSET_DISPCHAR_INVALID_PATH);
  1798.             DispIdleScrWPBadFilePopup();
  1799.             PhnsetWpUsrDefFreeBuf();
  1800.             return;
  1801.         }
  1802.         /* file limitation check - limitation is define in file manager util */
  1803.         if (!mmi_fmgr_util_file_limit_check(FMGR_LIMIT_SUB_WALLPAPER, (PS8) phnset_dispchar_strp, &error_str_ptr))
  1804.         {
  1805.             DispIdleScrWPBadFilePopup();
  1806.             PhnsetWpUsrDefFreeBuf();
  1807.             return;
  1808.         }
  1809.         g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_SUB_WP;
  1810.         g_phnset_cntx_p->ScrAnchor = GetCurrScrnId();
  1811.         PhnsetWpUsrDefPreView();
  1812.     }
  1813.     else
  1814.     {
  1815.         DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE);
  1816.     }
  1817. }
  1818. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1819. /*****************************************************************************
  1820.  * FUNCTION
  1821.  *  PhnsetWpUsrDefFreeBuf
  1822.  * DESCRIPTION
  1823.  *  This function is to free file name string buffer
  1824.  *  Following Function:
  1825.  * PARAMETERS
  1826.  *  void
  1827.  *  a(?)        [IN/OUT]        Void
  1828.  *  b(?)        [IN]            Void
  1829.  * RETURNS
  1830.  *  void
  1831.  *****************************************************************************/
  1832. void PhnsetWpUsrDefFreeBuf(void)
  1833. {
  1834.     /*----------------------------------------------------------------*/
  1835.     /* Local Variables                                                */
  1836.     /*----------------------------------------------------------------*/
  1837.     /*----------------------------------------------------------------*/
  1838.     /* Code Body                                                      */
  1839.     /*----------------------------------------------------------------*/
  1840.     if (phnset_dispchar_strp)
  1841.     {
  1842.         OslMfree(phnset_dispchar_strp);
  1843.         phnset_dispchar_strp = NULL;
  1844.     }
  1845. }
  1846. /*****************************************************************************
  1847.  * FUNCTION
  1848.  *  PhnsetWpUsrDefSelect
  1849.  * DESCRIPTION
  1850.  *  This function is LSK handler for set user defined wallpaper/screen saver
  1851.  *  Following Function:
  1852.  * PARAMETERS
  1853.  *  void
  1854.  *  a(?)        [IN/OUT]        Void
  1855.  *  b(?)        [IN]            Void
  1856.  * RETURNS
  1857.  *  void
  1858.  *****************************************************************************/
  1859. void PhnsetWpUsrDefSelect(void)
  1860. {
  1861.     /*----------------------------------------------------------------*/
  1862.     /* Local Variables                                                */
  1863.     /*----------------------------------------------------------------*/
  1864.     /*----------------------------------------------------------------*/
  1865.     /* Code Body                                                      */
  1866.     /*----------------------------------------------------------------*/
  1867.     if (mmi_fmgr_forwardable_path((PS8) phnset_dispchar_strp))
  1868.     {
  1869.         error_str_ptr = (PS8) GetString(STR_ID_PHNSET_DISPCHAR_INVALID_PATH);
  1870.         DispIdleScrWPBadFilePopup();
  1871.         PhnsetWpUsrDefFreeBuf();
  1872.         return;
  1873.     }
  1874.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  1875.     {
  1876.         
  1877.         PhnsetSetWallpaperByFileName((S8*) phnset_dispchar_strp);
  1878.     #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1879.         wgui_set_wallpaper_change();
  1880.     #endif 
  1881.         DisplayPopup(
  1882.             (PU8) GetString(STR_GLOBAL_DONE),
  1883.             IMG_GLOBAL_ACTIVATED,
  1884.             1,
  1885.             UI_POPUP_NOTIFYDURATION_TIME,
  1886.             SUCCESS_TONE);
  1887.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWpUsrDefSelect:main phnset_dispchar_strp=%sn",
  1888.                              phnset_dispchar_strp));
  1889.     }
  1890. #ifdef __MMI_SUB_WALLPAPER__
  1891.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  1892.     {
  1893.         PhnsetSetWallpaperByFileName((S8*) phnset_dispchar_strp);
  1894.         DisplayPopup(
  1895.             (PU8) GetString(STR_GLOBAL_DONE),
  1896.             IMG_GLOBAL_ACTIVATED,
  1897.             1,
  1898.             UI_POPUP_NOTIFYDURATION_TIME,
  1899.             SUCCESS_TONE);
  1900.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWpUsrDefSelect:sub phnset_dispchar_strp=%sn",
  1901.                              phnset_dispchar_strp));
  1902.     }
  1903. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1904.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SS)
  1905.     {
  1906.             PhnsetSetScrSvrByFileName((S8*) phnset_dispchar_strp);
  1907.             DisplayPopup(
  1908.                 (PU8) GetString(STR_GLOBAL_DONE),
  1909.                 IMG_GLOBAL_ACTIVATED,
  1910.                 1,
  1911.                 UI_POPUP_NOTIFYDURATION_TIME,
  1912.                 SUCCESS_TONE);
  1913.             PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWpUsrDefSelect:ss phnset_dispchar_strp=%sn",
  1914.                                  phnset_dispchar_strp));
  1915.     }
  1916.     else
  1917.     {
  1918.         ASSERT(0);
  1919.     }
  1920.     if (IsScreenPresent(SCR_MAIN_WALLPAPER) || IsScreenPresent(SCR_MAIN_SCREENSAVER))
  1921.     {
  1922.         fmgr_reset_app_select();    /* not forword from fmgr */
  1923.     }
  1924. }
  1925. /*****************************************************************************
  1926.  * FUNCTION
  1927.  *  PhnsetWpUsrDefPreViewScrDelCB
  1928.  * DESCRIPTION
  1929.  *  This function is RSK handler for set user define wallpaper/screensaver
  1930.  *  Following Function:
  1931.  * PARAMETERS
  1932.  *  ptr         [?]             
  1933.  *  a(?)        [IN/OUT]        Void
  1934.  *  b(?)        [IN]            Void
  1935.  * RETURNS
  1936.  *  void
  1937.  *****************************************************************************/
  1938. U8 PhnsetWpUsrDefPreViewScrDelCB(void *ptr)
  1939. {
  1940.     /*----------------------------------------------------------------*/
  1941.     /* Local Variables                                                */
  1942.     /*----------------------------------------------------------------*/
  1943.     /*----------------------------------------------------------------*/
  1944.     /* Code Body                                                      */
  1945.     /*----------------------------------------------------------------*/
  1946.     PhnsetWpUsrDefFreeBuf();
  1947.     return MMI_FALSE;
  1948. }
  1949. /*****************************************************************************
  1950.  * FUNCTION
  1951.  *  PhnsetWpUsrDefGoBack
  1952.  * DESCRIPTION
  1953.  *  This function is RSK handler for set user define wallpaper/screensaver
  1954.  *  Following Function:
  1955.  * PARAMETERS
  1956.  *  void
  1957.  *  a(?)        [IN/OUT]        Void
  1958.  *  b(?)        [IN]            Void
  1959.  * RETURNS
  1960.  *  void
  1961.  *****************************************************************************/
  1962. void PhnsetWpUsrDefGoBack(void)
  1963. {
  1964.     /*----------------------------------------------------------------*/
  1965.     /* Local Variables                                                */
  1966.     /*----------------------------------------------------------------*/
  1967.     /*----------------------------------------------------------------*/
  1968.     /* Code Body                                                      */
  1969.     /*----------------------------------------------------------------*/
  1970.     PhnsetWpUsrDefFreeBuf();
  1971.     GoBackHistory();
  1972. }
  1973. /*****************************************************************************
  1974.  * FUNCTION
  1975.  *  PhnsetWpUsrDefPreViewENDKeyHdlr
  1976.  * DESCRIPTION
  1977.  *  This function is to END key handler for wallpaper/screen preview screen
  1978.  *  Following Function:
  1979.  * PARAMETERS
  1980.  *  void
  1981.  *  a(?)        [IN/OUT]        Void
  1982.  *  b(?)        [IN]            Void
  1983.  * RETURNS
  1984.  *  void
  1985.  *****************************************************************************/
  1986. void PhnsetWpUsrDefPreViewENDKeyHdlr(void)
  1987. {
  1988.     /*----------------------------------------------------------------*/
  1989.     /* Local Variables                                                */
  1990.     /*----------------------------------------------------------------*/
  1991.     /*----------------------------------------------------------------*/
  1992.     /* Code Body                                                      */
  1993.     /*----------------------------------------------------------------*/
  1994.     /* Has to free the file name string buffer  */
  1995.     PhnsetWpUsrDefFreeBuf();
  1996.     /* Execute the stored END key handler */
  1997.     if (phnset_wpfp)
  1998.     {
  1999.         (*phnset_wpfp) ();
  2000.     }
  2001. }
  2002. /*****************************************************************************
  2003.  * FUNCTION
  2004.  *  ExitPhnsetWpUsrDefPreView
  2005.  * DESCRIPTION
  2006.  *  Exit handler of PhnsetWpUsrDefPreView
  2007.  * PARAMETERS
  2008.  *  void
  2009.  *  a(?)        [IN/OUT]        Void
  2010.  *  b(?)        [IN]            Void
  2011.  * RETURNS
  2012.  *  void
  2013.  *****************************************************************************/
  2014. void ExitPhnsetWpUsrDefPreView(void)
  2015. {
  2016.     /*----------------------------------------------------------------*/
  2017.     /* Local Variables                                                */
  2018.     /*----------------------------------------------------------------*/
  2019.     /*----------------------------------------------------------------*/
  2020.     /* Code Body                                                      */
  2021.     /*----------------------------------------------------------------*/
  2022.     if (g_phnset_cntx_p->isCorrectSet)
  2023.     {
  2024.         PhnsetWpUsrDefFreeBuf();
  2025.         DeleteUptoScrID(g_phnset_cntx_p->ScrAnchor);
  2026.     }
  2027. }
  2028. /*****************************************************************************
  2029.  * FUNCTION
  2030.  *  PhnsetWpUsrDefPreView
  2031.  * DESCRIPTION
  2032.  *  This function is to preview user define wallpaper/screensaver
  2033.  *  Following Function:
  2034.  * PARAMETERS
  2035.  *  void
  2036.  *  a(?)        [IN/OUT]        Void
  2037.  *  b(?)        [IN]            Void
  2038.  * RETURNS
  2039.  *  void
  2040.  *****************************************************************************/
  2041. void PhnsetWpUsrDefPreView(void)
  2042. {
  2043.     /*----------------------------------------------------------------*/
  2044.     /* Local Variables                                                */
  2045.     /*----------------------------------------------------------------*/
  2046.     U8 *gui_buffer;
  2047.     /*----------------------------------------------------------------*/
  2048.     /* Code Body                                                      */
  2049.     /*----------------------------------------------------------------*/
  2050.     EntryNewScreen(SCR_IDLE_SCR_DISP_WP_PREVIEW, ExitPhnsetWpUsrDefPreView, PhnsetWpUsrDefPreView, NULL);
  2051.     gui_buffer = GetCurrGuiBuffer(SCR_IDLE_SCR_DISP_WP_PREVIEW);
  2052.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWpUsrDefPreView: phnset_dispchar_strp=%sn", phnset_dispchar_strp));
  2053.     CallbackWpSsLSK = PhnsetWpUsrDefSelect;
  2054.     g_phnset_cntx_p->isCorrectSet = 0;
  2055. #if defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) && defined(__MTK_TARGET__)
  2056.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SS
  2057.         && mmi_fmgr_get_file_group(phnset_dispchar_strp) == FMGR_GROUP_VIDEO)
  2058.     {
  2059.         ShowCategory225Screen(
  2060.             STR_GLOBAL_VIEW,            /* title_str */
  2061.             IMG_SCR_SETTING_CAPTION,    /* title_icon */
  2062.             STR_GLOBAL_OK,              /* lsk_str */
  2063.             IMG_GLOBAL_OK,              /* lsk_icon */
  2064.             STR_GLOBAL_BACK,            /* rsk_str */
  2065.             IMG_GLOBAL_BACK,            /* rsk_icon */
  2066.             0,                          /* video_id */
  2067.             (S8*) phnset_dispchar_strp, /* video_filename */
  2068.             1,                          /* repeat_count */
  2069.             TRUE,                       /* is_visual_update */
  2070.             FALSE,                      /* is_play_audio */
  2071.             TRUE,                       /* is_lcd_no_sleep */
  2072.             GDI_COLOR_WHITE,            /* bg_color */
  2073.             PhnsetWpSsPlayCallBack,
  2074.             gui_buffer);
  2075.     }
  2076.     else
  2077. #endif /* defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) && defined(__MTK_TARGET__) */ 
  2078.     {
  2079.     #ifdef __MMI_SWFLASH__
  2080.         if (mmi_fmgr_get_file_group(phnset_dispchar_strp) == FMGR_GROUP_SWFLASH)
  2081.         {
  2082.             ShowCategory229Screen(
  2083.                         (U8 *)GetString(STR_GLOBAL_VIEW),   /* title_str */
  2084.                         IMG_SCR_SETTING_CAPTION,            /* title_icon */
  2085.                         STR_GLOBAL_OK,                      /* lsk_str */
  2086.                         IMG_GLOBAL_OK,                      /* lsk_icon */
  2087.                         STR_GLOBAL_BACK,                    /* rsk_str */
  2088.                         IMG_GLOBAL_BACK,                    /* rsk_icon */
  2089.                         0,                                  /* resource_id */
  2090.                         phnset_dispchar_strp,               /* resource_filename */
  2091.                         1,                                  /* repeat_count */
  2092.                         MMI_FALSE,                          /* is_play_audio */
  2093.                         MMI_FALSE,                          /* is_vibrate_on */
  2094.                         MMI_FALSE,                          /* is_interaction_on */
  2095.                         MMI_TRUE,                           /* is_lcd_no_sleep */
  2096.                         MMI_FALSE,                          /* is_full_screen */
  2097.                         GDI_COLOR_WHITE,                    /* bg_color */
  2098.                         PhnsetWpSsPlayCallBack,
  2099.                         gui_buffer);
  2100.         }
  2101.         else
  2102.     #endif
  2103.         ShowCategory222Screen(
  2104.             STR_GLOBAL_VIEW,
  2105.             GetRootTitleIcon(MENU_SETTING_WALLPAPER),
  2106.             STR_GLOBAL_OK,
  2107.             IMG_GLOBAL_OK,
  2108.             STR_GLOBAL_BACK,
  2109.             IMG_GLOBAL_BACK,
  2110.             GDI_COLOR_WHITE,
  2111.             NULL,
  2112.             (S8*) phnset_dispchar_strp,
  2113.             FALSE,
  2114.             PhnsetWpSsPlayCallBack);
  2115.     }
  2116.     SetDelScrnIDCallbackHandler(SCR_IDLE_SCR_DISP_WP_PREVIEW, PhnsetWpUsrDefPreViewScrDelCB);
  2117.     phnset_wpfp = GetKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2118.     SetKeyHandler(PhnsetWpUsrDefPreViewENDKeyHdlr, KEY_END, KEY_EVENT_DOWN);
  2119.     SetRightSoftkeyFunction(PhnsetWpUsrDefGoBack, KEY_EVENT_UP);
  2120.     SetLeftSoftkeyFunction(CallbackWpSsLSK, KEY_EVENT_UP);
  2121. }
  2122. /*****************************************************************************
  2123.  * FUNCTION
  2124.  *  PhnsetWallpaperSelectFmgrCallBack
  2125.  * DESCRIPTION
  2126.  *  This function is call back function for IdleScreenDisplay->Wallpaper->User Define
  2127.  *  Following Function:
  2128.  * PARAMETERS
  2129.  *  path            [?]             
  2130.  *  is_short        [IN]            
  2131.  *  a(?)            [IN/OUT]        Void
  2132.  *  b(?)            [IN]            Void
  2133.  * RETURNS
  2134.  *  void
  2135.  *****************************************************************************/
  2136. void PhnsetWallpaperSelectFmgrCallBack(void *path, int is_short)
  2137. {
  2138.     /*----------------------------------------------------------------*/
  2139.     /* Local Variables                                                */
  2140.     /*----------------------------------------------------------------*/
  2141.     /*----------------------------------------------------------------*/
  2142.     /* Code Body                                                      */
  2143.     /*----------------------------------------------------------------*/
  2144.     if (path)
  2145.     {
  2146.         if (mmi_fmgr_forwardable_path((PS8) path))
  2147.         {
  2148.             error_str_ptr = (PS8) GetString(STR_ID_PHNSET_DISPCHAR_INVALID_PATH);
  2149.             DispIdleScrWPBadFilePopup();
  2150.             PhnsetWpUsrDefFreeBuf();
  2151.             return;
  2152.         }
  2153.         if ((g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP
  2154.              && !mmi_fmgr_util_file_limit_check(FMGR_LIMIT_WALLPAPER, (PS8) path, &error_str_ptr))
  2155.     #ifdef __MMI_SUB_WALLPAPER__
  2156.             || (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP
  2157.                 && !mmi_fmgr_util_file_limit_check(FMGR_LIMIT_SUB_WALLPAPER, (PS8) path, &error_str_ptr))
  2158.     #endif /* __MMI_SUB_WALLPAPER__ */ 
  2159.             || (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SS
  2160.                 && !mmi_fmgr_util_file_limit_check(FMGR_LIMIT_SCREEN_SAVER, (PS8) path, &error_str_ptr)))
  2161.         {
  2162.             DispIdleScrWPBadFilePopup();
  2163.             PhnsetWpUsrDefFreeBuf();
  2164.             return;
  2165.         }
  2166.         /* Prevent memory leck, after buffer is free, set pointer to NULL */
  2167.         ASSERT(phnset_dispchar_strp == NULL);
  2168.         g_phnset_cntx_p->isShort = (S32) is_short;
  2169.         phnset_dispchar_strp = OslMalloc(FMGR_PATH_BUFFER_SIZE);
  2170.         if (phnset_dispchar_strp)
  2171.         {
  2172.             pfnUnicodeStrcpy((S8*) phnset_dispchar_strp, (S8*) path);
  2173.         }
  2174.         else
  2175.         {
  2176.             GoBackToHistory(SCR_IDLE_SCR_DISP);
  2177.             return;
  2178.         }
  2179.         PhnsetWpUsrDefPreView();
  2180.     }
  2181.     else
  2182.     {
  2183.         GoBackToHistory(g_phnset_cntx_p->ScrAnchor);
  2184.     }
  2185. }
  2186. /*****************************************************************************
  2187.  * FUNCTION
  2188.  *  EntryPhnsetWallpaperFmgr
  2189.  * DESCRIPTION
  2190.  *  This function is Entry function for Setting->Phonesetup->IdleScreenDisplay->Wallpaper (->Fix) -> User Define
  2191.  *  Follow functions:
  2192.  * PARAMETERS
  2193.  *  void
  2194.  *  a(?)        [IN/OUT]        Void
  2195.  *  b(?)        [IN]            Void
  2196.  * RETURNS
  2197.  *  void
  2198.  *****************************************************************************/
  2199. void EntryPhnsetWallpaperFmgr(void)
  2200. {
  2201.     /*----------------------------------------------------------------*/
  2202.     /* Local Variables                                                */
  2203.     /*----------------------------------------------------------------*/
  2204. #if ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__))
  2205.     FMGR_FILTER filter;
  2206.     U8 option = 1;
  2207.     /*----------------------------------------------------------------*/
  2208.     /* Code Body                                                      */
  2209.     /*----------------------------------------------------------------*/
  2210.     FMGR_FILTER_INIT(&filter);
  2211.     FMGR_FILTER_SET(&filter, FMGR_TYPE_BMP);
  2212.     FMGR_FILTER_SET(&filter, FMGR_TYPE_GIF);
  2213. #ifdef JPG_DECODE
  2214.     FMGR_FILTER_SET(&filter, FMGR_TYPE_JPG);
  2215. #endif 
  2216. #if defined(GDI_USING_PNG)
  2217.     FMGR_FILTER_SET(&filter, FMGR_TYPE_PNG);
  2218. #endif 
  2219. #ifdef __MMI_SUB_WALLPAPER__
  2220.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  2221.      option = 0;
  2222. #endif
  2223.     if (option)
  2224.     {
  2225.     #ifdef SVG_SUPPORT
  2226.         FMGR_FILTER_SET(&filter, FMGR_TYPE_SVG);
  2227.     #endif
  2228.     #ifdef M3D_MMI_SUPPORT
  2229.         FMGR_FILTER_SET(&filter, FMGR_TYPE_M3D);
  2230.     #endif
  2231.     #ifdef __MMI_SWFLASH__
  2232.         FMGR_FILTER_SET(&filter, FMGR_TYPE_CMP);
  2233.     #endif
  2234.     }
  2235.     
  2236.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER);
  2237.     FMGR_FILTER_SET(&filter, FMGR_TYPE_FOLDER_DOT);
  2238. #if defined(__MTK_TARGET__)
  2239. #if defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) || defined(__MMI_POWER_ON_OFF_DISPLAY_VIDEO__)
  2240.     if (
  2241. #if defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__)
  2242.            g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SS
  2243. #if defined(__MMI_POWER_ON_OFF_DISPLAY_VIDEO__)
  2244.            || g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWROFF
  2245.            || g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWRON
  2246. #endif /* defined(__MMI_POWER_ON_OFF_DISPLAY_VIDEO__) */ 
  2247. #else /* defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) */ 
  2248. #if defined(__MMI_POWER_ON_OFF_DISPLAY_VIDEO__)
  2249.            g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWROFF || g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWRON
  2250. #endif 
  2251. #endif /* defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) */ 
  2252.         )
  2253.     {
  2254.     #ifdef MP4_CODEC
  2255.         FMGR_FILTER_SET(&filter, FMGR_TYPE_3GP);
  2256.         FMGR_FILTER_SET(&filter, FMGR_TYPE_MP4);
  2257.     #endif /* MP4_CODEC */ 
  2258.     #ifdef MJPG_SUPPORT
  2259.         FMGR_FILTER_SET(&filter, FMGR_TYPE_AVI);
  2260.     #endif 
  2261.     }
  2262. #endif /* defined(__MMI_SCREENSAVER_DISPLAY_VIDEO__) || defined(__MMI_POWER_ON_OFF_DISPLAY_VIDEO__) */ 
  2263. #endif /* defined(__MTK_TARGET__) */ 
  2264. #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  2265.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWRON || g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_PWROFF)
  2266.     {
  2267.         mmi_fmgr_select_path_and_enter(
  2268.             APP_SETTINGS,
  2269.             FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2270.             filter,
  2271.             (S8*) L"root",
  2272.             PhnsetPwrOnOffSelectFmgrCallBack);
  2273.     }
  2274.     else
  2275. #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  2276.         mmi_fmgr_select_path_and_enter(
  2277.             APP_SETTINGS,
  2278.             FMGR_SELECT_FILE | FMGR_SELECT_REPEAT,
  2279.             filter,
  2280.             (S8*) L"root",
  2281.             PhnsetWallpaperSelectFmgrCallBack);
  2282. #endif /* ( defined(MMI_ON_HARDWARE_P) && defined(__MMI_FILE_MANAGER__)) */ 
  2283. }
  2284. #endif /* __MMI_FILE_MANAGER__ */ 
  2285. /*****************************************************************************
  2286.  * FUNCTION
  2287.  *  DispIdleScrWPBadFilePopup
  2288.  * DESCRIPTION
  2289.  *  This function is call back function for showcategories33screen,
  2290.  *  If display user defined image got problem in idle screen, this function will be executed
  2291.  *  Follow functions:
  2292.  * PARAMETERS
  2293.  *  void
  2294.  *  a(?)        [IN/OUT]        Void
  2295.  *  b(?)        [IN]            Void
  2296.  * RETURNS
  2297.  *  void
  2298.  *****************************************************************************/
  2299. void DispIdleScrWPBadFilePopup(void)
  2300. {
  2301.     /*----------------------------------------------------------------*/
  2302.     /* Local Variables                                                */
  2303.     /*----------------------------------------------------------------*/
  2304.     /*----------------------------------------------------------------*/
  2305.     /* Code Body                                                      */
  2306.     /*----------------------------------------------------------------*/
  2307.     if (error_str_ptr)
  2308.     {
  2309.         DisplayPopup((PU8) error_str_ptr, IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE);
  2310.     }
  2311.     else
  2312.     {
  2313.         DisplayPopup(
  2314.             (PU8) GetString(STR_IDLE_WP_DECODE_ERR),
  2315.             IMG_GLOBAL_ERROR,
  2316.             1,
  2317.             UI_POPUP_NOTIFYDURATION_TIME,
  2318.             ERROR_TONE);
  2319.     }
  2320.     error_str_ptr = NULL;
  2321. }
  2322. /*****************************************************************************
  2323.  * FUNCTION
  2324.  *  PhnsetWallpaperBadFileCallBack
  2325.  * DESCRIPTION
  2326.  *  This function is call back function for showcategories33screen,
  2327.  *  If display user defined image got problem in idle screen, this function will be executed
  2328.  *  Follow functions:
  2329.  * PARAMETERS
  2330.  *  imgID       [IN]            
  2331.  *  a(?)        [IN/OUT]        Void
  2332.  *  b(?)        [IN]            Void
  2333.  * RETURNS
  2334.  *  void
  2335.  *****************************************************************************/
  2336. void PhnsetWallpaperBadFileCallBack(U16 imgID)
  2337. {
  2338.     /*----------------------------------------------------------------*/
  2339.     /* Local Variables                                                */
  2340.     /*----------------------------------------------------------------*/
  2341.     /*----------------------------------------------------------------*/
  2342.     /* Code Body                                                      */
  2343.     /*----------------------------------------------------------------*/
  2344.     error_str_ptr = NULL;
  2345.     StartTimer(IDLE_SHOW_BADFILE_WARNING_TIMER, 1000, PhnsetRstWallpaperDefault);
  2346.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  2347. }
  2348. #ifdef __MMI_SUB_WALLPAPER__
  2349. /*****************************************************************************
  2350.  * FUNCTION
  2351.  *  PhnsetWallpaperSubBadFileCallBack
  2352.  * DESCRIPTION
  2353.  *  
  2354.  * PARAMETERS
  2355.  *  imgID       [IN]        
  2356.  * RETURNS
  2357.  *  void
  2358.  *****************************************************************************/
  2359. void PhnsetWallpaperSubBadFileCallBack(U16 imgID)
  2360. {
  2361.     /*----------------------------------------------------------------*/
  2362.     /* Local Variables                                                */
  2363.     /*----------------------------------------------------------------*/
  2364.     /*----------------------------------------------------------------*/
  2365.     /* Code Body                                                      */
  2366.     /*----------------------------------------------------------------*/
  2367.     error_str_ptr = NULL;
  2368.     StartTimer(IDLE_SHOW_SUB_BADFILE_WARNING_TIMER, 1000, PhnsetRstSubWallpaperDefault);
  2369.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_SUB_WP;
  2370. }
  2371. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2372. /*****************************************************************************
  2373.  * FUNCTION
  2374.  *  PhnsetGetDisplayType
  2375.  * DESCRIPTION
  2376.  *  
  2377.  * PARAMETERS
  2378.  *  id      [IN]        
  2379.  * RETURNS
  2380.  *  
  2381.  *****************************************************************************/
  2382. PHNSET_TYPE_DISP PhnsetGetDisplayType(U16 id)
  2383. {
  2384.     /*----------------------------------------------------------------*/
  2385.     /* Local Variables                                                */
  2386.     /*----------------------------------------------------------------*/
  2387.     /*----------------------------------------------------------------*/
  2388.     /* Code Body                                                      */
  2389.     /*----------------------------------------------------------------*/
  2390.     if ((id >= IMG_ID_PHNSET_WP_START && id <= IMG_ID_PHNSET_WP_MAX)
  2391. #ifdef __MMI_SUB_WALLPAPER__
  2392.         || (id >= IMG_ID_PHNSET_SUB_WP_START && id <= IMG_ID_PHNSET_SUB_WP_MAX)
  2393. #endif 
  2394.         || (id >= IMG_ID_PHNSET_SS_START && id <= IMG_ID_PHNSET_SS_MAX)
  2395. #if !defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  2396. #ifdef __MMI_ANALOG_CLOCK__
  2397.         || (id == IMG_ID_DISPCHAR_ANALOG_CLK)
  2398. #endif 
  2399. #ifdef __MMI_DIGITAL_CLOCK__
  2400.         || (id == IMG_ID_DISPCHAR_DIGITAL_CLK)
  2401. #endif 
  2402. #endif /* !__MMI_UI_TECHNO_IDLESCREEN_BAR__ */
  2403. #ifdef __MMI_THEMES_V2_SUPPORT__
  2404.         || (id == IMG_ID_DISPCHAR_THEME_WALLPAPER)
  2405.         || (id == IMG_ID_DISPCHAR_THEME_SCREENSAVER)
  2406. #endif 
  2407. #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  2408.         || (id >= IMG_ID_PHNSET_ON_START && id <= IMG_ID_PHNSET_ON_MAX)
  2409.         || (id >= IMG_ID_PHNSET_OFF_START && id <= IMG_ID_PHNSET_OFF_MAX)
  2410. #else /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  2411.         || (id == IMG_ID_PHNSET_ON_ANIMATION_DEFAULT) || (id == IMG_ID_PHNSET_OFF_ANIMATION_DEFAULT)
  2412. #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  2413.         )
  2414.     {
  2415.         return PHNSET_TYPE_DISP_IMAGE;
  2416.     }
  2417. #ifdef __MMI_SWFLASH__
  2418.     else if (id >= IMG_ID_DISPCHAR_SWFLASH_START && id <= IMG_ID_DISPCHAR_SWFLASH_MAX)
  2419.     {
  2420.         return PHNSET_TYPE_DISP_SWFLASH;
  2421.     }
  2422. #endif
  2423. #if defined(__MMI_VIDEO_PLAYER__) && defined(__MTK_TARGET__)
  2424.     else if ((id >= IMG_ID_PHNSET_SS_VDO_START && id <= IMG_ID_PHNSET_SS_VDO_MAX)
  2425. #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  2426.              || (id >= IMG_ID_PHNSET_ON_VDO_START && id <= IMG_ID_PHNSET_ON_VDO_MAX)
  2427.              || (id >= IMG_ID_PHNSET_OFF_VDO_START && id <= IMG_ID_PHNSET_OFF_VDO_MAX)
  2428. #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  2429.         )
  2430.         return PHNSET_TYPE_DISP_VIDEO;
  2431. #endif /* defined(__MMI_VIDEO_PLAYER__) && defined(__MTK_TARGET__) */ 
  2432.     else if (id == 0x00)
  2433.     {
  2434.         return PHNSET_TYPE_DISP_USER;
  2435.     }
  2436.     else
  2437.     {
  2438.         return PHNSET_TYPE_DISP_INVALID;
  2439.     }
  2440. }
  2441. /*****************************************************************************
  2442.  * FUNCTION
  2443.  *  PhnsetWpSsPlayCallBack
  2444.  * DESCRIPTION
  2445.  *  
  2446.  * PARAMETERS
  2447.  *  result      [IN]        
  2448.  * RETURNS
  2449.  *  void
  2450.  *****************************************************************************/
  2451. void PhnsetWpSsPlayCallBack(S32 result)
  2452. {
  2453.     /*----------------------------------------------------------------*/
  2454.     /* Local Variables                                                */
  2455.     /*----------------------------------------------------------------*/
  2456.     /*----------------------------------------------------------------*/
  2457.     /* Code Body                                                      */
  2458.     /*----------------------------------------------------------------*/
  2459.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWpSsPlayCallBack: result=%dn", result));
  2460.     if (result >= 0)
  2461.     {
  2462.         ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2463.     #ifdef __MMI_FILE_MANAGER__
  2464.         if (phnset_dispchar_strp)
  2465.         {
  2466.             CallbackWpSsLSK = PhnsetWpUsrDefSelect;
  2467.         }
  2468.         else
  2469.     #endif /* __MMI_FILE_MANAGER__ */ 
  2470.         {
  2471.             if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SS)
  2472.             {
  2473.                 CallbackWpSsLSK = PhnsetScrSvrSysViewLskHdlr;
  2474.             }
  2475.             else
  2476.             {
  2477.                 //ASSERT(0);
  2478.             }
  2479.         }
  2480.     }
  2481.     else
  2482.     {
  2483.         ChangeLeftSoftkey(0, 0);
  2484.         ChangeRightSoftkey(0, 0);
  2485.         CallbackWpSsLSK = UI_dummy_function;
  2486.         error_str_ptr = GetString(STR_GLOBAL_UNSUPPORTED_FORMAT);
  2487.         DispIdleScrWPBadFilePopup();
  2488.     #ifdef __MMI_FILE_MANAGER__
  2489.         PhnsetWpUsrDefFreeBuf();
  2490.     #endif 
  2491.         /* delete to file select screen again */
  2492.         DeleteNHistory(1);
  2493.     }
  2494.     SetLeftSoftkeyFunction(CallbackWpSsLSK, KEY_EVENT_UP);
  2495. }
  2496. /* 
  2497.  * Externel Interfaces
  2498.  */
  2499. /*****************************************************************************
  2500.  * FUNCTION
  2501.  *  PhnsetRstWallpaperDefault
  2502.  * DESCRIPTION
  2503.  *  This function is to set wallpaper to default one
  2504.  * PARAMETERS
  2505.  *  void
  2506.  *  a(?)        [IN/OUT]        Void
  2507.  *  b(?)        [IN]            ImageId
  2508.  * RETURNS
  2509.  *  void
  2510.  *****************************************************************************/
  2511. void PhnsetRstWallpaperDefault(void)
  2512. {
  2513.     /*----------------------------------------------------------------*/
  2514.     /* Local Variables                                                */
  2515.     /*----------------------------------------------------------------*/
  2516.     /*----------------------------------------------------------------*/
  2517.     /* Code Body                                                      */
  2518.     /*----------------------------------------------------------------*/
  2519.     g_phnset_cntx_p->curtWpID = RstGetWallpaperImgIdDefault();
  2520. #ifdef MMI_ON_WIN32
  2521.     g_phnset_cntx_p->curtWpID = IMG_ID_PHNSET_WP_START;
  2522. #endif /* MMI_ON_WIN32 */ 
  2523.     if (!mmi_bootup_is_in_power_on_period())
  2524.     {
  2525.         DispIdleScrWPBadFilePopup();
  2526.     }
  2527.     mmi_dispchar_set_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  2528.     SetIdleScreenWallpaperID(g_phnset_cntx_p->curtWpID, MMI_TRUE);
  2529.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetRstWallpaperDefault: Main, ID=%dn", g_phnset_cntx_p->curtWpID));
  2530. }
  2531. #ifdef __MMI_SUB_WALLPAPER__
  2532. /*****************************************************************************
  2533.  * FUNCTION
  2534.  *  PhnsetRstSubWallpaperDefault
  2535.  * DESCRIPTION
  2536.  *  This function is to set sub wallpaper to default one
  2537.  * PARAMETERS
  2538.  *  void
  2539.  *  a(?)        [IN/OUT]        Void
  2540.  *  b(?)        [IN]            ImageId
  2541.  * RETURNS
  2542.  *  void
  2543.  *****************************************************************************/
  2544. void PhnsetRstSubWallpaperDefault(void)
  2545. {
  2546.     /*----------------------------------------------------------------*/
  2547.     /* Local Variables                                                */
  2548.     /*----------------------------------------------------------------*/
  2549.     /*----------------------------------------------------------------*/
  2550.     /* Code Body                                                      */
  2551.     /*----------------------------------------------------------------*/
  2552.     g_phnset_cntx_p->curtSubWpID = RstGetWallpaperSubImgIdDefault();    /* RstGetWallpaperImgIdDefault(); */
  2553.     mmi_dispchar_set_img_id(NVRAM_SETWALLPAPER_SUB, &(g_phnset_cntx_p->curtSubWpID));
  2554.     SUBLCD_SetIdleScreenWallpaperID(g_phnset_cntx_p->curtSubWpID);
  2555.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetRstSubWallpaperDefault: Sub, ID=%dn",
  2556.                          g_phnset_cntx_p->curtSubWpID));
  2557.     if (!mmi_bootup_is_in_power_on_period())
  2558.     {
  2559.         DispIdleScrWPBadFilePopup();
  2560.     }
  2561. }
  2562. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2563. /*****************************************************************************
  2564.  * FUNCTION
  2565.  *  PhnsetReadWallpaper
  2566.  * DESCRIPTION
  2567.  *  This function is to Read wallpaper from Nvram, and set as current wallpaper
  2568.  *  Functionality: Referenced at InitNvramData when bootup
  2569.  * PARAMETERS
  2570.  *  void
  2571.  *  a(?)        [IN/OUT]        Void *
  2572.  *  b(?)        [IN]            
  2573.  * RETURNS
  2574.  *  void
  2575.  *****************************************************************************/
  2576. void PhnsetReadWallpaper(void)
  2577. {
  2578.     /*----------------------------------------------------------------*/
  2579.     /* Local Variables                                                */
  2580.     /*----------------------------------------------------------------*/
  2581. #ifdef __MMI_FILE_MANAGER__
  2582.     S16 error;
  2583. #endif
  2584.     PHNSET_TYPE_DISP type;
  2585.     phnset_wpss_type_enum temp_type = g_phnset_cntx_p->wpss_type;
  2586.     /*----------------------------------------------------------------*/
  2587.     /* Code Body                                                      */
  2588.     /*----------------------------------------------------------------*/
  2589.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_WP;
  2590.     mmi_dispchar_get_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  2591.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetReadWallpaper: Main ID=%dn", g_phnset_cntx_p->curtWpID));
  2592.     if ((type = PhnsetGetDisplayType(g_phnset_cntx_p->curtWpID)) == PHNSET_TYPE_DISP_INVALID)
  2593.     {
  2594.         PhnsetRstWallpaperDefault();
  2595.     }
  2596. #ifdef __MMI_FILE_MANAGER__
  2597.     else if (type == PHNSET_TYPE_DISP_USER)
  2598.     {
  2599.         ReadRecord(NVRAM_EF_WPSS_FILENAME_LID, 1, &phnset_wpss_filename, sizeof(phnset_wpss_filename), &error);
  2600.         if (error == NVRAM_READ_SUCCESS ||
  2601.             mmi_fmgr_util_file_limit_check(FMGR_LIMIT_WALLPAPER, (PS8) phnset_wpss_filename.wallpaper, &error_str_ptr))
  2602.         {
  2603.             g_phnset_cntx_p->isShort = phnset_wpss_filename.isWPShort;
  2604.             PhnsetSetWallpaperByFileName((S8*) phnset_wpss_filename.wallpaper);
  2605.         }
  2606.         else
  2607.         {
  2608.             memset(&phnset_wpss_filename, 0, sizeof(phnset_wpss_filename));
  2609.             PhnsetRstWallpaperDefault();
  2610.         }
  2611.     }
  2612. #endif /* __MMI_FILE_MANAGER__ */    
  2613.     else
  2614.     {
  2615.         PhnsetSetWallpaperByImgID(g_phnset_cntx_p->curtWpID);
  2616.     }
  2617. #ifdef __MMI_SUB_WALLPAPER__
  2618.     g_phnset_cntx_p->wpss_type = MMI_PHNSET_TYPE_SUB_WP;
  2619.     mmi_dispchar_get_img_id(NVRAM_SETWALLPAPER_SUB, &(g_phnset_cntx_p->curtSubWpID));
  2620.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetReadWallpaper: Sub ID=%dn", g_phnset_cntx_p->curtSubWpID));
  2621.     if ((type = PhnsetGetDisplayType(g_phnset_cntx_p->curtSubWpID)) == PHNSET_TYPE_DISP_INVALID)
  2622.     {
  2623.         PhnsetRstSubWallpaperDefault();
  2624.     }
  2625. #ifdef __MMI_FILE_MANAGER__
  2626.     else if (type == PHNSET_TYPE_DISP_USER)
  2627.     {
  2628.         ReadRecord(NVRAM_EF_WPSS_FILENAME_LID, 3, &phnset_wpss_sub_filename, sizeof(phnset_wpss_sub_filename), &error);
  2629.         if (error == NVRAM_READ_SUCCESS)
  2630.         {
  2631.             SUBLCD_SetIdleScreenWallpaperName((UI_string_type) phnset_wpss_sub_filename.wallpaper);
  2632.         }
  2633.         else
  2634.         {
  2635.             memset(&phnset_wpss_sub_filename, 0, sizeof(phnset_wpss_sub_filename));
  2636.             PhnsetRstSubWallpaperDefault();
  2637.             SUBLCD_SetIdleScreenWallpaperID(g_phnset_cntx_p->curtWpID);
  2638.         }
  2639.     }
  2640. #endif /* __MMI_FILE_MANAGER__ */    
  2641.     else
  2642.     {
  2643.         SUBLCD_SetIdleScreenWallpaperID(g_phnset_cntx_p->curtSubWpID);
  2644.     }
  2645. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2646.     g_phnset_cntx_p->wpss_type = temp_type;
  2647. }
  2648. /*****************************************************************************
  2649.  * FUNCTION
  2650.  *  PhnsetGetFileNamePointer
  2651.  * DESCRIPTION
  2652.  *  To find the pointer of path
  2653.  * PARAMETERS
  2654.  *  path        [IN]            
  2655.  *  a(?)        [IN/OUT]        Void *
  2656.  *  b(?)        [IN]            
  2657.  * RETURNS
  2658.  *  PS8 wallpaper name string pointer
  2659.  *****************************************************************************/
  2660. PS8 PhnsetGetFileNamePointer(PS8 path)
  2661. {
  2662.     /*----------------------------------------------------------------*/
  2663.     /* Local Variables                                                */
  2664.     /*----------------------------------------------------------------*/
  2665.     U16 len;
  2666.     U16 deter = 0x005C; /* '' */
  2667.     S16 *p = (S16*) path;
  2668.     /*----------------------------------------------------------------*/
  2669.     /* Code Body                                                      */
  2670.     /*----------------------------------------------------------------*/
  2671.     len = (U16) pfnUnicodeStrlen(path);
  2672.     for (; len > 0; len--)
  2673.     {
  2674.         if (*(p + len) == deter)
  2675.         {
  2676.             return (PS8) (p + len + 1);
  2677.         }
  2678.     }
  2679.     return NULL;
  2680. }
  2681. /*****************************************************************************
  2682.  * FUNCTION
  2683.  *  PhnsetGetCurWallpaperName
  2684.  * DESCRIPTION
  2685.  *  This function is to get current name string pointer of wallpaper
  2686.  *  Functionality: ex: Referenced by hint windows
  2687.  * PARAMETERS
  2688.  *  void
  2689.  *  a(?)        [IN/OUT]        Void *
  2690.  *  b(?)        [IN]            
  2691.  * RETURNS
  2692.  *  PS8 wallpaper name string pointer
  2693.  *****************************************************************************/
  2694. PS8 PhnsetGetCurWallpaperName(void)
  2695. {
  2696. #ifdef __MMI_FILE_MANAGER__
  2697.     /*----------------------------------------------------------------*/
  2698.     /* Local Variables                                                */
  2699.     /*----------------------------------------------------------------*/
  2700.     /*----------------------------------------------------------------*/
  2701.     /* Code Body                                                      */
  2702.     /*----------------------------------------------------------------*/
  2703.     if (g_phnset_cntx_p->curtWpID == 0)
  2704.     {
  2705.         if (phnset_wpss_filename.isWPShort == 1)
  2706.         {
  2707.             U8 type, *temp = phnset_dispchar_temp;
  2708.             PS8 p;
  2709.             /* rename short name file should pass converted short name to editor,
  2710.                so that the display will be the same as in File Manager */
  2711.             p = PhnsetGetFileNamePointer((PS8) phnset_wpss_filename.wallpaper);
  2712.             type = PhnsetGetDefEncodingType();
  2713.             mmi_chset_mixed_text_to_ucs2_str(
  2714.                 (U8*) temp,
  2715.                 (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
  2716.                 (U8*) p,
  2717.                 (mmi_chset_enum) type);
  2718.             p = (PS8) & temp[0];
  2719.             PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetGetCurWallpaperName: path=%s, encode=%dn", p, type));
  2720.             return p;
  2721.         }
  2722.         else
  2723.         {
  2724.             PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetGetCurWallpaperName: path=%sn",
  2725.                                  phnset_wpss_filename.wallpaper));
  2726.             return PhnsetGetFileNamePointer((PS8) phnset_wpss_filename.wallpaper);
  2727.         }
  2728.     }
  2729.     else
  2730. #endif /* __MMI_FILE_MANAGER__ */ 
  2731.         return PhnsetGetWallpaperNameById(g_phnset_cntx_p->curtWpID);
  2732. }
  2733. #ifdef __MMI_SUB_WALLPAPER__
  2734. /*****************************************************************************
  2735.  * FUNCTION
  2736.  *  PhnsetGetCurSubWallpaperName
  2737.  * DESCRIPTION
  2738.  *  This function is to get current name string pointer of sublcd wallpaper
  2739.  *  Functionality: ex: Referenced by hint windows
  2740.  * PARAMETERS
  2741.  *  void
  2742.  *  a(?)        [IN/OUT]        Void *
  2743.  *  b(?)        [IN]            
  2744.  * RETURNS
  2745.  *  PS8 wallpaper name string pointer
  2746.  *****************************************************************************/
  2747. PS8 PhnsetGetCurSubWallpaperName(void)
  2748. {
  2749.     /*----------------------------------------------------------------*/
  2750.     /* Local Variables                                                */
  2751.     /*----------------------------------------------------------------*/
  2752.     /*----------------------------------------------------------------*/
  2753.     /* Code Body                                                      */
  2754.     /*----------------------------------------------------------------*/
  2755.     if (g_phnset_cntx_p->curtSubWpID == 0)
  2756.     {
  2757.         if (phnset_wpss_sub_filename.isWPShort == 1)
  2758.         {
  2759.             U8 temp[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH], type;
  2760.             PS8 p;
  2761.             /* rename short name file should pass converted short name to editor,
  2762.                so that the display will be the same as in File Manager */
  2763.             p = PhnsetGetFileNamePointer((S8*) phnset_wpss_sub_filename.wallpaper);
  2764.             type = PhnsetGetDefEncodingType();
  2765.             mmi_chset_mixed_text_to_ucs2_str(
  2766.                 (U8*) temp,
  2767.                 (FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH,
  2768.                 (U8*) p,
  2769.                 (mmi_chset_enum) type);
  2770.             p = (PS8) & temp[0];
  2771.             PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetGetCurSubWallpaperName: path=%s, encode=%dn", p, type));
  2772.             return p;
  2773.         }
  2774.         else
  2775.         {
  2776.             PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetGetCurSubWallpaperName: path=%sn",
  2777.                                  phnset_wpss_sub_filename.wallpaper));
  2778.             return PhnsetGetFileNamePointer((PS8) phnset_wpss_sub_filename.wallpaper);
  2779.         }
  2780.     }
  2781.     else
  2782.     {
  2783.         return PhnsetGetWallpaperNameById(g_phnset_cntx_p->curtSubWpID);
  2784.     }
  2785. }
  2786. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2787. /*****************************************************************************
  2788.  * FUNCTION
  2789.  *  PhnsetGetWallpaperNameById
  2790.  * DESCRIPTION
  2791.  *  This function is to translate image ID to name string pointer
  2792.  *  Functionality: ex: Referenced by hint windows
  2793.  * PARAMETERS
  2794.  *  Id          [IN]            
  2795.  *  a(?)        [IN/OUT]        
  2796.  *  b(?)        [IN]            U16 image ID
  2797.  * RETURNS
  2798.  *  Wallpaper Name as PS8 passed as U16 as its ID
  2799.  *****************************************************************************/
  2800. PS8 PhnsetGetWallpaperNameById(U16 Id)
  2801. {
  2802.     /*----------------------------------------------------------------*/
  2803.     /* Local Variables                                                */
  2804.     /*----------------------------------------------------------------*/
  2805.     PS8 pstr = NULL;
  2806.     U32 strID;
  2807.     /*----------------------------------------------------------------*/
  2808.     /* Code Body                                                      */
  2809.     /*----------------------------------------------------------------*/
  2810.     if (Id >= IMG_ID_PHNSET_WP_START && Id <= IMG_ID_PHNSET_WP_MAX)
  2811.     {
  2812.         /* System Wallpaper Range */
  2813.         strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + (Id - IMG_ID_PHNSET_WP_START);
  2814.         pstr = GetString((U16) strID);
  2815.     }
  2816. #ifdef __MMI_SUB_WALLPAPER__
  2817.     else if (Id >= IMG_ID_PHNSET_SUB_WP_START && Id <= IMG_ID_PHNSET_SUB_WP_MAX)
  2818.     {
  2819.         strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + (Id - IMG_ID_PHNSET_SUB_WP_START);
  2820.         pstr = GetString((U16) strID);
  2821.     }
  2822. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2823.     else if ((strID = getFactoryImageRelativeIndex(Id)) != 0)
  2824.     {
  2825.         /* Factory Wallpaper Range */
  2826.         DYNIMAGEINFO *Info;
  2827.         U8 i;
  2828.         U8 noFactImages = GetFullScreenFactoryImagesInfo(&Info);
  2829.         for (i = 0; i < noFactImages; i++)
  2830.         {
  2831.             if (Id == Info[i].ImagesId)
  2832.             {
  2833.                 strID = STR_ID_PHNSET_DISPCHAR_IMGID_START + IMG_ID_PHNSET_WP_MAX + i;
  2834.                 break;
  2835.             }
  2836.         }
  2837.         pstr = GetString((U16) strID);
  2838.     }
  2839. #ifndef __MMI_UI_TECHNO_IDLESCREEN_BAR__    
  2840. #ifdef __MMI_ANALOG_CLOCK__
  2841.     else if (Id == IMG_ID_DISPCHAR_ANALOG_CLK)
  2842.     {
  2843.         /* Analog Clock Wallpaper */
  2844.         strID = STR_ID_PHNSET_DISPCHAR_ANALOG;
  2845.         pstr = GetString((U16) strID);
  2846.     }
  2847. #endif /* __MMI_ANALOG_CLOCK__ */ 
  2848. #ifdef __MMI_DIGITAL_CLOCK__
  2849.     else if (Id == IMG_ID_DISPCHAR_DIGITAL_CLK)
  2850.     {
  2851.         /* Digital Clock Wallpaper */
  2852.         strID = STR_ID_PHNSET_DISPCHAR_DIGITAL;
  2853.         pstr = GetString((U16) strID);
  2854.     }
  2855. #endif /* __MMI_DIGITAL_CLOCK__ */ 
  2856. #endif /* !__MMI_UI_TECHNO_IDLESCREEN_BAR__ */
  2857. #ifdef __MMI_THEMES_V2_SUPPORT__
  2858.     else if (Id == IMG_ID_DISPCHAR_THEME_WALLPAPER)
  2859.     {
  2860.         /* Digital Clock Wallpaper */
  2861.         strID = STR_ID_DISPCHAR_THEME_WALLPAPER;
  2862.         pstr = GetString((U16) strID);
  2863.     }
  2864. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  2865. #ifdef __MMI_SWFLASH__
  2866.     else if (Id >= IMG_ID_DISPCHAR_SWFLASH_START && Id <= IMG_ID_DISPCHAR_SWFLASH_MAX)
  2867.     {
  2868.         strID = STR_ID_DISPCHAR_SWFLASH_START + (Id - IMG_ID_DISPCHAR_SWFLASH_START);
  2869.         pstr = GetString((U16) strID);
  2870.     }
  2871. #endif /* __MMI_SWFLASH__ */
  2872.     return pstr;
  2873. }
  2874. /*****************************************************************************
  2875.  * FUNCTION
  2876.  *  PhnsetSetWallpaperByImgID
  2877.  * DESCRIPTION
  2878.  *  This function is to set current wallpaper using index by AT command
  2879.  * PARAMETERS
  2880.  *  imgID       [IN]            
  2881.  *  a(?)        [IN/OUT]        
  2882.  *  b(?)        [IN]            U16 image ID
  2883.  * RETURNS
  2884.  *  void
  2885.  *****************************************************************************/
  2886. void PhnsetSetWallpaperByImgID(U16 imgID)
  2887. {
  2888.     /*----------------------------------------------------------------*/
  2889.     /* Local Variables                                                */
  2890.     /*----------------------------------------------------------------*/
  2891.     /*----------------------------------------------------------------*/
  2892.     /* Code Body                                                      */
  2893.     /*----------------------------------------------------------------*/
  2894.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  2895.     {
  2896.         g_phnset_cntx_p->curtWpID = imgID;
  2897.         mmi_dispchar_set_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  2898.         SetIdleScreenWallpaperID(g_phnset_cntx_p->curtWpID, MMI_FALSE);
  2899.     
  2900.     #if defined(__MMI_SWFLASH__ ) && defined(__MMI_WALLPAPER_ON_BOTTOM__)
  2901.         if (PhnsetGetDisplayType(g_phnset_cntx_p->curtWpID) == PHNSET_TYPE_DISP_SWFLASH)
  2902.         {
  2903.             U16 default_id;
  2904.             mmi_dispchar_get_img_id(RESTORE_DEFAULT_FUNANDGAMES_SETWALLPAPER, &(default_id));            
  2905.             SetListWallpaperID(default_id);
  2906.         }
  2907.     #endif /* __MMI_SWFLASH__ */
  2908.     
  2909.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetSetWallpaperByImgID: Main, ID=%dn", g_phnset_cntx_p->curtWpID));
  2910.         if (g_idle_context.IsOnIdleScreen)
  2911.         {
  2912.             EntryIdleScreen();
  2913.         }
  2914.     }
  2915. #ifdef __MMI_SUB_WALLPAPER__
  2916.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  2917.     {
  2918.         g_phnset_cntx_p->curtSubWpID = imgID;
  2919.         mmi_dispchar_set_img_id(NVRAM_SETWALLPAPER_SUB, &(g_phnset_cntx_p->curtSubWpID));
  2920.         SUBLCD_SetIdleScreenWallpaperID(g_phnset_cntx_p->curtSubWpID);
  2921.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetSetWallpaperByImgID: sUB, ID=%dn",
  2922.                              g_phnset_cntx_p->curtSubWpID));
  2923.     }
  2924. #endif /* __MMI_SUB_WALLPAPER__ */ 
  2925.     else
  2926.     {
  2927.         MMI_ASSERT(0);
  2928.     }
  2929.     g_phnset_cntx_p->isCorrectSet = 1;
  2930. }
  2931. #ifdef __MMI_FILE_MANAGER__
  2932. /*****************************************************************************
  2933.  * FUNCTION
  2934.  *  PhnsetSetWallpaperByFileName
  2935.  * DESCRIPTION
  2936.  *  This function is to set current wallpaper using index by AT command
  2937.  * PARAMETERS
  2938.  *  path        [?]             
  2939.  *  a(?)        [IN/OUT]        
  2940.  *  b(?)        [IN]            U16 image ID
  2941.  * RETURNS
  2942.  *  void
  2943.  *****************************************************************************/
  2944. void PhnsetSetWallpaperByFileName(S8 *path)
  2945. {
  2946.     /*----------------------------------------------------------------*/
  2947.     /* Local Variables                                                */
  2948.     /*----------------------------------------------------------------*/
  2949.     S16 error;
  2950.     /*----------------------------------------------------------------*/
  2951.     /* Code Body                                                      */
  2952.     /*----------------------------------------------------------------*/
  2953.     g_phnset_cntx_p->isCorrectSet = 1;
  2954.     if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_WP)
  2955.     {
  2956.         if (g_phnset_cntx_p->isShort)
  2957.         {
  2958.             phnset_wpss_filename.isWPShort = 1;
  2959.         }
  2960.         else
  2961.         {
  2962.             phnset_wpss_filename.isWPShort = 0;
  2963.         }
  2964.         g_phnset_cntx_p->curtWpID = 0;
  2965.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetSetWallpaperByFileName: Main, isWPShort=%d, path=%sn",
  2966.                              phnset_wpss_filename.isWPShort, phnset_wpss_filename.wallpaper));
  2967.         pfnUnicodeStrcpy((S8*) phnset_wpss_filename.wallpaper, (S8*) path);
  2968.         mmi_dispchar_set_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  2969.         WriteRecord(NVRAM_EF_WPSS_FILENAME_LID, 1, &phnset_wpss_filename, sizeof(phnset_wpss_filename), &error);
  2970.         SetIdleScreenWallpaperName((UI_string_type) phnset_wpss_filename.wallpaper);
  2971.     #if defined(__MMI_SWFLASH__ ) && defined(__MMI_WALLPAPER_ON_BOTTOM__)
  2972.         if ((g_phnset_cntx_p->curtWpID == 0 && mmi_fmgr_get_file_group((PS8) phnset_wpss_filename.wallpaper) == FMGR_GROUP_SWFLASH) ||
  2973.             (g_phnset_cntx_p->curtWpID != 0 && PhnsetGetDisplayType(g_phnset_cntx_p->curtWpID) == PHNSET_TYPE_DISP_SWFLASH))
  2974.         {
  2975.             U16 default_id;
  2976.             mmi_dispchar_get_img_id(RESTORE_DEFAULT_FUNANDGAMES_SETWALLPAPER, &(default_id));            
  2977.             SetListWallpaperID(default_id);
  2978.         }
  2979.      else
  2980.     #endif /* __MMI_SWFLASH__ */
  2981.          wgui_save_wallpaper_to_speedup(MMI_FALSE);
  2982.         if (g_idle_context.IsOnIdleScreen)
  2983.         {
  2984.             EntryIdleScreen();
  2985.         }
  2986.     }
  2987. #ifdef __MMI_SUB_WALLPAPER__
  2988.     else if (g_phnset_cntx_p->wpss_type == MMI_PHNSET_TYPE_SUB_WP)
  2989.     {
  2990.         if (g_phnset_cntx_p->isShort)
  2991.         {
  2992.             phnset_wpss_sub_filename.isWPShort = 1;
  2993.         }
  2994.         else
  2995.         {
  2996.             phnset_wpss_sub_filename.isWPShort = 0;
  2997.         }
  2998.         g_phnset_cntx_p->curtSubWpID = 0;
  2999.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetSetWallpaperByFileName: Sub, isWPShort=%d, path=%sn",
  3000.                              phnset_wpss_sub_filename.isWPShort, phnset_wpss_sub_filename.wallpaper));
  3001.         pfnUnicodeStrcpy((S8*) phnset_wpss_sub_filename.wallpaper, (S8*) path);
  3002.         mmi_dispchar_set_img_id(NVRAM_SETWALLPAPER_SUB, &(g_phnset_cntx_p->curtSubWpID));
  3003.         WriteRecord(NVRAM_EF_WPSS_FILENAME_LID, 3, &phnset_wpss_sub_filename, sizeof(phnset_wpss_sub_filename), &error);
  3004.         SUBLCD_SetIdleScreenWallpaperName((UI_string_type) path);
  3005.         SUBLCD_UpdateWallpaper();
  3006.     }
  3007. #endif /* __MMI_SUB_WALLPAPER__ */ 
  3008.     else
  3009.     {
  3010.         MMI_ASSERT(0);
  3011.     }
  3012. }
  3013. #endif /* __MMI_FILE_MANAGER__ */
  3014. /*****************************************************************************
  3015.  * FUNCTION
  3016.  *  PhnsetSetDisplayFromAT
  3017.  * DESCRIPTION
  3018.  *  This function is to set current wallpaper using index by AT command
  3019.  * PARAMETERS
  3020.  *  idx         [IN]            
  3021.  *  type        [IN]            
  3022.  *  a(?)        [IN/OUT]        
  3023.  *  b(?)        [IN]            U16 image ID
  3024.  * RETURNS
  3025.  *  void
  3026.  *****************************************************************************/
  3027. BOOL PhnsetSetDisplayFromAT(U8 idx, U8 type)
  3028. {
  3029.     /*----------------------------------------------------------------*/
  3030.     /* Local Variables                                                */
  3031.     /*----------------------------------------------------------------*/
  3032.     U16 SysWpIDList[MAX_WALLPAPER_IMG];
  3033.     U8 max_idx = 0;
  3034.     /*----------------------------------------------------------------*/
  3035.     /* Code Body                                                      */
  3036.     /*----------------------------------------------------------------*/
  3037.     DisplayPopup(
  3038.                 (PU8) GetString(STR_GLOBAL_DONE),
  3039.                 IMG_GLOBAL_ACTIVATED,
  3040.                 1,
  3041.                 UI_POPUP_NOTIFYDURATION_TIME,
  3042.                 SUCCESS_TONE);
  3043.     
  3044.     switch (type)
  3045.     {
  3046.         case MMI_PHNSET_TYPE_WP:
  3047.     #ifdef __MMI_SUB_WALLPAPER__
  3048.         case MMI_PHNSET_TYPE_SUB_WP:
  3049.     #endif 
  3050.         {
  3051.             phnset_wpss_type_enum tmp_type = g_phnset_cntx_p->wpss_type;
  3052.             g_phnset_cntx_p->wpss_type = (phnset_wpss_type_enum) type;
  3053.             max_idx = PhnsetConstSysWallpaperList(NULL, SysWpIDList, NULL);
  3054.             g_phnset_cntx_p->wpss_type = tmp_type;
  3055.             if (idx < max_idx)  /* unsigned comparison with 0 is always true: '>=' */
  3056.             {
  3057.                 g_phnset_cntx_p->curtWpID = SysWpIDList[idx];
  3058.                 mmi_dispchar_set_img_id(NVRAM_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  3059.                 mmi_dispchar_set_img_id(RESTORE_DEFAULT_FUNANDGAMES_SETWALLPAPER, &(g_phnset_cntx_p->curtWpID));
  3060.                 SetIdleScreenWallpaperID(g_phnset_cntx_p->curtWpID, MMI_FALSE);
  3061.                 if (g_idle_context.IsOnIdleScreen)
  3062.                 {
  3063.                     EntryIdleScreen();
  3064.                 }
  3065.             }
  3066.             else
  3067.             {
  3068.                 return MMI_FALSE;
  3069.             }
  3070.         }
  3071.             break;
  3072.         case MMI_PHNSET_TYPE_SS:
  3073.         {
  3074.             max_idx = PhnsetConstSysScrSvrList(NULL, SysWpIDList, NULL);
  3075.             if (idx < max_idx)  /* unsigned comparison with 0 is always true: '>=' */
  3076.             {
  3077.                 g_phnset_cntx_p->curSsID = SysWpIDList[idx];
  3078.                 mmi_dispchar_set_img_id(NVRAM_CURRENT_SCREENSVER_ID, &(g_phnset_cntx_p->curSsID));
  3079.                 mmi_dispchar_set_img_id(RESTORE_DEFAULT_CURRENT_SCREENSVER_ID, &(g_phnset_cntx_p->curSsID));
  3080.             }
  3081.             else
  3082.             {
  3083.                 return MMI_FALSE;
  3084.             }
  3085.         }
  3086.             break;
  3087.     #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  3088.         case MMI_PHNSET_TYPE_PWRON:
  3089.         case MMI_PHNSET_TYPE_PWROFF:
  3090.         {
  3091.             phnset_wpss_type_enum tmp_type = g_phnset_cntx_p->wpss_type;
  3092.             g_phnset_cntx_p->wpss_type = (phnset_wpss_type_enum) type;
  3093.             max_idx = PhnsetConstSysPwrOnOffList(NULL, SysWpIDList, NULL);
  3094.             g_phnset_cntx_p->wpss_type = tmp_type;
  3095.             if (idx < max_idx)  /* unsigned comparison with 0 is always true: '>=' */
  3096.             {
  3097.                 if (type == MMI_PHNSET_TYPE_PWRON)
  3098.                 {
  3099.                     g_phnset_cntx_p->curtPwrOnID = SysWpIDList[idx];
  3100.                     mmi_dispchar_set_img_id(NVRAM_CURRENT_POWER_ON_DISPLAY, &(g_phnset_cntx_p->curtPwrOnID));
  3101.                     mmi_dispchar_set_img_id(NVRAM_RESTORE_POWER_ON_DISPLAY, &(g_phnset_cntx_p->curtPwrOnID));
  3102.                 }
  3103.                 else
  3104.                 {
  3105.                     g_phnset_cntx_p->curtPwrOffID = SysWpIDList[idx];
  3106.                     mmi_dispchar_set_img_id(NVRAM_CURRENT_POWER_OFF_DISPLAY, &(g_phnset_cntx_p->curtPwrOffID));
  3107.                     mmi_dispchar_set_img_id(NVRAM_RESTORE_POWER_OFF_DISPLAY, &(g_phnset_cntx_p->curtPwrOffID));
  3108.                 }
  3109.             }
  3110.             else
  3111.             {
  3112.                 return MMI_FALSE;
  3113.             }
  3114.         }
  3115.             break;
  3116.     #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  3117.     }
  3118.     return MMI_TRUE;
  3119. }
  3120. /*****************************************************************************
  3121.  * FUNCTION
  3122.  *  PhnsetGetATDisplayBound
  3123.  * DESCRIPTION
  3124.  *  This function is to get index boundary by AT command
  3125.  * PARAMETERS
  3126.  *  void
  3127.  *  a(?)        [IN/OUT]        
  3128.  *  b(?)        [IN]            U16 image ID
  3129.  * RETURNS
  3130.  *  U8 boundary
  3131.  *****************************************************************************/
  3132. U8 PhnsetGetATDisplayBound(void)
  3133. {
  3134.     /*----------------------------------------------------------------*/
  3135.     /* Local Variables                                                */
  3136.     /*----------------------------------------------------------------*/
  3137.     /*----------------------------------------------------------------*/
  3138.     /* Code Body                                                      */
  3139.     /*----------------------------------------------------------------*/
  3140.     return MMI_PHNSET_TYPE_MAX + 3;
  3141. }
  3142. /*****************************************************************************
  3143.  * FUNCTION
  3144.  *  PhnsetGetWallpaperIdxBound
  3145.  * DESCRIPTION
  3146.  *  This function is to get index boundary by AT command
  3147.  * PARAMETERS
  3148.  *  void
  3149.  *  a(?)        [IN/OUT]        
  3150.  *  b(?)        [IN]            U16 image ID
  3151.  * RETURNS
  3152.  *  U8 boundary
  3153.  *****************************************************************************/
  3154. U8 PhnsetGetWallpaperIdxBound()
  3155. {
  3156.     /*----------------------------------------------------------------*/
  3157.     /* Local Variables                                                */
  3158.     /*----------------------------------------------------------------*/
  3159.     DYNIMAGEINFO *Info;
  3160.     /*----------------------------------------------------------------*/
  3161.     /* Code Body                                                      */
  3162.     /*----------------------------------------------------------------*/
  3163.     return (MAX_WALLPAPER_IMG + GetFullScreenFactoryImagesInfo(&Info));
  3164. }
  3165. #ifdef __MMI_THEMES_V2_SUPPORT__
  3166. /*****************************************************************************
  3167.  * FUNCTION
  3168.  *  PhnsetIsWPCurrentTheme
  3169.  * DESCRIPTION
  3170.  *  To check if the wallpaper is the current theme.
  3171.  * PARAMETERS
  3172.  *  void
  3173.  * RETURNS
  3174.  *  
  3175.  *****************************************************************************/
  3176. BOOL PhnsetIsWPCurrentTheme(void)
  3177. {
  3178.     /*----------------------------------------------------------------*/
  3179.     /* Local Variables                                                */
  3180.     /*----------------------------------------------------------------*/
  3181.     /*----------------------------------------------------------------*/
  3182.     /* Code Body                                                      */
  3183.     /*----------------------------------------------------------------*/
  3184.     if (g_phnset_cntx_p->curtWpID == IMG_ID_DISPCHAR_THEME_WALLPAPER)
  3185.     {
  3186.         return TRUE;
  3187.     }
  3188.     else
  3189.     {
  3190.         return FALSE;
  3191.     }
  3192. }
  3193. #endif /* __MMI_THEMES_V2_SUPPORT__ */ 
  3194. #ifdef __USB_IN_NORMAL_MODE__
  3195. /*****************************************************************************
  3196.  * FUNCTION
  3197.  *  PhnsetWPUseDefault
  3198.  * DESCRIPTION
  3199.  *  Use default build-in wallpaper
  3200.  * PARAMETERS
  3201.  *  void
  3202.  * RETURNS
  3203.  *  void
  3204.  *****************************************************************************/
  3205. void PhnsetWPUseDefault(void)
  3206. {
  3207. #ifdef __MMI_FILE_MANAGER__
  3208.     /*----------------------------------------------------------------*/
  3209.     /* Local Variables                                                */
  3210.     /*----------------------------------------------------------------*/
  3211.     PHNSET_TYPE_DISP type;
  3212.     /*----------------------------------------------------------------*/
  3213.     /* Code Body                                                      */
  3214.     /*----------------------------------------------------------------*/
  3215.     if ((type = PhnsetGetDisplayType(g_phnset_cntx_p->curtWpID)) == PHNSET_TYPE_DISP_USER
  3216.         && (mmi_usb_check_path_exported((S8*) phnset_wpss_filename.wallpaper)))
  3217.     {
  3218.         g_phnset_cntx_p->curtWpID = RstGetWallpaperImgIdDefault();
  3219.         SetIdleScreenWallpaperID(g_phnset_cntx_p->curtWpID, MMI_TRUE);
  3220.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWPUseDefault: Main, ID=%dn", g_phnset_cntx_p->curtWpID));
  3221.     }
  3222. #ifdef __MMI_SUB_WALLPAPER__
  3223.     if ((type = PhnsetGetDisplayType(g_phnset_cntx_p->curtSubWpID)) == PHNSET_TYPE_DISP_USER
  3224.         && (mmi_usb_check_path_exported((S8*) phnset_wpss_sub_filename.wallpaper)))
  3225.     {
  3226.         g_phnset_cntx_p->curtSubWpID = RstGetWallpaperSubImgIdDefault();
  3227.         SUBLCD_SetIdleScreenWallpaperID(g_phnset_cntx_p->curtSubWpID);
  3228.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "PhnsetWPUseDefault: Main, ID=%dn", g_phnset_cntx_p->curtSubWpID));
  3229.     }
  3230. #endif /* __MMI_SUB_WALLPAPER__ */ 
  3231. #endif /* __MMI_FILE_MANAGER__ */
  3232. }
  3233. #endif /* __USB_IN_NORMAL_MODE__ */