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

MTK

开发平台:

C/C++

  1.     /*----------------------------------------------------------------*/
  2.     /*----------------------------------------------------------------*/
  3.     /* Code Body                                                      */
  4.     /*----------------------------------------------------------------*/
  5.     g_pwr_context.PowerOnNWStatus |= MMI_NW_STATUS_NETWORK_FLAG;        /* 0x01: network attachment timeout */
  6.     g_pwr_context.IsCampOnTonePlayed = 1;   /* Camp on tone will not be played after the timeout */
  7.     if (g_idle_context.IsOnIdleScreen)
  8.     {
  9.         mmi_bootup_exit_network_searching();
  10.     }
  11. }
  12. /*****************************************************************************
  13.  * FUNCTION
  14.  *  DisplayIdleScreen
  15.  * DESCRIPTION
  16.  *  Shows the idle screen
  17.  * PARAMETERS
  18.  *  void
  19.  * RETURNS
  20.  *  void
  21.  *****************************************************************************/
  22. void DisplayIdleScreen(void)
  23. {
  24.     /*----------------------------------------------------------------*/
  25.     /* Local Variables                                                */
  26.     /*----------------------------------------------------------------*/
  27.     extern U8 gCallCost;
  28.     /*----------------------------------------------------------------*/
  29.     /* Code Body                                                      */
  30.     /*----------------------------------------------------------------*/
  31.     /* highlight indexes should be reset when press end key for the call history module */
  32.     gCallCost = 0;
  33.     CHISTResetCallLogIndex();
  34.     /* Execute the root history */
  35.     ExecuteRootMainHistoryScreen(NULL);
  36.     OrgDeInit();
  37.     /* JBRW Sandeep */
  38. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  39.     mmi_brw_wap_deinit();
  40. #endif 
  41.     /* added by Manish for JMMS */
  42. #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
  43.     mmi_jmms_deinit();
  44. #endif 
  45. #if (defined(__MMI_VCARD__) || defined(__MMI_VCALENDAR__)) && defined(MMI_ON_HARDWARE_P)
  46.     mmi_vobj_deinit();
  47. #endif 
  48.     /* dara added to deinit profile handler data */
  49. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  50.     mmi_ph_deinit_profiles();
  51.     mmi_prov_deinit();
  52. #endif 
  53.     AlmEnableSPOF();
  54. }
  55. /*****************************************************************************
  56.  * FUNCTION
  57.  *  mmi_idle_notify_bootup_ready_to_wap
  58.  * DESCRIPTION
  59.  *  Send message to WAP for idle screen notification
  60.  * PARAMETERS
  61.  *  void
  62.  * RETURNS
  63.  *  void
  64.  *****************************************************************************/
  65. void mmi_idle_notify_bootup_ready_to_wap(void)
  66. {
  67. #ifdef WAP_SUPPORT
  68.     /*----------------------------------------------------------------*/
  69.     /* Local Variables                                                */
  70.     /*----------------------------------------------------------------*/
  71.     MYQUEUE Message;
  72.     /*----------------------------------------------------------------*/
  73.     /* Code Body                                                      */
  74.     /*----------------------------------------------------------------*/
  75.     Message.oslSrcId = MOD_MMI;
  76.     Message.oslDestId = MOD_WAP;
  77.     Message.oslMsgId = MSG_ID_MMI_READY_NOTIFY_REQ;
  78.     Message.oslDataPtr = (oslParaType*) NULL;
  79.     Message.oslPeerBuffPtr = NULL;
  80.     OslMsgSendExtQueue(&Message);
  81. #endif /* WAP_SUPPORT */ 
  82. }
  83. /*****************************************************************************
  84.  * FUNCTION
  85.  *  CheckAndStopAudioPlayer
  86.  * DESCRIPTION
  87.  *  Stop audio player
  88.  * PARAMETERS
  89.  *  void
  90.  * RETURNS
  91.  *  void
  92.  *****************************************************************************/
  93. #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
  94. extern BOOL DirectMode;
  95. #endif 
  96. extern void MMI_notify_bootup_ready(void);
  97. #ifdef __MMI_IDLE_CAMERA_KEY_TO_STOP_AUDIOPLAYER__
  98. static void CheckAndStopAudioPlayer(void)
  99. {
  100. #ifdef __MMI_AUDIO_PLAYER__
  101.     /*----------------------------------------------------------------*/
  102.     /* Local Variables                                                */
  103.     /*----------------------------------------------------------------*/
  104.     /*----------------------------------------------------------------*/
  105.     /* Code Body                                                      */
  106.     /*----------------------------------------------------------------*/
  107.     if (mmi_audply_is_playing())
  108.     {
  109.         mmi_audply_do_stop_action();
  110.     }
  111.     else
  112. #endif /* __MMI_AUDIO_PLAYER__ */ 
  113. #ifdef __MMI_FM_RADIO__
  114.     if (mmi_fmrdo_is_power_on())
  115.     {
  116.         mmi_fmrdo_power_on(FALSE);
  117.     }
  118.     else
  119. #endif /* __MMI_FM_RADIO__ */ 
  120.     #ifdef __MMI_SUBLCD_CAMERA__
  121.     if (IsClamClose())
  122.         mmi_sublcd_camera_entry_option_screen();
  123.     else
  124.         mmi_camera_entry_app_screen();
  125.     #else
  126.         mmi_camera_entry_app_screen();
  127.     #endif 
  128. }
  129. #endif /* __MMI_IDLE_CAMERA_KEY_TO_STOP_AUDIOPLAYER__ */ 
  130. /*****************************************************************************
  131.  * FUNCTION
  132.  *  IdleScreenEmergencyCallCheckNKeypadLock
  133.  * DESCRIPTION
  134.  *  Allow dial SOS number if keypad is locked in idle screen
  135.  * PARAMETERS
  136.  *  eventKey        [?]     
  137.  * RETURNS
  138.  *  void
  139.  *****************************************************************************/
  140. U8 IdleScreenEmergencyCallCheckNKeypadLock(KEYBRD_MESSAGE *eventKey)
  141. {
  142.     /*----------------------------------------------------------------*/
  143.     /* Local Variables                                                */
  144.     /*----------------------------------------------------------------*/
  145.     /*----------------------------------------------------------------*/
  146.     /* Code Body                                                      */
  147.     /*----------------------------------------------------------------*/
  148. //KP Jerry add on 2007-4-25 start
  149. #ifdef __MMI_SLIDE__
  150. if(!gMMIClamState)
  151. {
  152. #endif
  153. //KP Jerry add on 2007-4-25 end
  154.     if (g_keylock_context.gKeyPadLockFlag)
  155.     {
  156.         EmergencyCallCheck(eventKey->nKeyCode, eventKey->nMsgType);
  157.     }
  158.     if ((g_idle_context.AutoLockTimeOut != 0) && (g_idle_context.IsOnIdleScreen || g_idle_context.IsOnSimErrorScreen))
  159.     {
  160.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURKEY_HDLR, g_idle_context.AutoLockTimeOut));
  161.         StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  162.         if (g_idle_context.IsOnIdleScreen)
  163.         {
  164.             StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, IdleSetKeyPadLockFlag);
  165.         }
  166.         if (g_idle_context.IsOnSimErrorScreen)  /* diamond, 2005/10/29, keypad lock in insert sim screen */
  167.         {
  168.             StartTimer(IDLE_APP_AUTO_LOCK_TIMER_ID, g_idle_context.AutoLockTimeOut, InsertSimSetKeyPadLockFlag);
  169.         }
  170.     }
  171. //KP Jerry add on 2007-4-25 start
  172. #ifdef __MMI_SLIDE__
  173. }
  174. #endif
  175. //KP Jerry add on 2007-4-25 end
  176.     return TRUE;
  177. }
  178. /*****************************************************************************
  179.  * FUNCTION
  180.  *  RedrawIdleScreen
  181.  * DESCRIPTION
  182.  *  Entry idle screen
  183.  * PARAMETERS
  184.  *  void
  185.  * RETURNS
  186.  *  void
  187.  *****************************************************************************/
  188. void RedrawIdleScreen(void)
  189. {
  190.     /*----------------------------------------------------------------*/
  191.     /* Local Variables                                                */
  192.     /*----------------------------------------------------------------*/
  193.     /*----------------------------------------------------------------*/
  194.     /* Code Body                                                      */
  195.     /*----------------------------------------------------------------*/
  196.     IdleRefreshServiceIndicationArea();
  197. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && (defined __MMI_TOUCH_SCREEN__) && !(defined __MMI_TOUCH_IDLESCREEN_SHORTCUTS__))
  198.     EnableCenterSoftkey(0, IMG_CSK_DIAL_ICON);
  199. #endif 
  200. #ifdef __MMI_SWFLASH__
  201. if (dispchar_iswp_swflash())
  202. {
  203. ShowCategory34Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, PhnsetGetCurWallPaperIdx(), idle_screen_wallpaper_name, NULL);
  204. }
  205. else
  206. #endif /* _MMI_SWFLASH__ */
  207. #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  208.     ShowCategory33Screen(IDLE_SCREEN_RSK_TEXT, IDLE_SCREEN_RSK_ICON, idleLRStringtID, IDLE_SCREEN_LSK_ICON, 0,NULL);
  209. #else 
  210.     ShowCategory33Screen(IDLE_SCREEN_LSK_TEXT, IDLE_SCREEN_LSK_ICON, idleLRStringtID, IDLE_SCREEN_RSK_ICON, 0,NULL);
  211. #endif 
  212. }
  213. /*****************************************************************************
  214.  * FUNCTION
  215.  *  mmi_idle_generic_keypad_lock_screen_exit_hdlr
  216.  * DESCRIPTION
  217.  *  
  218.  * PARAMETERS
  219.  *  void
  220.  * RETURNS
  221.  *  void
  222.  *****************************************************************************/
  223. void mmi_idle_generic_keypad_lock_screen_exit_hdlr(void)
  224. {
  225.     /*----------------------------------------------------------------*/
  226.     /* Local Variables                                                */
  227.     /*----------------------------------------------------------------*/
  228.     /*----------------------------------------------------------------*/
  229.     /* Code Body                                                      */
  230.     /*----------------------------------------------------------------*/
  231.     /* diamond, 2006/03/26 Generic exit function for keypad lock callback screens */
  232.     mmi_frm_kbd_reg_pre_key_hdlr(NULL);
  233. #ifdef __MMI_TOUCH_SCREEN__
  234.     ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
  235. #else 
  236.     HideStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  237. #endif 
  238.     PRINT_INFORMATION(("[Keypad Lock] mmi_idle_generic_keypad_lock_screen_exit_hdlr"));
  239. #ifdef __MMI_TOUCH_SCREEN__
  240.     mmi_pen_unblock(); /* diamond, 2006/06/06 unblock pen is generic keypad lock screen exit handler */
  241. #endif
  242.     if (g_keylock_context.keypad_lock_screen_exit != NULL)
  243.     {
  244.         (*g_keylock_context.keypad_lock_screen_exit) ();
  245.     }
  246. }
  247. /*****************************************************************************
  248.  * FUNCTION
  249.  *  EntryIdleScreen
  250.  * DESCRIPTION
  251.  *  Entry function for idle screen
  252.  * PARAMETERS
  253.  *  void
  254.  * RETURNS
  255.  *  void
  256.  *****************************************************************************/
  257. static U8 gIsIdleScreenReentry = MMI_FALSE;
  258. void EntryIdleScreen(void)
  259. {
  260.     /*----------------------------------------------------------------*/
  261.     /* Local Variables                                                */
  262.     /*----------------------------------------------------------------*/
  263.     static U8 gIsOnSearchingScreen = MMI_FALSE;
  264.     /*----------------------------------------------------------------*/
  265.     /* Code Body                                                      */
  266.     /*----------------------------------------------------------------*/
  267. #ifdef __MMI_WLAN_FEATURES__
  268.     if (mmi_bootup_is_sim_valid() == MMI_FALSE && mmi_netset_get_active_preferred_mode() == P_GSM_ONLY && mmi_bootup_get_active_bt_access_profile_mode() == 0)
  269.     {
  270.         if (simErrorDisplayString == STR_SIM_BLOCK_MSG)
  271.         {
  272.             EntryScrnSimBlockRsp();
  273.         }
  274.         else
  275.         {
  276.             EntryScrnSimErrorScreen();
  277.         }
  278.         return;
  279.     }
  280. #endif /* __MMI_WLAN_FEATURES__ */
  281.     /* diamond, 2006/02/22 Avoid to restart keypad lock and screensaver timer if EntryIdleScreen is called again when active screen is still idle screen */
  282.     gIsIdleScreenReentry = (GetActiveScreenId() == IDLE_SCREEN_ID &&
  283.                             gIsOnSearchingScreen == MMI_FALSE) ? MMI_TRUE : MMI_FALSE;
  284. //KP Jerry add for third sevice on 2007-03-26 start
  285. #ifndef __VALUE_ADDED_SERVICE_IN_MAINMENU__
  286.      #ifdef __KONG_NET_SP__
  287.      SetHiliteHandler(MAIN_MENU_DREAM_FAIRYLAND_ID, hi_light_EntryDreamFairylandHandler);
  288.      #endif
  289. #endif
  290. //KP Jerry add for third sevice on 2007-03-26 end
  291.     EntryNewScreen(IDLE_SCREEN_ID, ExitIdleScreen, NULL, NULL);
  292.     /* START PMT NEERAJ 20051021 */
  293. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  294.     if (is_redrawing_old_screens()) /* 010706 small screen Calvin */
  295.     {
  296.         RedrawIdleScreen();
  297.         gIsIdleScreenReentry = MMI_FALSE;
  298.         return;
  299.     }
  300. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  301.     /* END PMT NEERAJ 20051021 */
  302.     g_pwr_context.PrevScreenIndicator = ENTER_IDLE_SCR;
  303.     DinitHistory();
  304.     DeInitSpecialMode();    /* EngineerMode/Factory Deinit */
  305. #ifdef __MMI_DOWNLOAD_AGENT__
  306.     mmi_da_enter_idle_screen_notify();
  307. #endif 
  308. #ifdef __J2ME__
  309.     jvm_enter_idle_screen_notify();
  310. #endif 
  311. #ifdef __MMI_SWFLASH__
  312.     mmi_swflash_enter_idle_screen_notify();
  313. #endif 
  314. #ifndef MMI_ON_WIN32
  315.     mmiapi_enter_idle_screen_notify();
  316. #endif 
  317. #if defined(__MMI_WEBCAM__) && defined(__MMI_USB_SUPPORT__)
  318.     /* entry webcam if it is still active */
  319.     if (mmi_usb_webcam_is_active())
  320.     {
  321.         mmi_usb_webcam_entry_app_scr();
  322.         return;
  323.     }
  324. #endif /* defined(__MMI_WEBCAM__) && defined(__MMI_USB_SUPPORT__) */ 
  325. #ifdef __MMI_SIMAP_SUPPORT__
  326.     if (mmi_bootup_get_active_bt_access_profile_mode())
  327.     {
  328.     #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  329.         widget_MMI_on_enter_idle_screen();
  330.     #endif
  331.         if (mmi_bootup_is_searching_or_idle_reached() == MMI_FALSE)
  332.         {
  333.         }
  334.         if (!gIsIdleScreenReentry)
  335.         {
  336.             mmi_idle_start_keypad_lock();   /* keypad lock in flight mode */
  337.             mmi_idle_start_screensaver();   /* screen saver in flight mode */
  338.         }
  339.         g_idle_context.IsOnIdleScreen = 1;
  340.         g_idle_context.IsOnDialerScreen = 0;
  341.         g_idle_context.LongPressEnable = 0;
  342.         
  343.         if (g_keylock_context.gKeyPadLockFlag == 0) /* keypad is not locked */
  344.         {
  345.             mmi_idle_entry_bt_access_profile_idle_screen();
  346.         }
  347.         else
  348.         {
  349.             EntryFlightModeKeypadLockScreen(); /* share with flight mode keypad lock screen */
  350.             g_keylock_context.keypad_lock_screen_exit = GetCurrExitFuncPtr();
  351.             SetCurrExitFuncPtr(mmi_idle_generic_keypad_lock_screen_exit_hdlr);
  352.         }
  353.         mmi_idle_dummy_key_in_screensaver();
  354.         return;
  355.     }
  356. #endif /* __MMI_SIMAP_SUPPORT__ */
  357. #ifdef __FLIGHT_MODE_SUPPORT__
  358.     if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  359.     {
  360.         if (mmi_bootup_is_searching_or_idle_reached() == MMI_FALSE)
  361.         {
  362.             g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_IDLE; /* 0x80: Flight mode idle screen */
  363.             g_pwr_context.PowerOnNWStatus |= MMI_NW_STATUS_NETWORK_FLAG;        /* 0x01: network attachment timeout */
  364.             g_pwr_context.InvalidSimShowed = 1;
  365.             TurnOffBacklight();
  366.             StartLEDPatternBackGround();
  367.             if (g_charbat_context.isChargerConnected)
  368.             {
  369.                 StartTimer(BOOTUP_CHARGER_DETECT_TIMER, 3000, ChargerDetectTimeoutHdlr);
  370.             }
  371.             PendingAlarmReminder();
  372.             mmi_idle_notify_bootup_ready_to_wap(); /* to WAP */
  373.             mmi_idle_notify_bootup_ready_to_l4c();  /* to L4C */
  374.         #ifdef __MMI_IMPS__
  375.             mmi_imps_notify_idle_reached();
  376.         #endif 
  377.             mmi_flight_mode_hide_menu_items();
  378.         }
  379.         if (!gIsIdleScreenReentry)
  380.         {
  381.             mmi_idle_start_keypad_lock();   /* keypad lock in flight mode */
  382.             mmi_idle_start_screensaver();   /* screen saver in flight mode */
  383.         }
  384.         g_idle_context.IsOnIdleScreen = 1;
  385.         g_idle_context.IsOnDialerScreen = 0;
  386.         g_idle_context.LongPressEnable = 0;
  387.         if (0)
  388.         {
  389.         }
  390.     #ifdef __J2ME__
  391.         else if (mmi_java_is_launch_after_install())
  392.         {
  393.             mmi_java_entry_mid_launch();
  394.         }
  395.     #endif /* __J2ME__ */ 
  396.     #ifdef __MMI_DOWNLOAD_AGENT__
  397.         else if (mmi_da_launch_ring_buffer_check())
  398.         {
  399.             mmi_da_entry_new_push_ind();
  400.         }
  401.     #endif /* __MMI_DOWNLOAD_AGENT__ */ 
  402.         else
  403.         {
  404.             if (g_keylock_context.gKeyPadLockFlag == 0) /* keypad is not locked */
  405.             {
  406.                 EntryFlightModeIdleScreen();
  407.             }
  408.             else
  409.             {
  410.                 EntryFlightModeKeypadLockScreen();
  411.                 /* diamond, 2006/03/26 Generic exit function for keypad lock callback screens */
  412.                 g_keylock_context.keypad_lock_screen_exit = GetCurrExitFuncPtr();
  413.                 SetCurrExitFuncPtr(mmi_idle_generic_keypad_lock_screen_exit_hdlr);
  414.             }
  415.             mmi_idle_dummy_key_in_screensaver();
  416.         }
  417.         gIsIdleScreenReentry = MMI_FALSE;
  418.         return;
  419.     }
  420. #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  421.     /* end, diamond */
  422.     mmi_phb_reset_scr_id();
  423.     NETSETCheckAndRestoreNetwork();
  424.     SATEVDLIdleScreenAvaliable();
  425. #ifdef __MMI_UNIFIED_MESSAGE__
  426.     mmi_um_on_enter_idle_screen();
  427. #endif 
  428. #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  429.     widget_MMI_on_enter_idle_screen();
  430. #endif 
  431. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  432.     mmi_brw_unread_push_message_indication();
  433. #endif 
  434. #ifdef __MOD_SMSAL__
  435.     mmi_msg_on_enter_idle_screen();
  436. #endif /* __MOD_SMSAL__ */ 
  437.     OslDumpDataInFile();
  438.     /* This block carries all functions to be called when user enter idle screen first time. */
  439.     if (mmi_bootup_is_searching_or_idle_reached() == MMI_FALSE)
  440.     {
  441.         TurnOffBacklight();
  442.         g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_NW_SEARCHING;     /* 0x40: Network searching screen */
  443.     #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
  444.         DirectMode = FALSE;
  445.     #endif 
  446.         PendingAlarmReminder();
  447.         StartLEDPatternBackGround();
  448.         if (!g_pwr_context.IsCampOnTonePlayed && g_pwr_context.CurrentServiceType == FULL_SERVICE)      /* Robin 1128 Play camp on tone after enter idle screen */
  449.         {
  450.             g_pwr_context.IsCampOnTonePlayed = 1;
  451.             playRequestedTone(CAMP_ON_TONE);
  452.         }
  453.     #ifdef __MMI_POC__
  454.         if (g_pwr_context.CurrentServiceType == FULL_SERVICE)
  455.         {
  456.             mmi_poc_poweron_reg();
  457.         }
  458.     #endif /* __MMI_POC__ */ 
  459.         if (g_charbat_context.isChargerConnected)
  460.         {
  461.             StartTimer(BOOTUP_CHARGER_DETECT_TIMER, 3000, ChargerDetectTimeoutHdlr);
  462.         }
  463.     #if defined(OBIGO_SUPPORT) && defined(WAP_SUPPORT)
  464.         MMIProcessActionMsg();
  465.     #endif 
  466.         mmi_idle_notify_bootup_ready_to_wap();
  467.         mmi_idle_notify_bootup_ready_to_l4c();
  468.     #ifdef __MMI_IMPS__
  469.         mmi_imps_notify_idle_reached();
  470.     #endif 
  471.     #ifdef __MMI_SML_MENU__
  472.         mmi_sml_display_auto_locked_notification();
  473.     #endif
  474.     #ifdef __MMI_WLAN_FEATURES__
  475.         if (mmi_netset_get_active_preferred_mode() == P_WLAN_ONLY)
  476.         {
  477.             g_pwr_context.PowerOnNWStatus |= MMI_NW_STATUS_NETWORK_FLAG; /* No need to show network searching screen */
  478.         }
  479.     #endif /* __MMI_WLAN_FEATURES__ */
  480.     }
  481.     g_idle_context.IsOnIdleScreen = 1;
  482.     g_idle_context.IsOnDialerScreen = 0;
  483.     /* This checks if network attach indication has been recieved once after bootup. */
  484.     /* If yes, then go to idle screen otherwise show network srch animation.    */
  485.     if (mmi_bootup_is_network_searching_complete() == MMI_TRUE)
  486.     {
  487.         /* isIdleScreenReached=1; */
  488.         g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_IDLE; /* 0x80: Idle screen */
  489.         gIsOnSearchingScreen = MMI_FALSE;
  490.         if (!gIsIdleScreenReentry)
  491.         {
  492.             mmi_idle_start_keypad_lock();
  493.             mmi_idle_start_screensaver();
  494.         }
  495.         gIsIdleScreenReentry = MMI_FALSE;
  496.         if (g_keylock_context.gKeyPadLockFlag == 0) /* keypad is not locked */
  497.         {
  498.             /* if g_msg_cntx.msg_status is not in idle state, need to help SMS to clear action queue */
  499.             if (mmi_msg_need_clear_action_queue())
  500.             {
  501.                 mmi_frm_sms_delete_action_pending();
  502.             }
  503.             if (mmi_idle_exe_callback() == MMI_FALSE)   /* no pending message */
  504.             {
  505.                 mmi_idle_entry_idle_screen();   /* idle screen */
  506.             }
  507.         }
  508.         else    /*  Keyapd is locked */
  509.         {
  510.             /* U16 KeyLockLSKStringtID=0, KeyLockRSKStringID=0, KeyLockLSKIconID=0, KeyLockRSKIconID=0; */
  511.             /* diamond, 2005/10/19 Prevent from re-entry idle screen after emergency call is dialed */
  512.         #ifndef __MMI_KEYPADLOCK_WITH_KEYTONE__
  513.             mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  514.         #endif 
  515.             mmi_idle_set_keypad_lock_string();
  516.             /* if g_msg_cntx.msg_status is not in idle state, need to help SMS to clear action queue */
  517.             if (mmi_msg_need_clear_action_queue())
  518.             {
  519.                 mmi_frm_sms_delete_action_pending();
  520.             }
  521.             if (mmi_idle_exe_callback() == MMI_FALSE)   /* no pending message */
  522.             {
  523.                 /* keypad lock idle screen */
  524.                 IdleRefreshServiceIndicationArea();
  525. #ifdef __MMI_SWFLASH__
  526.              if (dispchar_iswp_swflash())
  527. {
  528. ShowCategory34Screen(
  529.                         g_keylock_context.KeyLockLSKStringID,
  530.                         g_keylock_context.KeyLockLSKIconID,
  531.                         g_keylock_context.KeyLockRSKStringID,
  532.                         g_keylock_context.KeyLockRSKIconID,
  533.      PhnsetGetCurWallPaperIdx(), idle_screen_wallpaper_name, NULL);
  534. }
  535. else
  536. #endif /* _MMI_SWFLASH__ */
  537.                 ShowCategory33Screen(
  538.                     g_keylock_context.KeyLockLSKStringID,
  539.                     g_keylock_context.KeyLockLSKIconID,
  540.                     g_keylock_context.KeyLockRSKStringID,
  541.                     g_keylock_context.KeyLockRSKIconID,
  542. 0,
  543.                     NULL);
  544.             }
  545.         #ifdef __MMI_TOUCH_SCREEN__
  546.             mmi_idle_pen_block(); /* diamond, 2006/06/06 Block pen in all keypad lock screens */
  547.         #endif
  548.             /* diamond, 2006/03/26 Generic exit function for keypad lock callback screens */
  549.             g_keylock_context.keypad_lock_screen_exit = GetCurrExitFuncPtr();
  550.             SetCurrExitFuncPtr(mmi_idle_generic_keypad_lock_screen_exit_hdlr);
  551.         #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  552.             SetGroupKeyHandler(
  553.                 EntryScrKeyPadLockOnPessingAnyKey,
  554.                 (PU16) PresentAllKeys,
  555.                 (U8) TOTAL_KEYS,
  556.                 (U16) KEY_EVENT_DOWN);
  557.         #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  558.  #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  559.         #ifndef __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  560.             ClearKeyHandler(KEY_LSK, KEY_EVENT_DOWN);
  561.             ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
  562.             ClearKeyHandler(KEY_RSK, KEY_EVENT_DOWN);
  563.             ClearKeyHandler(KEY_RSK, KEY_EVENT_UP);
  564.         #endif /* __MMI_KEYPAD_LOCK_PROMPT_TEXT__ */ 
  565.             SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  566.         #else /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  567.         #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  568.             SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  569.         #endif 
  570.         #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  571.             SetLeftSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  572.         #endif 
  573.         #endif /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  574.             IdleSetLRKey(); /* __MANUAL_MODE_NW_SEL__ */
  575.         #ifdef __MMI_UNIFIED_MESSAGE__
  576.             if (mmi_um_check_new_msg() && !mmi_um_is_sending_num_msg())
  577.             {
  578.                 ClearInputEventHandler(MMI_DEVICE_ALL);
  579.             }
  580.         #endif /* __MMI_UNIFIED_MESSAGE__ */
  581.             if (g_idle_context.IsRSKPressOnScreenSaver)
  582.             {
  583.                 EntryScrAfterPessingRSK();
  584.                 g_idle_context.IsRSKPressOnScreenSaver = 0;
  585.             }
  586.             /* 
  587.              * Compensatory key handler registration for screen saver
  588.              * The idea here is to set those keys which are not set with handlers to a dummy handler. 
  589.              * But note that END key is still being set a handler (DisplayIdleScreen)  for KEY_EVENT_DOWN in PowerAndEndKeyHandler. 
  590.              */
  591.             mmi_idle_dummy_key_in_screensaver();
  592.         }
  593.         mmi_idle_date_time_reminder();
  594.     }
  595.     else    /*  displays network seaching animation */
  596.     {
  597.         if (!gIsOnSearchingScreen)
  598.         {
  599.             StartTimer(SEARCHING_SCREEN_TIMER, 10000, SearchingSrceenTimeOutHandler);
  600.             gIsOnSearchingScreen = MMI_TRUE;
  601.         }
  602.         mmi_idle_entry_searching_screen();
  603.         mmi_idle_date_time_reminder();
  604.     }
  605.     mmi_frm_kbd_reg_pre_key_hdlr(IdleScreenEmergencyCallCheckNKeypadLock);
  606.     if (GetPostponedSATScreen())
  607.     {
  608.         (*GetPostponedSATScreen())();
  609.         ClearPostponedSATScreen();
  610.     }
  611. //KP Jerry add for third sevice on 2007-03-26 start
  612. #if (defined(__KONG_NET_SP__) && defined(__VALUE_ADDED_SERVICE_QUICK_ENTER__))
  613. if (!g_keylock_context.gKeyPadLockFlag)
  614. SetKeyHandler(EntryDreamFairylandHandler,KEY_ENTER,KEY_EVENT_DOWN);
  615. #endif
  616. //KP Jerry add for third sevice on 2007-03-26 end
  617.     gIsIdleScreenReentry = MMI_FALSE;
  618.     
  619. #if (defined(MMI_ON_HARDWARE_P) && !defined(__MTK_TARGET__)) /* MoDIS only */
  620.     mmi_netset_write_auto_test_result(MMI_TRUE);
  621. #endif
  622. }
  623. /*****************************************************************************
  624.  * FUNCTION
  625.  *  ExitIdleScreen
  626.  * DESCRIPTION
  627.  *  Exit function for idle screen
  628.  * PARAMETERS
  629.  *  void
  630.  * RETURNS
  631.  *  void
  632.  *****************************************************************************/
  633. void ExitIdleScreen(void)
  634. {
  635.     /*----------------------------------------------------------------*/
  636.     /* Local Variables                                                */
  637.     /*----------------------------------------------------------------*/
  638.     /*----------------------------------------------------------------*/
  639.     /* Code Body                                                      */
  640.     /*----------------------------------------------------------------*/
  641.     GenericExitScreen(IDLE_SCREEN_ID, EntryIdleScreen);
  642.     g_idle_context.IsOnIdleScreen = 0;
  643.     mmi_frm_kbd_reg_pre_key_hdlr(NULL);
  644.     if (!g_idle_context.ScreenSaverRunFlag && !gIsIdleScreenReentry)
  645.     {
  646.         PRINT_INFORMATION(("[Keypad Lock] ExitIdleScreen: Timer %d Stop", g_idle_context.AutoLockTimeOut));
  647.         StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  648.     }
  649.     if (!gIsIdleScreenReentry)
  650.     {
  651.         StopTimer(SCREENSAVER_TIMER);
  652.     }
  653.     StopTimer(KEYPADUNLOCKEDMESSAGE_TIMER);
  654. #ifdef __MMI_TOUCH_SCREEN__
  655.     if (g_keylock_context.gKeyPadLockFlag == 1)
  656.     {
  657.         mmi_pen_unblock();  /* diamond, 2005/12/22 Enable touch panel if exit idle keypad lock screen */
  658.     }
  659.     wgui_reset_status_icon_pen_event_hdlr();
  660. #endif /* __MMI_TOUCH_SCREEN__ */ 
  661. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  662.     ResetCenterSoftkey();
  663. #endif 
  664. }
  665. /*****************************************************************************
  666.  * FUNCTION
  667.  *  mmi_idle_check_nw_provider_name_length
  668.  * DESCRIPTION
  669.  *  Check if the input string length is larger than main lcd width
  670.  * PARAMETERS
  671.  *  unicode_string      [?]     
  672.  *  U8*(?)
  673.  * RETURNS
  674.  *  pBOOL
  675.  *****************************************************************************/
  676. extern void UI_set_font(UI_font_type f);
  677. pBOOL mmi_idle_check_nw_provider_name_length(U8 *unicode_string)
  678. {
  679.     /*----------------------------------------------------------------*/
  680.     /* Local Variables                                                */
  681.     /*----------------------------------------------------------------*/
  682.     pBOOL rtn;
  683.     S32 StringWidth, StringHeight;
  684.     stFontAttribute prev_f;
  685.     /*----------------------------------------------------------------*/
  686.     /* Code Body                                                      */
  687.     /*----------------------------------------------------------------*/
  688.     /* copy the system font to backup */
  689.     memcpy(&prev_f, UI_font, sizeof(stFontAttribute));
  690.     /* set default font for length calculation */
  691.     UI_set_font(&UI_DEFAULT_FONT);
  692.     Get_StringWidthHeight(unicode_string, &StringWidth, &StringHeight);
  693.     /* check the string length if it is larger than main lcd width */
  694.     if ((StringWidth + 1) >= MAIN_LCD_device_width - (ICON_WIDTH << 1))
  695.     {
  696.         rtn = MMI_FALSE;
  697.     }
  698.     else
  699.     {
  700.         rtn = MMI_TRUE;
  701.     }
  702.     /* restore the system font */
  703.     UI_set_font(&prev_f);
  704.     return rtn;
  705. }
  706. /*****************************************************************************
  707.  * FUNCTION
  708.  *  IdleRefreshServiceIndicationArea
  709.  * DESCRIPTION
  710.  *  To refresh Service indication Area
  711.  * PARAMETERS
  712.  *  void
  713.  * RETURNS
  714.  *  void
  715.  *****************************************************************************/
  716. #define SetLine1Text SetIdleScreenNetworkName
  717. #define SetLine2Text SetIdleScreenNetworkStatus
  718. void IdleRefreshServiceIndicationArea(void)
  719. {
  720.     /*----------------------------------------------------------------*/
  721.     /* Local Variables                                                */
  722.     /*----------------------------------------------------------------*/
  723.     /*----------------------------------------------------------------*/
  724.     /* Code Body                                                      */
  725.     /*----------------------------------------------------------------*/
  726. #ifdef __MMI_SWAP_LSK_RSK_IN_IDLE_SCREEN__
  727.     idleLRStringtID = IDLE_SCREEN_LSK_TEXT;
  728. #else 
  729.     idleLRStringtID = IDLE_SCREEN_RSK_TEXT;
  730. #endif 
  731.     SetLine1Text((U8*) NULL);
  732.     SetLine2Text((U8*) NULL);
  733.     /* diamond, 2005/07/22 240x320 sync searching screen style with idle screen style */
  734. #ifdef __MMI_MAINLCD_240X320__
  735.     if (mmi_bootup_is_network_searching_complete() == MMI_FALSE)
  736.     {
  737.         pfnUnicodeStrncpy(
  738.             (PS8) gNWProviderName,
  739.             (PS8) GetString(STR_IDLE_NETWORK_SRCH_SCR),
  740.             MAX_LENGTH_DISPLAY_NAME - 1);
  741.         SetLine1Text(gNWProviderName);
  742.         return;
  743.     }
  744. #endif /* __MMI_MAINLCD_240X320__ */ 
  745.     /* end, diamond */
  746.     if (g_pwr_context.CurrentServiceType == FULL_SERVICE)
  747.     {
  748.         /* MMI_BOOL SHOW_OPN = MMI_TRUE; */
  749.         MMI_BOOL OPN_Exist;
  750.         MMI_BOOL Short_OPN_Exist;
  751.         MMI_BOOL SPN_Exist;
  752.         MMI_BOOL MSISDN_Exist = PhnsetGetShowOwnerNumStatus() && (pfnUnicodeStrlen(gOwnerName) != 0);
  753.         stFontAttribute IdleScr_Medium_font = {0, 0, 0, MEDIUM_FONT, 0, 0};
  754.         U8 Scenario;
  755.     #if defined(__MMI_OPERATOR_NAME_MENU__)
  756.         /* SHOW_OPN = PhnsetGetShowOPNStatus(); */
  757.         if (PhnsetGetShowOPNStatus() == 0)  /* diamond, 2005/10/18 Hide the service area if this setting is off */
  758.         {
  759.             return;
  760.         }
  761.     #endif /* defined(__MMI_OPERATOR_NAME_MENU__) */ 
  762.         /* Now the line1 string is temporarily set to "Searching" so clear line2 in this case */
  763.         if (pfnUnicodeStrcmp((PS8) gNWProviderName, GetString(STR_ID_NETSET_SEARCHIN_NW)) == 0)
  764.         {
  765.             SetLine1Text(gNWProviderName);
  766.             return;
  767.         }
  768.         /* OPN*4 + SPN*2+ b1*1 */
  769.         Scenario = ((gOpNameValid || gShortOpnameValid) ? 4 : 0) +
  770.             (gSpnValid ? 2 : 0) + (g_pwr_context.RequireRPLMN ? 1 : 0);
  771.         PRINT_INFORMATION(("[Idle] display scenario: %d", Scenario));
  772.         /* OPN_Exist means gOpNameValid and the string is not NULL */
  773.         OPN_Exist = gOpNameValid && (pfnUnicodeStrlen(gOperatorName) != 0) /* && SHOW_OPN */ ;
  774.         Short_OPN_Exist = gShortOpnameValid && (pfnUnicodeStrlen(gShortOperatorName) != 0) /* && SHOW_OPN */ ;
  775.         SPN_Exist = gSpnValid && (pfnUnicodeStrlen(gServProvderName) != 0);
  776.         SetFont(IdleScr_Medium_font, (U8) gCurrLangIndex);
  777.         if (IsChineseSet()) /* Trad. Chinese and Simp. Chinese only */
  778.         {
  779.             SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  780.             if (SPN_Exist && pfnUnicodeStrcmp((S8*) gServProvderName, (S8*) gNWProviderName) != 0)
  781.             {
  782.                 SetLine2Text((U8*) gServProvderName);   /* Line 2: SPN */
  783.             }
  784.             else if (MSISDN_Exist)
  785.             {
  786.                 SetLine2Text((U8*) gOwnerName); /* Line 2: Owner Name */
  787.             }
  788.             else
  789.             {
  790.                 SetLine2Text((U8*) NULL);
  791.             }
  792.         }
  793.         else
  794.         {
  795.             switch (Scenario)   /* OPN--SPN--b1 */
  796.             {
  797.                 case 0:                             /* OPN=OFF, SPN=OFF, b1=0 */
  798.                 case 1:                             /* OPN=OFF, SPN=OFF, b1=1 */
  799.                     SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  800.                     if (MSISDN_Exist)
  801.                     {
  802.                         SetLine2Text((U8*) gOwnerName); /* Line 2: Owner Name */
  803.                     }
  804.                     break;
  805.                 case 2: /* OPN=OFF, SPN=ON, b1=0 */
  806.                     if (MSISDN_Exist)
  807.                     {
  808.                         if (mmi_bootup_is_roaming() == MMI_TRUE)
  809.                         {
  810.                             SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  811.                             if (SPN_Exist)
  812.                             {
  813.                                 SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  814.                             }
  815.                         }
  816.                         else
  817.                         {
  818.                             SetLine2Text((U8*) gOwnerName); /* Line 2: Owner Name */
  819.                             if (SPN_Exist)
  820.                             {
  821.                                 SetLine1Text((U8*) gServProvderName); /* Line 1 = SPN */
  822.                             }
  823.                         }
  824.                     }
  825.                     else
  826.                     {
  827.                         if (mmi_bootup_is_roaming() == MMI_TRUE)
  828.                         {
  829.                             SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  830.                             if (SPN_Exist)
  831.                             {
  832.                                 SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  833.                             }
  834.                         }
  835.                         else
  836.                         {
  837.                             if (SPN_Exist)
  838.                             {
  839.                                 SetLine1Text((U8*) gServProvderName);  /* Line 1 = SPN */
  840.                             }
  841.                             else
  842.                             {
  843.                                 SetLine1Text(gNWProviderName);  /* Line 2 = NULL */
  844.                             }
  845.                         }
  846.                     }
  847.                     break;
  848.                 case 3:                             /* OPN=OFF, SPN=ON, b1=1 */
  849.                     SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  850.                     if (SPN_Exist)
  851.                     {
  852.                         SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  853.                     }
  854.                     else if (MSISDN_Exist)
  855.                     {
  856.                         SetLine2Text((U8*) gOwnerName); /* Line 2: Owner Name */
  857.                     }
  858.                     else
  859.                     {
  860.                         SetLine2Text((U8*) NULL);
  861.                     }
  862.                     break;
  863.                 case 4: /* OPN=ON, SPN=OFF, b1=0 */
  864.                 case 5: /* OPN=ON, SPN=OFF, b1=1 */
  865.                     if (mmi_bootup_is_roaming() == MMI_TRUE)
  866.                     {
  867.                         SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  868.                         if (OPN_Exist)
  869.                         {
  870.                             SetLine2Text((U8*) gOperatorName); /* Line 2 = OPN */
  871.                         }
  872.                         else if (Short_OPN_Exist)
  873.                         {
  874.                             SetLine2Text((U8*) gShortOperatorName);
  875.                         }
  876.                         else    /* They are both valid but NULL */
  877.                         {
  878.                             SetLine2Text((U8*) NULL);
  879.                         }
  880.                     }
  881.                     else
  882.                     {
  883.                         if (OPN_Exist)
  884.                         {
  885.                             SetLine1Text((U8*) gOperatorName); /* Line 1 = OPN */
  886.                         }
  887.                         else if (Short_OPN_Exist)
  888.                         {
  889.                             SetLine1Text((U8*) gShortOperatorName);
  890.                         }
  891.                         else    /* They are both valid but NULL */
  892.                         {
  893.                             SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  894.                         }
  895.                         if (MSISDN_Exist)
  896.                         {
  897.                             SetLine2Text((U8*) gOwnerName); /* Line 2 = Owner Name */
  898.                         }
  899.                     }
  900.                     break;
  901.                 case 6: /* OPN=ON, SPN=ON, b1=0 */
  902.                 case 7: /* OPN=ON, SPN=ON, b1=1 */
  903.                     if (mmi_bootup_is_roaming() == MMI_TRUE)
  904.                     {
  905.                         SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  906.                         if (SPN_Exist && pfnUnicodeStrcmp((S8*) gServProvderName, (S8*) gNWProviderName) != 0)
  907.                         {
  908.                             SetLine2Text((U8*) gServProvderName);      /* Line 2 = SPN */
  909.                         }
  910.                         else if (MSISDN_Exist)
  911.                         {
  912.                             SetLine2Text((U8*) gOwnerName);
  913.                         }
  914.                         else
  915.                         {
  916.                             SetLine2Text((U8*) NULL);
  917.                         }
  918.                     }
  919.                     else
  920.                     {
  921.                         if (OPN_Exist)
  922.                         {
  923.                             SetLine1Text((U8*) gOperatorName); /* Line 1 = OPN */
  924.                             if (SPN_Exist && pfnUnicodeStrcmp((S8*) gServProvderName, (S8*) gOperatorName) != 0)
  925.                             {
  926.                                 SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  927.                             }
  928.                             else if (MSISDN_Exist)
  929.                             {
  930.                                 SetLine2Text((U8*) gOwnerName);        /* Line 2 = MSISDN */
  931.                             }
  932.                             else
  933.                             {
  934.                                 SetLine2Text((U8*) NULL);
  935.                             }
  936.                         }
  937.                         else if (Short_OPN_Exist)
  938.                         {
  939.                             SetLine1Text((U8*) gShortOperatorName);    /* Line 1 = Short OPN */
  940.                             if (SPN_Exist && pfnUnicodeStrcmp((S8*) gServProvderName, (S8*) gShortOperatorName) != 0)
  941.                             {
  942.                                 SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  943.                             }
  944.                             else if (MSISDN_Exist)
  945.                             {
  946.                                 SetLine2Text((U8*) gOwnerName);        /* Line 2 = MSISDN */
  947.                             }
  948.                             else
  949.                             {
  950.                                 SetLine2Text((U8*) NULL);
  951.                             }
  952.                         }
  953.                         else    /* They are both valid but NULL */
  954.                         {
  955.                             if (g_pwr_context.RequireRPLMN)
  956.                             {
  957.                                 SetLine1Text(gNWProviderName);  /* Line 1 = PLMN */
  958.                                 if (SPN_Exist && pfnUnicodeStrcmp((S8*) gServProvderName, (S8*) gNWProviderName) != 0)
  959.                                 {
  960.                                     SetLine2Text((U8*) gServProvderName);  /* Line 2 = SPN */
  961.                                 }
  962.                                 else if (MSISDN_Exist)
  963.                                 {
  964.                                     SetLine2Text((U8*) gOwnerName);        /* Line 2 = MSISDN */
  965.                                 }
  966.                                 else
  967.                                 {
  968.                                     SetLine2Text((U8*) NULL);
  969.                                 }
  970.                             }
  971.                             else
  972.                             {
  973.                                 if (MSISDN_Exist)
  974.                                 {
  975.                                     SetLine2Text((U8*) gOwnerName); /* Line 2: Owner Name */
  976.                                     if (SPN_Exist)
  977.                                     {
  978.                                         SetLine1Text((U8*) gServProvderName);  /* Line 1: SPN */
  979.                                     }
  980.                                 }
  981.                                 else
  982.                                 {
  983.                                     SetLine1Text((U8*) gServProvderName);  /* Line 1: SPN */
  984.                                 }
  985.                             }
  986.                         }
  987.                     }
  988.                     break;
  989.                 default:
  990.                     MMI_ASSERT(0);
  991.                     break;
  992.             }
  993.         }
  994.     #ifdef __MMI_NITZ__
  995.         mmi_idle_update_nitz_content();
  996.         if (g_nitz_display.opname_from_nitz && mmi_idle_check_nitz_display_validation())
  997.         {
  998.             PRINT_INFORMATION(("[Idle] Network name from NITZ"));
  999.             if (mmi_bootup_is_roaming())
  1000.             {
  1001.                 /* Roaming and receive NITZ network name */
  1002.                 SetLine1Text(g_nitz_display.display_name);
  1003.             }
  1004.             else if (OPN_Exist == 0 && g_pwr_context.RequireRPLMN == 1) /* not roaming but no OPN */
  1005.             {
  1006.                 /* Network name from NITZ takes lower priority from OPN, but not replace SPN */
  1007.                 SetLine1Text(g_nitz_display.display_name);
  1008.             }
  1009.         }
  1010.     #endif /* __MMI_NITZ__ */ 
  1011.     #ifdef __HOMEZONE_SUPPORT__
  1012.         if (gHomezoneText)
  1013.         {
  1014.             SetLine2Text((U8*) gHomezoneText);
  1015.         }
  1016.     #endif /* __HOMEZONE_SUPPORT__ */ 
  1017.     }
  1018. #ifdef __MANUAL_MODE_NW_SEL__
  1019.     else if (g_pwr_context.CurrentServiceType == LIMITED_SERVICE)
  1020.     {
  1021.     #ifdef __MMI_SIMAP_SUPPORT__
  1022.         if (mmi_bootup_get_active_bt_access_profile_mode())
  1023.         {
  1024.             pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8)L"SIM Access Profile");
  1025.         }
  1026.         else
  1027.     #endif /* __MMI_SIMAP_SUPPORT__ */
  1028.     #ifdef __MMI_WLAN_FEATURES__
  1029.         if (!mmi_bootup_is_sim_valid())
  1030.         {
  1031.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(simErrorDisplayString), MAX_LENGTH_DISPLAY_NAME - 1);
  1032.         }
  1033.         else
  1034.     #endif /* __MMI_WLAN_FEATURES__ */
  1035.         if (mmi_bootup_get_plmn_selection_mode() == AUTOMATIC_MODE)
  1036.         {
  1037.             if (mmi_bootup_is_nw_registration_ok() == MMI_FALSE)
  1038.             {
  1039.                 pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8) GetString(STR_SIM_INVALID_SIM_TITLE)); /* L1: "Invalid SIM" */
  1040.             }
  1041.             else
  1042.             {
  1043.                 pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8) GetString(STR_LIMITED_SERVICE)); /* L1: "Emergency" */
  1044.             }
  1045.         }
  1046.         else
  1047.         {
  1048.             /* L1: "Select Network" */
  1049.             /* diamond, 2005/12/18 Check if the input string length is larger than main lcd width */
  1050.             if (mmi_idle_check_nw_provider_name_length((PU8) GetString(STR_ID_NETSET_MANUAL_MODE_TITLE)))
  1051.             {
  1052.                 pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8) GetString(STR_ID_NETSET_MANUAL_MODE_TITLE));
  1053.             }
  1054.             else
  1055.             {
  1056.                 pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8) GetString(STR_ID_NETSET_MANUAL_MODE_SHORT));
  1057.             }
  1058.         #ifdef __MMI_WLAN_FEATURES__
  1059.             if (mmi_netset_get_active_preferred_mode() != P_WLAN_ONLY)
  1060.         #endif
  1061.                 idleLRStringtID = STR_GLOBAL_SELECT;
  1062.         }
  1063.         SetLine1Text(gNWProviderName);
  1064.     }
  1065.     else if (g_pwr_context.CurrentServiceType == NO_SERVICE)
  1066.     {
  1067.         /* L1: "No Service" */
  1068.     #ifdef __FLIGHT_MODE_SUPPORT__
  1069.         if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  1070.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(STR_MENU_FLIGHT_MODE), MAX_LENGTH_DISPLAY_NAME - 1);
  1071.         else
  1072.     #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1073.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(STR_NO_SERVICE), MAX_LENGTH_DISPLAY_NAME - 1);
  1074.         SetLine1Text(gNWProviderName);
  1075.     }
  1076.     else    /* temporarily remove the string */
  1077.     {
  1078.         /* L1: "" */
  1079.         SetLine1Text((U8*) NULL);
  1080.     }
  1081. #else /* __MANUAL_MODE_NW_SEL__ */ 
  1082.     else if (g_pwr_context.CurrentServiceType == LIMITED_SERVICE)
  1083.     {
  1084.     #ifdef __MMI_SIMAP_SUPPORT__
  1085.         if (mmi_bootup_get_active_bt_access_profile_mode())
  1086.             pfnUnicodeStrcpy((PS8) gNWProviderName, L"SIM Access Profile");
  1087.         else
  1088.     #endif /* __MMI_SIMAP_SUPPORT__ */
  1089.         /* L1: "Limited Service" */
  1090.     #ifdef __MMI_WLAN_FEATURES__
  1091.         if (!mmi_bootup_is_sim_valid())
  1092.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(simErrorDisplayString), MAX_LENGTH_DISPLAY_NAME - 1);
  1093.         else
  1094.     #endif /* __MMI_WLAN_FEATURES__ */
  1095.             pfnUnicodeStrcpy((PS8) gNWProviderName, (PS8) GetString(STR_LIMITED_SERVICE));
  1096.         SetLine1Text(gNWProviderName);
  1097.     }
  1098.     else    /* if ( gNoService ) */
  1099.     {
  1100.         /* L1: "No Service" */
  1101.     #ifdef __FLIGHT_MODE_SUPPORT__
  1102.         if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  1103.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(STR_MENU_FLIGHT_MODE), MAX_LENGTH_DISPLAY_NAME - 1);
  1104.         else
  1105.     #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1106.             pfnUnicodeStrncpy((PS8) gNWProviderName, (PS8) GetString(STR_NO_SERVICE), MAX_LENGTH_DISPLAY_NAME - 1);
  1107.         SetLine1Text(gNWProviderName);
  1108.     }
  1109. #endif /* __MANUAL_MODE_NW_SEL__ */ 
  1110. #ifdef __MMI_WLAN_FEATURES__
  1111.     if (mmi_bootup_get_active_flight_mode() != FLIGHTMODE_SILENT)
  1112.     {
  1113.         mmi_netset_update_preferred_mode_service_area();
  1114.     }
  1115. #endif /* __MMI_WLAN_FEATURES__ */
  1116. }
  1117. #undef SetLine1Text
  1118. #undef SetLine2Text
  1119. //KP Jerry add on 2007-3-31 start
  1120. #ifdef __MMI_PROFILE_POWER_SAVING__
  1121. /*****************************************************************************
  1122.  * FUNCTION
  1123.  *  IdleTogglePowerSavingProfile
  1124.  * DESCRIPTION
  1125.  *  Toggles profiles between PowerSvaing mode and current activated profile on long press of CAM key.
  1126.  * PARAMETERS
  1127.  *  void
  1128.  * RETURNS
  1129.  *  void
  1130.  *****************************************************************************/
  1131. void IdleTogglePowerSavingProfile(void)
  1132. {
  1133.     /*----------------------------------------------------------------*/
  1134.     /* Local Variables                                                */
  1135.     /*----------------------------------------------------------------*/
  1136.     MMI_ALERT_TYPE alert_type;
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140. #ifdef __MMI_BT_PROFILE__
  1141.     if( (gprofileheadset != 1) && (gactivatedprofile != MMI_PROFILE_BT) )
  1142. #else
  1143.     if(gprofileheadset != 1) 
  1144. #endif
  1145.     {
  1146.     if (gactivatedprofile != MMI_PROFILE_POWER_SAVING)
  1147.     {
  1148.           mmi_profiles_power_saving_activate_profile();
  1149.     }
  1150.     else
  1151.     {
  1152.           mmi_profiles_power_saving_deactivate_profile();
  1153.     }
  1154.     alert_type = GetMtCallAlertTypeEnum();
  1155. #ifdef __MMI_BT_PROFILE__
  1156.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged && ((gactivatedprofile != MMI_PROFILE_BT)))
  1157. #else
  1158.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged)
  1159. #endif
  1160.     {
  1161.         VibratorOn();
  1162.         StartTimer(TOGGLE_TIMER, TOGGLE_PROFILE_TIMEOUT, IdleStopToggleTimer);
  1163.     }
  1164.     /* diamond, 2005/10/21 disable long press if # is long pressed when earphone is plugged in */
  1165. #ifdef __MMI_BT_PROFILE__
  1166.     if (isEarphonePlugged || mmi_profiles_bt_is_activated())
  1167. #else 
  1168.     if (isEarphonePlugged)
  1169. #endif 
  1170.         IdleDisableLongPress();
  1171.     }
  1172. }
  1173. #endif
  1174. //KP Jerry add on 2007-3-31 end
  1175. /*****************************************************************************
  1176.  * FUNCTION
  1177.  *  IdleToggleProfile
  1178.  * DESCRIPTION
  1179.  *  Toggles profiles between silent mode and current activated profile on long press of # key.
  1180.  * PARAMETERS
  1181.  *  void
  1182.  * RETURNS
  1183.  *  void
  1184.  *****************************************************************************/
  1185. void IdleToggleProfile(void)
  1186. {
  1187.     /*----------------------------------------------------------------*/
  1188.     /* Local Variables                                                */
  1189.     /*----------------------------------------------------------------*/
  1190.     MMI_ALERT_TYPE alert_type;
  1191.     /*----------------------------------------------------------------*/
  1192.     /* Code Body                                                      */
  1193.     /*----------------------------------------------------------------*/
  1194.     if (gactivatedprofile == MMI_PROFILE_SILENT)    //Old:if (gactivatedprofile == 5)     //KP Jerry modify on 2007-4-2
  1195.     {
  1196.         g_idle_context.ToggleProfile = SET_SILENT_PROFILE;
  1197.     }
  1198.     else
  1199.     {
  1200.         g_idle_context.ToggleProfile = SET_CURRENT_PROFILE;
  1201.     }
  1202.     if (g_idle_context.ToggleProfile == SET_CURRENT_PROFILE)
  1203.     {
  1204.         g_idle_context.ToggleProfile = SET_SILENT_PROFILE;
  1205.         ActivateSilentProfile();
  1206.     }
  1207.     else
  1208.     {
  1209.         g_idle_context.ToggleProfile = SET_CURRENT_PROFILE;
  1210.         DeactivateSilentProfile();
  1211.     }
  1212.     alert_type = GetMtCallAlertTypeEnum();
  1213. //KP Jerry modify on 2007-4-3 start
  1214. #ifdef __MMI_PROFILE_POWER_SAVING__
  1215. #ifdef __MMI_BT_PROFILE__
  1216.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged && (gactivatedprofile != MMI_PROFILE_BT) && (gactivatedprofile != MMI_PROFILE_POWER_SAVING))
  1217. #else
  1218.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged && (gactivatedprofile != MMI_PROFILE_POWER_SAVING))
  1219. #endif
  1220. #else/*!__MMI_PROFILE_POWER_SAVING__*/
  1221. #ifdef __MMI_BT_PROFILE__
  1222.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged && (gactivatedprofile != MMI_PROFILE_BT))
  1223. #else
  1224.     if (alert_type == MMI_VIBRATION_ONLY && !isEarphonePlugged)
  1225. #endif
  1226. #endif/*__MMI_PROFILE_POWER_SAVING__*/
  1227. //KP Jerry modify on 2007-4-3 end
  1228.     {
  1229.         VibratorOn();
  1230.         StartTimer(TOGGLE_TIMER, TOGGLE_PROFILE_TIMEOUT, IdleStopToggleTimer);
  1231.     }
  1232.     /* diamond, 2005/10/21 disable long press if # is long pressed when earphone is plugged in */
  1233. //KP Jerry modify on 2007-4-3 start
  1234. #ifdef __MMI_PROFILE_POWER_SAVING__
  1235. #ifdef __MMI_BT_PROFILE__
  1236.     if (isEarphonePlugged || mmi_profiles_bt_is_activated() || (gactivatedprofile == MMI_PROFILE_POWER_SAVING))
  1237. #else 
  1238.     if (isEarphonePlugged)
  1239. #endif 
  1240. #else/*!__MMI_PROFILE_POWER_SAVING__*/
  1241. #ifdef __MMI_BT_PROFILE__
  1242.     if (isEarphonePlugged || mmi_profiles_bt_is_activated())
  1243. #else 
  1244.     if (isEarphonePlugged)
  1245. #endif 
  1246. #endif/*__MMI_PROFILE_POWER_SAVING__*/
  1247. //KP Jerry modify on 2007-4-3 end
  1248.         IdleDisableLongPress();
  1249. }
  1250. /*****************************************************************************
  1251.  * FUNCTION
  1252.  *  IdleStopToggleTimer
  1253.  * DESCRIPTION
  1254.  *  Stop toggle Profile timer of # key..
  1255.  * PARAMETERS
  1256.  *  void
  1257.  * RETURNS
  1258.  *  void
  1259.  *****************************************************************************/
  1260. void IdleStopToggleTimer(void)
  1261. {
  1262.     /*----------------------------------------------------------------*/
  1263.     /* Local Variables                                                */
  1264.     /*----------------------------------------------------------------*/
  1265.     /*----------------------------------------------------------------*/
  1266.     /* Code Body                                                      */
  1267.     /*----------------------------------------------------------------*/
  1268.     StopTimer(TOGGLE_TIMER);
  1269.     VibratorOff();
  1270. }
  1271. /*****************************************************************************
  1272.  * FUNCTION
  1273.  *  IdleCallSpeedDialOnLongPress
  1274.  * DESCRIPTION
  1275.  *  Implements speed dial on idle screen.
  1276.  * PARAMETERS
  1277.  *  void
  1278.  * RETURNS
  1279.  *  void
  1280.  *****************************************************************************/
  1281. void IdleCallSpeedDialOnLongPress(void)
  1282. {
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Local Variables                                                */
  1285.     /*----------------------------------------------------------------*/
  1286.     U16 Keycode, Keytype;
  1287.     S8 *tempbuffer = NULL;
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Code Body                                                      */
  1290.     /*----------------------------------------------------------------*/
  1291.     GetkeyInfo(&Keycode, &Keytype);
  1292.     if ((Keycode >= 1) && (Keycode <= 9))
  1293.     {
  1294.     #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1295.         g_idle_context.AvoidHistoryofDialerScreen = 1; /* Not save dialer screen to history for long press to speed dial */
  1296.     #endif
  1297.         if (!g_phb_cntx.phb_ready)
  1298.         {
  1299.             mmi_phb_entry_not_ready(STR_PROCESSING_PHONEBOOK);
  1300.             return;
  1301.         }
  1302.         tempbuffer = PhbGetSpeedDialNum(Keycode);
  1303.         if (tempbuffer != NULL)
  1304.         {
  1305.             pfnUnicodeStrcpy(g_idle_context.DialPadCallBuffer, tempbuffer);
  1306.             IdleDialPadCall();
  1307.         }
  1308.         else
  1309.         {
  1310.             IdleShowScrNoSpeedDialNumSaved();
  1311.         }
  1312.     }
  1313. }
  1314. /*****************************************************************************
  1315.  * FUNCTION
  1316.  *  IdleShowScrNoSpeedDialNumSaved
  1317.  * DESCRIPTION
  1318.  *  Displays pop up: no speed dial number saved for this digit.
  1319.  * PARAMETERS
  1320.  *  void
  1321.  * RETURNS
  1322.  *  void
  1323.  *****************************************************************************/
  1324. void IdleShowScrNoSpeedDialNumSaved(void)
  1325. {
  1326.     /*----------------------------------------------------------------*/
  1327.     /* Local Variables                                                */
  1328.     /*----------------------------------------------------------------*/
  1329.     /*----------------------------------------------------------------*/
  1330.     /* Code Body                                                      */
  1331.     /*----------------------------------------------------------------*/
  1332.     PRINT_INFORMATION(("@@@@@@ NO SPEED DIAL NUMBER SAVED @@@@@@@@@"));
  1333.     DeleteUptoScrID(IDLE_SCREEN_ID);
  1334.     DisplayPopup((U8*) GetString(STR_NO_SPEED_DIAL_NUM_SAVED), IMG_GLOBAL_WARNING, 0, 2000, (U8) WARNING_TONE);
  1335. }
  1336. /*****************************************************************************
  1337.  * FUNCTION
  1338.  *  IdleAbbrevDialling
  1339.  * DESCRIPTION
  1340.  *  Quick acces to phonebook entries.
  1341.  * PARAMETERS
  1342.  *  void
  1343.  * RETURNS
  1344.  *  void
  1345.  *****************************************************************************/
  1346. void IdleAbbrevDialling(void)
  1347. {
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Local Variables                                                */
  1350.     /*----------------------------------------------------------------*/
  1351.     S8 tempbuffer[(MAX_LOCATION_DIGITS + 1) * ENCODING_LENGTH];
  1352.     U8 count, i = 0;
  1353.     U16 Location;
  1354.     /*----------------------------------------------------------------*/
  1355.     /* Code Body                                                      */
  1356.     /*----------------------------------------------------------------*/
  1357.     memset(tempbuffer, 0, ((MAX_LOCATION_DIGITS + 1) * ENCODING_LENGTH));
  1358.     /* Don't do anything when shifting out digits */
  1359.     if (pfnUnicodeStrlen((PS8) g_idle_context.DialPadCallBuffer) >= (MAX_DIAL_PAD - 1))
  1360.     {
  1361.         return;
  1362.     }
  1363.     if ((g_idle_context.DialPadCallBuffer[0] >= '0') && (g_idle_context.DialPadCallBuffer[0] <= '9'))
  1364.     {
  1365.         /* This loop search for '#' in DialpadCallbuffer,if # is not found before MAX_LOCATION_DIGITS then return */
  1366.         for (count = 0; (g_idle_context.DialPadCallBuffer[count] != '#'); count++)
  1367.         {
  1368.             if (count > (MAX_LOCATION_DIGITS * ENCODING_LENGTH - 1) || g_idle_context.DialPadCallBuffer[count] == '*' || g_idle_context.DialPadCallBuffer[count] == '+')
  1369.             {
  1370.                 return;
  1371.             }
  1372.             tempbuffer[i] = g_idle_context.DialPadCallBuffer[count];
  1373.             i++;
  1374.         }
  1375.         if (g_idle_context.DialPadCallBuffer[count + 2] == 0)   /* no other digits after the first found # */
  1376.         {
  1377.             Location = (U16) gui_atoi((UI_string_type) tempbuffer);
  1378.             g_idle_context.AvoidHistoryofDialerScreen = 1;
  1379.             mmi_phb_get_sim_entry_by_location((U16) Location);
  1380.         }
  1381.     }
  1382.     else if (!SSCStringParsing3())
  1383.     {
  1384.         SSCStringParsing1();
  1385.     }
  1386. }
  1387. /*****************************************************************************
  1388.  * FUNCTION
  1389.  *  IdleShowScrInvalidLocation
  1390.  * DESCRIPTION
  1391.  *  Displays popup for Invalid location
  1392.  * PARAMETERS
  1393.  *  void
  1394.  * RETURNS
  1395.  *  void
  1396.  *****************************************************************************/
  1397. void IdleShowScrInvalidLocation(void)
  1398. {
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Local Variables                                                */
  1401.     /*----------------------------------------------------------------*/
  1402.     /*----------------------------------------------------------------*/
  1403.     /* Code Body                                                      */
  1404.     /*----------------------------------------------------------------*/
  1405.     PRINT_INFORMATION(("@@@@@@ INVALID LOCATION IN PHONE BOOK @@@@@@@@@"));
  1406.     DisplayPopup((U8*) GetString(STR_INVALID_LOCATION), IMG_GLOBAL_WARNING, 0, 2000, (U8) WARNING_TONE);
  1407. }
  1408. /*****************************************************************************
  1409.  * FUNCTION
  1410.  *  IdleShowScrNoPhoneNumEntry
  1411.  * DESCRIPTION
  1412.  *  Show pop up that no phone book entry saved on this location.
  1413.  * PARAMETERS
  1414.  *  void
  1415.  * RETURNS
  1416.  *  void
  1417.  *****************************************************************************/
  1418. void IdleShowScrNoPhoneNumEntry(void)
  1419. {
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Local Variables                                                */
  1422.     /*----------------------------------------------------------------*/
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Code Body                                                      */
  1425.     /*----------------------------------------------------------------*/
  1426.     PRINT_INFORMATION(("@@@@@@ NO PHONE NUMBER CORRESPONDING TO THIS LOCATION @@@@@@@@@"));
  1427.     DisplayPopup((U8*) GetString(STR_NO_PHONE_NUM), IMG_GLOBAL_WARNING, 0, 2000, (U8) WARNING_TONE);
  1428. }
  1429. /*****************************************************************************
  1430.  * FUNCTION
  1431.  *  IdleDialPadSavePhoneBook
  1432.  * DESCRIPTION
  1433.  *  Save entered number in phonebook on press of LSK on dialler screen.
  1434.  *  
  1435.  *  Temorary function
  1436.  * PARAMETERS
  1437.  *  void
  1438.  * RETURNS
  1439.  *  void
  1440.  *****************************************************************************/
  1441. void IdleDialPadSavePhoneBook(void)
  1442. {
  1443.     /*----------------------------------------------------------------*/
  1444.     /* Local Variables                                                */
  1445.     /*----------------------------------------------------------------*/
  1446.     /*----------------------------------------------------------------*/
  1447.     /* Code Body                                                      */
  1448.     /*----------------------------------------------------------------*/
  1449. #ifdef __MMI_VOIP__
  1450.     if (IsScreenPresent(SCR_ID_VOIP_CALL_EDITOR)) /* save voip uri */
  1451.     {        
  1452.         if (pfnUnicodeStrlen((S8*)g_idle_context.DialPadCallBuffer))
  1453.         {
  1454.             mmi_phb_save_entry_for_service_field((S8*)g_idle_context.DialPadCallBuffer, MMI_PHB_ENTER_FROM_VOIP);
  1455.         }
  1456.         else
  1457.         {
  1458.             DisplayPopup(
  1459.                 (U8*)GetString(STR_ID_VOIP_EMPTY_USERNAME),
  1460.                 IMG_GLOBAL_UNFINISHED,
  1461.                 1,
  1462.                 UI_POPUP_NOTIFYDURATION_TIME,
  1463.                 ERROR_TONE_IN_CALL);
  1464.             DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_OPTIONS_ID); /* go back to call editor screen */
  1465.         }        
  1466.     }
  1467.     else
  1468. #endif /* __MMI_VOIP__ */
  1469.     {
  1470.         SaveNumberFromIdleScrn(g_idle_context.DialPadCallBuffer, 0);
  1471.     }    
  1472. }
  1473. /*****************************************************************************
  1474.  * FUNCTION
  1475.  *  IdleDialPadCall
  1476.  * DESCRIPTION
  1477.  *  Make a call from scratch pad
  1478.  * PARAMETERS
  1479.  *  void
  1480.  * RETURNS
  1481.  *  void
  1482.  *****************************************************************************/
  1483. void IdleDialPadCall(void)
  1484. {
  1485.     /*----------------------------------------------------------------*/
  1486.     /* Local Variables                                                */
  1487.     /*----------------------------------------------------------------*/
  1488.     /*----------------------------------------------------------------*/
  1489.     /* Code Body                                                      */
  1490.     /*----------------------------------------------------------------*/
  1491.     /* Call the API with collected digits(DialPadCallBuffer) to initiate MO call */
  1492.     g_idle_context.AvoidHistoryofDialerScreen = 1;
  1493. #ifdef __IP_NUMBER__
  1494.     SetTempUseIPNumber(FALSE);
  1495. #endif 
  1496.     /* to disable the dialing if no digit is present */
  1497. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1498.     if (!SSCStringParsing2() && g_idle_context.DialPadCallBuffer[0] != '')
  1499. #else 
  1500.     if (!SSCStringParsing2())
  1501. #endif 
  1502.         MakeCall(g_idle_context.DialPadCallBuffer);
  1503. }
  1504. /*****************************************************************************
  1505.  * FUNCTION
  1506.  *  DialIPNumber
  1507.  * DESCRIPTION
  1508.  *  Dial IP Number
  1509.  * PARAMETERS
  1510.  *  void
  1511.  * RETURNS
  1512.  *  void
  1513.  *****************************************************************************/
  1514. #ifdef __IP_NUMBER__
  1515. void DialIPNumber(void)
  1516. {
  1517.     /*----------------------------------------------------------------*/
  1518.     /* Local Variables                                                */
  1519.     /*----------------------------------------------------------------*/
  1520.     /*----------------------------------------------------------------*/
  1521.     /* Code Body                                                      */
  1522.     /*----------------------------------------------------------------*/
  1523.     g_idle_context.AvoidHistoryofDialerScreen = 1;
  1524.     SetTempUseIPNumber(TRUE);
  1525.     if (!SSCStringParsing2())
  1526.     {
  1527.         MakeCall(g_idle_context.DialPadCallBuffer);
  1528.     }
  1529. }
  1530. #endif /* __IP_NUMBER__ */ 
  1531. /*****************************************************************************
  1532.  * FUNCTION
  1533.  *  IdleScreenDigitHandler
  1534.  * DESCRIPTION
  1535.  *  Inputs the digits of a phone number
  1536.  * PARAMETERS
  1537.  *  void
  1538.  * RETURNS
  1539.  *  void
  1540.  *****************************************************************************/
  1541. //KP Jerry add on 2007-4-12 start
  1542. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  1543. void IdleScreenDigit_Option(void);
  1544. #endif
  1545. //KP Jerry add on 2007-4-12 end
  1546. void IdleScreenDigitHandler(void)
  1547. {
  1548.     /*----------------------------------------------------------------*/
  1549.     /* Local Variables                                                */
  1550.     /*----------------------------------------------------------------*/
  1551.     U8 *history_buffer;
  1552.     U16 SpeedDialKeys[MAX_SPEED_DIAL_KEYS] = {KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9};
  1553. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1554.     U16 TouchDialPadKeys[MAX_TOUCH_DIAL_PAD_KEYS] =
  1555.         {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, /*KEY_STAR,*/ KEY_POUND};
  1556. #endif /* __MMI_TOUCH_DIAL_SCREEN__ */ 
  1557.     /*----------------------------------------------------------------*/
  1558.     /* Code Body                                                      */
  1559.     /*----------------------------------------------------------------*/
  1560. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  1561.     //if (mmi_netset_get_active_preferred_mode() == P_WLAN_ONLY || mmi_netset_get_active_preferred_mode() == P_WLAN_PREFERRED)
  1562.     if (mmi_netset_get_dial_mode())
  1563.     {
  1564.         mmi_frm_unhide_menu_item(MENU_ID_DIALER_SCREEN_OPTIONS_INPUT_METHOD);
  1565.         mmi_netset_enter_wlan_dialer_screen();
  1566.         return;
  1567.     }
  1568.     else
  1569.     {
  1570.         mmi_frm_hide_menu_item(MENU_ID_DIALER_SCREEN_OPTIONS_INPUT_METHOD);
  1571.     }
  1572. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  1573.     EntryNewScreen(IDLE_SCREEN_DIGIT_HANDLER_ID, ExitIdleScreenDigitHandler, NULL, NULL);
  1574.     DeInitSpecialMode();
  1575.     g_idle_context.IsOnDialerScreen = 1;
  1576.     g_idle_context.AvoidHistoryofDialerScreen = 0;
  1577.     history_buffer = GetCurrGuiBuffer(IDLE_SCREEN_DIGIT_HANDLER_ID);
  1578. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  1579.     if (mmi_netset_get_active_preferred_mode() == P_GSM_PREFERRED || mmi_netset_get_active_preferred_mode() == P_WLAN_PREFERRED)
  1580.         ShowCategory16Screen(
  1581.             STR_GLOBAL_OPTIONS,
  1582.             0,
  1583.             STR_GLOBAL_BACK,
  1584.             0,
  1585.             (U8*) g_idle_context.DialPadCallBuffer,
  1586.             MAX_DIAL_PAD,
  1587.             history_buffer);
  1588.     else
  1589. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  1590.         ShowCategory16Screen(
  1591. //KP Jerry add on 2007-4-12 start
  1592. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  1593.             STR_GLOBAL_OPTIONS,
  1594. #else
  1595.             STR_GLOBAL_SAVE,
  1596. #endif
  1597. //KP Jerry add on 2007-4-12 end
  1598.             0,
  1599.             STR_GLOBAL_BACK,
  1600.             0,
  1601.             (U8*) g_idle_context.DialPadCallBuffer,
  1602.             MAX_DIAL_PAD,
  1603.             history_buffer);
  1604.     /* 090605 Dialing Calvin Start */
  1605. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__))
  1606. #if defined  (__MMI_TOUCH_DIAL_SCREEN_WITH_FUNCTION__)
  1607.     SetDialingKeypadCallHandler(IdleDialPadCall);
  1608. SetDialingKeypadIPCallHandler(DialIPNumber);         //KP Jerry add on 2006-11-13
  1609. #else 
  1610.     SetCenterSoftkeyFunction(IdleDialPadCall, KEY_EVENT_UP);
  1611. #endif 
  1612. #endif /* ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__)) */ 
  1613.     /* 090605 Dialing Calvin Start */
  1614.     if (g_idle_context.IdleScreenDigitKeyCode >= 0)
  1615.     {
  1616.         ExecuteCurrKeyHandler(g_idle_context.IdleScreenDigitKeyCode, KEY_EVENT_DOWN);
  1617.     }
  1618. #if defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__)
  1619.     if (mmi_netset_get_active_preferred_mode() == P_GSM_PREFERRED || mmi_netset_get_active_preferred_mode() == P_WLAN_PREFERRED)
  1620.         SetLeftSoftkeyFunction(mmi_netset_enter_wlan_dialer_option, KEY_EVENT_UP);
  1621.     else
  1622. #endif /* defined(__MMI_WLAN_FEATURES__) && defined(__MMI_VOIP__) */
  1623. //KP Jerry add on 2007-4-12 start
  1624. #ifdef __MMI_MESSAGES_SENDMSG_QUICKLY__
  1625.     SetLeftSoftkeyFunction(IdleScreenDigit_Option, KEY_EVENT_UP);
  1626. #else
  1627.     SetLeftSoftkeyFunction(IdleDialPadSavePhoneBook, KEY_EVENT_UP);
  1628. #endif
  1629. //KP Jerry add on 2007-4-12 end
  1630.     SetKeyHandler(IdleDialPadCall, KEY_SEND, KEY_EVENT_UP);
  1631.     SetKeyHandler(IdleAbbrevDialling, KEY_POUND, KEY_EVENT_UP);
  1632.     SetCategory16RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1633. #ifdef __MMI_IP_KEY__
  1634. /* under construction !*/
  1635. #endif 
  1636.     /* first press of any key on idle screen to enter dialer screen, gLongPressEnable will be 0; 
  1637.        so following keyhandlers will b registered. On up event of anykey will call DisableLongPress 
  1638.        which will make gLongPressEnable=1 and will enter this screen again and these key handlers will not register again. */
  1639. #ifdef __MMI_STARKEY_TOGGLE_PROFILE__
  1640.     if ((g_idle_context.LongPressEnable == 0) && !history_buffer)       /* Lisen  (!history_buffer) to check if it is back from history, see Cannon+ SCR 1847 */
  1641. #else /* __MMI_STARKEY_TOGGLE_PROFILE__ */ 
  1642. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1643.     /* history buffer condition removed as to restore the key handlers after popup */
  1644.     /* g_idle_context.IdleScreenDigitKeyCode=-1 means dial screen shows when user click on CSK */
  1645.     /* MTK Leo start, last one condition is not needed */
  1646.     /* if((g_idle_context.LongPressEnable==0) && (g_idle_context.IdleScreenDigitKeyCode!=KEY_STAR) && (g_idle_context.IdleScreenDigitKeyCode!=-1) ) */
  1647.     if ((g_idle_context.LongPressEnable == 0) && (g_idle_context.IdleScreenDigitKeyCode != KEY_STAR))
  1648. #else /* __MMI_TOUCH_DIAL_SCREEN__ */ 
  1649.     if ((g_idle_context.LongPressEnable == 0) && (g_idle_context.IdleScreenDigitKeyCode != KEY_STAR) && !history_buffer)
  1650. #endif /* __MMI_TOUCH_DIAL_SCREEN__ */ 
  1651. #endif /* __MMI_STARKEY_TOGGLE_PROFILE__ */ 
  1652.     {
  1653.     #ifndef __MMI_TOUCH_DIAL_SCREEN__
  1654.         g_idle_context.AvoidHistoryofDialerScreen = 1;
  1655.     #endif
  1656.         mmi_phb_call_set_dial_from_list(MMI_PHB_NONE);  /* diamond, 2006/02/13 Reset dial from list flag */
  1657.         if (PhbGetSpeedDialStatus() == MMI_TRUE)
  1658.         {
  1659.             SetGroupKeyHandler(IdleCallSpeedDialOnLongPress, SpeedDialKeys, MAX_SPEED_DIAL_KEYS - 1, KEY_LONG_PRESS);
  1660.         }
  1661.         SetKeyHandler(DialVoiceMail, KEY_1, KEY_LONG_PRESS);
  1662.     #ifdef __MMI_STARKEY_TOGGLE_PROFILE__
  1663.         SetKeyHandler(IdleToggleProfile, KEY_STAR, KEY_LONG_PRESS);
  1664.     #else 
  1665.         SetKeyHandler(IdleToggleProfile, KEY_POUND, KEY_LONG_PRESS);
  1666.     #endif 
  1667.     #ifdef __MMI_POUNDKEY_ENTER_PROFILE__
  1668.         SetKeyHandler(EntryScrProfiles, KEY_POUND, KEY_LONG_PRESS);
  1669.     #endif 
  1670.     #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1671.         SetGroupKeyHandler(IdleDisableLongPress, TouchDialPadKeys, (U8) MAX_TOUCH_DIAL_PAD_KEYS, KEY_EVENT_UP);
  1672.     #else 
  1673.         SetGroupKeyHandler(IdleDisableLongPress, (PU16) PresentAllKeys, (U8) TOTAL_KEYS, KEY_EVENT_UP);
  1674.     #endif 
  1675.     }
  1676. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  1677.     else
  1678.     {
  1679.         DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_HANDLER_ID);
  1680.     }
  1681. #endif /* __MMI_TOUCH_DIAL_SCREEN__ */
  1682. }
  1683. /*****************************************************************************
  1684.  * FUNCTION
  1685.  *  ExitIdleScreenDigitHandler
  1686.  * DESCRIPTION
  1687.  *  Exit function for idle screen digit handle
  1688.  * PARAMETERS
  1689.  *  void
  1690.  * RETURNS
  1691.  *  void
  1692.  *****************************************************************************/
  1693. void ExitIdleScreenDigitHandler(void)
  1694. {
  1695.     /*----------------------------------------------------------------*/
  1696.     /* Local Variables                                                */
  1697.     /*----------------------------------------------------------------*/
  1698.     /*----------------------------------------------------------------*/
  1699.     /* Code Body                                                      */
  1700.     /*----------------------------------------------------------------*/
  1701.     if (!g_idle_context.AvoidHistoryofDialerScreen)
  1702.     {
  1703.     #ifdef __FLIGHT_MODE_SUPPORT__
  1704.         if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  1705.         {
  1706.             GenericExitScreen(IDLE_SCREEN_DIGIT_HANDLER_ID, FlightModeDigitHandler);
  1707.         }
  1708.         else
  1709.     #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1710.             GenericExitScreen(IDLE_SCREEN_DIGIT_HANDLER_ID, IdleScreenDigitHandler);
  1711.     }
  1712.     g_idle_context.IsOnDialerScreen = 0;
  1713.     g_idle_context.IdleScreenDigitKeyCode = -1;
  1714. #if ( (defined  __MMI_WGUI_CSK_ENABLE__) && defined (__MMI_TOUCH_SCREEN__) )
  1715.     ResetCenterSoftkey();
  1716. #endif 
  1717. }
  1718. /*****************************************************************************
  1719.  * FUNCTION
  1720.  *  HandleIdleScreenDigitEntry
  1721.  * DESCRIPTION
  1722.  *  This function is entered when a key is pressed at the Idle screen.
  1723.  * PARAMETERS
  1724.  *  void
  1725.  * RETURNS
  1726.  *  void
  1727.  *****************************************************************************/
  1728. void HandleIdleScreenDigitEntry(void)
  1729. {
  1730.     /*----------------------------------------------------------------*/
  1731.     /* Local Variables                                                */
  1732.     /*----------------------------------------------------------------*/
  1733.     U16 Keycode, Keytype;
  1734.     /*----------------------------------------------------------------*/
  1735.     /* Code Body                                                      */
  1736.     /*----------------------------------------------------------------*/
  1737.     GetkeyInfo(&Keycode, &Keytype);
  1738.     sprintf(g_idle_context.DialPadCallBuffer, "");
  1739.     g_idle_context.IdleScreenDigitKeyCode = Keycode;
  1740.     /* diamond, 2005/07/05 Flight mode */
  1741. #ifdef __FLIGHT_MODE_SUPPORT__
  1742.     if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  1743.     {
  1744.         FlightModeDigitHandler();
  1745.     }
  1746.     else
  1747. #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1748.         /* end, diamond */
  1749.         IdleScreenDigitHandler();
  1750. }
  1751. /*****************************************************************************
  1752.  * FUNCTION
  1753.  *  IdleDisableLongPress
  1754.  * DESCRIPTION
  1755.  *  Disbale some long press handlers on up event of key
  1756.  * PARAMETERS
  1757.  *  void
  1758.  * RETURNS
  1759.  *  void
  1760.  *****************************************************************************/
  1761. void IdleDisableLongPress(void)
  1762. {
  1763.     /*----------------------------------------------------------------*/
  1764.     /* Local Variables                                                */
  1765.     /*----------------------------------------------------------------*/
  1766.     /*----------------------------------------------------------------*/
  1767.     /* Code Body                                                      */
  1768.     /*----------------------------------------------------------------*/
  1769.     g_idle_context.LongPressEnable = 1;
  1770. #ifdef __FLIGHT_MODE_SUPPORT__
  1771.     if (mmi_bootup_get_active_flight_mode() == FLIGHTMODE_SILENT)
  1772.     {
  1773.         FlightModeDigitHandler();
  1774.     }
  1775.     else
  1776. #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  1777.         IdleScreenDigitHandler();
  1778. }
  1779. /*****************************************************************************
  1780.  * FUNCTION
  1781.  *  IdleSetKeyPadLockFlag
  1782.  * DESCRIPTION
  1783.  *  This function is called when time out occurs on idle screen to set key pad lock flag
  1784.  * PARAMETERS
  1785.  *  void
  1786.  * RETURNS
  1787.  *  void
  1788.  *****************************************************************************/
  1789. //KP Jerry add on 2007-4-10 start
  1790. #if defined(__MMI_PEN_BLOCK_WHEN_KAYPAD_LOCKED__)
  1791. extern BOOL GetLCDSleepStatus(void);
  1792. #endif
  1793. //KP Jerry add on 2007-4-10 end
  1794. void IdleSetKeyPadLockFlag(void)
  1795. {
  1796.     /*----------------------------------------------------------------*/
  1797.     /* Local Variables                                                */
  1798.     /*----------------------------------------------------------------*/
  1799.     /*----------------------------------------------------------------*/
  1800.     /* Code Body                                                      */
  1801.     /*----------------------------------------------------------------*/
  1802.     PRINT_INFORMATION(("[Keypad Lock] SetKeyPadLockFlag: gKeyPadLockFlag ON"));
  1803.     g_keylock_context.gKeyPadLockFlag = 1;
  1804. #if 0   /* diamond, 2006/03/07 Not necessary to block pen here because pen is blocked in EntryIdleScreen */
  1805. #ifdef __MMI_TOUCH_SCREEN__
  1806. /* under construction !*/
  1807. #endif
  1808. #endif /* 0 */ 
  1809. #ifndef __MMI_KEYPADLOCK_WITH_KEYTONE__
  1810.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  1811. #endif 
  1812.     if (g_idle_context.ScreenSaverRunFlag != 1)
  1813.     {
  1814.         /* Screen saver is not running, using SetRightSoftkeyFunction() for redrew softkey */
  1815.         EntryIdleScreen();
  1816.     #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  1817.         SetKeyHandler(IdleRSKPressOnScreenSaver, KEY_SEND, KEY_EVENT_DOWN);
  1818.     #else /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  1819. SetGroupKeyHandler(NULL, (PU16) PresentAllKeys, (U8) TOTAL_KEYS /* MAX_KEYS - 1 */ , KEY_EVENT_DOWN);
  1820.     #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27    /* Robin 1223 */
  1821.         SetRightSoftkeyFunction(IdleRSKPressOnScreenSaver, KEY_EVENT_DOWN);
  1822.     #endif 
  1823.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__    /* Robin 1223 */
  1824.         SetLeftSoftkeyFunction(IdleRSKPressOnScreenSaver, KEY_EVENT_DOWN);
  1825.     #endif 
  1826.     #endif /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  1827.     }
  1828.     else
  1829.     {
  1830.         /* Robin 1216, Screen saver is running, using SetKeyHandler() to prevent redrew softkey */
  1831.     #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  1832.         SetKeyHandler(IdleRSKPressOnScreenSaver, KEY_SEND, KEY_EVENT_DOWN);
  1833.     #else /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  1834.     #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27    /* Robin 1223 */
  1835.         SetKeyHandler(IdleRSKPressOnScreenSaver, KEY_RSK, KEY_EVENT_DOWN);
  1836.     #endif 
  1837.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__    /* Robin 1223 */
  1838.         SetKeyHandler(IdleRSKPressOnScreenSaver, KEY_LSK, KEY_EVENT_DOWN);
  1839.     #endif 
  1840.     #endif /* __MMI_TOUCH_SCREEN__ || !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */      //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ " on 2007-3-27
  1841.     }
  1842. #ifdef __MMI_TOUCH_SCREEN__
  1843.     ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_LOCK);
  1844.     UpdateStatusIcons();    /* 101805 ChangeStatusIconImage Calvin: ChangeStatusIconImage will not call UpdateStatusIcon */
  1845. #else /* __MMI_TOUCH_SCREEN__ */ 
  1846.     IdleSetStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  1847. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1848.     PRINT_INFORMATION(("[Keypad Lock] SetKeyPadLockFlag: Timer %d Expire", g_idle_context.AutoLockTimeOut));
  1849.     StopTimer(IDLE_APP_AUTO_LOCK_TIMER_ID);
  1850. //KP Jerry add on 2007-4-10 start
  1851. #if defined(__MMI_PEN_BLOCK_WHEN_KAYPAD_LOCKED__)
  1852.     if(GetLCDSleepStatus())
  1853.     {
  1854.         //touch_panel_enable(KAL_FALSE);
  1855.         //touch_panel_flush();        
  1856.         //mmi_pen_forced_block();        
  1857.     }
  1858. #endif
  1859. //KP Jerry add on 2007-4-10 end
  1860. }
  1861. /*****************************************************************************
  1862.  * FUNCTION
  1863.  *  IdleSetStatusIcon
  1864.  * DESCRIPTION
  1865.  *  Show Icon
  1866.  * PARAMETERS
  1867.  *  index       [IN]        
  1868.  *  U8(?)       [IN]        
  1869.  * RETURNS
  1870.  *  void
  1871.  *****************************************************************************/
  1872. void IdleSetStatusIcon(S16 index)
  1873. {
  1874.     /*----------------------------------------------------------------*/
  1875.     /* Local Variables                                                */
  1876.     /*----------------------------------------------------------------*/
  1877.     /*----------------------------------------------------------------*/
  1878.     /* Code Body                                                      */
  1879.     /*----------------------------------------------------------------*/
  1880.     ShowStatusIcon(index);
  1881.     UpdateStatusIcons();
  1882. }
  1883. /*****************************************************************************
  1884.  * FUNCTION
  1885.  *  IdleResetStatusIcon
  1886.  * DESCRIPTION
  1887.  *  Hide Icon
  1888.  * PARAMETERS
  1889.  *  index       [IN]        
  1890.  *  U8(?)       [IN]        
  1891.  * RETURNS
  1892.  *  void
  1893.  *****************************************************************************/
  1894. void IdleResetStatusIcon(S16 index)
  1895. {
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Local Variables                                                */
  1898.     /*----------------------------------------------------------------*/
  1899.     /*----------------------------------------------------------------*/
  1900.     /* Code Body                                                      */
  1901.     /*----------------------------------------------------------------*/
  1902.     HideStatusIcon(index);
  1903.     UpdateStatusIcons();
  1904. }
  1905. /*****************************************************************************
  1906.  * FUNCTION
  1907.  *  IsChineseSet
  1908.  * DESCRIPTION
  1909.  *  This function tells whether current lang is set as chinese or not
  1910.  * PARAMETERS
  1911.  *  void
  1912.  * RETURNS
  1913.  *  void
  1914.  *****************************************************************************/
  1915. pBOOL IsChineseSet(void)
  1916. {
  1917.     /*----------------------------------------------------------------*/
  1918.     /* Local Variables                                                */
  1919.     /*----------------------------------------------------------------*/
  1920.     /*----------------------------------------------------------------*/
  1921.     /* Code Body                                                      */
  1922.     /*----------------------------------------------------------------*/
  1923.     if (strcmp((PS8) gLanguageArray[gCurrLangIndex].aLangSSC, SSC_TCHINESE) == 0)
  1924.     {
  1925.         return 1;
  1926.     }
  1927.     if (strcmp((PS8) gLanguageArray[gCurrLangIndex].aLangSSC, SSC_SCHINESE) == 0)
  1928.     {
  1929.         return 1;
  1930.     }
  1931.     return 0;
  1932. }
  1933. /*****************************************************************************
  1934.  * FUNCTION
  1935.  *  IsTrChineseSet
  1936.  * DESCRIPTION
  1937.  *  This fn tells whether traditional chinese is set or not
  1938.  * PARAMETERS
  1939.  *  void
  1940.  * RETURNS
  1941.  *  void
  1942.  *****************************************************************************/
  1943. pBOOL IsTrChineseSet(void)
  1944. {
  1945.     /*----------------------------------------------------------------*/
  1946.     /* Local Variables                                                */
  1947.     /*----------------------------------------------------------------*/
  1948.     /*----------------------------------------------------------------*/
  1949.     /* Code Body                                                      */
  1950.     /*----------------------------------------------------------------*/
  1951.     if (strcmp((PS8) gLanguageArray[gCurrLangIndex].aLangSSC, SSC_TCHINESE) == 0)
  1952.     {
  1953.         return 1;
  1954.     }
  1955.     return 0;
  1956. }
  1957. /*****************************************************************************
  1958.  * FUNCTION
  1959.  *  IsSmChineseSet
  1960.  * DESCRIPTION
  1961.  *  This fn tells whether simplified chinese is set or not
  1962.  * PARAMETERS
  1963.  *  void
  1964.  * RETURNS
  1965.  *  void
  1966.  *****************************************************************************/
  1967. pBOOL IsSmChineseSet(void)
  1968. {
  1969.     /*----------------------------------------------------------------*/
  1970.     /* Local Variables                                                */
  1971.     /*----------------------------------------------------------------*/
  1972.     /*----------------------------------------------------------------*/
  1973.     /* Code Body                                                      */
  1974.     /*----------------------------------------------------------------*/
  1975.     if (strcmp((PS8) gLanguageArray[gCurrLangIndex].aLangSSC, SSC_SCHINESE) == 0)
  1976.     {
  1977.         return 1;
  1978.     }
  1979.     return 0;
  1980. }
  1981. /*****************************************************************************
  1982.  * FUNCTION
  1983.  *  ReadValueCityNVRAM
  1984.  * DESCRIPTION
  1985.  *  Read city values from NVRAM
  1986.  * PARAMETERS
  1987.  *  void
  1988.  * RETURNS
  1989.  *  void
  1990.  *****************************************************************************/
  1991. void ReadValueCityNVRAM(void)
  1992. {
  1993.     /*----------------------------------------------------------------*/
  1994.     /* Local Variables                                                */
  1995.     /*----------------------------------------------------------------*/
  1996.     S16 error;
  1997.     U8 city_chosen1;
  1998.     U8 city_chosen2;
  1999.     /*----------------------------------------------------------------*/
  2000.     /* Code Body                                                      */
  2001.     /*----------------------------------------------------------------*/
  2002.     ReadValue(NVRAM_DOWNLOAD_CITY1, &city_chosen1, DS_BYTE, &error);
  2003.     if (city_chosen1 == 0xff)
  2004.     {
  2005.         city_chosen1 = PhnsetGetHomeCity();
  2006.         city_chosen1++;
  2007.         WriteValue(NVRAM_DOWNLOAD_CITY1, &city_chosen1, DS_BYTE, &error);
  2008.     }
  2009.     ReadValue(NVRAM_DOWNLOAD_CITY2, &city_chosen2, DS_BYTE, &error);
  2010.     if (city_chosen2 == 0xff)
  2011.     {
  2012.         city_chosen2 = 0;
  2013.         WriteValue(NVRAM_DOWNLOAD_CITY2, &city_chosen2, DS_BYTE, &error);
  2014.     }
  2015. }
  2016. /*****************************************************************************
  2017.  * FUNCTION
  2018.  *  EntryIdleAppSubLcdWithErrorMsg
  2019.  * DESCRIPTION
  2020.  *  Show Sub LCD idle screen with error message
  2021.  * PARAMETERS
  2022.  *  message             [?]         
  2023.  *  message_icon        [IN]        
  2024.  *  history_buffer      [?]         
  2025.  * RETURNS
  2026.  *  void
  2027.  *****************************************************************************/
  2028. void EntryIdleAppSubLcdWithErrorMsg(U8 *message, U16 message_icon, U8 *history_buffer)
  2029. {
  2030.     /*----------------------------------------------------------------*/
  2031.     /* Local Variables                                                */
  2032.     /*----------------------------------------------------------------*/
  2033.     /*----------------------------------------------------------------*/
  2034.     /* Code Body                                                      */
  2035.     /*----------------------------------------------------------------*/
  2036.     ExecSubLCDCurrExitHandler();
  2037.     DinitSubLCDHistory();
  2038.     ShowCategory301Screen(message, message_icon, history_buffer);
  2039.     SetSubLCDExitHandler(ExitSubLCDIdleScr);
  2040. }
  2041. /*****************************************************************************
  2042.  * FUNCTION
  2043.  *  ShowIdleAppSubLcd
  2044.  * DESCRIPTION
  2045.  *  Show Sub LCD idle screen
  2046.  * PARAMETERS
  2047.  *  void
  2048.  * RETURNS
  2049.  *  void
  2050.  *****************************************************************************/
  2051. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  2052. extern U8 gMMIClamState;
  2053. #endif 
  2054. void ShowIdleAppSubLcd(void)
  2055. {
  2056.     /*----------------------------------------------------------------*/
  2057.     /* Local Variables                                                */
  2058.     /*----------------------------------------------------------------*/
  2059.     S8 *CityAbbr1, *CityAbbr2;
  2060.     FLOAT time_difference;
  2061.     U8 city_chosen1;
  2062.     U8 city_chosen2;
  2063.     U8 home_city_sublcd;
  2064.     FLOAT diff1, diff2;
  2065.     S16 error = -1;
  2066.     BOOL show_category_333_screen = FALSE;
  2067.     /*----------------------------------------------------------------*/
  2068.     /* Code Body                                                      */
  2069.     /*----------------------------------------------------------------*/
  2070.     ExecSubLCDCurrExitHandler();
  2071.     DinitSubLCDHistory();
  2072.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_ON_IDLE_NORMAL;
  2073. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  2074.     if (gMMIClamState == 1)
  2075.     {
  2076.         ShowCategory310Screen((U8*) get_string(STR_GLOBAL_LOGO), 0, NULL);
  2077.     }
  2078.     else
  2079.     {
  2080.         ShowSubLCDAnalogClockScreen();
  2081.     }
  2082. #else /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  2083. #ifdef __MMI_AUDIO_PLAYER__
  2084.     if (mmi_audply_is_playing())
  2085.     {
  2086.         show_category_333_screen = TRUE;
  2087.     }
  2088. #endif /* __MMI_AUDIO_PLAYER__ */ 
  2089. #ifdef __MMI_FM_RADIO__
  2090.     if (mmi_fmrdo_is_power_on())
  2091.     {
  2092.         show_category_333_screen = TRUE;
  2093.     }
  2094. #endif /* __MMI_FM_RADIO__ */ 
  2095.     if (show_category_333_screen)
  2096.     {
  2097.         ShowCategory333Screen();
  2098.     }
  2099.     else
  2100.     {
  2101.         ReadValue(NVRAM_DOWNLOAD_CITY1, &city_chosen1, DS_BYTE, &error);
  2102.         ReadValue(NVRAM_DOWNLOAD_CITY2, &city_chosen2, DS_BYTE, &error);
  2103.         home_city_sublcd = PhnsetGetHomeCity();
  2104.         home_city_sublcd++;
  2105.         if (city_chosen1 > 57)
  2106.         {
  2107.             city_chosen1 = 1;
  2108.         }
  2109.         if (city_chosen2 > 57)
  2110.         {
  2111.             city_chosen2 = 1;
  2112.         }
  2113.         if ((TimeZoneData[city_chosen1].CityAbbr != STR_WCLOCK_CITY_ABBRE_NONE) &&
  2114.             (TimeZoneData[city_chosen2].CityAbbr != STR_WCLOCK_CITY_ABBRE_NONE))
  2115.         {
  2116.             CityAbbr1 = GetString((U16) TimeZoneData[city_chosen1].CityAbbr);
  2117.             CityAbbr2 = GetString((U16) TimeZoneData[city_chosen2].CityAbbr);
  2118.             diff1 = TimeZoneData[city_chosen1].CityTimeZone - TimeZoneData[home_city_sublcd].CityTimeZone;
  2119.             diff2 = TimeZoneData[city_chosen2].CityTimeZone - TimeZoneData[home_city_sublcd].CityTimeZone;
  2120.             ShowCategory303Screen((U8*) CityAbbr1, (U8*) CityAbbr2, diff1, diff2, NULL);
  2121.         }
  2122.         else if (TimeZoneData[city_chosen1].CityAbbr != STR_WCLOCK_CITY_ABBRE_NONE)
  2123.         {
  2124.             CityAbbr1 = GetString((U16) TimeZoneData[city_chosen1].CityAbbr);
  2125.             time_difference = TimeZoneData[city_chosen1].CityTimeZone - TimeZoneData[home_city_sublcd].CityTimeZone;
  2126.             ShowCategory312Screen((U8*) CityAbbr1, time_difference, NULL);
  2127.         }
  2128.         else if (TimeZoneData[city_chosen2].CityAbbr != STR_WCLOCK_CITY_ABBRE_NONE)
  2129.         {
  2130.             CityAbbr2 = GetString((U16) TimeZoneData[city_chosen2].CityAbbr);
  2131.             time_difference = TimeZoneData[city_chosen2].CityTimeZone - TimeZoneData[home_city_sublcd].CityTimeZone;
  2132.             ShowCategory312Screen((U8*) CityAbbr2, time_difference, NULL);
  2133.         }
  2134.         else if ((TimeZoneData[city_chosen1].CityAbbr == STR_WCLOCK_CITY_ABBRE_NONE) &&
  2135.                  (TimeZoneData[city_chosen2].CityAbbr == STR_WCLOCK_CITY_ABBRE_NONE))
  2136.         {
  2137.             city_chosen1 = home_city_sublcd;
  2138.             CityAbbr1 = GetString((U16) TimeZoneData[city_chosen1].CityAbbr);
  2139.             time_difference = TimeZoneData[city_chosen1].CityTimeZone - TimeZoneData[home_city_sublcd].CityTimeZone;
  2140.             ShowCategory312Screen((U8*) CityAbbr1, time_difference, NULL);
  2141.         }
  2142.     }
  2143. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  2144. #ifdef __MMI_SUBLCD_CAMERA__
  2145.     if (IsClamClose() && FALSE == isInCall())
  2146.     {
  2147.         SetKeyHandler(mmi_sublcd_camera_entry_option_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
  2148.     }
  2149. #endif
  2150.     SetSubLCDExitHandler(ExitSubLCDIdleScr);
  2151. }
  2152. /*****************************************************************************
  2153.  * FUNCTION
  2154.  *  SubLCDIdleScreen
  2155.  * DESCRIPTION
  2156.  *  Displays the idle screen of sub-LCD
  2157.  * PARAMETERS
  2158.  *  funcptr     [?]     
  2159.  * RETURNS
  2160.  *  void
  2161.  *****************************************************************************/
  2162. U8 SubLCDIdleScreen(void *funcptr)
  2163. {
  2164. #ifdef __MMI_SUBLCD__
  2165.     /*----------------------------------------------------------------*/
  2166.     /* Local Variables                                                */
  2167.     /*----------------------------------------------------------------*/
  2168.     /*----------------------------------------------------------------*/
  2169.     /* Code Body                                                      */
  2170.     /*----------------------------------------------------------------*/
  2171.     /* MMI_TRACE( (MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_SUBLCD_IDLE_SCRN_HDLR)); */
  2172.     PRINT_INFORMATION(("SubLCDIdleScreen"));
  2173.     if (g_pwr_context.PrevScreenIndicator == ENTER_PIN_SCR)
  2174.     {
  2175.         EntryIdleAppSubLcdWithErrorMsg((PU8) GetString(STR_SUBLCD_ENTER_PIN_MSG), 0, NULL);
  2176.     }
  2177.     else if ((g_pwr_context.PrevScreenIndicator == ENTER_PUK_SCR) ||
  2178.              (g_pwr_context.PrevScreenIndicator == ENTER_CONFIRM_PIN) ||
  2179.              (g_pwr_context.PrevScreenIndicator == ENTER_NEW_PIN))
  2180.     {
  2181.         EntryIdleAppSubLcdWithErrorMsg((PU8) GetString(STR_SUBLCD_ENTER_PUK_MSG), 0, NULL);
  2182.     }
  2183.     else if (g_pwr_context.PrevScreenIndicator == ENTER_PHONELOCK)
  2184.     {
  2185.         EntryIdleAppSubLcdWithErrorMsg((PU8) GetString(STR_SUBLCD_ENTER_PHONELOCK_MSG), 0, NULL);
  2186.     }
  2187.     else if (g_pwr_context.PrevScreenIndicator == ENTER_SIM_INSERTION)
  2188.     {
  2189.         EntryIdleAppSubLcdWithErrorMsg((PU8) GetString(STR_SUBLCD_SIM_INSERTION_MSG), 0, NULL);
  2190.     }
  2191.     else if (g_pwr_context.PrevScreenIndicator == ENTER_SIM_BLOCK)
  2192.     {
  2193.         EntryIdleAppSubLcdWithErrorMsg((PU8) GetString(STR_SUBLCD_SIM_BLOCK_MSG), 0, NULL);
  2194.     }
  2195.     else if (g_pwr_context.PrevScreenIndicator == ENTER_IDLE_SCR)
  2196.     {
  2197.         /* City names and time difference need to be added here  */
  2198.         ShowIdleAppSubLcd();
  2199.     }
  2200.     else
  2201.     {
  2202.         ExecSubLCDCurrExitHandler();
  2203.         DinitSubLCDHistory();
  2204.         ShowCategory302Screen(NULL);
  2205.         SetSubLCDExitHandler(ExitSubLCDIdleScr);
  2206.     }
  2207. #endif /* __MMI_SUBLCD__ */ 
  2208.     return 0;
  2209. }
  2210. /*****************************************************************************
  2211.  * FUNCTION
  2212.  *  ExitSubLCDIdleScr
  2213.  * DESCRIPTION
  2214.  *  Exit sublcd idle screen
  2215.  * PARAMETERS
  2216.  *  void
  2217.  * RETURNS
  2218.  *  void
  2219.  *****************************************************************************/
  2220. void ExitSubLCDIdleScr(void)
  2221. {
  2222.     /*----------------------------------------------------------------*/
  2223.     /* Local Variables                                                */
  2224.     /*----------------------------------------------------------------*/
  2225.     SubLCDHistoryNode SubLCDHistory;
  2226.     /*----------------------------------------------------------------*/
  2227.     /* Code Body                                                      */
  2228.     /*----------------------------------------------------------------*/
  2229.     g_idle_context.IsSubLcdOnIdleScreen = SUBLCD_NOT_ON_IDLE;
  2230.     SubLCDHistory.entryFuncPtr = ShowIdleAppSubLcd;
  2231.     AddSubLCDHistory(&SubLCDHistory);
  2232. }
  2233. /*****************************************************************************
  2234.  * FUNCTION
  2235.  *  IdleHandleKeypadLockProcess
  2236.  * DESCRIPTION
  2237.  *  This fn handle the press of star key , when LSK is pressed first
  2238.  * PARAMETERS
  2239.  *  void
  2240.  * RETURNS
  2241.  *  void
  2242.  *****************************************************************************/
  2243. void IdleHandleKeypadLockProcess(void)
  2244. {
  2245.     /*----------------------------------------------------------------*/
  2246.     /* Local Variables                                                */
  2247.     /*----------------------------------------------------------------*/
  2248.     /*----------------------------------------------------------------*/
  2249.     /* Code Body                                                      */
  2250.     /*----------------------------------------------------------------*/
  2251.     StopTimer(KEYPAD_LOCK_TIMER);
  2252.     g_idle_context.RskPressedFromIdleApp = 0;
  2253. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  2254.     g_idle_context.ToMainMenuScrFromIdleApp = 0;
  2255. #endif 
  2256. }
  2257. /*****************************************************************************
  2258.  * FUNCTION
  2259.  *  IdleHandlePoundKeyForKeypadLock
  2260.  * DESCRIPTION
  2261.  *  This fn handle the press of star key , when LSK is pressed first
  2262.  * PARAMETERS
  2263.  *  void
  2264.  * RETURNS
  2265.  *  void
  2266.  *****************************************************************************/
  2267. void IdleHandlePoundKeyForKeypadLock(void)
  2268. {
  2269.     /*----------------------------------------------------------------*/
  2270.     /* Local Variables                                                */
  2271.     /*----------------------------------------------------------------*/
  2272.     /*----------------------------------------------------------------*/
  2273.     /* Code Body                                                      */
  2274.     /*----------------------------------------------------------------*/
  2275. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  2276.     if (g_idle_context.RskPressedFromIdleApp == 0)
  2277.     {
  2278.         return;
  2279.     }
  2280.     g_idle_context.RskPressedFromIdleApp = 0;
  2281. #endif /* __MMI_KEYPAD_LOCK_PATTERN_1__ || __MMI_KEYPAD_LOCK_PATTERN_3__ || __MMI_KEYPAD_LOCK_PATTERN_4__ */      //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  2282. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  2283.     if (g_idle_context.ToMainMenuScrFromIdleApp == 0)
  2284.     {
  2285.         return;
  2286.     }
  2287.     g_idle_context.ToMainMenuScrFromIdleApp = 0;
  2288. #endif /* __MMI_KEYPAD_LOCK_PATTERN_2__ */ 
  2289.     StopTimer(KEYPAD_LOCK_TIMER);
  2290.     g_keylock_context.gKeyPadLockFlag = 1;
  2291.     /* Lisen 02182005 */
  2292. #ifndef __MMI_KEYPADLOCK_WITH_KEYTONE__
  2293.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  2294. #endif 
  2295. #ifdef __MMI_TOUCH_SCREEN__
  2296.     ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_LOCK);
  2297.     UpdateStatusIcons();    /* 101805 ChangeStatusIconImage Calvin: ChangeStatusIconImage will not call UpdateStatusIcon */
  2298. #else /* __MMI_TOUCH_SCREEN__ */ 
  2299.     IdleSetStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  2300. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2301.     DisplayIdleScreen();
  2302. }
  2303. /* Cylen, for __MANUAL_MODE_NW_SEL__ */
  2304. /*****************************************************************************
  2305.  * FUNCTION
  2306.  *  IdleSetLRKey
  2307.  * DESCRIPTION
  2308.  *  Change Idlescreen's L or RSK according to network status
  2309.  * PARAMETERS
  2310.  *  void
  2311.  * RETURNS
  2312.  *  void
  2313.  *****************************************************************************/
  2314. void IdleSetLRKey(void)
  2315. {
  2316.     /*----------------------------------------------------------------*/
  2317.     /* Local Variables                                                */
  2318.     /*----------------------------------------------------------------*/
  2319.     /*----------------------------------------------------------------*/
  2320.     /* Code Body                                                      */
  2321.     /*----------------------------------------------------------------*/
  2322.     if (g_keylock_context.gKeyPadLockFlag)
  2323.     {
  2324.     #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  2325.     #ifdef __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  2326.     #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27    /* Robin 1223 */
  2327.         SetRightSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  2328.     #endif 
  2329.     #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__    /* Robin 1223 */
  2330.         SetLeftSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  2331.     #endif 
  2332.     #endif /* __MMI_KEYPAD_LOCK_PROMPT_TEXT__ */ 
  2333.     #endif /* __MMI_TOUCH_SCREEN__ */ 
  2334.     }
  2335.     else    /* keypad unlocked */
  2336.     {
  2337.     #if defined (__MANUAL_MODE_NW_SEL__) && !defined (__MMI_TOUCH_IDLESCREEN_SHORTCUTS__)
  2338.     #ifdef __MMI_WLAN_FEATURES__
  2339.         if (g_pwr_context.CurrentServiceType == LIMITED_SERVICE && mmi_bootup_get_plmn_selection_mode() == MANUAL_MODE && mmi_netset_get_active_preferred_mode() != P_WLAN_ONLY)