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

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.  * Shortcuts.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements Shortcuts application.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  * removed!
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * removed!
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * removed!
  139.  *
  140.  * removed!
  141.  * removed!
  142.  * removed!
  143.  *
  144.  * removed!
  145.  * removed!
  146.  * removed!
  147.  *
  148.  * removed!
  149.  * removed!
  150.  * removed!
  151.  *
  152.  * removed!
  153.  * removed!
  154.  * removed!
  155.  *
  156.  * removed!
  157.  * removed!
  158.  * removed!
  159.  *
  160.  * removed!
  161.  * removed!
  162.  * removed!
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * removed!
  167.  *
  168.  *------------------------------------------------------------------------------
  169.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  170.  *============================================================================
  171.  ****************************************************************************/
  172. /**
  173.  * Copyright Notice
  174.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  175.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  176.  *  (It is illegal to remove this copyright notice from this software or any
  177.  *  portion of it)
  178.  */
  179. /**************************************************************
  180.    FILENAME : Shortcuts.c
  181.    PURPOSE     : Shortcuts Application
  182.    REMARKS     : nil
  183.    AUTHOR      : NEERAJ SHARMA
  184.    DATE     : May 12,03
  185. **************************************************************/
  186. #ifdef SHORTCUTS_APP
  187. #ifndef _MMI_SHORTCUTS_C
  188. #define _MMI_SHORTCUTS_C
  189. #include "MMI_features.h"
  190. #ifndef __DISABLE_SHORTCUTS_IMPL__
  191. /*  Include: MMI header file */
  192. #include "StdC.h"
  193. #include "l4Dr.h"
  194. #include "L4Dr1.h"
  195. #include "ShortcutsDefs.h"
  196. #include "CommonScreens.h"
  197. #include "ShortcutsProts.h"
  198. #include "MainMenuDef.h"
  199. #include "CustMenuRes.h"
  200. #include "EventsDef.h"
  201. #include "CustDataRes.h"
  202. #include "EventsGprot.h"
  203. #include "HistoryGprot.h"
  204. #include "wgui_categories.h"
  205. #include "wgui_softkeys.h"
  206. #include "Unicodexdcl.h"
  207. #include "DebugInitDef.h"
  208. #include "WrapperGprot.h"
  209. #include "TimerEvents.h"
  210. #include "NVRAMEnum.h"
  211. #include "NVRAMProt.h"
  212. #include "NVRAMType.h"
  213. #include "IdleAppDef.h"
  214. #include "ProfileGprots.h"
  215. #include "GlobalDefs.h"
  216. #include "AudioInc.h"
  217. #include "MessagesResourceData.h"
  218. #include "SettingDefs.h"
  219. #include "CallHistoryMain.h"    /* CHISTResetCallLogIndex */
  220. #include "MMI_trc.h"
  221. /*
  222.  * Define
  223.  */
  224. /* 
  225.  * Typedef 
  226.  */
  227. /* 
  228.  * Global Variable
  229.  */
  230. shct_context_struct g_shct_cntx;
  231. /* 
  232.  * Global Function
  233.  */
  234. extern MMI_BOOL mmi_frm_test_menu_item_hide(U16 menu_item_id);
  235. /*
  236.  * Local Variable
  237.  */
  238. /* 
  239.  * Local Function
  240.  */
  241. void ShctSelOption(void);
  242. void EntryShctOptionScreen(void);
  243. void HighlightShctOption(S32 index);
  244. void ShctDeleteItem(void);
  245. void ShctShowPopupScreen(U16 Msg);
  246. void ShctChangeState(U8 state);
  247. void HighlightShctOptionAdd(void);
  248. void HighlightShctOptionEdit(void);
  249. void HighlightShctOptionDelete(void);
  250. void HighlightShctOptionDeleteAll(void);
  251. void HighlightShctOptionEnable(void);
  252. void HighlightShctOptionDisable(void);
  253. void HighlightShctOptionChangeOrder(void);
  254. void ShctSetOrder(void);
  255. extern CUSTOM_MENU *nCustMenus;
  256. extern hiliteInfo maxHiliteInfo[MAX_HILITE_HANDLER];    /* available hilite func ptrs */
  257. /* retrieve shortcut from custom folder */
  258. extern const U16 gShctCandList[];
  259. extern const U16 gShctDefaultList[];
  260. extern const U8 gShctDefaultState[];
  261. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  262. extern U16 gShctDefaultDediList[];
  263. #endif 
  264. #if 0
  265. /* under construction !*/
  266. /* under construction !*/
  267. /* under construction !*/
  268. /* under construction !*/
  269. #endif /* 0 */ 
  270. /*****************************************************************************
  271.  * FUNCTION
  272.  *  ShctInit
  273.  * DESCRIPTION
  274.  *  Initialises variables & Protocol Handlers for Shortcuts
  275.  * PARAMETERS
  276.  *  void
  277.  * RETURNS
  278.  *  void
  279.  *****************************************************************************/
  280. void ShctInit(void)
  281. {
  282.     /*----------------------------------------------------------------*/
  283.     /* Local Variables                                                */
  284.     /*----------------------------------------------------------------*/
  285.     /*----------------------------------------------------------------*/
  286.     /* Code Body                                                      */
  287.     /*----------------------------------------------------------------*/
  288.     ShctGetCandidateList();
  289.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_ADD_MENUID, HighlightShctOptionAdd);
  290.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID, HighlightShctOptionEdit);
  291.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID, HighlightShctOptionDelete);
  292.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_DELETEALL_MENUID, HighlightShctOptionDeleteAll);
  293.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID, HighlightShctOptionEnable);
  294.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID, HighlightShctOptionDisable);
  295.     SetHiliteHandler(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID, HighlightShctOptionChangeOrder);
  296.     ShctReadFromNvram();
  297. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  298.     g_shct_cntx.IsKeyRetrieving = FALSE;
  299.     ShctReadDedicatedListFromNVRAM();
  300. #endif /* defined(__MMI_DEDICATED_KEY_SHORTCUTS__) */ 
  301. }
  302. /*****************************************************************************
  303.  * FUNCTION
  304.  *  ShctWriteToNvram
  305.  * DESCRIPTION
  306.  *  Write shortcut data to NVRAM.
  307.  * PARAMETERS
  308.  *  void
  309.  * RETURNS
  310.  *  void
  311.  *****************************************************************************/
  312. void ShctWriteToNvram(void)
  313. {
  314.     /*----------------------------------------------------------------*/
  315.     /* Local Variables                                                */
  316.     /*----------------------------------------------------------------*/
  317.     U8 nvramData[SHCT_NVRAM_SIZE];
  318.     S16 error;
  319.     /*----------------------------------------------------------------*/
  320.     /* Code Body                                                      */
  321.     /*----------------------------------------------------------------*/
  322.     memset(nvramData, 0xff, sizeof(nvramData));
  323.     nvramData[SHCT_COUNT_BYTE] = g_shct_cntx.NumSelShct;
  324.     nvramData[SHCT_INTEGRITY_BYTE] = 1;
  325.     memcpy(
  326.         (void*)&nvramData[SHCT_DATA_BYTE],
  327.         (void*)&g_shct_cntx.SelShctList,
  328.         sizeof(shct_item_struct) * g_shct_cntx.NumSelShct);
  329.     WriteRecord(NVRAM_EF_SHORTCUTS_LID, 1, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
  330. }
  331. /*****************************************************************************
  332.  * FUNCTION
  333.  *  ShctGetCandidateList
  334.  * DESCRIPTION
  335.  *  Get candidate list of shortcuts.
  336.  * PARAMETERS
  337.  *  void
  338.  * RETURNS
  339.  *  void
  340.  *****************************************************************************/
  341. void ShctGetCandidateList()
  342. {
  343.     /*----------------------------------------------------------------*/
  344.     /* Local Variables                                                */
  345.     /*----------------------------------------------------------------*/
  346.     S32 i;
  347.     S32 count = (S32) shct_max_list_cand;
  348.     /*----------------------------------------------------------------*/
  349.     /* Code Body                                                      */
  350.     /*----------------------------------------------------------------*/
  351.     g_shct_cntx.NumCandShct = 0;
  352.     for (i = 0; i < count; i++)
  353.         if (maxHiliteInfo[gShctCandList[i]].entryFuncPtr)
  354.         {
  355.             g_shct_cntx.CandShctList[g_shct_cntx.NumCandShct++] = gShctCandList[i];
  356.         }
  357. }
  358. /*****************************************************************************
  359.  * FUNCTION
  360.  *  ShctReadFromNvram
  361.  * DESCRIPTION
  362.  *  Read shortcut data from NVRAM and initialize selected shortcut list.
  363.  * PARAMETERS
  364.  *  void
  365.  * RETURNS
  366.  *  void
  367.  *****************************************************************************/
  368. void ShctReadFromNvram(void)
  369. {
  370.     /*----------------------------------------------------------------*/
  371.     /* Local Variables                                                */
  372.     /*----------------------------------------------------------------*/
  373.     S8 j, total, index = 0;
  374.     U8 nvramData[SHCT_NVRAM_SIZE];
  375.     shct_item_struct menuID;
  376.     S16 error;
  377.     S8 shortcut_not_found = FALSE;
  378.     /*----------------------------------------------------------------*/
  379.     /* Code Body                                                      */
  380.     /*----------------------------------------------------------------*/
  381.     ReadRecord(NVRAM_EF_SHORTCUTS_LID, 1, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
  382.     if (nvramData[1] != 1)
  383.     {
  384.         nvramData[SHCT_COUNT_BYTE] = shct_list_default;
  385.         nvramData[SHCT_INTEGRITY_BYTE] = 1;
  386.         memcpy(
  387.             (void*)&nvramData[SHCT_DATA_BYTE],
  388.             (void*)&gShctDefaultList,
  389.             sizeof(shct_item_struct) * shct_list_default);
  390.         WriteRecord(NVRAM_EF_SHORTCUTS_LID, 1, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
  391.     }
  392.     total = nvramData[SHCT_COUNT_BYTE];
  393.     g_shct_cntx.Integrity = nvramData[SHCT_INTEGRITY_BYTE];
  394.     for (j = 0; j < total; j++)
  395.     {
  396.         memcpy(&menuID, &nvramData[j * sizeof(shct_item_struct) + SHCT_DATA_BYTE], sizeof(shct_item_struct));
  397.         if (maxHiliteInfo[menuID.shortcuts].entryFuncPtr)
  398.         {
  399.             g_shct_cntx.SelShctList[index++] = menuID;
  400.             error = menuID.shortcuts;
  401.         }
  402.         else
  403.         {
  404.             shortcut_not_found = TRUE;
  405.             MMI_TRACE((MMI_TRACE_G1_FRM, MMI_SHORTCUTS_NOT_FOUND, menuID.shortcuts));
  406.             break;
  407.         }
  408.     }
  409. #ifdef MMI_ON_HARDWARE_P
  410.     MMI_ASSERT(shortcut_not_found == FALSE);
  411. #endif 
  412.     g_shct_cntx.NumSelShct = index;
  413. }
  414. /*****************************************************************************
  415.  * FUNCTION
  416.  *  ShctMenuShortcut
  417.  * DESCRIPTION
  418.  *  Shortcut handler of selected menu item
  419.  * PARAMETERS
  420.  *  index       [IN]        
  421.  *  a(?)        [IN]        Index of menu item
  422.  * RETURNS
  423.  *  void
  424.  *****************************************************************************/
  425. void ShctMenuShortcut(S32 index)
  426. {
  427.     /*----------------------------------------------------------------*/
  428.     /* Local Variables                                                */
  429.     /*----------------------------------------------------------------*/
  430.     /*----------------------------------------------------------------*/
  431.     /* Code Body                                                      */
  432.     /*----------------------------------------------------------------*/
  433.     if (index >= 0 && index < g_shct_cntx.NumSelShct)
  434.     {
  435.         execute_left_softkey_function(KEY_EVENT_UP);
  436.     }
  437. }
  438. /*****************************************************************************
  439.  * FUNCTION
  440.  *  EntryShctInIdle
  441.  * DESCRIPTION
  442.  *  Display shorcut list in IDLE screen.
  443.  * PARAMETERS
  444.  *  void
  445.  * RETURNS
  446.  *  void
  447.  *****************************************************************************/
  448. void EntryShctInIdle(void)
  449. {
  450.     /*----------------------------------------------------------------*/
  451.     /* Local Variables                                                */
  452.     /*----------------------------------------------------------------*/
  453.     U8 i, index = 0;
  454.     U8 *guiBuffer;
  455.     /* U8 num=0; */
  456.     // #if 0
  457. #ifdef __MMI_TOUCH_SCREEN__
  458.     U16 ShortcutList[SHCT_MAX_LIST + 1];
  459. #else 
  460.     U16 ShortcutList[SHCT_MAX_LIST];
  461. #endif 
  462.     /*----------------------------------------------------------------*/
  463.     /* Code Body                                                      */
  464.     /*----------------------------------------------------------------*/
  465.     // #endif
  466.     for (i = 0; i < g_shct_cntx.NumSelShct; i++)
  467.     {
  468.         if (g_shct_cntx.SelShctList[i].shortcut_state == ENABLE_STATE)
  469.         {
  470.             ShortcutList[index++] = ShctGetStringID(g_shct_cntx.SelShctList[i].shortcuts);
  471.         }
  472.     }
  473. #ifdef __MMI_TOUCH_SCREEN__
  474.     /* Last Entry is always Calibration */
  475.     if (maxHiliteInfo[MENU_SETTING_CALIBRATION].entryFuncPtr)
  476.     {
  477.         g_shct_cntx.SelShctList[i].shortcuts = MENU_SETTING_CALIBRATION;
  478.         g_shct_cntx.SelShctList[i].shortcut_state = ENABLE_STATE;
  479.         ShortcutList[index++] = ShctGetStringID(MENU_SETTING_CALIBRATION);
  480.     }
  481. #endif /* __MMI_TOUCH_SCREEN__ */ 
  482.     EntryNewScreen(SCR_ID_SHCT_IDLE_SHORTCUT, NULL, EntryShctInIdle, NULL);
  483.     if (g_shct_cntx.CurrSelShct > g_shct_cntx.NumSelShct - 1)
  484.     {
  485.         g_shct_cntx.CurrSelShct = 0;
  486.     }
  487.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_IDLE_SHORTCUT);
  488.     RegisterHighlightHandler(HighlightShctSelShortcut);
  489.     if (index > 0)
  490.     {
  491.         ShowCategory15Screen(
  492.             SHORTCUTS_TITLE_STRING_ID,
  493.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  494.             STR_GLOBAL_OK,
  495.             IMG_GLOBAL_OK,
  496.             STR_GLOBAL_BACK,
  497.             IMG_GLOBAL_BACK,
  498.             index,
  499.             ShortcutList,
  500.             (U16*) gIndexIconsImageList,
  501.             LIST_MENU,
  502.             0,
  503.             guiBuffer);
  504.         SetLeftSoftkeyFunction(ShctExecSelectedShortcut, KEY_EVENT_UP);
  505.         SetKeyHandler(ShctExecSelectedShortcut, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  506.         register_menu_shortcut_selected(ShctMenuShortcut);
  507.     }
  508.     else
  509.     {
  510.         ShowCategory15Screen(
  511.             SHORTCUTS_TITLE_STRING_ID,
  512.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  513.             0,
  514.             0,
  515.             STR_GLOBAL_BACK,
  516.             IMG_GLOBAL_BACK,
  517.             index,
  518.             ShortcutList,
  519.             (U16*) gIndexIconsImageList,
  520.             LIST_MENU,
  521.             0,
  522.             guiBuffer);
  523.     }
  524.     CHISTResetCallLogIndex();
  525.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  526.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  527. }
  528. /*****************************************************************************
  529.  * FUNCTION
  530.  *  HighlightShctSelShortcut
  531.  * DESCRIPTION
  532.  *  Highlight handler for IDLE screen shortcut.
  533.  * PARAMETERS
  534.  *  index       [IN]        
  535.  * RETURNS
  536.  *  void
  537.  *****************************************************************************/
  538. void HighlightShctSelShortcut(S32 index)
  539. {
  540.     /*----------------------------------------------------------------*/
  541.     /* Local Variables                                                */
  542.     /*----------------------------------------------------------------*/
  543.     /*----------------------------------------------------------------*/
  544.     /* Code Body                                                      */
  545.     /*----------------------------------------------------------------*/
  546.     g_shct_cntx.CurrSelShct = (U8) index;
  547.     /*
  548.      * ChangeLeftSoftkey(STR_GLOBAL_OK,IMG_GLOBAL_OK);
  549.      * SetLeftSoftkeyFunction(ShctExecSelectedShortcut,KEY_EVENT_UP);
  550.      * SetKeyHandler(ShctExecSelectedShortcut,KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  551.      * 
  552.      * ChangeRightSoftkey(STR_GLOBAL_BACK,IMG_GLOBAL_BACK);
  553.      * SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
  554.      * SetKeyHandler(GoBackHistory,KEY_LEFT_ARROW,KEY_EVENT_DOWN);
  555.      */
  556. }
  557. /*****************************************************************************
  558.  * FUNCTION
  559.  *  HighlightShctOptionAdd
  560.  * DESCRIPTION
  561.  *  Highlight handler of add option
  562.  * PARAMETERS
  563.  *  void
  564.  * RETURNS
  565.  *  void
  566.  *****************************************************************************/
  567. void HighlightShctOptionAdd(void)
  568. {
  569.     /*----------------------------------------------------------------*/
  570.     /* Local Variables                                                */
  571.     /*----------------------------------------------------------------*/
  572.     /*----------------------------------------------------------------*/
  573.     /* Code Body                                                      */
  574.     /*----------------------------------------------------------------*/
  575.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ADD;
  576.     SetKeyHandler(ShctSelOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  577. }
  578. /*****************************************************************************
  579.  * FUNCTION
  580.  *  HighlightShctOptionEdit
  581.  * DESCRIPTION
  582.  *  Highlight handler of edit option
  583.  * PARAMETERS
  584.  *  void
  585.  * RETURNS
  586.  *  void
  587.  *****************************************************************************/
  588. void HighlightShctOptionEdit(void)
  589. {
  590.     /*----------------------------------------------------------------*/
  591.     /* Local Variables                                                */
  592.     /*----------------------------------------------------------------*/
  593.     /*----------------------------------------------------------------*/
  594.     /* Code Body                                                      */
  595.     /*----------------------------------------------------------------*/
  596.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_EDIT;
  597.     SetKeyHandler(ShctSelOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  598. }
  599. /*****************************************************************************
  600.  * FUNCTION
  601.  *  HighlightShctOptionDelete
  602.  * DESCRIPTION
  603.  *  Highlight handler of delete option
  604.  * PARAMETERS
  605.  *  void
  606.  * RETURNS
  607.  *  void
  608.  *****************************************************************************/
  609. void HighlightShctOptionDelete(void)
  610. {
  611.     /*----------------------------------------------------------------*/
  612.     /* Local Variables                                                */
  613.     /*----------------------------------------------------------------*/
  614.     /*----------------------------------------------------------------*/
  615.     /* Code Body                                                      */
  616.     /*----------------------------------------------------------------*/
  617.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DELETE;
  618.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  HighlightShctOptionDeleteAll
  623.  * DESCRIPTION
  624.  *  Highlight handler of delete all option
  625.  * PARAMETERS
  626.  *  void
  627.  * RETURNS
  628.  *  void
  629.  *****************************************************************************/
  630. void HighlightShctOptionDeleteAll(void)
  631. {
  632.     /*----------------------------------------------------------------*/
  633.     /* Local Variables                                                */
  634.     /*----------------------------------------------------------------*/
  635.     /*----------------------------------------------------------------*/
  636.     /* Code Body                                                      */
  637.     /*----------------------------------------------------------------*/
  638.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DELETE_ALL;
  639.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  640. }
  641. /*****************************************************************************
  642.  * FUNCTION
  643.  *  HighlightShctOptionEnable
  644.  * DESCRIPTION
  645.  *  Highlight handler of delete all option
  646.  * PARAMETERS
  647.  *  void
  648.  * RETURNS
  649.  *  void
  650.  *****************************************************************************/
  651. void HighlightShctOptionEnable(void)
  652. {
  653.     /*----------------------------------------------------------------*/
  654.     /* Local Variables                                                */
  655.     /*----------------------------------------------------------------*/
  656.     /*----------------------------------------------------------------*/
  657.     /* Code Body                                                      */
  658.     /*----------------------------------------------------------------*/
  659.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ENABLE;
  660.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  661. }
  662. /*****************************************************************************
  663.  * FUNCTION
  664.  *  HighlightShctOptionDisable
  665.  * DESCRIPTION
  666.  *  Highlight handler of delete all option
  667.  * PARAMETERS
  668.  *  void
  669.  * RETURNS
  670.  *  void
  671.  *****************************************************************************/
  672. void HighlightShctOptionDisable(void)
  673. {
  674.     /*----------------------------------------------------------------*/
  675.     /* Local Variables                                                */
  676.     /*----------------------------------------------------------------*/
  677.     /*----------------------------------------------------------------*/
  678.     /* Code Body                                                      */
  679.     /*----------------------------------------------------------------*/
  680.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DISABLE;
  681.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  682. }
  683. /*****************************************************************************
  684.  * FUNCTION
  685.  *  HighlightShctOptionChangeOrder
  686.  * DESCRIPTION
  687.  *  Highlight handler of change order
  688.  * PARAMETERS
  689.  *  void
  690.  * RETURNS
  691.  *  void
  692.  *****************************************************************************/
  693. void HighlightShctOptionChangeOrder(void)
  694. {
  695.     /*----------------------------------------------------------------*/
  696.     /* Local Variables                                                */
  697.     /*----------------------------------------------------------------*/
  698.     /*----------------------------------------------------------------*/
  699.     /* Code Body                                                      */
  700.     /*----------------------------------------------------------------*/
  701.     g_shct_cntx.CurrOptionShct = SHR_OPTIONS_CHANGE_ORDER;
  702.     SetKeyHandler(ShctSelOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  703. }
  704. /*****************************************************************************
  705.  * FUNCTION
  706.  *  ShctExecSelectedShortcut
  707.  * DESCRIPTION
  708.  *  Execute correspoding function of selected shortcuts.
  709.  * PARAMETERS
  710.  *  void
  711.  * RETURNS
  712.  *  void
  713.  *****************************************************************************/
  714. void ShctExecSelectedShortcut(void)
  715. {
  716.     /*----------------------------------------------------------------*/
  717.     /* Local Variables                                                */
  718.     /*----------------------------------------------------------------*/
  719.     U8 i = 0, count = 0;
  720.     /*----------------------------------------------------------------*/
  721.     /* Code Body                                                      */
  722.     /*----------------------------------------------------------------*/
  723.     SetCurrentProfileAsActivatedProfile();
  724.     while (count < g_shct_cntx.CurrSelShct + 1) /* search for nth enable shortcut item */
  725.     {
  726.         //if(g_shct_cntx.SelShctList[i++].shortcut_state== ENABLE_STATE)    //KP Jerry disable on 2007-1-8
  727.         {
  728.             count++;
  729.         }
  730.     }
  731.   i=count;     //KP Jerry add on 2007-1-8 
  732.   if(g_shct_cntx.SelShctList[i-1].shortcut_state== ENABLE_STATE)    //KP Jerry add on 2007-1-8
  733.   {     //KP Jerry add on 2007-1-8
  734.     (*maxHiliteInfo[g_shct_cntx.SelShctList[i - 1].shortcuts].entryFuncPtr) ();
  735.     g_shct_cntx.LSKFunc = get_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  736.     (*g_shct_cntx.LSKFunc) ();
  737.   }     //KP Jerry add on 2007-1-8
  738. //KP Jerry add on 2007-3-23 start
  739. #ifdef __MMI_TOUCH_SCREEN__
  740.   /* Last Entry is always Calibration */
  741.   if (i == (g_shct_cntx.NumSelShct+1))
  742.   {
  743.       (*maxHiliteInfo[MENU_SETTING_CALIBRATION].entryFuncPtr)();
  744.       g_shct_cntx.LSKFunc = get_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  745.       (*g_shct_cntx.LSKFunc) ();
  746.   }
  747. #endif /* __MMI_TOUCH_SCREEN__ */   
  748. //KP Jerry add on 2007-3-23 end
  749. }
  750. /*****************************************************************************
  751.  * FUNCTION
  752.  *  EntryShctInMainMenu
  753.  * DESCRIPTION
  754.  *  Execute correspoding function of selected shortcuts.
  755.  * PARAMETERS
  756.  *  void
  757.  * RETURNS
  758.  *  void
  759.  *****************************************************************************/
  760. void EntryShctInMainMenu(void)
  761. {
  762.     /*----------------------------------------------------------------*/
  763.     /* Local Variables                                                */
  764.     /*----------------------------------------------------------------*/
  765.     U8 i;
  766.     U8 *guiBuffer;
  767. #ifdef __MMI_TOUCH_SCREEN__
  768.     U16 ShortcutList[SHCT_MAX_LIST + 1];
  769.     U16 ShortcutStateIcon[SHCT_MAX_LIST + 1];
  770. #else /* __MMI_TOUCH_SCREEN__ */ 
  771.     U16 ShortcutList[SHCT_MAX_LIST];
  772.     U16 ShortcutStateIcon[SHCT_MAX_LIST];
  773. #endif /* __MMI_TOUCH_SCREEN__ */ 
  774.     /*----------------------------------------------------------------*/
  775.     /* Code Body                                                      */
  776.     /*----------------------------------------------------------------*/
  777.     EntryNewScreen(SCR_ID_SHCT_MAIN_MENU, NULL, EntryShctInMainMenu, NULL);
  778.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_MAIN_MENU);
  779.     for (i = 0; i < g_shct_cntx.NumSelShct; i++)
  780.     {
  781.         ShortcutList[i] = ShctGetStringID(g_shct_cntx.SelShctList[i].shortcuts);
  782.         if (g_shct_cntx.SelShctList[i].shortcut_state == ENABLE_STATE)
  783.         {
  784.             ShortcutStateIcon[i] = CHECKBOX_ON_IMAGE_ID;
  785.         }
  786.         else
  787.         {
  788.             ShortcutStateIcon[i] = CHECKBOX_OFF_IMAGE_ID;
  789.         }
  790.     }
  791. #ifdef __MMI_TOUCH_SCREEN__
  792.     /* Last Entry is always Calibration */
  793.     if (maxHiliteInfo[MENU_SETTING_CALIBRATION].entryFuncPtr)
  794.     {
  795.         ShortcutList[i] = ShctGetStringID(MENU_SETTING_CALIBRATION);
  796.         ShortcutStateIcon[i++] = CHECKBOX_ON_IMAGE_ID;
  797.     }
  798.     if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID))
  799.     {
  800.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
  801.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
  802.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
  803.     }
  804. #endif /* __MMI_TOUCH_SCREEN__ */ 
  805.     if (g_shct_cntx.CurrSelShct > g_shct_cntx.NumSelShct - 1)
  806.     {
  807.         g_shct_cntx.CurrSelShct = 0;
  808.     }
  809.     if (i == 0)
  810.     {
  811.         g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ADD;
  812.         ShowCategory15Screen(
  813.             MAIN_MENU_SHORTCUTS_TEXT,
  814.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  815.             STR_GLOBAL_ADD,
  816.             0,
  817.             STR_GLOBAL_BACK,
  818.             IMG_GLOBAL_BACK,
  819.             i,
  820.             ShortcutList,
  821.             (U16*) ShortcutStateIcon,
  822.             LIST_MENU,
  823.             0,
  824.             guiBuffer);
  825.         SetLeftSoftkeyFunction(EntryShctEditScreen, KEY_EVENT_UP);
  826.         SetKeyHandler(EntryShctEditScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  827.     }
  828.     else
  829.     {
  830.         RegisterHighlightHandler(ShortcutsMenuIndex);
  831.         ShowCategory15Screen(
  832.             MAIN_MENU_SHORTCUTS_TEXT,
  833.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  834.             STR_GLOBAL_OPTIONS,
  835.             IMG_GLOBAL_OPTIONS,
  836.             STR_GLOBAL_BACK,
  837.             IMG_GLOBAL_BACK,
  838.             i,
  839.             ShortcutList,
  840.             (U16*) ShortcutStateIcon,
  841.             LIST_MENU,
  842.             0,
  843.             guiBuffer);
  844.         SetLeftSoftkeyFunction(EntryShctOptionScreen, KEY_EVENT_UP);
  845.         SetKeyHandler(EntryShctOptionScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  846.         SetKeyHandler(ShctExecSelectedShortcut,KEY_ENTER,KEY_EVENT_DOWN);  //KP Jerry add for can execute corresponding shortcut function on 2006-12-2
  847.         SetKeyHandler(ShctExecSelectedShortcut,KEY_SEND,KEY_EVENT_DOWN);  //KP Jerry add for can execute corresponding shortcut function on 2006-12-2
  848.     }
  849.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  850.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  851. }
  852. /*****************************************************************************
  853.  * FUNCTION
  854.  *  ShortcutsMenuIndex
  855.  * DESCRIPTION
  856.  *  Execute correspoding function of selected shortcuts.
  857.  * PARAMETERS
  858.  *  index       [IN]        
  859.  * RETURNS
  860.  *  void
  861.  *****************************************************************************/
  862. void ShortcutsMenuIndex(S32 index)
  863. {
  864. #ifdef __MMI_TOUCH_SCREEN__
  865.     /*----------------------------------------------------------------*/
  866.     /* Local Variables                                                */
  867.     /*----------------------------------------------------------------*/
  868.     /*----------------------------------------------------------------*/
  869.     /* Code Body                                                      */
  870.     /*----------------------------------------------------------------*/
  871.     if (index == g_shct_cntx.NumSelShct)
  872.     {
  873.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
  874.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
  875.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
  876.     }
  877.     else if (g_shct_cntx.CurrSelShct == g_shct_cntx.NumSelShct)
  878.     {
  879.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
  880.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
  881.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
  882.     }
  883. #endif /* __MMI_TOUCH_SCREEN__ */ 
  884.     g_shct_cntx.CurrSelShct = (U8) index;
  885. }
  886. /*****************************************************************************
  887.  * FUNCTION
  888.  *  ShctResetOptions
  889.  * DESCRIPTION
  890.  *  Execute correspoding function of selected shortcuts.
  891.  * PARAMETERS
  892.  *  void
  893.  * RETURNS
  894.  *  void
  895.  *****************************************************************************/
  896. void ShctResetOptions(void)
  897. {
  898.     /*----------------------------------------------------------------*/
  899.     /* Local Variables                                                */
  900.     /*----------------------------------------------------------------*/
  901.     /*----------------------------------------------------------------*/
  902.     /* Code Body                                                      */
  903.     /*----------------------------------------------------------------*/
  904.     if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID))
  905.     {
  906.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
  907.     }
  908.     if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID))
  909.     {
  910.         mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
  911.     }
  912. }
  913. /*****************************************************************************
  914.  * FUNCTION
  915.  *  EntryShctOptionScreen
  916.  * DESCRIPTION
  917.  *  Entry the option screen of shortcuts
  918.  * PARAMETERS
  919.  *  void
  920.  * RETURNS
  921.  *  void
  922.  *****************************************************************************/
  923. void EntryShctOptionScreen(void)
  924. {
  925.     /*----------------------------------------------------------------*/
  926.     /* Local Variables                                                */
  927.     /*----------------------------------------------------------------*/
  928.     U16 OptionShortcutsIds[6];
  929.     U8 *guiBuffer;
  930.     U16 MenuId;
  931.     U16 nNumofItem; /* Stores no of children in the submenu */
  932.     /*----------------------------------------------------------------*/
  933.     /* Code Body                                                      */
  934.     /*----------------------------------------------------------------*/
  935.     EntryNewScreen(SCR_ID_SHCT_OPTION, NULL, EntryShctOptionScreen, NULL);
  936.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_OPTION);
  937.     ShctResetOptions();
  938.     if (g_shct_cntx.CurrOptionShct > SHR_OPTIONS_TOTAL)
  939.     {
  940.         g_shct_cntx.CurrOptionShct = 0;
  941.     }
  942.     MenuId = EXTRA_SHORTCUTS_OPTION_MENUID;
  943.     if (g_shct_cntx.NumSelShct >= SHCT_MAX_LIST)
  944.     {
  945.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ADD_MENUID);
  946.     }
  947. #ifdef __MMI_TOUCH_SCREEN__
  948.     if (g_shct_cntx.CurrSelShct == g_shct_cntx.NumSelShct)
  949.     {
  950.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
  951.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
  952.     }
  953.     else
  954. #endif /* __MMI_TOUCH_SCREEN__ */ 
  955.     if (g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcut_state == ENABLE_STATE)
  956.     {
  957.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
  958.     }
  959.     else
  960.     {
  961.         mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
  962.     }
  963.     nNumofItem = GetNumOfChild_Ext(MenuId);
  964.     GetSequenceStringIds_Ext(MenuId, OptionShortcutsIds);
  965.     SetParentHandler(MenuId);
  966.     RegisterHighlightHandler(ExecuteCurrHiliteHandler_Ext);
  967.     ShowCategory15Screen(
  968.         MAIN_MENU_SHORTCUTS_TEXT,
  969.         GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  970.         STR_GLOBAL_OK,
  971.         IMG_GLOBAL_OK,
  972.         STR_GLOBAL_BACK,
  973.         IMG_GLOBAL_BACK,
  974.         nNumofItem,
  975.         OptionShortcutsIds,
  976.         (U16*) gIndexIconsImageList,
  977.         LIST_MENU,
  978.         0,
  979.         guiBuffer);
  980.     SetLeftSoftkeyFunction(ShctSelOption, KEY_EVENT_UP);
  981.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  982.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  983. }
  984. /*****************************************************************************
  985.  * FUNCTION
  986.  *  EntryShctEditScreen
  987.  * DESCRIPTION
  988.  *  Execute correspoding function of selected shortcuts.
  989.  * PARAMETERS
  990.  *  void
  991.  * RETURNS
  992.  *  void
  993.  *****************************************************************************/
  994. void EntryShctEditScreen(void)
  995. {
  996.     /*----------------------------------------------------------------*/
  997.     /* Local Variables                                                */
  998.     /*----------------------------------------------------------------*/
  999.     U8 i;
  1000.     U8 highlighted = 0;
  1001.     U16 EditShortcutsIds[SHCT_MAX_CANDI_LIST];
  1002.     U8 *guiBuffer;
  1003.     /*----------------------------------------------------------------*/
  1004.     /* Code Body                                                      */
  1005.     /*----------------------------------------------------------------*/
  1006.     EntryNewScreen(SCR_ID_SHCT_EDIT, NULL, EntryShctEditScreen, NULL);
  1007.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_EDIT);
  1008.     for (i = 0; i < g_shct_cntx.NumCandShct; i++)
  1009.     {
  1010.         EditShortcutsIds[i] = ShctGetStringID(g_shct_cntx.CandShctList[i]);
  1011.         if (g_shct_cntx.CurrOptionShct == SHR_OPTIONS_EDIT)
  1012.         {
  1013.             if (guiBuffer == NULL)
  1014.                 if (g_shct_cntx.CandShctList[i] == g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcuts)
  1015.                 {
  1016.                     highlighted = i;
  1017.                 }
  1018.         }
  1019.     }
  1020.     RegisterHighlightHandler(HighlightShctEdit);
  1021.     ShowCategory1Screen(
  1022.         MAIN_MENU_SHORTCUTS_TEXT,
  1023.         GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  1024.         STR_GLOBAL_OK,
  1025.         IMG_GLOBAL_OK,
  1026.         STR_GLOBAL_BACK,
  1027.         IMG_GLOBAL_BACK,
  1028.         g_shct_cntx.NumCandShct,
  1029.         EditShortcutsIds,
  1030.         highlighted,
  1031.         guiBuffer);
  1032.     switch (g_shct_cntx.CurrOptionShct)
  1033.     {
  1034.         case SHR_OPTIONS_EDIT:
  1035.             g_shct_cntx.Order = g_shct_cntx.CurrSelShct + 1;
  1036.             SetLeftSoftkeyFunction(ShctSaveChanges, KEY_EVENT_UP);
  1037.             break;
  1038.         case SHR_OPTIONS_ADD:
  1039.             SetLeftSoftkeyFunction(ShctSetOrder, KEY_EVENT_UP);
  1040.             break;
  1041.         default:
  1042.             break;
  1043.     }
  1044.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1045.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1046. }
  1047. /*****************************************************************************
  1048.  * FUNCTION
  1049.  *  EntryShctDeleteScreen
  1050.  * DESCRIPTION
  1051.  *  Display confirmation screen for deleting one shortcut item.
  1052.  * PARAMETERS
  1053.  *  void
  1054.  * RETURNS
  1055.  *  void
  1056.  *****************************************************************************/
  1057. void EntryShctDeleteScreen(void)
  1058. {
  1059.     /*----------------------------------------------------------------*/
  1060.     /* Local Variables                                                */
  1061.     /*----------------------------------------------------------------*/
  1062.     /*----------------------------------------------------------------*/
  1063.     /* Code Body                                                      */
  1064.     /*----------------------------------------------------------------*/
  1065.     switch (g_shct_cntx.CurrOptionShct)
  1066.     {
  1067.         case SHR_OPTIONS_DELETE_ALL:
  1068.             DisplayConfirm(
  1069.                 STR_GLOBAL_YES,
  1070.                 IMG_GLOBAL_YES,
  1071.                 STR_GLOBAL_NO,
  1072.                 IMG_GLOBAL_NO,
  1073.                 get_string(STR_GLOBAL_DELETE_ALL),
  1074.                 IMG_GLOBAL_QUESTION,
  1075.                 WARNING_TONE);
  1076.             break;
  1077.         default:
  1078.             DisplayConfirm(
  1079.                 STR_GLOBAL_YES,
  1080.                 IMG_GLOBAL_YES,
  1081.                 STR_GLOBAL_NO,
  1082.                 IMG_GLOBAL_NO,
  1083.                 get_string(STR_GLOBAL_DELETE),
  1084.                 IMG_GLOBAL_QUESTION,
  1085.                 WARNING_TONE);
  1086.             break;
  1087.     }
  1088.     SetLeftSoftkeyFunction(ShctDeleteItem, KEY_EVENT_UP);
  1089.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1090. }
  1091. /*****************************************************************************
  1092.  * FUNCTION
  1093.  *  ShctDeleteItem
  1094.  * DESCRIPTION
  1095.  *  Display confirmation screen for deleting one shortcut item.
  1096.  * PARAMETERS
  1097.  *  void
  1098.  * RETURNS
  1099.  *  void
  1100.  *****************************************************************************/
  1101. void ShctDeleteItem(void)
  1102. {
  1103.     /*----------------------------------------------------------------*/
  1104.     /* Local Variables                                                */
  1105.     /*----------------------------------------------------------------*/
  1106.     /*----------------------------------------------------------------*/
  1107.     /* Code Body                                                      */
  1108.     /*----------------------------------------------------------------*/
  1109.     if (g_shct_cntx.Integrity == 1)
  1110.     {
  1111.         switch (g_shct_cntx.CurrOptionShct)
  1112.         {
  1113.             case SHR_OPTIONS_DELETE:
  1114.                 memcpy(
  1115.                     &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct],
  1116.                     &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct + 1],
  1117.                     (g_shct_cntx.NumSelShct - g_shct_cntx.CurrSelShct - 1) * sizeof(shct_item_struct));
  1118.                 g_shct_cntx.NumSelShct--;
  1119.                 break;
  1120.             case SHR_OPTIONS_DELETE_ALL:
  1121.                 g_shct_cntx.NumSelShct = 0;
  1122.                 break;
  1123.         }
  1124.         ShctWriteToNvram();
  1125.         if (g_shct_cntx.NumSelShct < SHCT_MAX_LIST)
  1126.         {
  1127.             mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_ADD_MENUID);
  1128.         }
  1129.         ShctShowPopupScreen(STR_GLOBAL_DONE);
  1130.     }
  1131.     else
  1132.     {
  1133.         DisplayPopup(
  1134.             (U8*) GetString(STR_GLOBAL_UNFINISHED),
  1135.             IMG_GLOBAL_UNFINISHED,
  1136.             0,
  1137.             UI_POPUP_NOTIFYDURATION_TIME,
  1138.             (U8) ERROR_TONE);
  1139.     }
  1140. }
  1141. /*****************************************************************************
  1142.  * FUNCTION
  1143.  *  ShctGetStringID
  1144.  * DESCRIPTION
  1145.  *  Return the string ID of a menu item.
  1146.  * PARAMETERS
  1147.  *  menu_id     [IN]        Index of a menu item.
  1148.  * RETURNS
  1149.  *  string index
  1150.  *****************************************************************************/
  1151. U16 ShctGetStringID(U16 menu_id)
  1152. {
  1153.     /*----------------------------------------------------------------*/
  1154.     /* Local Variables                                                */
  1155.     /*----------------------------------------------------------------*/
  1156.     /*----------------------------------------------------------------*/
  1157.     /* Code Body                                                      */
  1158.     /*----------------------------------------------------------------*/
  1159.     return nCustMenus[menu_id - 1].nStrId;
  1160. }
  1161. /*****************************************************************************
  1162.  * FUNCTION
  1163.  *  HighlightShctEdit
  1164.  * DESCRIPTION
  1165.  *  Highlight handler for edit shortcut screen
  1166.  * PARAMETERS
  1167.  *  index           [IN]        
  1168.  *  menu_id(?)      [IN]        Index of a menu item.
  1169.  * RETURNS
  1170.  *  string index(?)
  1171.  *****************************************************************************/
  1172. void HighlightShctEdit(S32 index)
  1173. {
  1174.     /*----------------------------------------------------------------*/
  1175.     /* Local Variables                                                */
  1176.     /*----------------------------------------------------------------*/
  1177.     /*----------------------------------------------------------------*/
  1178.     /* Code Body                                                      */
  1179.     /*----------------------------------------------------------------*/
  1180.     g_shct_cntx.CurrEditShct = (U8) index;
  1181. }
  1182. /*****************************************************************************
  1183.  * FUNCTION
  1184.  *  ATSetShortcuts
  1185.  * DESCRIPTION
  1186.  *  Set shortcutfrom AT command
  1187.  * PARAMETERS
  1188.  *  index       [?]         
  1189.  *  inde(?)     [IN]        List of shortcut index
  1190.  * RETURNS
  1191.  *  string index
  1192.  *****************************************************************************/
  1193. BOOL ATSetShortcuts(U8 *index)
  1194. {
  1195.     /*----------------------------------------------------------------*/
  1196.     /* Local Variables                                                */
  1197.     /*----------------------------------------------------------------*/
  1198.     U8 i;
  1199.     U8 ID;
  1200.     /*----------------------------------------------------------------*/
  1201.     /* Code Body                                                      */
  1202.     /*----------------------------------------------------------------*/
  1203.     if (index == NULL)
  1204.     {
  1205.         return MMI_FALSE;
  1206.     }
  1207.     for (i = 0; i < SHCT_MAX_LIST; i++)
  1208.     {
  1209.         ID = index[i] - 1;
  1210.         if (ID < g_shct_cntx.NumCandShct)
  1211.         {
  1212.             g_shct_cntx.SelShctList[i].shortcuts = g_shct_cntx.CandShctList[ID];
  1213.         }
  1214.     }
  1215.     ShctWriteToNvram();
  1216.     return MMI_TRUE;
  1217. }
  1218. /*****************************************************************************
  1219.  * FUNCTION
  1220.  *  ShctSelOption
  1221.  * DESCRIPTION
  1222.  *  select option of shortcut item
  1223.  * PARAMETERS
  1224.  *  void
  1225.  *  index(?)        [IN]        List of shortcut index
  1226.  * RETURNS
  1227.  *  string index(?)
  1228.  *****************************************************************************/
  1229. void ShctSelOption(void)
  1230. {
  1231.     /*----------------------------------------------------------------*/
  1232.     /* Local Variables                                                */
  1233.     /*----------------------------------------------------------------*/
  1234.     /*----------------------------------------------------------------*/
  1235.     /* Code Body                                                      */
  1236.     /*----------------------------------------------------------------*/
  1237.     switch (g_shct_cntx.CurrOptionShct)
  1238.     {
  1239.         case SHR_OPTIONS_EDIT:
  1240.             EntryShctEditScreen();
  1241.             break;
  1242.         case SHR_OPTIONS_ADD:
  1243.             if (g_shct_cntx.NumSelShct < SHCT_MAX_LIST)
  1244.             {
  1245.                 EntryShctEditScreen();
  1246.             }
  1247.             else
  1248.             {
  1249.                 ShctShowPopupScreen(SHORTCUTS_FULL_MSG_STRING_ID);
  1250.             }
  1251.             break;
  1252.         case SHR_OPTIONS_DELETE:
  1253.         case SHR_OPTIONS_DELETE_ALL:
  1254.             EntryShctDeleteScreen();
  1255.             break;
  1256.         case SHR_OPTIONS_ENABLE:
  1257.             ShctChangeState((U8) ENABLE_STATE);
  1258.             break;
  1259.         case SHR_OPTIONS_DISABLE:
  1260.             ShctChangeState((U8) DISABLE_STATE);
  1261.             break;
  1262.         case SHR_OPTIONS_CHANGE_ORDER:
  1263.             ShctSetOrder();
  1264.             break;
  1265.         default:
  1266.             break;
  1267.     }
  1268. }
  1269. /*****************************************************************************
  1270.  * FUNCTION
  1271.  *  ShctChangeState
  1272.  * DESCRIPTION
  1273.  *  Display confirmation screen for changing the state of the shortcut item.
  1274.  * PARAMETERS
  1275.  *  state       [IN]        
  1276.  * RETURNS
  1277.  *  void
  1278.  *****************************************************************************/
  1279. void ShctChangeState(U8 state)
  1280. {
  1281.     /*----------------------------------------------------------------*/
  1282.     /* Local Variables                                                */
  1283.     /*----------------------------------------------------------------*/
  1284.     /*----------------------------------------------------------------*/
  1285.     /* Code Body                                                      */
  1286.     /*----------------------------------------------------------------*/
  1287.     if (g_shct_cntx.Integrity == 1)
  1288.     {
  1289.         g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcut_state = state;
  1290.         ShctWriteToNvram();
  1291.         ShctShowPopupScreen(STR_GLOBAL_DONE);
  1292.     }
  1293.     else
  1294.     {
  1295.         DisplayPopup(
  1296.             (U8*) GetString(STR_GLOBAL_UNFINISHED),
  1297.             IMG_GLOBAL_UNFINISHED,
  1298.             0,
  1299.             UI_POPUP_NOTIFYDURATION_TIME,
  1300.             (U8) ERROR_TONE);
  1301.     }
  1302. }
  1303. /*****************************************************************************
  1304.  * FUNCTION
  1305.  *  ShctSetOrder
  1306.  * DESCRIPTION
  1307.  *  Set the shortcuts order
  1308.  * PARAMETERS
  1309.  *  void
  1310.  *  index(?)        [IN]        List of shortcut index
  1311.  * RETURNS
  1312.  *  string index(?)
  1313.  *****************************************************************************/
  1314. void ShctSetOrder(void)
  1315. {
  1316.     /*----------------------------------------------------------------*/
  1317.     /* Local Variables                                                */
  1318.     /*----------------------------------------------------------------*/
  1319.     PU8 guiBuffer;
  1320.     /*----------------------------------------------------------------*/
  1321.     /* Code Body                                                      */
  1322.     /*----------------------------------------------------------------*/
  1323.     g_shct_cntx.Order = g_shct_cntx.CurrSelShct + 1;
  1324.     EntryNewScreen(SCR_ID_SHCT_ORDER, NULL, ShctSetOrder, NULL);
  1325.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_ORDER);
  1326.     if (g_shct_cntx.CurrOptionShct == SHR_OPTIONS_ADD)
  1327.     {
  1328.         ShowCategory87Screen(
  1329.             SHORTCUTS_CHANGE_ORDER_STRING_ID,
  1330.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  1331.             STR_GLOBAL_OK,
  1332.             IMG_GLOBAL_OK,
  1333.             STR_GLOBAL_BACK,
  1334.             IMG_GLOBAL_BACK,
  1335.             1,
  1336.             (S32) (g_shct_cntx.NumSelShct + 1),
  1337.             &g_shct_cntx.Order,
  1338.             guiBuffer);
  1339.     }
  1340.     else
  1341.     {
  1342.         ShowCategory87Screen(
  1343.             SHORTCUTS_CHANGE_ORDER_STRING_ID,
  1344.             GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
  1345.             STR_GLOBAL_OK,
  1346.             IMG_GLOBAL_OK,
  1347.             STR_GLOBAL_BACK,
  1348.             IMG_GLOBAL_BACK,
  1349.             1,
  1350.             (S32) (g_shct_cntx.NumSelShct),
  1351.             &g_shct_cntx.Order,
  1352.             guiBuffer);
  1353.     }
  1354.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1355.     SetLeftSoftkeyFunction(ShctSaveChanges, KEY_EVENT_UP);
  1356. }
  1357. /*****************************************************************************
  1358.  * FUNCTION
  1359.  *  ShctSaveChanges
  1360.  * DESCRIPTION
  1361.  *  Save change of shorcut
  1362.  * PARAMETERS
  1363.  *  void
  1364.  *  index(?)        [IN]        List of shortcut index
  1365.  * RETURNS
  1366.  *  string index(?)
  1367.  *****************************************************************************/
  1368. void ShctSaveChanges(void)
  1369. {
  1370.     /*----------------------------------------------------------------*/
  1371.     /* Local Variables                                                */
  1372.     /*----------------------------------------------------------------*/
  1373.     S32 i = 0;
  1374.     shct_item_struct temp;
  1375.     /*----------------------------------------------------------------*/
  1376.     /* Code Body                                                      */
  1377.     /*----------------------------------------------------------------*/
  1378.     switch (g_shct_cntx.CurrOptionShct)
  1379.     {
  1380.         case SHR_OPTIONS_EDIT:
  1381.             g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcuts =
  1382.                 g_shct_cntx.CandShctList[g_shct_cntx.CurrEditShct];
  1383.             break;
  1384.         case SHR_OPTIONS_CHANGE_ORDER:
  1385.             temp = g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct];
  1386.             if (g_shct_cntx.Order < g_shct_cntx.CurrSelShct + 1)
  1387.             {
  1388.                 /* move (order-1) ~ (current select item-1) to next position */
  1389.                 for (i = g_shct_cntx.CurrSelShct; i >= g_shct_cntx.Order; i--)
  1390.                 {
  1391.                     memcpy(&g_shct_cntx.SelShctList[i], &g_shct_cntx.SelShctList[i - 1], sizeof(shct_item_struct));
  1392.                 }
  1393.             }
  1394.             else
  1395.             {
  1396.                 memcpy(
  1397.                     &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct],
  1398.                     &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct + 1],
  1399.                     sizeof(shct_item_struct) * (g_shct_cntx.Order - (g_shct_cntx.CurrSelShct + 1)));
  1400.             }
  1401.             g_shct_cntx.SelShctList[g_shct_cntx.Order - 1] = temp;
  1402.             g_shct_cntx.CurrSelShct = g_shct_cntx.Order - 1;
  1403.             break;
  1404.         case SHR_OPTIONS_ADD:
  1405.             for (i = g_shct_cntx.NumSelShct - 1; i >= g_shct_cntx.Order - 1; i--)
  1406.             {
  1407.                 memcpy(&g_shct_cntx.SelShctList[i + 1], &g_shct_cntx.SelShctList[i], sizeof(shct_item_struct));
  1408.             }
  1409.             g_shct_cntx.SelShctList[g_shct_cntx.Order - 1].shortcuts =
  1410.                 g_shct_cntx.CandShctList[g_shct_cntx.CurrEditShct];
  1411.             g_shct_cntx.SelShctList[g_shct_cntx.Order - 1].shortcut_state = ENABLE_STATE;
  1412.             g_shct_cntx.NumSelShct++;
  1413.             break;
  1414.         default:
  1415.             break;
  1416.     }
  1417.     ShctWriteToNvram();
  1418.     DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, 2000, SUCCESS_TONE);
  1419.     DeleteUptoScrID(SCR_ID_SHCT_MAIN_MENU);
  1420. }
  1421. /*****************************************************************************
  1422.  * FUNCTION
  1423.  *  ShctShowPopupScreen
  1424.  * DESCRIPTION
  1425.  *  Display popup screen with corresponding messages.
  1426.  * PARAMETERS
  1427.  *  Msg     [IN]        Enum value of message type.
  1428.  * RETURNS
  1429.  *  void
  1430.  *****************************************************************************/
  1431. void ShctShowPopupScreen(U16 Msg)
  1432. {
  1433.     /*----------------------------------------------------------------*/
  1434.     /* Local Variables                                                */
  1435.     /*----------------------------------------------------------------*/
  1436.     U16 ScreenToShow;
  1437.     U16 ScreenImageId;
  1438.     ALL_TONE_ENUM ScreenTone;
  1439.     /*----------------------------------------------------------------*/
  1440.     /* Code Body                                                      */
  1441.     /*----------------------------------------------------------------*/
  1442.     switch (Msg)
  1443.     {
  1444.         case STR_GLOBAL_EMPTY:
  1445.         {
  1446.             ScreenImageId = IMG_GLOBAL_EMPTY;
  1447.             ScreenToShow = SCR_ID_SHCT_OPTION;
  1448.             ScreenTone = EMPTY_LIST_TONE;
  1449.             break;
  1450.         }
  1451.         case SHORTCUTS_FULL_MSG_STRING_ID:
  1452.         {
  1453.             ScreenImageId = IMG_GLOBAL_NO;
  1454.             ScreenToShow = SCR_ID_SHCT_OPTION;
  1455.             ScreenTone = EMPTY_LIST_TONE;
  1456.             break;
  1457.         }
  1458.         default:    /* case STR_GLOBAL_DONE */
  1459.         {
  1460.             ScreenImageId = IMG_GLOBAL_ACTIVATED;
  1461.             ScreenToShow = SCR_ID_SHCT_MAIN_MENU;
  1462.             ScreenTone = SUCCESS_TONE;
  1463.             break;
  1464.         }
  1465.     }
  1466.     DisplayPopup((U8*) GetString(Msg), ScreenImageId, 0, UI_POPUP_NOTIFYDURATION_TIME, (U8) ScreenTone);
  1467.     DeleteUptoScrID(ScreenToShow);
  1468. }
  1469. #if defined(__MMI_DEDICATED_KEY_SHORTCUTS__)
  1470. /*****************************************************************************
  1471.  * FUNCTION
  1472.  *  ShctReadDedicatedListFromNVRAM
  1473.  * DESCRIPTION
  1474.  *  Read dedicated key shortcut list and initialized.
  1475.  * PARAMETERS
  1476.  *  void
  1477.  *  index(?)        [IN]        List of shortcut index
  1478.  * RETURNS
  1479.  *  void
  1480.  *****************************************************************************/
  1481. void ShctReadDedicatedListFromNVRAM(void)
  1482. {
  1483.     /*----------------------------------------------------------------*/
  1484.     /* Local Variables                                                */
  1485.     /*----------------------------------------------------------------*/
  1486.     U8 i;
  1487.     U16 nvramData[SHCT_NVRAM_SIZE];
  1488.     S16 error;
  1489.     /*----------------------------------------------------------------*/
  1490.     /* Code Body                                                      */
  1491.     /*----------------------------------------------------------------*/
  1492.     ReadRecord(NVRAM_EF_SHORTCUTS_LID, 2, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
  1493.     for (i = 0; i < TOTAL_DEDICATED_KEYS; i++)
  1494.     {
  1495.         if (nvramData[i] == 0xffff)
  1496.         {
  1497.             memcpy((void*)&nvramData, (void*)&gShctDefaultDediList, TOTAL_DEDICATED_KEYS * 2);
  1498.             break;
  1499.         }
  1500.     }
  1501.     for (i = 0; i < TOTAL_DEDICATED_KEYS; i++)
  1502.     {
  1503.         if (maxHiliteInfo[nvramData[i]].entryFuncPtr == NULL)
  1504.         {
  1505.             g_shct_cntx.DediShctList[i] = SHCT_DEFAULT_MENU_ID;
  1506.         }
  1507.         else
  1508.         {
  1509.             memcpy((void*)&g_shct_cntx.DediShctList[i], (void*)&nvramData[i], 2);
  1510.         }
  1511.     }
  1512. }
  1513. /*****************************************************************************
  1514.  * FUNCTION
  1515.  *  ShctWriteDedicatedListToNVRAM
  1516.  * DESCRIPTION
  1517.  *  Write dedicated key shortcut list to NVRAM.
  1518.  * PARAMETERS
  1519.  *  void
  1520.  * RETURNS
  1521.  *  void
  1522.  *****************************************************************************/
  1523. void ShctWriteDedicatedListToNVRAM(void)
  1524. {
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Local Variables                                                */
  1527.     /*----------------------------------------------------------------*/
  1528.     U8 nvramData[SHCT_NVRAM_SIZE];
  1529.     S16 error;
  1530.     /*----------------------------------------------------------------*/
  1531.     /* Code Body                                                      */
  1532.     /*----------------------------------------------------------------*/
  1533.     memset(nvramData, 0xff, sizeof(nvramData));
  1534.     memcpy((void*)&nvramData, (void*)&g_shct_cntx.DediShctList, sizeof(g_shct_cntx.DediShctList));
  1535.     WriteRecord(NVRAM_EF_SHORTCUTS_LID, 2, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
  1536. }
  1537. /*****************************************************************************
  1538.  * FUNCTION
  1539.  *  EntryShctArrowKeyList
  1540.  * DESCRIPTION
  1541.  *  Display Up/Down/Left/Right key for editing.
  1542.  * PARAMETERS
  1543.  *  void
  1544.  * RETURNS
  1545.  *  string index(?)
  1546.  *****************************************************************************/
  1547. void EntryShctArrowKeyList(void)
  1548. {
  1549.     /*----------------------------------------------------------------*/
  1550.     /* Local Variables                                                */
  1551.     /*----------------------------------------------------------------*/
  1552.     U16 ItemList[TOTAL_DEDICATED_KEYS];
  1553.     U16 nItems;
  1554.     U8 *guiBuffer;
  1555.     U8 *popupList[TOTAL_DEDICATED_KEYS];
  1556.     S32 i;
  1557.     /*----------------------------------------------------------------*/
  1558.     /* Code Body                                                      */
  1559.     /*----------------------------------------------------------------*/
  1560.     EntryNewScreen(SCR_ID_SHCT_DEDICATED_KEYS, NULL, EntryShctArrowKeyList, NULL);
  1561.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_DEDICATED_KEYS);
  1562.     nItems = GetNumOfChild(MENU_SETTING_DEDICATED_KEYS);
  1563.     GetSequenceStringIds(MENU_SETTING_DEDICATED_KEYS, ItemList);
  1564.     /* get popup hint */
  1565.     for (i = 0; i < TOTAL_DEDICATED_KEYS; i++)
  1566.     {
  1567.         if (g_shct_cntx.DediShctList[i] == SHCT_DEFAULT_MENU_ID)
  1568.         {
  1569.             popupList[i] = (U8*) GetString(MAIN_MENU_SHORTCUTS_TEXT);
  1570.         }
  1571.         else
  1572.         {
  1573.             popupList[i] = (U8*) GetString(ShctGetStringID(g_shct_cntx.DediShctList[i]));
  1574.         }
  1575.     }
  1576.     SetParentHandler(MENU_SETTING_DEDICATED_KEYS);
  1577.     RegisterHighlightHandler(HighlightShctSelectedKey);
  1578.     ShowCategory52Screen(
  1579.         STR_DEDICATED_KEY,
  1580.         GetRootTitleIcon(MENU_SETTING_DEDICATED_KEYS),
  1581.         STR_EDIT,
  1582.         IMG_GLOBAL_OK,
  1583.         STR_GLOBAL_BACK,
  1584.         IMG_GLOBAL_BACK,
  1585.         nItems,
  1586.         ItemList,
  1587.         (U16*) gIndexIconsImageList,
  1588.         popupList,
  1589.         0,
  1590.         0,
  1591.         guiBuffer);
  1592.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1593.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1594.     SetLeftSoftkeyFunction(EntryShctEditDedicatedKey, KEY_EVENT_UP);
  1595.     SetKeyHandler(EntryShctEditDedicatedKey, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1596. }
  1597. /*****************************************************************************
  1598.  * FUNCTION
  1599.  *  HighlightDedicatedKeys
  1600.  * DESCRIPTION
  1601.  *  Highlight handler of dedicated key shortcut item in Phonesetup
  1602.  * PARAMETERS
  1603.  *  void
  1604.  * RETURNS
  1605.  *  void
  1606.  *****************************************************************************/
  1607. void HighlightDedicatedKeys(void)
  1608. {
  1609.     /*----------------------------------------------------------------*/
  1610.     /* Local Variables                                                */
  1611.     /*----------------------------------------------------------------*/
  1612.     /*----------------------------------------------------------------*/
  1613.     /* Code Body                                                      */
  1614.     /*----------------------------------------------------------------*/
  1615.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1616.     SetLeftSoftkeyFunction(EntryShctArrowKeyList, KEY_EVENT_UP);
  1617.     SetKeyHandler(EntryShctArrowKeyList, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1618.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1619.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1620. }
  1621. /*****************************************************************************
  1622.  * FUNCTION
  1623.  *  HighlightShctSelectedKey
  1624.  * DESCRIPTION
  1625.  *  Highlight handler of dedicated keys setting
  1626.  * PARAMETERS
  1627.  *  nIndex      [IN]        
  1628.  * RETURNS
  1629.  *  void
  1630.  *****************************************************************************/
  1631. void HighlightShctSelectedKey(S32 nIndex)
  1632. {
  1633.     /*----------------------------------------------------------------*/
  1634.     /* Local Variables                                                */
  1635.     /*----------------------------------------------------------------*/
  1636.     /*----------------------------------------------------------------*/
  1637.     /* Code Body                                                      */
  1638.     /*----------------------------------------------------------------*/
  1639.     g_shct_cntx.CurrSelArrow = (U8) nIndex;
  1640. }
  1641. /*****************************************************************************
  1642.  * FUNCTION
  1643.  *  EntryShctEditDedicatedKey
  1644.  * DESCRIPTION
  1645.  *  Entry edit dedicated key shortcut screen.
  1646.  * PARAMETERS
  1647.  *  void
  1648.  * RETURNS
  1649.  *  void
  1650.  *****************************************************************************/
  1651. void EntryShctEditDedicatedKey(void)
  1652. {
  1653.     /*----------------------------------------------------------------*/
  1654.     /* Local Variables                                                */
  1655.     /*----------------------------------------------------------------*/
  1656.     U8 i;
  1657.     U8 highlighted = 0;
  1658.     U16 EditShortcutsIds[SHCT_MAX_CANDI_LIST + 1];
  1659.     U8 *guiBuffer;
  1660.     /*----------------------------------------------------------------*/
  1661.     /* Code Body                                                      */
  1662.     /*----------------------------------------------------------------*/
  1663.     EntryNewScreen(SCR_ID_SHCT_EDIT_DEDICATED_KEYS, NULL, EntryShctEditDedicatedKey, NULL);
  1664.     /* the first item == Shortcuts */
  1665.     EditShortcutsIds[0] = MAIN_MENU_SHORTCUTS_TEXT;
  1666.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_EDIT_DEDICATED_KEYS);
  1667.     for (i = 0; i < g_shct_cntx.NumCandShct; i++)
  1668.     {
  1669.         EditShortcutsIds[i + 1] = ShctGetStringID(g_shct_cntx.CandShctList[i]);
  1670.         if (guiBuffer == NULL)
  1671.             if (g_shct_cntx.CandShctList[i] == g_shct_cntx.DediShctList[g_shct_cntx.CurrSelArrow])
  1672.             {
  1673.                 highlighted = i + 1;
  1674.             }
  1675.     }
  1676.     RegisterHighlightHandler(HighlightShctEdit);
  1677.     ShowCategory1Screen(
  1678.         MAIN_MENU_SHORTCUTS_TEXT,
  1679.         GetRootTitleIcon(MENU_SETTING_DEDICATED_KEYS),
  1680.         STR_GLOBAL_OK,
  1681.         IMG_GLOBAL_OK,
  1682.         STR_GLOBAL_BACK,
  1683.         IMG_GLOBAL_BACK,
  1684.         g_shct_cntx.NumCandShct + 1,
  1685.         EditShortcutsIds,
  1686.         highlighted,
  1687.         guiBuffer);
  1688.     SetLeftSoftkeyFunction(ShctSaveDedicated, KEY_EVENT_UP);
  1689.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1690.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1691. }
  1692. /*****************************************************************************
  1693.  * FUNCTION
  1694.  *  ShctSaveDedicated
  1695.  * DESCRIPTION
  1696.  *  Save dedicated key shortcut.
  1697.  * PARAMETERS
  1698.  *  void
  1699.  * RETURNS
  1700.  *  void
  1701.  *****************************************************************************/
  1702. void ShctSaveDedicated(void)
  1703. {
  1704.     /*----------------------------------------------------------------*/
  1705.     /* Local Variables                                                */
  1706.     /*----------------------------------------------------------------*/
  1707.     /*----------------------------------------------------------------*/
  1708.     /* Code Body                                                      */
  1709.     /*----------------------------------------------------------------*/
  1710.     if (g_shct_cntx.CurrEditShct > 0)
  1711.     {
  1712.         g_shct_cntx.DediShctList[g_shct_cntx.CurrSelArrow] = g_shct_cntx.CandShctList[g_shct_cntx.CurrEditShct - 1];
  1713.     }
  1714.     else
  1715.     {
  1716.         g_shct_cntx.DediShctList[g_shct_cntx.CurrSelArrow] = SHCT_DEFAULT_MENU_ID;
  1717.     }
  1718.     ShctWriteDedicatedListToNVRAM();
  1719.     DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, 2000, SUCCESS_TONE);
  1720.     DeleteUptoScrID(SCR_ID_SHCT_DEDICATED_KEYS);
  1721. }
  1722. /*****************************************************************************
  1723.  * FUNCTION
  1724.  *  ShctExecuteUpKey
  1725.  * DESCRIPTION
  1726.  *  Up key handler in IDLE screen.
  1727.  * PARAMETERS
  1728.  *  void
  1729.  * RETURNS
  1730.  *  void
  1731.  *****************************************************************************/
  1732. void ShctExecuteUpKey(void)
  1733. {
  1734.     /*----------------------------------------------------------------*/
  1735.     /* Local Variables                                                */
  1736.     /*----------------------------------------------------------------*/
  1737.     /*----------------------------------------------------------------*/
  1738.     /* Code Body                                                      */
  1739.     /*----------------------------------------------------------------*/
  1740.     if (g_shct_cntx.DediShctList[0] != SHCT_DEFAULT_MENU_ID)
  1741.     {
  1742.         g_shct_cntx.IsKeyRetrieving = TRUE;
  1743.         (*maxHiliteInfo[g_shct_cntx.DediShctList[0]].entryFuncPtr) ();
  1744.         g_shct_cntx.IsKeyRetrieving = FALSE;
  1745.         execute_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  1746.     }
  1747.     else
  1748.     {
  1749.         EntryShctInIdle();
  1750.     }
  1751. }
  1752. /*****************************************************************************
  1753.  * FUNCTION
  1754.  *  ShctExecuteDownKey
  1755.  * DESCRIPTION
  1756.  *  Down key handler in IDLE screen.
  1757.  * PARAMETERS
  1758.  *  void
  1759.  * RETURNS
  1760.  *  void
  1761.  *****************************************************************************/
  1762. void ShctExecuteDownKey(void)
  1763. {
  1764.     /*----------------------------------------------------------------*/
  1765.     /* Local Variables                                                */
  1766.     /*----------------------------------------------------------------*/
  1767.     /*----------------------------------------------------------------*/
  1768.     /* Code Body                                                      */
  1769.     /*----------------------------------------------------------------*/
  1770.     if (g_shct_cntx.DediShctList[1] != SHCT_DEFAULT_MENU_ID)
  1771.     {
  1772.         g_shct_cntx.IsKeyRetrieving = TRUE;
  1773.         (*maxHiliteInfo[g_shct_cntx.DediShctList[1]].entryFuncPtr) ();
  1774.         g_shct_cntx.IsKeyRetrieving = FALSE;
  1775.         execute_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  1776.     }
  1777.     else
  1778.     {
  1779.         EntryShctInIdle();
  1780.     }
  1781. }
  1782. /*****************************************************************************
  1783.  * FUNCTION
  1784.  *  ShctExecuteLeftKey
  1785.  * DESCRIPTION
  1786.  *  Left key handler in IDLE screen.
  1787.  * PARAMETERS
  1788.  *  void
  1789.  * RETURNS
  1790.  *  void
  1791.  *****************************************************************************/
  1792. void ShctExecuteLeftKey(void)
  1793. {
  1794.     /*----------------------------------------------------------------*/
  1795.     /* Local Variables                                                */
  1796.     /*----------------------------------------------------------------*/
  1797.     /*----------------------------------------------------------------*/
  1798.     /* Code Body                                                      */
  1799.     /*----------------------------------------------------------------*/
  1800.     if (g_shct_cntx.DediShctList[2] != SHCT_DEFAULT_MENU_ID)
  1801.     {
  1802.         g_shct_cntx.IsKeyRetrieving = TRUE;
  1803.         (*maxHiliteInfo[g_shct_cntx.DediShctList[2]].entryFuncPtr) ();
  1804.         g_shct_cntx.IsKeyRetrieving = FALSE;
  1805.         execute_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  1806.     }
  1807.     else
  1808.     {
  1809.         EntryShctInIdle();
  1810.     }
  1811. }
  1812. /*****************************************************************************
  1813.  * FUNCTION
  1814.  *  ShctExecuteRightKey
  1815.  * DESCRIPTION
  1816.  *  Right key handler in IDLE screen.
  1817.  * PARAMETERS
  1818.  *  void
  1819.  * RETURNS
  1820.  *  void
  1821.  *****************************************************************************/
  1822. void ShctExecuteRightKey(void)
  1823. {
  1824.     /*----------------------------------------------------------------*/
  1825.     /* Local Variables                                                */
  1826.     /*----------------------------------------------------------------*/
  1827.     /*----------------------------------------------------------------*/
  1828.     /* Code Body                                                      */
  1829.     /*----------------------------------------------------------------*/
  1830.     if (g_shct_cntx.DediShctList[3] != SHCT_DEFAULT_MENU_ID)
  1831.     {
  1832.         g_shct_cntx.IsKeyRetrieving = TRUE;
  1833.         (*maxHiliteInfo[g_shct_cntx.DediShctList[3]].entryFuncPtr) ();
  1834.         g_shct_cntx.IsKeyRetrieving = FALSE;
  1835.         execute_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
  1836.     }
  1837.     else
  1838.     {
  1839.         EntryShctInIdle();
  1840.     }
  1841. }
  1842. /*****************************************************************************
  1843.  * FUNCTION
  1844.  *  RegisterDedicatedKeyHandlers
  1845.  * DESCRIPTION
  1846.  *  Register arrow key handlers in IDLE screen.
  1847.  * PARAMETERS
  1848.  *  void
  1849.  * RETURNS
  1850.  *  void
  1851.  *****************************************************************************/
  1852. void RegisterDedicatedKeyHandlers(void)
  1853. {
  1854.     /*----------------------------------------------------------------*/
  1855.     /* Local Variables                                                */
  1856.     /*----------------------------------------------------------------*/
  1857.     /*----------------------------------------------------------------*/
  1858.     /* Code Body                                                      */
  1859.     /*----------------------------------------------------------------*/
  1860.     SetCurrentProfileAsActivatedProfile();
  1861.     SetKeyHandler(ShctExecuteUpKey, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1862.     SetKeyHandler(ShctExecuteDownKey, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1863.     SetKeyHandler(ShctExecuteLeftKey, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1864.     SetKeyHandler(ShctExecuteRightKey, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1865. }
  1866. #endif /* defined(__MMI_DEDICATED_KEY_SHORTCUTS__) */ // #ifdef __MMI_DEDICATED_KEY_SHORTCUTS__
  1867. #endif /* __DISABLE_SHORTCUTS_IMPL__ */ /* #if !defined (__MMI_FOURWAYS_KEY_DISABLE__) || defined (__MMI_VRSD_SHORTCUT__) || defined (__MMI_VRSI__) */
  1868. #endif /* _MMI_SHORTCUTS_C */ /* SHORTCUTS_APP */
  1869. #endif /* SHORTCUTS_APP */ /* _MMI_SHORTCUTS_C */